1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-30 12:42:56 +08:00
osu-lazer/osu.Game/Screens/Ranking/Expanded/Statistics/ComboStatistic.cs

73 lines
2.5 KiB
C#
Raw Normal View History

2020-03-17 16:25:24 +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.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
2020-03-17 16:25:24 +08:00
using osu.Game.Screens.Ranking.Expanded.Accuracy;
using osuTK;
namespace osu.Game.Screens.Ranking.Expanded.Statistics
{
2020-03-17 16:34:16 +08:00
/// <summary>
/// A <see cref="StatisticDisplay"/> to display the player's combo.
/// </summary>
2022-11-24 13:32:20 +08:00
public partial class ComboStatistic : CounterStatistic
2020-03-17 16:25:24 +08:00
{
private readonly bool isPerfect;
private Drawable perfectText = null!;
2020-03-17 16:25:24 +08:00
2020-03-17 16:34:16 +08:00
/// <summary>
/// Creates a new <see cref="ComboStatistic"/>.
/// </summary>
/// <param name="combo">The combo to be displayed.</param>
/// <param name="maxCombo">The maximum value of <paramref name="combo"/>.</param>
public ComboStatistic(int combo, int? maxCombo)
: base(BeatmapsetsStrings.ShowScoreboardHeadersCombo, combo, maxCombo)
2020-03-17 16:25:24 +08:00
{
isPerfect = combo == maxCombo;
2020-03-17 16:25:24 +08:00
}
public override void Appear()
{
base.Appear();
if (isPerfect)
{
2021-07-05 23:52:39 +08:00
using (BeginDelayedSequence(AccuracyCircle.ACCURACY_TRANSFORM_DURATION / 2))
2020-03-17 16:25:24 +08:00
perfectText.FadeIn(50);
}
}
2020-03-17 16:34:16 +08:00
protected override Drawable CreateContent() => new FillFlowContainer
2020-03-17 16:25:24 +08:00
{
2020-03-17 16:34:16 +08:00
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Children = new[]
2020-03-17 16:25:24 +08:00
{
2022-06-24 20:25:23 +08:00
base.CreateContent().With(_ =>
2020-03-17 16:25:24 +08:00
{
2020-03-17 16:34:16 +08:00
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
}),
perfectText = new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = "PERFECT",
Font = OsuFont.Torus.With(size: 11, weight: FontWeight.SemiBold),
Colour = ColourInfo.GradientVertical(Color4Extensions.FromHex("#66FFCC"), Color4Extensions.FromHex("#FF9AD7")),
Alpha = 0,
UseFullGlyphHeight = false,
2020-03-17 16:25:24 +08:00
}
2020-03-17 16:34:16 +08:00
}
};
2020-03-17 16:25:24 +08:00
}
}