mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 10:17:19 +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.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapSet
|
namespace osu.Game.Overlays.BeatmapSet
|
||||||
{
|
{
|
||||||
public class BeatmapRulesetSelector : OverlayRulesetSelector
|
public class BeatmapRulesetSelector : OverlayRulesetSelector
|
||||||
{
|
{
|
||||||
|
protected override bool SelectInitialRuleset => false;
|
||||||
|
|
||||||
private readonly Bindable<BeatmapSetInfo> beatmapSet = new Bindable<BeatmapSetInfo>();
|
private readonly Bindable<BeatmapSetInfo> beatmapSet = new Bindable<BeatmapSetInfo>();
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public BeatmapSetInfo BeatmapSet
|
||||||
|
@ -21,10 +21,13 @@ namespace osu.Game.Overlays
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(RulesetStore store, IAPIProvider api)
|
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)
|
if (preferredRuleset != null)
|
||||||
Current.Value = preferredRuleset;
|
Current.Value = preferredRuleset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new OverlayRulesetTabItem(value);
|
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 override Dropdown<RulesetInfo> CreateDropdown() => null;
|
||||||
|
|
||||||
|
protected virtual bool SelectInitialRuleset => true;
|
||||||
|
|
||||||
|
protected RulesetSelector()
|
||||||
|
{
|
||||||
|
SelectFirstTabByDefault = false;
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
foreach (var r in Rulesets.AvailableRulesets)
|
foreach (var r in Rulesets.AvailableRulesets)
|
||||||
AddItem(r);
|
AddItem(r);
|
||||||
|
|
||||||
// This is supposed to be an implicit process in the base class, but the problem is that it happens in LoadComplete.
|
if (SelectInitialRuleset)
|
||||||
// That can become an issue with overlays that require access to the initial ruleset value
|
{
|
||||||
// before the ruleset selectors reached a LoadComplete state.
|
// This is supposed to be an implicit process in the base class, but the problem is that it happens in LoadComplete.
|
||||||
// (e.g. displaying RankingsOverlay for the first time).
|
// That can become an issue with overlays that require access to the initial ruleset value
|
||||||
Current.Value = Items.First();
|
// 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