Make all the overlays IStateful

This commit is contained in:
EVAST9919 2017-10-05 04:38:13 +03:00
parent 80fb14e3dc
commit 22a59d753b
5 changed files with 69 additions and 47 deletions

View File

@ -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);
}
}
}

View File

@ -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)

View File

@ -1,16 +1,20 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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<int> RankDisplay;
public InfoLine<ScoreRank> 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<int>("Rank", @"#"),
GradeDisplay = new InfoLine<ScoreRank>("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<int>("Rank", @"#"),
GradeDisplay = new InfoLine<ScoreRank>("Grade"),
},
}
},
};
}
protected override void PopIn() => this.FadeIn(fade_duration);
protected override void PopOut() => this.FadeOut(fade_duration);
}
}

View File

@ -1,16 +1,19 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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);
}
}

View File

@ -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);
}
}