From 9e35eb8d978be13c4664d378967fe7443ddbd744 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 3 May 2017 13:53:45 +0300 Subject: [PATCH] Fixes --- osu.Game/Rulesets/UI/ModIcon.cs | 47 ++++++++++++-------------- osu.Game/Screens/Play/ModsContainer.cs | 2 -- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 127f1483b8..710ea22a5b 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.UI public new Color4 Colour { - get { return background?.Colour ?? Color4.Transparent; } + get { return background.Colour; } set { background.Colour = value; } } @@ -42,31 +42,28 @@ namespace osu.Game.Rulesets.UI public ModIcon(Mod m) { - if(m!= null) + Children = new Drawable[] { - Children = new Drawable[] + background = new TextAwesome { - 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, - }, - }; + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Icon = FontAwesome.fa_osu_mod_bg, + Colour = pickColour(m), + Shadow = true, + TextSize = 20 + }, + modIcon = new TextAwesome + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Colour = OsuColour.Gray(84), + TextSize = 20, + Icon = m?.Icon ?? FontAwesome.fa_question, + }, + }; - reapplySize(); - } + reapplySize(); } private void reapplySize() @@ -75,9 +72,9 @@ namespace osu.Game.Rulesets.UI modIcon.TextSize = iconSize - 35; } - private Color4 selectColour(Mod mod) + private Color4 pickColour(Mod mod) { - switch (mod.Type) + switch (mod?.Type) { case ModType.DifficultyIncrease: return OsuColour.FromHex(@"ffcc22"); diff --git a/osu.Game/Screens/Play/ModsContainer.cs b/osu.Game/Screens/Play/ModsContainer.cs index ddb24bfb31..26f0edcf10 100644 --- a/osu.Game/Screens/Play/ModsContainer.cs +++ b/osu.Game/Screens/Play/ModsContainer.cs @@ -5,8 +5,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using osu.Framework.Graphics; -using OpenTK.Graphics; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK;