From c40c70509e1909fab2488120c9e867cb76f66827 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 4 Nov 2022 15:14:09 +0900 Subject: [PATCH 1/2] Improve song select transition to gameplay --- osu.Game/Screens/Select/BeatmapCarousel.cs | 20 +++++++++++++++++ osu.Game/Screens/Select/SongSelect.cs | 26 +++++++++++++++++----- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 3b694dbf43..2f99f6acca 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -770,6 +770,26 @@ namespace osu.Game.Screens.Select { updateItem(item); + if (!item.Item.Filtered.Value) + { + bool isSelected = item.Item.State.Value == CarouselItemState.Selected; + + // Cheap way of doing animations when entering / exiting song select. + const double half_time = 50; + const float panel_x_offset_when_inactive = 200; + + if (isSelected || AllowSelection) + { + item.Alpha = (float)Interpolation.DampContinuously(item.Alpha, 1, half_time, Clock.ElapsedFrameTime); + item.X = (float)Interpolation.DampContinuously(item.X, 0, half_time, Clock.ElapsedFrameTime); + } + else + { + item.Alpha = (float)Interpolation.DampContinuously(item.Alpha, 0, half_time, Clock.ElapsedFrameTime); + item.X = (float)Interpolation.DampContinuously(item.X, panel_x_offset_when_inactive, half_time, Clock.ElapsedFrameTime); + } + } + if (item is DrawableCarouselBeatmapSet set) { foreach (var diff in set.DrawableBeatmaps) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index f5a058e945..fe9b67a02e 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -89,6 +89,8 @@ namespace osu.Game.Screens.Select protected BeatmapCarousel Carousel { get; private set; } + private ParallaxContainer wedgeBackground; + protected Container LeftArea { get; private set; } private BeatmapInfoWedge beatmapInfoWedge; @@ -165,10 +167,12 @@ namespace osu.Game.Screens.Select { new Drawable[] { - new ParallaxContainer + wedgeBackground = new ParallaxContainer { ParallaxAmount = 0.005f, RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, Child = new WedgeBackground { RelativeSizeAxes = Axes.Both, @@ -609,9 +613,15 @@ namespace osu.Game.Screens.Select } } - this.FadeIn(250); + LeftArea.MoveToX(0, 400, Easing.OutQuint); + LeftArea.FadeIn(100, Easing.OutQuint); - this.ScaleTo(1, 250, Easing.OutSine); + FilterControl.MoveToY(0, 400, Easing.OutQuint); + FilterControl.FadeIn(100, Easing.OutQuint); + + this.FadeIn(250, Easing.OutQuint); + + wedgeBackground.ScaleTo(1, 500, Easing.OutQuint); FilterControl.Activate(); } @@ -629,9 +639,15 @@ namespace osu.Game.Screens.Select endLooping(); - this.ScaleTo(1.1f, 250, Easing.InSine); + FilterControl.MoveToY(-120, 250, Easing.OutQuint); + FilterControl.FadeOut(100); - this.FadeOut(250); + LeftArea.MoveToX(-150, 1800, Easing.OutQuint); + LeftArea.FadeOut(200, Easing.OutQuint); + + wedgeBackground.ScaleTo(2.4f, 400, Easing.OutQuint); + + this.FadeOut(400, Easing.OutQuint); FilterControl.Deactivate(); base.OnSuspending(e); From 391840404de144367f979f4cde1ac59475c972c2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 7 Nov 2022 11:59:43 +0900 Subject: [PATCH 2/2] Play exiting transition in both directions --- osu.Game/Screens/Select/SongSelect.cs | 40 +++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index fe9b67a02e..4b2417aab4 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -633,14 +633,32 @@ namespace osu.Game.Screens.Select transferRulesetValue(); ModSelect.SelectedMods.UnbindFrom(selectedMods); + + playExitingTransition(); + base.OnSuspending(e); + } + + public override bool OnExiting(ScreenExitEvent e) + { + if (base.OnExiting(e)) + return true; + + playExitingTransition(); + return false; + } + + private void playExitingTransition() + { ModSelect.Hide(); BeatmapOptions.Hide(); + Carousel.AllowSelection = false; + endLooping(); - FilterControl.MoveToY(-120, 250, Easing.OutQuint); - FilterControl.FadeOut(100); + FilterControl.MoveToY(-120, 500, Easing.OutQuint); + FilterControl.FadeOut(200, Easing.OutQuint); LeftArea.MoveToX(-150, 1800, Easing.OutQuint); LeftArea.FadeOut(200, Easing.OutQuint); @@ -650,24 +668,6 @@ namespace osu.Game.Screens.Select this.FadeOut(400, Easing.OutQuint); FilterControl.Deactivate(); - base.OnSuspending(e); - } - - public override bool OnExiting(ScreenExitEvent e) - { - if (base.OnExiting(e)) - return true; - - beatmapInfoWedge.Hide(); - ModSelect.Hide(); - - this.FadeOut(100); - - FilterControl.Deactivate(); - - endLooping(); - - return false; } private bool isHandlingLooping;