mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 23:22:55 +08:00
Use bindable for PlayMode.
This commit is contained in:
parent
ab91333b21
commit
e399d6c6d1
@ -28,14 +28,13 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
ModMode = PlayMode.Osu,
|
||||
});
|
||||
|
||||
AddButton("Toggle", modSelect.ToggleVisibility);
|
||||
AddButton("osu!", () => modSelect.ModMode = PlayMode.Osu);
|
||||
AddButton("osu!taiko", () => modSelect.ModMode = PlayMode.Taiko);
|
||||
AddButton("osu!catch", () => modSelect.ModMode = PlayMode.Catch);
|
||||
AddButton("osu!mania", () => modSelect.ModMode = PlayMode.Mania);
|
||||
AddButton("osu!", () => modSelect.PlayMode.Value = PlayMode.Osu);
|
||||
AddButton("osu!taiko", () => modSelect.PlayMode.Value = PlayMode.Taiko);
|
||||
AddButton("osu!catch", () => modSelect.PlayMode.Value = PlayMode.Catch);
|
||||
AddButton("osu!mania", () => modSelect.PlayMode.Value = PlayMode.Mania);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using OpenTK;
|
||||
@ -34,53 +35,51 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
public Bindable<Mod[]> SelectedMods = new Bindable<Mod[]>();
|
||||
|
||||
private PlayMode modMode;
|
||||
public PlayMode ModMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return modMode;
|
||||
}
|
||||
set
|
||||
{
|
||||
modMode = value;
|
||||
var ruleset = Ruleset.GetRuleset(value);
|
||||
public readonly Bindable<PlayMode> PlayMode = new Bindable<PlayMode>();
|
||||
|
||||
modSectionsContainer.Children = new ModSection[]
|
||||
private void modeChanged(object sender, EventArgs eventArgs)
|
||||
{
|
||||
var ruleset = Ruleset.GetRuleset(PlayMode);
|
||||
|
||||
modSectionsContainer.Children = new ModSection[]
|
||||
{
|
||||
new DifficultyReductionSection
|
||||
{
|
||||
new DifficultyReductionSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.DifficultyReduction).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
new DifficultyIncreaseSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.DifficultyIncrease).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
new AssistedSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.Special).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
};
|
||||
}
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.DifficultyReduction).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
new DifficultyIncreaseSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.DifficultyIncrease).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
new AssistedSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.Special).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
[BackgroundDependencyLoader(permitNulls:true)]
|
||||
private void load(OsuColour colours, OsuGame osu)
|
||||
{
|
||||
lowMultiplierColour = colours.Red;
|
||||
highMultiplierColour = colours.Green;
|
||||
|
||||
if (osu != null)
|
||||
PlayMode.BindTo(osu.PlayMode);
|
||||
PlayMode.ValueChanged += modeChanged;
|
||||
PlayMode.TriggerChange();
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
|
@ -162,7 +162,6 @@ namespace osu.Game.Screens.Select
|
||||
if (osuGame != null)
|
||||
{
|
||||
playMode = osuGame.PlayMode;
|
||||
modSelect.ModMode = playMode;
|
||||
playMode.ValueChanged += playMode_ValueChanged;
|
||||
}
|
||||
|
||||
@ -287,7 +286,6 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void playMode_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
modSelect.ModMode = playMode;
|
||||
}
|
||||
|
||||
private void changeBackground(WorkingBeatmap beatmap)
|
||||
|
Loading…
Reference in New Issue
Block a user