From 714d53f3292e102fe086590cfceaf4cfed0638d9 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 27 Jun 2017 05:17:21 +0300 Subject: [PATCH 1/4] Hide "Unranked" text in ModDisplay if play is ranked --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 28 +++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 921accf6ac..1295bcb9f2 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -12,16 +12,20 @@ using osu.Game.Rulesets.UI; using OpenTK; using osu.Framework.Input; using osu.Game.Graphics.Containers; +using System.Linq; namespace osu.Game.Screens.Play.HUD { public class ModDisplay : Container, IHasCurrentValue> { + private const int fade_duration = 1000; + private readonly Bindable> mods = new Bindable>(); public Bindable> Current => mods; private readonly FillFlowContainer iconsContainer; + private readonly OsuSpriteText unrankedText; public ModDisplay() { @@ -35,8 +39,9 @@ namespace osu.Game.Screens.Play.HUD Direction = FillDirection.Horizontal, Margin = new MarginPadding { Left = 10, Right = 10 }, }, - new OsuSpriteText + unrankedText = new OsuSpriteText { + AlwaysPresent = true, Anchor = Anchor.BottomCentre, Origin = Anchor.TopCentre, Text = @"/ UNRANKED /", @@ -48,6 +53,7 @@ namespace osu.Game.Screens.Play.HUD mods.ValueChanged += mods => { iconsContainer.Clear(); + foreach (Mod mod in mods) { iconsContainer.Add(new ModIcon(mod) @@ -62,6 +68,19 @@ namespace osu.Game.Screens.Play.HUD }; } + private bool playIsRanked() + { + if (!mods.Value.Any()) return true; + + foreach (var mod in mods.Value) + { + if (!mod.Ranked) + return false; + } + + return true; + } + protected override void LoadComplete() { base.LoadComplete(); @@ -70,8 +89,13 @@ namespace osu.Game.Screens.Play.HUD private void appearTransform() { + if (!playIsRanked()) + unrankedText.FadeInFromZero(fade_duration, EasingTypes.OutQuint); + else + unrankedText.FadeTo(0); + iconsContainer.Flush(); - iconsContainer.FadeInFromZero(1000, EasingTypes.OutQuint); + iconsContainer.FadeInFromZero(fade_duration, EasingTypes.OutQuint); expand(); using (iconsContainer.BeginDelayedSequence(1200)) contract(); From 2ad6d3fa77250088d845f5052c9905df161924a4 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 27 Jun 2017 05:41:24 +0300 Subject: [PATCH 2/4] Simplify property --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 1295bcb9f2..64a3554762 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -53,7 +53,6 @@ namespace osu.Game.Screens.Play.HUD mods.ValueChanged += mods => { iconsContainer.Clear(); - foreach (Mod mod in mods) { iconsContainer.Add(new ModIcon(mod) @@ -68,28 +67,17 @@ namespace osu.Game.Screens.Play.HUD }; } - private bool playIsRanked() - { - if (!mods.Value.Any()) return true; - - foreach (var mod in mods.Value) - { - if (!mod.Ranked) - return false; - } - - return true; - } - protected override void LoadComplete() { base.LoadComplete(); appearTransform(); } + private bool playIsRanked => !mods.Value.Any(m => !m.Ranked); + private void appearTransform() { - if (!playIsRanked()) + if (!playIsRanked) unrankedText.FadeInFromZero(fade_duration, EasingTypes.OutQuint); else unrankedText.FadeTo(0); From 33206fcf0e7ae1fe87534f0a0d0cf549b8f6cdfd Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Sat, 8 Jul 2017 12:34:24 +0300 Subject: [PATCH 3/4] Use `Hide` instead of `FadeTo(0)` --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 64a3554762..3fad7032a5 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Play.HUD if (!playIsRanked) unrankedText.FadeInFromZero(fade_duration, EasingTypes.OutQuint); else - unrankedText.FadeTo(0); + unrankedText.Hide(); iconsContainer.Flush(); iconsContainer.FadeInFromZero(fade_duration, EasingTypes.OutQuint); From 0b1db1502d386fa7ed291f45682de3a742724373 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Wed, 12 Jul 2017 09:42:38 +0300 Subject: [PATCH 4/4] removed useless bool --- osu.Game/Screens/Play/HUD/ModDisplay.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 6facc1c349..f8235e5bcf 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -73,11 +73,9 @@ namespace osu.Game.Screens.Play.HUD appearTransform(); } - private bool playIsRanked => !mods.Value.Any(m => !m.Ranked); - private void appearTransform() { - if (!playIsRanked) + if (mods.Value.Any(m => !m.Ranked)) unrankedText.FadeInFromZero(fade_duration, EasingTypes.OutQuint); else unrankedText.Hide();