mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Streamline panel selection event logic.
Was previously firing multiple times where it was completely unnecessary. Also had bidirection firing going on.
This commit is contained in:
parent
b78fa99620
commit
003cf53441
@ -17,7 +17,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires when one of our difficulties was selected. Will fire on first expand.
|
/// Fires when one of our difficulties was selected. Will fire on first expand.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Action<BeatmapGroup, BeatmapInfo> SelectionChanged;
|
public Action<BeatmapGroup, BeatmapPanel> SelectionChanged;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires when one of our difficulties is clicked when already selected. Should start playing the map.
|
/// Fires when one of our difficulties is clicked when already selected. Should start playing the map.
|
||||||
@ -89,8 +89,6 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
//we want to make sure one of our children is selected in the case none have been selected yet.
|
//we want to make sure one of our children is selected in the case none have been selected yet.
|
||||||
if (SelectedPanel == null)
|
if (SelectedPanel == null)
|
||||||
BeatmapPanels.First().State = PanelSelectedState.Selected;
|
BeatmapPanels.First().State = PanelSelectedState.Selected;
|
||||||
else
|
|
||||||
SelectionChanged?.Invoke(this, SelectedPanel.Beatmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void panelGainedSelection(BeatmapPanel panel)
|
private void panelGainedSelection(BeatmapPanel panel)
|
||||||
@ -106,7 +104,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
State = BeatmapGroupState.Expanded;
|
State = BeatmapGroupState.Expanded;
|
||||||
SelectionChanged?.Invoke(this, panel.Beatmap);
|
SelectionChanged?.Invoke(this, SelectedPanel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public void RemoveBeatmap(BeatmapSetInfo info) => removeGroup(groups.Find(b => b.BeatmapSet.ID == info.ID));
|
public void RemoveBeatmap(BeatmapSetInfo info) => removeGroup(groups.Find(b => b.BeatmapSet.ID == info.ID));
|
||||||
|
|
||||||
public Action<BeatmapGroup, BeatmapInfo> SelectionChanged;
|
public Action<BeatmapInfo> SelectionChanged;
|
||||||
|
|
||||||
public Action StartRequested;
|
public Action StartRequested;
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
return new BeatmapGroup(beatmapSet, database)
|
return new BeatmapGroup(beatmapSet, database)
|
||||||
{
|
{
|
||||||
SelectionChanged = SelectionChanged,
|
SelectionChanged = (g, p) => selectGroup(g, p),
|
||||||
StartRequested = b => StartRequested?.Invoke(),
|
StartRequested = b => StartRequested?.Invoke(),
|
||||||
State = BeatmapGroupState.Collapsed
|
State = BeatmapGroupState.Collapsed
|
||||||
};
|
};
|
||||||
@ -345,6 +345,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
float selectedY = computeYPositions(animated);
|
float selectedY = computeYPositions(animated);
|
||||||
ScrollTo(selectedY, animated);
|
ScrollTo(selectedY, animated);
|
||||||
|
|
||||||
|
SelectionChanged?.Invoke(panel.Beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
@ -300,7 +300,7 @@ namespace osu.Game.Screens.Select
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// selection has been changed as the result of interaction with the carousel.
|
/// selection has been changed as the result of interaction with the carousel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void selectionChanged(BeatmapGroup group, BeatmapInfo beatmap)
|
private void selectionChanged(BeatmapInfo beatmap)
|
||||||
{
|
{
|
||||||
bool beatmapSetChange = false;
|
bool beatmapSetChange = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user