CreateModSections -> GetModsFor(PlayMode), fixed deselect not working in ModSelectOverlay, added MultiMod for multiple mods in one mod, fixed issues with SelectedColour in ModSection

This commit is contained in:
DrabWeb
2017-03-02 01:07:28 -04:00
parent 6c680825ed
commit 1eee587c18
15 changed files with 339 additions and 502 deletions

View File

@ -56,4 +56,9 @@ namespace osu.Game.Modes.Catch
public override double ScoreMultiplier => 1.12; public override double ScoreMultiplier => 1.12;
public override Mods[] DisablesMods => new Mods[] { }; public override Mods[] DisablesMods => new Mods[] { };
} }
public class CatchModPerfect : ModPerfect
{
}
} }

View File

@ -33,111 +33,61 @@ namespace osu.Game.Modes.Catch
new CatchModFlashlight(), new CatchModFlashlight(),
}; };
public override IEnumerable<ModSection> CreateModSections() => new ModSection[] public override IEnumerable<Mod> GetModsFor(ModType type)
{ {
new DifficultyReductionSection switch (type)
{ {
Buttons = new[] case ModType.DifficultyReduction:
{ return new Mod[]
new ModButton
{
ToggleKey = Key.Q,
Mods = new Mod[]
{ {
new CatchModEasy(), new CatchModEasy(),
},
},
new ModButton
{
ToggleKey = Key.W,
Mods = new Mod[]
{
new CatchModNoFail(), new CatchModNoFail(),
},
},
new ModButton
{
ToggleKey = Key.E,
Mods = new Mod[]
{
new CatchModHalfTime(), new CatchModHalfTime(),
}, };
},
}, case ModType.DifficultyIncrease:
}, return new Mod[]
new DifficultyIncreaseSection
{
Buttons = new ModButton[]
{
new ModButton
{
ToggleKey = Key.A,
Mods = new Mod[]
{ {
new CatchModHardRock(), new CatchModHardRock(),
}, new MultiMod
},
new ModButton
{ {
ToggleKey = Key.S,
Mods = new Mod[] Mods = new Mod[]
{ {
new CatchModPerfect(),
new CatchModSuddenDeath(), new CatchModSuddenDeath(),
new ModPerfect(),
}, },
}, },
new ModButton new MultiMod
{ {
ToggleKey = Key.D,
Mods = new Mod[] Mods = new Mod[]
{ {
new CatchModDoubleTime(), new CatchModDoubleTime(),
new CatchModNightcore(), new CatchModNightcore(),
}, },
}, },
new ModButton
{
ToggleKey = Key.F,
Mods = new Mod[]
{
new CatchModHidden(), new CatchModHidden(),
},
},
new ModButton
{
ToggleKey = Key.G,
Mods = new Mod[]
{
new CatchModFlashlight(), new CatchModFlashlight(),
}, };
},
}, case ModType.Special:
}, return new Mod[]
new AssistedSection
{
Buttons = new[]
{
new ModButton
{
ToggleKey = Key.Z,
Mods = new Mod[]
{ {
new CatchModRelax(), new CatchModRelax(),
}, new MultiMod
},
new ModButton
{ {
ToggleKey = Key.B,
Mods = new Mod[] Mods = new Mod[]
{ {
new ModAutoplay(), new ModAutoplay(),
new ModCinema(), new ModCinema(),
}, },
}, },
}
},
}; };
default:
return new Mod[] { };
}
}
protected override PlayMode PlayMode => PlayMode.Catch; protected override PlayMode PlayMode => PlayMode.Catch;
public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o; public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o;

View File

