1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-06 02:23:21 +08:00

Handle the case where the selected panel is no longer a valid selection better

This commit is contained in:
Dean Herbert 2017-12-11 21:31:26 +09:00
parent fb92b3551e
commit b10240d7ef
2 changed files with 31 additions and 24 deletions

View File

@ -47,8 +47,14 @@ namespace osu.Game.Beatmaps.Drawables
set
{
state = value;
UpdateState();
StateChanged?.Invoke(state);
}
}
switch (value)
public void UpdateState()
{
switch (state)
{
case BeatmapGroupState.Expanded:
Header.State = PanelSelectedState.Selected;
@ -67,9 +73,6 @@ namespace osu.Game.Beatmaps.Drawables
panel.State = PanelSelectedState.Hidden;
break;
}
StateChanged?.Invoke(state);
}
}
public BeatmapGroup(BeatmapSetInfo beatmapSet, BeatmapManager manager)

View File

@ -327,6 +327,8 @@ namespace osu.Game.Screens.Select
computeYPositions();
selectedGroup?.UpdateState();
if (selectedGroup == null || selectedGroup.State == BeatmapGroupState.Hidden)
SelectNext();
else
@ -441,11 +443,13 @@ namespace osu.Game.Screens.Select
panel.MoveToX(-50, 500, Easing.OutExpo);
bool isHidden = panel.State == PanelSelectedState.Hidden;
//on first display we want to begin hidden under our group's header.
if (panel.Filtered || panel.Alpha == 0)
if (isHidden || panel.Alpha == 0)
panel.MoveToY(headerY);
movePanel(panel, !panel.Filtered, animated, ref currentY);
movePanel(panel, !isHidden, animated, ref currentY);
}
}
else
@ -479,7 +483,7 @@ namespace osu.Game.Screens.Select
{
try
{
if (panel == null)
if (panel == null || panel.Filtered == true)
panel = group.BeatmapPanels.First(p => !p.Filtered);
if (selectedPanel == panel) return;