mirror of
https://github.com/ppy/osu
synced 2025-01-18 20:10:49 +00:00
Handle the case where the selected panel is no longer a valid selection better
This commit is contained in:
parent
fb92b3551e
commit
b10240d7ef
@ -47,31 +47,34 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
set
|
||||
{
|
||||
state = value;
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case BeatmapGroupState.Expanded:
|
||||
Header.State = PanelSelectedState.Selected;
|
||||
foreach (BeatmapPanel panel in BeatmapPanels)
|
||||
panel.State = panel == SelectedPanel ? PanelSelectedState.Selected :
|
||||
!panel.Filtered ? PanelSelectedState.NotSelected : PanelSelectedState.Hidden;
|
||||
break;
|
||||
case BeatmapGroupState.Collapsed:
|
||||
Header.State = PanelSelectedState.NotSelected;
|
||||
foreach (BeatmapPanel panel in BeatmapPanels)
|
||||
panel.State = PanelSelectedState.Hidden;
|
||||
break;
|
||||
case BeatmapGroupState.Hidden:
|
||||
Header.State = PanelSelectedState.Hidden;
|
||||
foreach (BeatmapPanel panel in BeatmapPanels)
|
||||
panel.State = PanelSelectedState.Hidden;
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateState();
|
||||
StateChanged?.Invoke(state);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateState()
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case BeatmapGroupState.Expanded:
|
||||
Header.State = PanelSelectedState.Selected;
|
||||
foreach (BeatmapPanel panel in BeatmapPanels)
|
||||
panel.State = panel == SelectedPanel ? PanelSelectedState.Selected :
|
||||
!panel.Filtered ? PanelSelectedState.NotSelected : PanelSelectedState.Hidden;
|
||||
break;
|
||||
case BeatmapGroupState.Collapsed:
|
||||
Header.State = PanelSelectedState.NotSelected;
|
||||
foreach (BeatmapPanel panel in BeatmapPanels)
|
||||
panel.State = PanelSelectedState.Hidden;
|
||||
break;
|
||||
case BeatmapGroupState.Hidden:
|
||||
Header.State = PanelSelectedState.Hidden;
|
||||
foreach (BeatmapPanel panel in BeatmapPanels)
|
||||
panel.State = PanelSelectedState.Hidden;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public BeatmapGroup(BeatmapSetInfo beatmapSet, BeatmapManager manager)
|
||||
{
|
||||
if (beatmapSet == null)
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user