@ -54,6 +54,11 @@ namespace osu.Game.Modes.Mania
public override Mods[] DisablesMods => new Mods[] { Mods.Hidden }; public override Mods[] DisablesMods => new Mods[] { Mods.Hidden };
} }
public class ManiaModPerfect : ModPerfect
{
}
public class ManiaModFadeIn : Mod public class ManiaModFadeIn : Mod
{ {
public override Mods Name => Mods.FadeIn; public override Mods Name => Mods.FadeIn;

View File

@ -44,93 +44,47 @@ namespace osu.Game.Modes.Mania
new ManiaModKeyCoop(), new ManiaModKeyCoop(),
}; };
public override IEnumerable<ModSection> CreateModSections() => new ModSection[] public override IEnumerable<Mod> GetModsFor(ModType type)
{ {
new DifficultyReductionSection switch (type)
{ {
Buttons = new[] case ModType.DifficultyReduction:
{ return new Mod[]
new ModButton
{
ToggleKey = Key.Q,
Mods = new Mod[]
{ {
new ManiaModEasy(), new ManiaModEasy(),
},
},
new ModButton
{
ToggleKey = Key.W,
Mods = new Mod[]
{
new ManiaModNoFail(), new ManiaModNoFail(),
},
},
new ModButton
{
ToggleKey = Key.E,
Mods = new Mod[]
{
new ManiaModHalfTime(), new ManiaModHalfTime(),
}, };
},
}, case ModType.DifficultyIncrease:
}, return new Mod[]
new DifficultyIncreaseSection
{
Buttons = new ModButton[]
{
new ModButton
{
ToggleKey = Key.A,
Mods = new Mod[]
{ {
new ManiaModHardRock(), new ManiaModHardRock(),
}, new MultiMod
},
new ModButton
{ {
ToggleKey = Key.S,
Mods = new Mod[] Mods = new Mod[]
{ {
new ManiaModPerfect(),
new ManiaModSuddenDeath(), new ManiaModSuddenDeath(),
new ModPerfect(),
}, },
}, },
new ModButton new MultiMod
{ {
ToggleKey = Key.D,
Mods = new Mod[] Mods = new Mod[]
{ {
new ManiaModDoubleTime(), new ManiaModDoubleTime(),
new ManiaModNightcore(), new ManiaModNightcore(),
}, },
}, },
new ModButton
{
ToggleKey = Key.F,
Mods = new Mod[]
{
new ManiaModHidden(), new ManiaModHidden(),
},
},
new ModButton
{
ToggleKey = Key.G,
Mods = new Mod[]
{
new ManiaModFlashlight(), new ManiaModFlashlight(),
}, };
},
}, case ModType.Special:
}, return new Mod[]
new AssistedSection
{ {
Buttons = new[] new MultiMod
{ {
new ModButton
{
ToggleKey = Key.Z,
Mods = new Mod[] Mods = new Mod[]
{ {
new ManiaModKey4(), new ManiaModKey4(),
@ -144,35 +98,23 @@ namespace osu.Game.Modes.Mania
new ManiaModKey3(), new ManiaModKey3(),
}, },
}, },
new ModButton
{
ToggleKey = Key.X,
Mods = new Mod[]
{
new ManiaModKeyCoop(), new ManiaModKeyCoop(),
},
},
new ModButton
{
ToggleKey = Key.C,
Mods = new Mod[]
{
new ManiaModRandom(), new ManiaModRandom(),
}, new MultiMod
},
new ModButton
{ {
ToggleKey = Key.V,
Mods = new Mod[] Mods = new Mod[]
{ {
new ModAutoplay(), new ModAutoplay(),
new ModCinema(), new ModCinema(),
}, },
}, },
}
},
}; };
default:
return new Mod[] { };
}
}
protected override PlayMode PlayMode => PlayMode.Mania; protected override PlayMode PlayMode => PlayMode.Mania;
public override FontAwesome Icon => FontAwesome.fa_osu_mania_o; public override FontAwesome Icon => FontAwesome.fa_osu_mania_o;

View File

