diff --git a/osu.Game/Screens/Play/BreaksOverlay/ArrowsOverlay.cs b/osu.Game/Screens/Play/BreaksOverlay/ArrowsOverlay.cs index 9d729826de..111ed61fd3 100644 --- a/osu.Game/Screens/Play/BreaksOverlay/ArrowsOverlay.cs +++ b/osu.Game/Screens/Play/BreaksOverlay/ArrowsOverlay.cs @@ -5,11 +5,15 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics; using OpenTK; using osu.Game.Graphics.Containers; +using System; +using osu.Game.Beatmaps.Timing; namespace osu.Game.Screens.Play.BreaksOverlay { - public class ArrowsOverlay : Container + public class ArrowsOverlay : VisibilityContainer { + private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2; + private const int glow_icon_size = 60; private const int glow_icon_blur_sigma = 10; private const float glow_icon_final_offset = 0.22f; @@ -79,22 +83,22 @@ namespace osu.Game.Screens.Play.BreaksOverlay }; } - public void Show(double fadeDuration) + protected override void PopIn() { - leftGlowIcon.MoveToX(-glow_icon_final_offset, fadeDuration, Easing.OutQuint); - rightGlowIcon.MoveToX(glow_icon_final_offset, fadeDuration, Easing.OutQuint); + leftGlowIcon.MoveToX(-glow_icon_final_offset, fade_duration, Easing.OutQuint); + rightGlowIcon.MoveToX(glow_icon_final_offset, fade_duration, Easing.OutQuint); - leftBlurredIcon.MoveToX(-blurred_icon_final_offset, fadeDuration, Easing.OutQuint); - rightBlurredIcon.MoveToX(blurred_icon_final_offset, fadeDuration, Easing.OutQuint); + leftBlurredIcon.MoveToX(-blurred_icon_final_offset, fade_duration, Easing.OutQuint); + rightBlurredIcon.MoveToX(blurred_icon_final_offset, fade_duration, Easing.OutQuint); } - public void Hide(double fadeDuration) + protected override void PopOut() { - leftGlowIcon.MoveToX(-glow_icon_offscreen_offset, fadeDuration, Easing.OutQuint); - rightGlowIcon.MoveToX(glow_icon_offscreen_offset, fadeDuration, Easing.OutQuint); + leftGlowIcon.MoveToX(-glow_icon_offscreen_offset, fade_duration, Easing.OutQuint); + rightGlowIcon.MoveToX(glow_icon_offscreen_offset, fade_duration, Easing.OutQuint); - leftBlurredIcon.MoveToX(-blurred_icon_offscreen_offset, fadeDuration, Easing.OutQuint); - rightBlurredIcon.MoveToX(blurred_icon_offscreen_offset, fadeDuration, Easing.OutQuint); + leftBlurredIcon.MoveToX(-blurred_icon_offscreen_offset, fade_duration, Easing.OutQuint); + rightBlurredIcon.MoveToX(blurred_icon_offscreen_offset, fade_duration, Easing.OutQuint); } } } diff --git a/osu.Game/Screens/Play/BreaksOverlay/BreakOverlay.cs b/osu.Game/Screens/Play/BreaksOverlay/BreakOverlay.cs index 3b2335a455..1b0e04eac1 100644 --- a/osu.Game/Screens/Play/BreaksOverlay/BreakOverlay.cs +++ b/osu.Game/Screens/Play/BreaksOverlay/BreakOverlay.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay private void onBreakIn(BreakPeriod b) { if (letterboxing) - letterboxOverlay.FadeIn(fade_duration); + letterboxOverlay.Show(); remainingTimeBox .ResizeWidthTo(remaining_time_container_max_size, fade_duration, Easing.OutQuint) @@ -115,20 +115,19 @@ namespace osu.Game.Screens.Play.BreaksOverlay Scheduler.AddDelayed(() => remainingTimeCounter.StartCounting(b.EndTime), b.StartTime - Clock.CurrentTime); - remainingTimeCounter.FadeIn(fade_duration); - - info.FadeIn(fade_duration); - arrowsOverlay.Show(fade_duration); + remainingTimeCounter.Show(); + info.Show(); + arrowsOverlay.Show(); } private void onBreakOut() { if (letterboxing) - letterboxOverlay.FadeOut(fade_duration); + letterboxOverlay.Hide(); - remainingTimeCounter.FadeOut(fade_duration); - info.FadeOut(fade_duration); - arrowsOverlay.Hide(fade_duration); + remainingTimeCounter.Hide(); + info.Hide(); + arrowsOverlay.Hide(); } public void BindProcessor(ScoreProcessor processor) diff --git a/osu.Game/Screens/Play/BreaksOverlay/InfoContainer.cs b/osu.Game/Screens/Play/BreaksOverlay/InfoContainer.cs index 351dc66930..6a850d066d 100644 --- a/osu.Game/Screens/Play/BreaksOverlay/InfoContainer.cs +++ b/osu.Game/Screens/Play/BreaksOverlay/InfoContainer.cs @@ -1,16 +1,20 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Scoring; +using osu.Game.Beatmaps.Timing; namespace osu.Game.Screens.Play.BreaksOverlay { - public class InfoContainer : FillFlowContainer + public class InfoContainer : VisibilityContainer { + private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2; + public PercentageInfoLine AccuracyDisplay; public InfoLine RankDisplay; public InfoLine GradeDisplay; @@ -18,33 +22,38 @@ namespace osu.Game.Screens.Play.BreaksOverlay public InfoContainer() { AutoSizeAxes = Axes.Both; - Alpha = 0; - Direction = FillDirection.Vertical; - Spacing = new Vector2(5); - Children = new Drawable[] + Child = new FillFlowContainer { - new OsuSpriteText + Direction = FillDirection.Vertical, + Spacing = new Vector2(5), + Children = new Drawable[] { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = "current progress".ToUpper(), - TextSize = 15, - Font = "Exo2.0-Black", - }, - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Direction = FillDirection.Vertical, - Children = new Drawable[] + new OsuSpriteText { - AccuracyDisplay = new PercentageInfoLine("Accuracy"), - RankDisplay = new InfoLine("Rank", @"#"), - GradeDisplay = new InfoLine("Grade"), + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + Text = "current progress".ToUpper(), + TextSize = 15, + Font = "Exo2.0-Black", }, - } + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Direction = FillDirection.Vertical, + Children = new Drawable[] + { + AccuracyDisplay = new PercentageInfoLine("Accuracy"), + RankDisplay = new InfoLine("Rank", @"#"), + GradeDisplay = new InfoLine("Grade"), + }, + } + }, }; } + + protected override void PopIn() => this.FadeIn(fade_duration); + protected override void PopOut() => this.FadeOut(fade_duration); } } diff --git a/osu.Game/Screens/Play/BreaksOverlay/LetterboxOverlay.cs b/osu.Game/Screens/Play/BreaksOverlay/LetterboxOverlay.cs index 1581c45c56..e0d3889673 100644 --- a/osu.Game/Screens/Play/BreaksOverlay/LetterboxOverlay.cs +++ b/osu.Game/Screens/Play/BreaksOverlay/LetterboxOverlay.cs @@ -1,16 +1,19 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Beatmaps.Timing; namespace osu.Game.Screens.Play.BreaksOverlay { - public class LetterboxOverlay : Container + public class LetterboxOverlay : VisibilityContainer { + private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2; private const int height = 350; private static readonly Color4 transparent_black = new Color4(0, 0, 0, 0); @@ -18,7 +21,6 @@ namespace osu.Game.Screens.Play.BreaksOverlay public LetterboxOverlay() { RelativeSizeAxes = Axes.Both; - Alpha = 0; Children = new Drawable[] { new Container @@ -59,5 +61,8 @@ namespace osu.Game.Screens.Play.BreaksOverlay } }; } + + protected override void PopIn() => this.FadeIn(fade_duration); + protected override void PopOut() => this.FadeOut(fade_duration); } } diff --git a/osu.Game/Screens/Play/BreaksOverlay/RemainingTimeCounter.cs b/osu.Game/Screens/Play/BreaksOverlay/RemainingTimeCounter.cs index c8b8b6a072..b5d77d0d02 100644 --- a/osu.Game/Screens/Play/BreaksOverlay/RemainingTimeCounter.cs +++ b/osu.Game/Screens/Play/BreaksOverlay/RemainingTimeCounter.cs @@ -5,11 +5,14 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics; using System; +using osu.Game.Beatmaps.Timing; namespace osu.Game.Screens.Play.BreaksOverlay { - public class RemainingTimeCounter : Container + public class RemainingTimeCounter : VisibilityContainer { + private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2; + private readonly OsuSpriteText counter; private int? previousSecond; @@ -21,7 +24,6 @@ namespace osu.Game.Screens.Play.BreaksOverlay public RemainingTimeCounter() { AutoSizeAxes = Axes.Both; - Alpha = 0; Child = counter = new OsuSpriteText { Anchor = Anchor.Centre, @@ -56,5 +58,8 @@ namespace osu.Game.Screens.Play.BreaksOverlay else isCounting = false; } } + + protected override void PopIn() => this.FadeIn(fade_duration); + protected override void PopOut() => this.FadeOut(fade_duration); } }