mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 17:33:02 +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),
|
Size = new Vector2(carousel_width, 1),
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
SelectionChanged = carouselSelectionChanged,
|
SelectionChanged = updateSelectedBeatmap,
|
||||||
BeatmapSetsChanged = carouselBeatmapsLoaded,
|
BeatmapSetsChanged = carouselBeatmapsLoaded,
|
||||||
},
|
},
|
||||||
FilterControl = new FilterControl
|
FilterControl = new FilterControl
|
||||||
@ -186,6 +186,8 @@ namespace osu.Game.Screens.Select
|
|||||||
dependencies.CacheAs(this);
|
dependencies.CacheAs(this);
|
||||||
dependencies.CacheAs(Ruleset);
|
dependencies.CacheAs(Ruleset);
|
||||||
|
|
||||||
|
base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce);
|
||||||
|
|
||||||
if (Footer != null)
|
if (Footer != null)
|
||||||
{
|
{
|
||||||
Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2);
|
Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2);
|
||||||
@ -252,9 +254,6 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private ScheduledDelegate selectionChangedDebounce;
|
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)
|
private void workingBeatmapChanged(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
if (beatmap is DummyWorkingBeatmap) return;
|
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>
|
/// <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>
|
/// </summary>
|
||||||
private void carouselSelectionChanged(BeatmapInfo beatmap)
|
private void updateSelectedBeatmap(BeatmapInfo beatmap)
|
||||||
{
|
{
|
||||||
|
var ruleset = base.Ruleset.Value;
|
||||||
|
|
||||||
void performLoad()
|
void performLoad()
|
||||||
{
|
{
|
||||||
// We may be arriving here due to another component changing the bindable Beatmap.
|
// 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;
|
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
|
||||||
|
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
||||||
Ruleset.Value = base.Ruleset.Value;
|
Ruleset.Value = ruleset;
|
||||||
ensurePlayingSelected(preview);
|
ensurePlayingSelected(preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateBeatmap(Beatmap.Value);
|
UpdateBeatmap(Beatmap.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beatmap?.Equals(beatmapNoDebounce) == true)
|
if (beatmap?.Equals(beatmapNoDebounce) == true && ruleset?.Equals(rulesetNoDebounce) == true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
selectionChangedDebounce?.Cancel();
|
selectionChangedDebounce?.Cancel();
|
||||||
|
|
||||||
beatmapNoDebounce = beatmap;
|
beatmapNoDebounce = beatmap;
|
||||||
|
rulesetNoDebounce = ruleset;
|
||||||
|
|
||||||
if (beatmap == null)
|
if (beatmap == null)
|
||||||
performLoad();
|
performLoad();
|
||||||
@ -463,7 +469,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
// in the case random selection failed, we want to trigger selectionChanged
|
// in the case random selection failed, we want to trigger selectionChanged
|
||||||
// to show the dummy beatmap (we have nothing else to display).
|
// to show the dummy beatmap (we have nothing else to display).
|
||||||
carouselSelectionChanged(null);
|
updateSelectedBeatmap(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user