mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 14:13:18 +08:00
Ensure toolbar triggers updates to SongSelect's ruleset
This commit is contained in:
parent
182ac80881
commit
1c32951d4b
@ -127,7 +127,7 @@ namespace osu.Game.Screens.Select
|
||||
Size = new Vector2(carousel_width, 1),
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
SelectionChanged = carouselSelectionChanged,
|
||||
SelectionChanged = updateSelectedBeatmap,
|
||||
BeatmapSetsChanged = carouselBeatmapsLoaded,
|
||||
},
|
||||
FilterControl = new FilterControl
|
||||
@ -186,6 +186,8 @@ namespace osu.Game.Screens.Select
|
||||
dependencies.CacheAs(this);
|
||||
dependencies.CacheAs(Ruleset);
|
||||
|
||||
base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce);
|
||||
|
||||
if (Footer != null)
|
||||
{
|
||||
Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2);
|
||||
@ -252,9 +254,6 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private ScheduledDelegate selectionChangedDebounce;
|
||||
|
||||
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.
|
||||
private BeatmapInfo beatmapNoDebounce;
|
||||
|
||||
private void workingBeatmapChanged(WorkingBeatmap beatmap)
|
||||
{
|
||||
if (beatmap is DummyWorkingBeatmap) return;
|
||||
@ -268,11 +267,17 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
|
||||
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.
|
||||
private BeatmapInfo beatmapNoDebounce;
|
||||
private RulesetInfo rulesetNoDebounce;
|
||||
|
||||
/// <summary>
|
||||
/// selection has been changed as the result of interaction with the carousel.
|
||||
/// selection has been changed as the result of a user interaction.
|
||||
/// </summary>
|
||||
private void carouselSelectionChanged(BeatmapInfo beatmap)
|
||||
private void updateSelectedBeatmap(BeatmapInfo beatmap)
|
||||
{
|
||||
var ruleset = base.Ruleset.Value;
|
||||
|
||||
void performLoad()
|
||||
{
|
||||
// We may be arriving here due to another component changing the bindable Beatmap.
|
||||
@ -282,19 +287,20 @@ namespace osu.Game.Screens.Select
|
||||
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
|
||||
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
||||
Ruleset.Value = base.Ruleset.Value;
|
||||
Ruleset.Value = ruleset;
|
||||
ensurePlayingSelected(preview);
|
||||
}
|
||||
|
||||
UpdateBeatmap(Beatmap.Value);
|
||||
}
|
||||
|
||||
if (beatmap?.Equals(beatmapNoDebounce) == true)
|
||||
if (beatmap?.Equals(beatmapNoDebounce) == true && ruleset?.Equals(rulesetNoDebounce) == true)
|
||||
return;
|
||||
|
||||
selectionChangedDebounce?.Cancel();
|
||||
|
||||
beatmapNoDebounce = beatmap;
|
||||
rulesetNoDebounce = ruleset;
|
||||
|
||||
if (beatmap == null)
|
||||
performLoad();
|
||||
@ -463,7 +469,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
// in the case random selection failed, we want to trigger selectionChanged
|
||||
// to show the dummy beatmap (we have nothing else to display).
|
||||
carouselSelectionChanged(null);
|
||||
updateSelectedBeatmap(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user