2024-03-05 08:01:01 +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.
|
|
|
|
|
|
|
|
#nullable disable
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Framework.Localisation;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Resources.Localisation.Web;
|
2024-03-05 09:34:41 +08:00
|
|
|
using osu.Game.Screens.Play.HUD;
|
2024-03-05 08:01:01 +08:00
|
|
|
using osuTK;
|
|
|
|
|
2024-03-05 09:34:41 +08:00
|
|
|
namespace osu.Game.Skinning.Triangles
|
2024-03-05 08:01:01 +08:00
|
|
|
{
|
2024-03-05 09:34:41 +08:00
|
|
|
public partial class TrianglesPerformancePointsCounter : PerformancePointsCounter
|
2024-03-05 08:01:01 +08:00
|
|
|
{
|
|
|
|
protected override bool IsRollingProportional => true;
|
|
|
|
|
|
|
|
protected override double RollingDuration => 500;
|
|
|
|
|
|
|
|
private const float alpha_when_invalid = 0.3f;
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
{
|
|
|
|
Colour = colours.BlueLighter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override bool IsValid
|
|
|
|
{
|
|
|
|
get => base.IsValid;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (value == IsValid)
|
|
|
|
return;
|
|
|
|
|
|
|
|
base.IsValid = value;
|
|
|
|
DrawableCount.FadeTo(value ? 1 : alpha_when_invalid, 1000, Easing.OutQuint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override LocalisableString FormatCount(int count) => count.ToString(@"D");
|
|
|
|
|
|
|
|
protected override IHasText CreateText() => new TextComponent
|
|
|
|
{
|
|
|
|
Alpha = alpha_when_invalid
|
|
|
|
};
|
|
|
|
|
|
|
|
private partial class TextComponent : CompositeDrawable, IHasText
|
|
|
|
{
|
|
|
|
public LocalisableString Text
|
|
|
|
{
|
|
|
|
get => text.Text;
|
|
|
|
set => text.Text = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
private readonly OsuSpriteText text;
|
|
|
|
|
|
|
|
public TextComponent()
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
InternalChild = new FillFlowContainer
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Spacing = new Vector2(2),
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
text = new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
Font = OsuFont.Numeric.With(size: 16, fixedWidth: true)
|
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
Text = BeatmapsetsStrings.ShowScoreboardHeaderspp,
|
|
|
|
Font = OsuFont.Numeric.With(size: 8),
|
|
|
|
Padding = new MarginPadding { Bottom = 1.5f }, // align baseline better
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|