From 901032bfa21e0916efa9ce1b5b184f1978f53e8f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 18:25:27 +0900 Subject: [PATCH] Animate multiplier display --- .../Mods/DifficultyMultiplierDisplay.cs | 5 ++-- osu.Game/Overlays/Mods/ModSelectScreen.cs | 27 +++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs index 4fc3a904fa..4d3f630a55 100644 --- a/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs +++ b/osu.Game/Overlays/Mods/DifficultyMultiplierDisplay.cs @@ -20,6 +20,8 @@ namespace osu.Game.Overlays.Mods { public class DifficultyMultiplierDisplay : CompositeDrawable, IHasCurrentValue { + public const float HEIGHT = 42; + public Bindable 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 diff --git a/osu.Game/Overlays/Mods/ModSelectScreen.cs b/osu.Game/Overlays/Mods/ModSelectScreen.cs index 8468448bbb..3437922cc8 100644 --- a/osu.Game/Overlays/Mods/ModSelectScreen.cs +++ b/osu.Game/Overlays/Mods/ModSelectScreen.cs @@ -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);