diff --git a/osu.Game/Overlays/Mods/AssistedSection.cs b/osu.Game/Overlays/Mods/AssistedSection.cs index b4263fa309..b3cbb410e4 100644 --- a/osu.Game/Overlays/Mods/AssistedSection.cs +++ b/osu.Game/Overlays/Mods/AssistedSection.cs @@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods [BackgroundDependencyLoader] private void load(OsuColour colours) { - ButtonColour = colours.Blue; SelectedColour = colours.BlueLight; } diff --git a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs index 0a293416dc..fc759eb7d9 100644 --- a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs @@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods [BackgroundDependencyLoader] private void load(OsuColour colours) { - ButtonColour = colours.Yellow; SelectedColour = colours.YellowLight; } diff --git a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs index 3a373e6f09..dd3b5965f3 100644 --- a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs @@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods [BackgroundDependencyLoader] private void load(OsuColour colours) { - ButtonColour = colours.Green; SelectedColour = colours.GreenLight; } diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index f380c19d8a..409207dd55 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -71,10 +71,6 @@ namespace osu.Game.Overlays.Mods { if (value == buttonColour) return; buttonColour = value; - foreach (ModIcon icon in iconsContainer.Children) - { - icon.Colour = value; - } } } @@ -180,41 +176,33 @@ namespace osu.Game.Overlays.Mods { iconsContainer.Add(new[] { - new ModIcon + new ModIcon(Mods[0]) { Origin = Anchor.Centre, Anchor = Anchor.Centre, AutoSizeAxes = Axes.Both, Position = new Vector2(1.5f), - Colour = ButtonColour }, - foregroundIcon = new ModIcon + foregroundIcon = new ModIcon(Mods[0]) { Origin = Anchor.Centre, Anchor = Anchor.Centre, AutoSizeAxes = Axes.Both, Position = new Vector2(-1.5f), - Colour = ButtonColour }, }); } else { - iconsContainer.Add(foregroundIcon = new ModIcon + iconsContainer.Add(foregroundIcon = new ModIcon(Mod) { Origin = Anchor.Centre, Anchor = Anchor.Centre, AutoSizeAxes = Axes.Both, - Colour = ButtonColour }); } - } - protected override void LoadComplete() - { - base.LoadComplete(); - foreach (ModIcon icon in iconsContainer.Children) - icon.Colour = ButtonColour; + buttonColour = foregroundIcon.Colour; } public ModButton(Mod m) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index c2af12f49e..b70323fb63 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -50,7 +50,6 @@ namespace osu.Game.Overlays.Mods foreach (ModButton button in value) { - button.ButtonColour = ButtonColour; button.SelectedColour = selectedColour; button.Action = Action; } @@ -59,25 +58,6 @@ namespace osu.Game.Overlays.Mods } } - private Color4 buttonsBolour = Color4.White; - public Color4 ButtonColour - { - get - { - return buttonsBolour; - } - set - { - if (value == buttonsBolour) return; - buttonsBolour = value; - - foreach (ModButton button in buttons) - { - button.ButtonColour = value; - } - } - } - private Color4 selectedColour = Color4.White; public Color4 SelectedColour { diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 8301796c1f..127f1483b8 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -5,6 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.UI { @@ -29,25 +30,42 @@ namespace osu.Game.Rulesets.UI public new Color4 Colour { - get - { - return background.Colour; - } - set - { - background.Colour = value; - } + get { return background?.Colour ?? Color4.Transparent; } + set { background.Colour = value; } } public FontAwesome Icon { - get + get { return modIcon.Icon; } + set { modIcon.Icon = value; } + } + + public ModIcon(Mod m) + { + if(m!= null) { - return modIcon.Icon; - } - set - { - modIcon.Icon = value; + Children = new Drawable[] + { + background = new TextAwesome + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Icon = FontAwesome.fa_osu_mod_bg, + Colour = selectColour(m), + Shadow = true, + TextSize = 20 + }, + modIcon = new TextAwesome + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Colour = OsuColour.Gray(84), + TextSize = 20, + Icon = m.Icon, + }, + }; + + reapplySize(); } } @@ -57,28 +75,19 @@ namespace osu.Game.Rulesets.UI modIcon.TextSize = iconSize - 35; } - public ModIcon() + private Color4 selectColour(Mod mod) { - Children = new Drawable[] + switch (mod.Type) { - background = new TextAwesome - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Icon = FontAwesome.fa_osu_mod_bg, - Shadow = true, - TextSize = 20 - }, - modIcon = new TextAwesome - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Colour = OsuColour.Gray(84), - TextSize = 20 - }, - }; + case ModType.DifficultyIncrease: + return OsuColour.FromHex(@"ffcc22"); + case ModType.DifficultyReduction: + return OsuColour.FromHex(@"88b300"); + case ModType.Special: + return OsuColour.FromHex(@"66ccff"); - reapplySize(); + default: return Color4.White; + } } } } \ No newline at end of file diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index 280759485f..ddb24bfb31 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -16,9 +16,15 @@ namespace osu.Game.Screens.Play { private readonly FillFlowContainer iconsContainer; + private bool showMods; public bool ShowMods { - set { if (!value) Hide(); } + set + { + showMods = value; + if (!showMods) Hide(); + } + get { return ShowMods; } } public ModsContainer() @@ -46,28 +52,11 @@ namespace osu.Game.Screens.Play public void Add(Mod mod) { - iconsContainer.Add(new ModIcon + iconsContainer.Add(new ModIcon(mod) { AutoSizeAxes = Axes.Both, - Icon = mod.Icon, - Colour = selectColour(mod), Scale = new Vector2((float)0.7), }); } - - private Color4 selectColour(Mod mod) - { - switch (mod.Type) - { - case ModType.DifficultyIncrease: - return OsuColour.FromHex(@"ffcc22"); - case ModType.DifficultyReduction: - return OsuColour.FromHex(@"88b300"); - case ModType.Special: - return OsuColour.FromHex(@"66ccff"); - - default: return Color4.White; - } - } } }