2021-09-30 16:00:15 +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 ;
2021-09-30 16:54:56 +08:00
using osu.Framework.Graphics.Containers ;
using osu.Framework.Graphics.Sprites ;
2021-09-30 16:00:15 +08:00
using osu.Framework.Localisation ;
using osu.Game.Graphics ;
using osu.Game.Graphics.Sprites ;
2022-01-28 12:53:48 +08:00
using osu.Game.Resources.Localisation.Web ;
2021-09-30 16:00:15 +08:00
using osu.Game.Skinning ;
2021-09-30 16:54:56 +08:00
using osuTK ;
2021-09-30 16:00:15 +08:00
namespace osu.Game.Screens.Play.HUD
{
2023-10-26 13:59:47 +08:00
// todo: this should be renamed to DefaultPerformancePointsCounter, or probably even TrianglesPerformancePointsCounter once all other triangles components are renamed accordingly.
public partial class PerformancePointsCounter : GameplayPerformancePointsCounter , ISerialisableDrawable
2021-09-30 16:00:15 +08:00
{
public bool UsesFixedAnchor { get ; set ; }
[BackgroundDependencyLoader]
2023-10-26 13:59:47 +08:00
private void load ( OsuColour colours )
2021-09-30 16:00:15 +08:00
{
Colour = colours . BlueLighter ;
}
2023-10-26 13:59:47 +08:00
protected override IHasText CreateText ( ) = > new TextComponent ( ) ;
2021-09-30 16:00:15 +08:00
2021-09-30 16:54:52 +08:00
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 ,
2021-11-12 12:18:46 +08:00
Font = OsuFont . Numeric . With ( size : 16 , fixedWidth : true )
2021-09-30 16:54:52 +08:00
} ,
new OsuSpriteText
{
Anchor = Anchor . BottomLeft ,
Origin = Anchor . BottomLeft ,
2022-01-28 12:53:48 +08:00
Text = BeatmapsetsStrings . ShowScoreboardHeaderspp ,
2021-10-05 14:23:34 +08:00
Font = OsuFont . Numeric . With ( size : 8 ) ,
Padding = new MarginPadding { Bottom = 1.5f } , // align baseline better
2021-09-30 16:54:52 +08:00
}
}
} ;
}
}
2021-09-30 16:00:15 +08:00
}
}