Animate multiplier display

This commit is contained in:
Dean Herbert 2022-04-05 18:25:27 +09:00
parent 497e5e3a36
commit 901032bfa2
2 changed files with 25 additions and 7 deletions

View File

@ -20,6 +20,8 @@ namespace osu.Game.Overlays.Mods
{
public class DifficultyMultiplierDisplay : CompositeDrawable, IHasCurrentValue<double>
{
public const float HEIGHT = 42;
public Bindable<double> Current
{
get => current.Current;
@ -42,13 +44,12 @@ namespace osu.Game.Overlays.Mods
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
private const float height = 42;
private const float multiplier_value_area_width = 56;
private const float transition_duration = 200;
public DifficultyMultiplierDisplay()
{
Height = height;
Height = HEIGHT;
AutoSizeAxes = Axes.X;
InternalChild = new Container

View File

@ -84,13 +84,21 @@ namespace osu.Game.Overlays.Mods
{
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = 100, Vertical = 10 },
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.X,
RelativePositionAxes = Axes.X,
X = 0.3f,
Height = DifficultyMultiplierDisplay.HEIGHT,
Margin = new MarginPadding
{
Horizontal = 100,
Vertical = 10
},
Child = multiplierDisplay = new DifficultyMultiplierDisplay
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight
Anchor = Anchor.Centre,
Origin = Anchor.Centre
}
}
},
@ -283,6 +291,11 @@ namespace osu.Game.Overlays.Mods
footer.MoveToY(0, fade_in_duration, Easing.OutQuint);
this.FadeIn(fade_in_duration, Easing.OutQuint);
multiplierDisplay
.Delay(300)
.FadeIn(200, Easing.OutQuint)
.ScaleTo(1, fade_in_duration, Easing.OutElastic);
}
protected override void PopOut()
@ -291,6 +304,10 @@ namespace osu.Game.Overlays.Mods
base.PopOut();
multiplierDisplay
.FadeOut(200, Easing.OutQuint)
.ScaleTo(0.75f, fade_out_duration, Easing.OutQuint);
header.MoveToY(-header.DrawHeight, fade_out_duration, Easing.OutQuint);
footer.MoveToY(footer.DrawHeight, fade_out_duration, Easing.OutQuint);