@ -59,6 +59,11 @@ namespace osu.Game.Modes.Osu
public override Mods[] DisablesMods => new Mods[] { }; public override Mods[] DisablesMods => new Mods[] { };
} }
public class OsuModPerfect : ModPerfect
{
}
public class OsuModSpunOut : Mod public class OsuModSpunOut : Mod
{ {
public override Mods Name => Mods.SpunOut; public override Mods Name => Mods.SpunOut;

View File

@ -53,135 +53,64 @@ namespace osu.Game.Modes.Osu
new OsuModTarget(), new OsuModTarget(),
}; };
public override IEnumerable<ModSection> CreateModSections() => new ModSection[] public override IEnumerable<Mod> GetModsFor(ModType type)
{ {
new DifficultyReductionSection switch (type)
{ {
Buttons = new[] case ModType.DifficultyReduction:
{ return new Mod[]
new ModButton
{
ToggleKey = Key.Q,
Mods = new Mod[]
{ {
new OsuModEasy(), new OsuModEasy(),
},
},
new ModButton
{
ToggleKey = Key.W,
Mods = new Mod[]
{
new OsuModNoFail(), new OsuModNoFail(),
},
},
new ModButton
{
ToggleKey = Key.E,
Mods = new Mod[]
{
new OsuModHalfTime(), new OsuModHalfTime(),
}, };
},
}, case ModType.DifficultyIncrease:
}, return new Mod[]
new DifficultyIncreaseSection
{
Buttons = new ModButton[]
{
new ModButton
{
ToggleKey = Key.A,
Mods = new Mod[]
{ {
new OsuModHardRock(), new OsuModHardRock(),
}, new MultiMod
},
new ModButton
{ {
ToggleKey = Key.S,
Mods = new Mod[] Mods = new Mod[]
{ {
new OsuModSuddenDeath(), new OsuModSuddenDeath(),
new ModPerfect(), new OsuModPerfect(),
}, },
}, },
new ModButton new MultiMod
{ {
ToggleKey = Key.D,
Mods = new Mod[] Mods = new Mod[]
{ {
new OsuModDoubleTime(), new OsuModDoubleTime(),
new OsuModNightcore(), new OsuModNightcore(),
}, },
}, },
new ModButton
{
ToggleKey = Key.F,
Mods = new Mod[]
{
new OsuModHidden(), new OsuModHidden(),
},
},
new ModButton
{
ToggleKey = Key.G,
Mods = new Mod[]
{
new OsuModFlashlight(), new OsuModFlashlight(),
}, };
},
}, case ModType.Special:
}, return new Mod[]
new AssistedSection
{
Buttons = new[]
{
new ModButton
{
ToggleKey = Key.Z,
Mods = new Mod[]
{ {
new OsuModRelax(), new OsuModRelax(),
},
},
new ModButton
{
ToggleKey = Key.X,
Mods = new Mod[]
{
new OsuModAutopilot(), new OsuModAutopilot(),
},
},
new ModButton
{
ToggleKey = Key.C,
Mods = new Mod[]
{
new OsuModTarget(), new OsuModTarget(),
},
},
new ModButton
{
ToggleKey = Key.V,
Mods = new Mod[]
{
new OsuModSpunOut(), new OsuModSpunOut(),
}, new MultiMod
},
new ModButton
{ {
ToggleKey = Key.B,
Mods = new Mod[] Mods = new Mod[]
{ {
new ModAutoplay(), new ModAutoplay(),
new ModCinema(), new ModCinema(),
}, },
}, },
}
},
}; };
default:
return new Mod[] { };
}
}
public override FontAwesome Icon => FontAwesome.fa_osu_osu_o; public override FontAwesome Icon => FontAwesome.fa_osu_osu_o;
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser(); public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();

View File

@ -56,4 +56,9 @@ namespace osu.Game.Modes.Taiko
public override double ScoreMultiplier => 1.12; public override double ScoreMultiplier => 1.12;
public override Mods[] DisablesMods => new Mods[] { }; public override Mods[] DisablesMods => new Mods[] { };
} }
public class TaikoModPerfect : ModPerfect
{
}
} }

View File

