1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 15:12:57 +08:00

Fix and update mode changing handling.

This commit is contained in:
Huo Yaoyuan 2017-03-07 00:58:32 +08:00
parent 5cd859ecf1
commit eda7e1b26f

View File

@ -43,6 +43,7 @@ namespace osu.Game.Overlays.Mods
var ruleset = Ruleset.GetRuleset(PlayMode); var ruleset = Ruleset.GetRuleset(PlayMode);
foreach (ModSection section in modSectionsContainer.Children) foreach (ModSection section in modSectionsContainer.Children)
section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray();
refreshSelectedMods();
} }
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
@ -54,7 +55,7 @@ namespace osu.Game.Overlays.Mods
if (osu != null) if (osu != null)
PlayMode.BindTo(osu.PlayMode); PlayMode.BindTo(osu.PlayMode);
PlayMode.ValueChanged += modeChanged; PlayMode.ValueChanged += modeChanged;
PlayMode.TriggerChange(); modeChanged(null, null);
} }
protected override void PopOut() protected override void PopOut()
@ -119,12 +120,13 @@ namespace osu.Game.Overlays.Mods
private void modButtonPressed(Mod selectedMod) private void modButtonPressed(Mod selectedMod)
{ {
if (selectedMod != null) if (selectedMod != null)
{ DeselectTypes(selectedMod.IncompatibleMods);
foreach (Type t in selectedMod.IncompatibleMods) refreshSelectedMods();
DeselectType(t);
} }
refreshSelectedMods(); private void refreshSelectedMods()
{
SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.Buttons.Select(x => x.SelectedMod).Where(x => x != null)).ToArray();
double multiplier = 1.0; double multiplier = 1.0;
bool ranked = true; bool ranked = true;
@ -132,9 +134,7 @@ namespace osu.Game.Overlays.Mods
foreach (Mod mod in SelectedMods.Value) foreach (Mod mod in SelectedMods.Value)
{ {
multiplier *= mod.ScoreMultiplier; multiplier *= mod.ScoreMultiplier;
ranked &= mod.Ranked;
if (ranked)
ranked = mod.Ranked;
} }
// 1.00x // 1.00x
@ -146,23 +146,12 @@ namespace osu.Game.Overlays.Mods
rankedLabel.Text = $@"{rankedString}, Score Multiplier: "; rankedLabel.Text = $@"{rankedString}, Score Multiplier: ";
if (multiplier > 1.0) if (multiplier > 1.0)
{
multiplierLabel.FadeColour(highMultiplierColour, 200); multiplierLabel.FadeColour(highMultiplierColour, 200);
}
else if (multiplier < 1.0) else if (multiplier < 1.0)
{
multiplierLabel.FadeColour(lowMultiplierColour, 200); multiplierLabel.FadeColour(lowMultiplierColour, 200);
}
else else
{
multiplierLabel.FadeColour(Color4.White, 200); multiplierLabel.FadeColour(Color4.White, 200);
} }
}
private void refreshSelectedMods()
{
SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.Buttons.Select(x => x.SelectedMod).Where(x => x != null)).ToArray();
}
public ModSelectOverlay() public ModSelectOverlay()
{ {