1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:02:55 +08:00

Fade out text instead of removing it immediately

This commit is contained in:
jorolf 2019-02-26 15:26:00 +01:00
parent cacef7421d
commit 4c10185f5b

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Screens;
@ -14,6 +15,7 @@ using osu.Game.Online.API;
using osuTK;
using osuTK.Graphics;
using osu.Game.Overlays;
using osu.Game.Users;
namespace osu.Game.Screens.Menu
{
@ -34,13 +36,16 @@ namespace osu.Game.Screens.Menu
private const float icon_y = -85;
[Resolved]
private APIAccess api { get; set; }
public Disclaimer()
{
ValidForResume = false;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, APIAccess api)
private void load(OsuColour colours)
{
InternalChildren = new Drawable[]
{
@ -96,12 +101,6 @@ namespace osu.Game.Screens.Menu
t.Origin = Anchor.Centre;
}).First());
api.LocalUser.BindValueChanged(user =>
{
if (user.NewValue.IsSupporter)
textFlow.RemoveRange(supporterDrawables);
}, true);
iconColour = colours.Yellow;
}
@ -109,6 +108,8 @@ namespace osu.Game.Screens.Menu
{
base.LoadComplete();
LoadComponentAsync(intro = new Intro());
api.LocalUser.BindValueChanged(userChanged, true);
}
public override void OnEntering(IScreen last)
@ -134,5 +135,17 @@ namespace osu.Game.Screens.Menu
heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop();
}
public override void OnSuspending(IScreen next)
{
base.OnSuspending(next);
api.LocalUser.ValueChanged -= userChanged;
}
private void userChanged(ValueChangedEvent<User> user)
{
if (user.NewValue.IsSupporter) supporterDrawables.ForEach(d => d.FadeOut(200, Easing.OutQuint).Expire());
}
}
}