@ -33,111 +33,61 @@ namespace osu.Game.Modes.Taiko
new TaikoModFlashlight(), new TaikoModFlashlight(),
}; };
public override IEnumerable<ModSection> CreateModSections() => new ModSection[] public override IEnumerable<Mod> GetModsFor(ModType type)
{ {
new DifficultyReductionSection switch (type)
{ {
Buttons = new[] case ModType.DifficultyReduction:
{ return new Mod[]
new ModButton
{
ToggleKey = Key.Q,
Mods = new Mod[]
{ {
new TaikoModEasy(), new TaikoModEasy(),
},
},
new ModButton
{
ToggleKey = Key.W,
Mods = new Mod[]
{
new TaikoModNoFail(), new TaikoModNoFail(),
},
},
new ModButton
{
ToggleKey = Key.E,
Mods = new Mod[]
{
new TaikoModHalfTime(), new TaikoModHalfTime(),
}, };
},
}, case ModType.DifficultyIncrease:
}, return new Mod[]
new DifficultyIncreaseSection
{
Buttons = new ModButton[]
{
new ModButton
{
ToggleKey = Key.A,
Mods = new Mod[]
{ {
new TaikoModHardRock(), new TaikoModHardRock(),
}, new MultiMod
},
new ModButton
{ {
ToggleKey = Key.S,
Mods = new Mod[] Mods = new Mod[]
{ {
new TaikoModPerfect(),
new TaikoModSuddenDeath(), new TaikoModSuddenDeath(),
new ModPerfect(),
}, },
}, },
new ModButton new MultiMod
{ {
ToggleKey = Key.D,
Mods = new Mod[] Mods = new Mod[]
{ {
new TaikoModDoubleTime(), new TaikoModDoubleTime(),
new TaikoModNightcore(), new TaikoModNightcore(),
}, },
}, },
new ModButton
{
ToggleKey = Key.F,
Mods = new Mod[]
{
new TaikoModHidden(), new TaikoModHidden(),
},
},
new ModButton
{
ToggleKey = Key.G,
Mods = new Mod[]
{
new TaikoModFlashlight(), new TaikoModFlashlight(),
}, };
},
}, case ModType.Special:
}, return new Mod[]
new AssistedSection
{
Buttons = new[]
{
new ModButton
{
ToggleKey = Key.Z,
Mods = new Mod[]
{ {
new TaikoModRelax(), new TaikoModRelax(),
}, new MultiMod
},
new ModButton
{ {
ToggleKey = Key.B,
Mods = new Mod[] Mods = new Mod[]
{ {
new ModAutoplay(), new ModAutoplay(),
new ModCinema(), new ModCinema(),
}, },
}, },
}
},
}; };
default:
return new Mod[] { };
}
}
protected override PlayMode PlayMode => PlayMode.Taiko; protected override PlayMode PlayMode => PlayMode.Taiko;
public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o; public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o;

View File

@ -43,6 +43,18 @@ namespace osu.Game.Modes
public abstract Mods[] DisablesMods { get; } public abstract Mods[] DisablesMods { get; }
} }
public class MultiMod : Mod
{
public override Mods Name => Modes.Mods.None;
public override FontAwesome Icon => FontAwesome.fa_close;
public override string Description => @"";
public override double ScoreMultiplier => 0.0;
public override bool Ranked => false;
public override Mods[] DisablesMods => new Mods[] { };
public Mod[] Mods;
}
public abstract class ModNoFail : Mod public abstract class ModNoFail : Mod
{ {
public override Mods Name => Mods.NoFail; public override Mods Name => Mods.NoFail;
@ -140,7 +152,7 @@ namespace osu.Game.Modes
public override Mods[] DisablesMods => new Mods[] { Mods.Relax, Mods.Autopilot, Mods.SpunOut, Mods.SuddenDeath, Mods.Perfect }; public override Mods[] DisablesMods => new Mods[] { Mods.Relax, Mods.Autopilot, Mods.SpunOut, Mods.SuddenDeath, Mods.Perfect };
} }
public class ModPerfect : ModSuddenDeath public abstract class ModPerfect : ModSuddenDeath
{ {
public override Mods Name => Mods.Perfect; public override Mods Name => Mods.Perfect;
public override FontAwesome Icon => FontAwesome.fa_osu_mod_perfect; public override FontAwesome Icon => FontAwesome.fa_osu_mod_perfect;
@ -250,4 +262,11 @@ namespace osu.Game.Modes
FreeModAllowed = NoFail | Easy | Hidden | HardRock | SuddenDeath | Flashlight | FadeIn | Relax | Autopilot | SpunOut | KeyMod, FreeModAllowed = NoFail | Easy | Hidden | HardRock | SuddenDeath | Flashlight | FadeIn | Relax | Autopilot | SpunOut | KeyMod,
ScoreIncreaseMods = Hidden | HardRock | DoubleTime | Flashlight | FadeIn ScoreIncreaseMods = Hidden | HardRock | DoubleTime | Flashlight | FadeIn
} }
public enum ModType
{
DifficultyReduction,
DifficultyIncrease,
Special,
}
} }

