2020-03-17 15:37:56 +08:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-03-17 17:04:32 +08:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
2020-03-17 15:37:56 +08:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Online.Leaderboards;
|
|
|
|
using osu.Game.Scoring;
|
|
|
|
using osuTK;
|
2020-03-17 17:04:32 +08:00
|
|
|
using osuTK.Graphics;
|
2020-03-17 15:37:56 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Ranking.Expanded.Accuracy
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The text that appears in the middle of the <see cref="AccuracyCircle"/> displaying the user's rank.
|
|
|
|
/// </summary>
|
|
|
|
public class RankText : CompositeDrawable
|
|
|
|
{
|
|
|
|
private readonly ScoreRank rank;
|
|
|
|
|
2020-03-17 17:04:32 +08:00
|
|
|
private BufferedContainer flash;
|
|
|
|
private BufferedContainer superFlash;
|
|
|
|
private GlowingSpriteText rankText;
|
2020-03-17 15:37:56 +08:00
|
|
|
|
|
|
|
public RankText(ScoreRank rank)
|
|
|
|
{
|
|
|
|
this.rank = rank;
|
|
|
|
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
|
|
|
Alpha = 0;
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2020-03-17 17:04:32 +08:00
|
|
|
InternalChildren = new Drawable[]
|
2020-03-17 15:37:56 +08:00
|
|
|
{
|
2020-03-17 17:04:32 +08:00
|
|
|
rankText = new GlowingSpriteText
|
2020-03-17 15:37:56 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
2020-03-17 17:04:32 +08:00
|
|
|
GlowColour = OsuColour.ForRank(rank),
|
2020-03-17 15:37:56 +08:00
|
|
|
Spacing = new Vector2(-15, 0),
|
|
|
|
Text = DrawableRank.GetRankName(rank),
|
|
|
|
Font = OsuFont.Numeric.With(size: 76),
|
|
|
|
UseFullGlyphHeight = false
|
|
|
|
},
|
2021-11-05 14:54:27 +08:00
|
|
|
superFlash = new BufferedContainer(cachedFrameBuffer: true)
|
2020-03-17 17:04:32 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
BlurSigma = new Vector2(85),
|
|
|
|
Size = new Vector2(600),
|
|
|
|
Blending = BlendingParameters.Additive,
|
|
|
|
Alpha = 0,
|
|
|
|
Children = new[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
Colour = Color4.White,
|
|
|
|
Size = new Vector2(150),
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-11-05 14:54:27 +08:00
|
|
|
flash = new BufferedContainer(cachedFrameBuffer: true)
|
2020-03-17 15:37:56 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
BlurSigma = new Vector2(35),
|
|
|
|
BypassAutoSizeAxes = Axes.Both,
|
2020-07-15 14:36:17 +08:00
|
|
|
Size = new Vector2(200),
|
2020-03-17 15:37:56 +08:00
|
|
|
Blending = BlendingParameters.Additive,
|
2020-03-17 17:04:32 +08:00
|
|
|
Alpha = 0,
|
2020-03-17 15:37:56 +08:00
|
|
|
Scale = new Vector2(1.8f),
|
|
|
|
Children = new[]
|
|
|
|
{
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Spacing = new Vector2(-15, 0),
|
|
|
|
Text = DrawableRank.GetRankName(rank),
|
|
|
|
Font = OsuFont.Numeric.With(size: 76),
|
|
|
|
UseFullGlyphHeight = false,
|
|
|
|
Shadow = false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Appear()
|
|
|
|
{
|
2020-03-17 17:04:32 +08:00
|
|
|
this.FadeIn();
|
|
|
|
|
|
|
|
if (rank < ScoreRank.A)
|
|
|
|
{
|
|
|
|
this
|
|
|
|
.MoveToOffset(new Vector2(0, -20))
|
|
|
|
.MoveToOffset(new Vector2(0, 20), 200, Easing.OutBounce);
|
|
|
|
|
|
|
|
if (rank <= ScoreRank.D)
|
|
|
|
{
|
|
|
|
this.Delay(700)
|
|
|
|
.RotateTo(5, 150, Easing.In)
|
|
|
|
.MoveToOffset(new Vector2(0, 3), 150, Easing.In);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.FadeInFromZero(200, Easing.OutQuint);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
flash.Colour = OsuColour.ForRank(rank);
|
2020-03-17 15:37:56 +08:00
|
|
|
|
2020-03-17 17:04:32 +08:00
|
|
|
if (rank >= ScoreRank.S)
|
|
|
|
rankText.ScaleTo(1.05f).ScaleTo(1, 3000, Easing.OutQuint);
|
|
|
|
|
|
|
|
if (rank >= ScoreRank.X)
|
|
|
|
{
|
2020-07-15 14:36:17 +08:00
|
|
|
flash.FadeOutFromOne(3000);
|
|
|
|
superFlash.FadeOutFromOne(800, Easing.OutQuint);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
flash.FadeOutFromOne(1200, Easing.OutQuint);
|
2020-03-17 17:04:32 +08:00
|
|
|
}
|
2020-03-17 15:37:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|