mirror of https://github.com/ppy/osu
Merge branch 'master' into fix-hitsound-fallback
This commit is contained in:
commit
ede95b6954
|
@ -16,8 +16,8 @@ public class TestCaseToolbar : OsuTestCase
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(ToolbarButton),
|
typeof(ToolbarButton),
|
||||||
typeof(ToolbarModeSelector),
|
typeof(ToolbarRulesetSelector),
|
||||||
typeof(ToolbarModeButton),
|
typeof(ToolbarRulesetButton),
|
||||||
typeof(ToolbarNotificationButton),
|
typeof(ToolbarNotificationButton),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public Toolbar()
|
||||||
{
|
{
|
||||||
Action = () => OnHome?.Invoke()
|
Action = () => OnHome?.Invoke()
|
||||||
},
|
},
|
||||||
new ToolbarModeSelector()
|
new ToolbarRulesetSelector()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
public class ToolbarModeButton : ToolbarButton
|
public class ToolbarRulesetButton : ToolbarButton
|
||||||
{
|
{
|
||||||
private RulesetInfo ruleset;
|
private RulesetInfo ruleset;
|
||||||
public RulesetInfo Ruleset
|
public RulesetInfo Ruleset
|
|
@ -16,18 +16,18 @@
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
public class ToolbarModeSelector : Container
|
public class ToolbarRulesetSelector : Container
|
||||||
{
|
{
|
||||||
private const float padding = 10;
|
private const float padding = 10;
|
||||||
|
|
||||||
private readonly FillFlowContainer modeButtons;
|
private readonly FillFlowContainer modeButtons;
|
||||||
private readonly Drawable modeButtonLine;
|
private readonly Drawable modeButtonLine;
|
||||||
private ToolbarModeButton activeButton;
|
private ToolbarRulesetButton activeButton;
|
||||||
|
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
public ToolbarModeSelector()
|
public ToolbarRulesetSelector()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ private void load(RulesetStore rulesets, Bindable<RulesetInfo> parentRuleset)
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
foreach (var r in rulesets.AvailableRulesets)
|
foreach (var r in rulesets.AvailableRulesets)
|
||||||
{
|
{
|
||||||
modeButtons.Add(new ToolbarModeButton
|
modeButtons.Add(new ToolbarRulesetButton
|
||||||
{
|
{
|
||||||
Ruleset = r,
|
Ruleset = r,
|
||||||
Action = delegate { ruleset.Value = r; }
|
Action = delegate { ruleset.Value = r; }
|
||||||
|
@ -115,7 +115,7 @@ protected override void Update()
|
||||||
|
|
||||||
private void rulesetChanged(RulesetInfo ruleset)
|
private void rulesetChanged(RulesetInfo ruleset)
|
||||||
{
|
{
|
||||||
foreach (ToolbarModeButton m in modeButtons.Children.Cast<ToolbarModeButton>())
|
foreach (ToolbarRulesetButton m in modeButtons.Children.Cast<ToolbarRulesetButton>())
|
||||||
{
|
{
|
||||||
bool isActive = m.Ruleset.ID == ruleset.ID;
|
bool isActive = m.Ruleset.ID == ruleset.ID;
|
||||||
m.Active = isActive;
|
m.Active = isActive;
|
|
@ -193,8 +193,6 @@ private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dia
|
||||||
dependencies.CacheAs(Ruleset);
|
dependencies.CacheAs(Ruleset);
|
||||||
dependencies.CacheAs<IBindable<RulesetInfo>>(Ruleset);
|
dependencies.CacheAs<IBindable<RulesetInfo>>(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);
|
||||||
|
@ -222,6 +220,12 @@ private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dia
|
||||||
Beatmap.BindValueChanged(workingBeatmapChanged);
|
Beatmap.BindValueChanged(workingBeatmapChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce);
|
||||||
|
}
|
||||||
|
|
||||||
public void Edit(BeatmapInfo beatmap)
|
public void Edit(BeatmapInfo beatmap)
|
||||||
{
|
{
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
||||||
|
|
Loading…
Reference in New Issue