View File

@ -29,7 +29,7 @@ namespace osu.Game.Modes
public abstract IEnumerable<Mod> AvailableMods { get; } public abstract IEnumerable<Mod> AvailableMods { get; }
public abstract IEnumerable<ModSection> CreateModSections(); public abstract IEnumerable<Mod> GetModsFor(ModType type);
public abstract ScoreProcessor CreateScoreProcessor(int hitObjectCount); public abstract ScoreProcessor CreateScoreProcessor(int hitObjectCount);

View File

@ -1,14 +1,11 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK.Input;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Modes; using osu.Game.Modes;
using osu.Game.Overlays.Mods;
namespace osu.Game namespace osu.Game.Overlays.Mods
{ {
public class AssistedSection : ModSection public class AssistedSection : ModSection
{ {

View File

@ -1,13 +1,10 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Modes;
using osu.Game.Overlays.Mods;
namespace osu.Game namespace osu.Game.Overlays.Mods
{ {
public class DifficultyIncreaseSection : ModSection public class DifficultyIncreaseSection : ModSection
{ {

View File

@ -100,25 +100,38 @@ namespace osu.Game.Overlays.Mods
} }
} }
private Mod[] mods; private Mod mod;
public Mod[] Mods public Mod Mod
{ {
get get
{ {
return mods; return mod;
} }
set set
{ {
if (mods == value) return; if (mod == value) return;
mods = value; mod = value;
createIcons();
if (value.Length > 0) if (mod is MultiMod)
{ {
displayMod(value[0]); mods = ((MultiMod)mod).Mods;
}
else
{
mods = new Mod[] { mod };
}
createIcons();
if (mods.Length > 0)
{
displayMod(mods[0]);
} }
} }
} }
private Mod[] mods;
public Mod[] Mods => mods; // the mods from Mod, only multiple if Mod is a MultiMod
public Mod SelectedMod => Mods.ElementAtOrDefault(selectedMod); public Mod SelectedMod => Mods.ElementAtOrDefault(selectedMod);
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -233,7 +246,7 @@ namespace osu.Game.Overlays.Mods
return base.OnKeyDown(state, args); return base.OnKeyDown(state, args);
} }
public ModButton() public ModButton(Mod m)
{ {
Direction = FlowDirections.Vertical; Direction = FlowDirections.Vertical;
Spacing = new Vector2(0f, -5f); Spacing = new Vector2(0f, -5f);
@ -263,6 +276,8 @@ namespace osu.Game.Overlays.Mods
TextSize = 18, TextSize = 18,
}, },
}; };
Mod = m;
} }
} }
} }

View File

