Add back "rewind" text, showing temporarily after a rewind occurs

This commit is contained in:
Dean Herbert
2021-04-07 18:29:45 +09:00
parent b4c6894d13
commit 0f2c03d54b
2 changed files with 24 additions and 0 deletions

View File

@ -106,6 +106,7 @@ namespace osu.Game.Screens.Select
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Child = SpriteText = new OsuSpriteText Child = SpriteText = new OsuSpriteText
{ {
AlwaysPresent = true,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
} }

View File

@ -4,8 +4,11 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osuTK;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
{ {
@ -22,10 +25,30 @@ namespace osu.Game.Screens.Select
SelectedColour = colours.Green; SelectedColour = colours.Green;
DeselectedColour = SelectedColour.Opacity(0.5f); DeselectedColour = SelectedColour.Opacity(0.5f);
Text = @"random"; Text = @"random";
Action = () => Action = () =>
{ {
if (rewindSearch) if (rewindSearch)
{ {
const double fade_time = 500;
OsuSpriteText rewindSpriteText;
TextContainer.Add(rewindSpriteText = new OsuSpriteText
{
Alpha = 0,
Text = @"rewind",
AlwaysPresent = true, // make sure the button is sized large enough to always show this
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
rewindSpriteText.FadeOutFromOne(fade_time, Easing.In);
rewindSpriteText.MoveTo(Vector2.Zero).MoveTo(new Vector2(0, 10), fade_time, Easing.In);
rewindSpriteText.Expire();
SpriteText.FadeInFromZero(fade_time, Easing.In);
PreviousRandom.Invoke(); PreviousRandom.Invoke();
} }
else else