1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 14:53:01 +08:00

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

View File

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