1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 16:52:55 +08:00

Merge pull request #978 from EVAST9919/mods_overlay_fix

Hide "Unranked" text in ModDisplay if play is ranked
This commit is contained in:
Dean Herbert 2017-07-14 17:36:46 +09:00 committed by GitHub
commit 36594afee3

View File

@ -12,16 +12,20 @@ using osu.Game.Rulesets.UI;
using OpenTK; using OpenTK;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using System.Linq;
namespace osu.Game.Screens.Play.HUD namespace osu.Game.Screens.Play.HUD
{ {
public class ModDisplay : Container, IHasCurrentValue<IEnumerable<Mod>> public class ModDisplay : Container, IHasCurrentValue<IEnumerable<Mod>>
{ {
private const int fade_duration = 1000;
private readonly Bindable<IEnumerable<Mod>> mods = new Bindable<IEnumerable<Mod>>(); private readonly Bindable<IEnumerable<Mod>> mods = new Bindable<IEnumerable<Mod>>();
public Bindable<IEnumerable<Mod>> Current => mods; public Bindable<IEnumerable<Mod>> Current => mods;
private readonly FillFlowContainer<ModIcon> iconsContainer; private readonly FillFlowContainer<ModIcon> iconsContainer;
private readonly OsuSpriteText unrankedText;
public ModDisplay() public ModDisplay()
{ {
@ -35,8 +39,9 @@ namespace osu.Game.Screens.Play.HUD
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Margin = new MarginPadding { Left = 10, Right = 10 }, Margin = new MarginPadding { Left = 10, Right = 10 },
}, },
new OsuSpriteText unrankedText = new OsuSpriteText
{ {
AlwaysPresent = true,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Text = @"/ UNRANKED /", Text = @"/ UNRANKED /",
@ -70,8 +75,13 @@ namespace osu.Game.Screens.Play.HUD
private void appearTransform() private void appearTransform()
{ {
if (mods.Value.Any(m => !m.Ranked))
unrankedText.FadeInFromZero(fade_duration, EasingTypes.OutQuint);
else
unrankedText.Hide();
iconsContainer.Flush(); iconsContainer.Flush();
iconsContainer.FadeInFromZero(1000, EasingTypes.OutQuint); iconsContainer.FadeInFromZero(fade_duration, EasingTypes.OutQuint);
expand(); expand();
using (iconsContainer.BeginDelayedSequence(1200)) using (iconsContainer.BeginDelayedSequence(1200))
contract(); contract();