@ -37,10 +37,8 @@ namespace osu.Game.Overlays.Mods
{ {
Mod selectedMod = button.SelectedMod; Mod selectedMod = button.SelectedMod;
if (selectedMod != null) if (selectedMod != null)
{
selectedMods.Add(selectedMod); selectedMods.Add(selectedMod);
} }
}
return selectedMods.ToArray(); return selectedMods.ToArray();
} }
@ -75,6 +73,7 @@ namespace osu.Game.Overlays.Mods
foreach (ModButton button in value) foreach (ModButton button in value)
{ {
button.Colour = Colour; button.Colour = Colour;
button.SelectedColour = selectedColour;
button.Action = buttonPressed; button.Action = buttonPressed;
} }

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -10,11 +11,11 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.Transforms;
using osu.Framework.Allocation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Modes; using osu.Game.Modes;
using osu.Framework.Allocation;
namespace osu.Game.Overlays.Mods namespace osu.Game.Overlays.Mods
{ {
@ -43,17 +44,35 @@ namespace osu.Game.Overlays.Mods
set set
{ {
modMode = value; modMode = value;
var ruleset = Ruleset.GetRuleset(value);
modSectionsContainer.RemoveAll(delegate (ModSection m) { return true; }); modSectionsContainer.Children = new ModSection[]
foreach (ModSection s in Ruleset.GetRuleset(value).CreateModSections())
{ {
s.RelativeSizeAxes = Axes.X; new DifficultyReductionSection
s.Origin = Anchor.TopCentre; {
s.Anchor = Anchor.TopCentre; RelativeSizeAxes = Axes.X,
s.Action = modButtonPressed; Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
modSectionsContainer.Add(s); 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(),
},
};
} }
} }
@ -109,51 +128,6 @@ namespace osu.Game.Overlays.Mods
} }
} }
private void modButtonPressed(Mod selectedMod)
{
if (selectedMod != null)
{
foreach (Modes.Mods disableMod in selectedMod.DisablesMods)
{
DeselectMod(disableMod);
}
refreshSelectedMods();
}
double multiplier = 1;
bool ranked = true;
foreach (Mod mod in SelectedMods.Value)
{
multiplier *= mod.ScoreMultiplier;
if (ranked)
{
ranked = mod.Ranked;
}
}
// 1.00x
// 1.05x
// 1.20x
multiplierLabel.Text = string.Format("{0:N2}x", multiplier);
string rankedString = ranked ? "Ranked" : "Unranked";
rankedLabel.Text = $@"{rankedString}, Score Multiplier: ";
if (multiplier > 1.0)
{
multiplierLabel.FadeColour(highMultiplierColour, 200);
}
else if (multiplier < 1.0)
{
multiplierLabel.FadeColour(lowMultiplierColour, 200);
}
else
{
multiplierLabel.FadeColour(Color4.White, 200);
}
}
public void DeselectMod(Modes.Mods modName) public void DeselectMod(Modes.Mods modName)
{ {
foreach (ModSection section in modSectionsContainer.Children) foreach (ModSection section in modSectionsContainer.Children)
@ -172,6 +146,51 @@ namespace osu.Game.Overlays.Mods
} }
} }
private void modButtonPressed(Mod selectedMod)
{
if (selectedMod != null)
{
foreach (Modes.Mods disableMod in selectedMod.DisablesMods)
{
DeselectMod(disableMod);
}
}
refreshSelectedMods();
double multiplier = 1.0;
bool ranked = true;
foreach (Mod mod in SelectedMods.Value)
{
multiplier *= mod.ScoreMultiplier;
if (ranked)
ranked = mod.Ranked;
}
// 1.00x
// 1.05x
// 1.20x
multiplierLabel.Text = string.Format("{0:N2}x", multiplier);
string rankedString = ranked ? "Ranked" : "Unranked";
rankedLabel.Text = $@"{rankedString}, Score Multiplier: ";
if (multiplier > 1.0)
{
multiplierLabel.FadeColour(highMultiplierColour, 200);
}
else if (multiplier < 1.0)
{
multiplierLabel.FadeColour(lowMultiplierColour, 200);
}
else
{
multiplierLabel.FadeColour(Color4.White, 200);
}
}
private void refreshSelectedMods() private void refreshSelectedMods()
{ {
List<Mod> selectedMods = new List<Mod>(); List<Mod> selectedMods = new List<Mod>();