1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-27 16:22:59 +08:00
osu-lazer/osu.Game/Screens/Play/Break/BreakArrows.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

111 lines
4.5 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
2022-06-17 15:37:17 +08:00
#nullable disable
2017-09-22 06:16:05 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Containers;
2018-11-20 15:51:59 +08:00
using osuTK;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Screens.Play.Break
2017-09-22 06:16:05 +08:00
{
public class BreakArrows : CompositeDrawable
2017-09-22 06:16:05 +08: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-23 01:43:51 +08:00
private const float glow_icon_offscreen_offset = 0.6f;
2018-04-13 17:19:50 +08:00
2017-09-23 01:43:51 +08: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;
2018-04-13 17:19:50 +08:00
2017-09-22 06:16:05 +08:00
private readonly GlowIcon leftGlowIcon;
private readonly GlowIcon rightGlowIcon;
2018-04-13 17:19:50 +08:00
2017-09-22 06:16:05 +08:00
private readonly BlurredIcon leftBlurredIcon;
private readonly BlurredIcon rightBlurredIcon;
2018-04-13 17:19:50 +08:00
public BreakArrows()
2017-09-22 06:16:05 +08:00
{
RelativeSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
2017-09-22 06:16:05 +08:00
{
new ParallaxContainer
2017-09-22 06:16:05 +08:00
{
ParallaxAmount = -0.01f,
Children = new Drawable[]
{
leftGlowIcon = new GlowIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight,
X = -glow_icon_offscreen_offset,
2019-04-02 18:55:24 +08:00
Icon = FontAwesome.Solid.ChevronRight,
BlurSigma = new Vector2(glow_icon_blur_sigma),
Size = new Vector2(glow_icon_size),
},
rightGlowIcon = new GlowIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
X = glow_icon_offscreen_offset,
2019-04-02 18:55:24 +08:00
Icon = FontAwesome.Solid.ChevronLeft,
BlurSigma = new Vector2(glow_icon_blur_sigma),
Size = new Vector2(glow_icon_size),
},
}
2017-09-22 06:16:05 +08:00
},
new ParallaxContainer
2017-09-22 06:16:05 +08:00
{
ParallaxAmount = -0.02f,
Children = new Drawable[]
{
leftBlurredIcon = new BlurredIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight,
Alpha = 0.7f,
X = -blurred_icon_offscreen_offset,
2019-04-02 18:55:24 +08:00
Icon = FontAwesome.Solid.ChevronRight,
BlurSigma = new Vector2(blurred_icon_blur_sigma),
Size = new Vector2(blurred_icon_size),
},
rightBlurredIcon = new BlurredIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
Alpha = 0.7f,
X = blurred_icon_offscreen_offset,
2019-04-02 18:55:24 +08:00
Icon = FontAwesome.Solid.ChevronLeft,
BlurSigma = new Vector2(blurred_icon_blur_sigma),
Size = new Vector2(blurred_icon_size),
},
}
}
2017-09-22 06:16:05 +08:00
};
}
2018-04-13 17:19:50 +08:00
public void Show(double duration)
2017-09-22 06:16:05 +08:00
{
leftGlowIcon.MoveToX(-glow_icon_final_offset, duration, Easing.OutQuint);
rightGlowIcon.MoveToX(glow_icon_final_offset, duration, Easing.OutQuint);
2018-04-13 17:19:50 +08:00
leftBlurredIcon.MoveToX(-blurred_icon_final_offset, duration, Easing.OutQuint);
rightBlurredIcon.MoveToX(blurred_icon_final_offset, duration, Easing.OutQuint);
2017-09-22 06:16:05 +08:00
}
2018-04-13 17:19:50 +08:00
public void Hide(double duration)
2017-09-22 06:16:05 +08:00
{
leftGlowIcon.MoveToX(-glow_icon_offscreen_offset, duration, Easing.OutQuint);
rightGlowIcon.MoveToX(glow_icon_offscreen_offset, duration, Easing.OutQuint);
2018-04-13 17:19:50 +08:00
leftBlurredIcon.MoveToX(-blurred_icon_offscreen_offset, duration, Easing.OutQuint);
rightBlurredIcon.MoveToX(blurred_icon_offscreen_offset, duration, Easing.OutQuint);
2017-09-22 06:16:05 +08:00
}
}
}