2018-01-05 11:21:19 +00:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-09-21 22:16:05 +00:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using OpenTK;
|
2017-09-22 18:00:45 +00:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2017-10-05 01:38:13 +00:00
|
|
|
|
using osu.Game.Beatmaps.Timing;
|
2017-09-21 22:16:05 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play.BreaksOverlay
|
|
|
|
|
{
|
2017-10-05 01:38:13 +00:00
|
|
|
|
public class ArrowsOverlay : VisibilityContainer
|
2017-09-21 22:16:05 +00:00
|
|
|
|
{
|
2017-10-05 01:38:13 +00:00
|
|
|
|
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
|
|
|
|
|
|
2017-09-22 18:12:58 +00:00
|
|
|
|
private const int glow_icon_size = 60;
|
|
|
|
|
private const int glow_icon_blur_sigma = 10;
|
|
|
|
|
private const float glow_icon_final_offset = 0.22f;
|
2017-09-22 17:43:51 +00:00
|
|
|
|
private const float glow_icon_offscreen_offset = 0.6f;
|
2017-09-21 22:16:05 +00:00
|
|
|
|
|
2017-09-22 17:43:51 +00:00
|
|
|
|
private const int blurred_icon_blur_sigma = 20;
|
|
|
|
|
private const int blurred_icon_size = 130;
|
|
|
|
|
private const float blurred_icon_final_offset = 0.35f;
|
|
|
|
|
private const float blurred_icon_offscreen_offset = 0.7f;
|
2017-09-21 22:16:05 +00:00
|
|
|
|
|
|
|
|
|
private readonly GlowIcon leftGlowIcon;
|
|
|
|
|
private readonly GlowIcon rightGlowIcon;
|
|
|
|
|
|
|
|
|
|
private readonly BlurredIcon leftBlurredIcon;
|
|
|
|
|
private readonly BlurredIcon rightBlurredIcon;
|
|
|
|
|
|
|
|
|
|
public ArrowsOverlay()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
leftGlowIcon = new GlowIcon
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
2017-09-26 22:10:48 +00:00
|
|
|
|
X = -glow_icon_offscreen_offset,
|
2017-09-21 22:16:05 +00:00
|
|
|
|
Icon = Graphics.FontAwesome.fa_chevron_right,
|
2017-09-22 17:43:51 +00:00
|
|
|
|
BlurSigma = new Vector2(glow_icon_blur_sigma),
|
|
|
|
|
Size = new Vector2(glow_icon_size),
|
2017-09-21 22:16:05 +00:00
|
|
|
|
},
|
|
|
|
|
rightGlowIcon = new GlowIcon
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
2017-09-22 17:43:51 +00:00
|
|
|
|
X = glow_icon_offscreen_offset,
|
2017-09-21 22:16:05 +00:00
|
|
|
|
Icon = Graphics.FontAwesome.fa_chevron_left,
|
2017-09-22 17:43:51 +00:00
|
|
|
|
BlurSigma = new Vector2(glow_icon_blur_sigma),
|
|
|
|
|
Size = new Vector2(glow_icon_size),
|
2017-09-21 22:16:05 +00:00
|
|
|
|
},
|
2017-09-22 18:00:45 +00:00
|
|
|
|
new ParallaxContainer
|
2017-09-21 22:16:05 +00:00
|
|
|
|
{
|
2017-09-22 18:00:45 +00:00
|
|
|
|
ParallaxAmount = -0.02f,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
leftBlurredIcon = new BlurredIcon
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
2017-09-22 18:12:58 +00:00
|
|
|
|
Alpha = 0.7f,
|
2017-09-26 22:10:48 +00:00
|
|
|
|
X = -blurred_icon_offscreen_offset,
|
2017-09-22 18:00:45 +00:00
|
|
|
|
Icon = Graphics.FontAwesome.fa_chevron_right,
|
|
|
|
|
BlurSigma = new Vector2(blurred_icon_blur_sigma),
|
|
|
|
|
Size = new Vector2(blurred_icon_size),
|
|
|
|
|
},
|
|
|
|
|
rightBlurredIcon = new BlurredIcon
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
2017-09-22 18:12:58 +00:00
|
|
|
|
Alpha = 0.7f,
|
2017-09-22 18:00:45 +00:00
|
|
|
|
X = blurred_icon_offscreen_offset,
|
|
|
|
|
Icon = Graphics.FontAwesome.fa_chevron_left,
|
|
|
|
|
BlurSigma = new Vector2(blurred_icon_blur_sigma),
|
|
|
|
|
Size = new Vector2(blurred_icon_size),
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-09-21 22:16:05 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-05 01:38:13 +00:00
|
|
|
|
protected override void PopIn()
|
2017-09-21 22:16:05 +00:00
|
|
|
|
{
|
2017-10-05 01:38:13 +00:00
|
|
|
|
leftGlowIcon.MoveToX(-glow_icon_final_offset, fade_duration, Easing.OutQuint);
|
|
|
|
|
rightGlowIcon.MoveToX(glow_icon_final_offset, fade_duration, Easing.OutQuint);
|
2017-09-21 22:16:05 +00:00
|
|
|
|
|
2017-10-05 01:38:13 +00:00
|
|
|
|
leftBlurredIcon.MoveToX(-blurred_icon_final_offset, fade_duration, Easing.OutQuint);
|
|
|
|
|
rightBlurredIcon.MoveToX(blurred_icon_final_offset, fade_duration, Easing.OutQuint);
|
2017-09-21 22:16:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-05 01:38:13 +00:00
|
|
|
|
protected override void PopOut()
|
2017-09-21 22:16:05 +00:00
|
|
|
|
{
|
2017-10-05 01:38:13 +00:00
|
|
|
|
leftGlowIcon.MoveToX(-glow_icon_offscreen_offset, fade_duration, Easing.OutQuint);
|
|
|
|
|
rightGlowIcon.MoveToX(glow_icon_offscreen_offset, fade_duration, Easing.OutQuint);
|
2017-09-21 22:16:05 +00:00
|
|
|
|
|
2017-10-05 01:38:13 +00:00
|
|
|
|
leftBlurredIcon.MoveToX(-blurred_icon_offscreen_offset, fade_duration, Easing.OutQuint);
|
|
|
|
|
rightBlurredIcon.MoveToX(blurred_icon_offscreen_offset, fade_duration, Easing.OutQuint);
|
2017-09-21 22:16:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|