From 49fc91cf375678bd3aece6f13169282ae6da77bf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Apr 2017 16:28:11 +0900 Subject: [PATCH] Add an exit transition. --- osu.Game/Screens/Ranking/Results.cs | 45 +++++++++++++++++++---------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index e440799e25..9536f862b0 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.IEnumerableExtensions; @@ -43,13 +44,15 @@ namespace osu.Game.Screens.Ranking this.score = score; } + private const float transition_time = 800; + + private IEnumerable allCircles => new Drawable[] { circleOuterBackground, circleInner, circleOuter }; + protected override void OnEntering(Screen last) { base.OnEntering(last); (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, EasingTypes.OutQuint); - var allCircles = new[] { circleOuterBackground, circleInner, circleOuter }; - allCircles.ForEach(c => { c.FadeOut(); @@ -60,31 +63,43 @@ namespace osu.Game.Screens.Ranking modeChangeButtons.FadeOut(); currentPage.FadeOut(); - const float appear_time = 800; + - circleOuterBackground.ScaleTo(1, appear_time, EasingTypes.OutQuint); - circleOuterBackground.FadeTo(1, appear_time, EasingTypes.OutQuint); + circleOuterBackground.ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleOuterBackground.FadeTo(1, transition_time, EasingTypes.OutQuint); - Content.Delay(appear_time * 0.25f, true); + Content.Delay(transition_time * 0.25f, true); - circleOuter.ScaleTo(1, appear_time, EasingTypes.OutQuint); - circleOuter.FadeTo(1, appear_time, EasingTypes.OutQuint); + circleOuter.ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleOuter.FadeTo(1, transition_time, EasingTypes.OutQuint); - Content.Delay(appear_time * 0.3f, true); + Content.Delay(transition_time * 0.3f, true); - backgroundParallax.FadeIn(appear_time, EasingTypes.OutQuint); + backgroundParallax.FadeIn(transition_time, EasingTypes.OutQuint); - circleInner.ScaleTo(1, appear_time, EasingTypes.OutQuint); - circleInner.FadeTo(1, appear_time, EasingTypes.OutQuint); + circleInner.ScaleTo(1, transition_time, EasingTypes.OutQuint); + circleInner.FadeTo(1, transition_time, EasingTypes.OutQuint); - Content.Delay(appear_time * 0.4f, true); + Content.Delay(transition_time * 0.4f, true); - modeChangeButtons.FadeIn(appear_time, EasingTypes.OutQuint); - currentPage.FadeIn(appear_time, EasingTypes.OutQuint); + modeChangeButtons.FadeIn(transition_time, EasingTypes.OutQuint); + currentPage.FadeIn(transition_time, EasingTypes.OutQuint); Content.DelayReset(); } + protected override bool OnExiting(Screen next) + { + allCircles.ForEach(c => + { + c.ScaleTo(0, transition_time, EasingTypes.OutSine); + }); + + Content.FadeOut(transition_time / 4); + + return base.OnExiting(next); + } + [BackgroundDependencyLoader] private void load() {