mirror of
https://github.com/ppy/osu.git
synced 2025-03-18 06:27:18 +08:00
Fix beatmap ruleset selector selecting initial ruleset
This commit is contained in:
parent
2ba88923b6
commit
1d89d757af
@ -6,11 +6,14 @@ using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public class BeatmapRulesetSelector : OverlayRulesetSelector
|
||||
{
|
||||
protected override bool SelectInitialRuleset => false;
|
||||
|
||||
private readonly Bindable<BeatmapSetInfo> beatmapSet = new Bindable<BeatmapSetInfo>();
|
||||
|
||||
public BeatmapSetInfo BeatmapSet
|
||||
|
@ -21,10 +21,13 @@ namespace osu.Game.Overlays
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetStore store, IAPIProvider api)
|
||||
{
|
||||
var preferredRuleset = store.GetRuleset(api.LocalUser.Value.PlayMode);
|
||||
if (SelectInitialRuleset)
|
||||
{
|
||||
var preferredRuleset = store.GetRuleset(api.LocalUser.Value.PlayMode);
|
||||
|
||||
if (preferredRuleset != null)
|
||||
Current.Value = preferredRuleset;
|
||||
if (preferredRuleset != null)
|
||||
Current.Value = preferredRuleset;
|
||||
}
|
||||
}
|
||||
|
||||
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new OverlayRulesetTabItem(value);
|
||||
|
@ -14,17 +14,27 @@ namespace osu.Game.Rulesets
|
||||
|
||||
protected override Dropdown<RulesetInfo> CreateDropdown() => null;
|
||||
|
||||
protected virtual bool SelectInitialRuleset => true;
|
||||
|
||||
protected RulesetSelector()
|
||||
{
|
||||
SelectFirstTabByDefault = false;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
foreach (var r in Rulesets.AvailableRulesets)
|
||||
AddItem(r);
|
||||
|
||||
// This is supposed to be an implicit process in the base class, but the problem is that it happens in LoadComplete.
|
||||
// That can become an issue with overlays that require access to the initial ruleset value
|
||||
// before the ruleset selectors reached a LoadComplete state.
|
||||
// (e.g. displaying RankingsOverlay for the first time).
|
||||
Current.Value = Items.First();
|
||||
if (SelectInitialRuleset)
|
||||
{
|
||||
// This is supposed to be an implicit process in the base class, but the problem is that it happens in LoadComplete.
|
||||
// That can become an issue with overlays that require access to the initial ruleset value
|
||||
// before the ruleset selectors reached a LoadComplete state.
|
||||
// (e.g. displaying RankingsOverlay for the first time).
|
||||
Current.Value = Items.First();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user