From 56eeb117ce2011ad4b80cf32c3b015eb482d7c9b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Thu, 26 Oct 2023 09:00:16 +0300 Subject: [PATCH] Add "Argon" performance points counter --- .../TestScenePerformancePointsCounter.cs | 5 +- .../Play/ArgonPerformancePointsCounter.cs | 62 +++++++++++++++++++ 2 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Screens/Play/ArgonPerformancePointsCounter.cs diff --git a/osu.Game.Tests/Visual/Gameplay/TestScenePerformancePointsCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestScenePerformancePointsCounter.cs index 9622caabf5..9b8346cf12 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestScenePerformancePointsCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestScenePerformancePointsCounter.cs @@ -16,7 +16,6 @@ using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; -using osu.Game.Screens.Play.HUD; using osuTK; namespace osu.Game.Tests.Visual.Gameplay @@ -30,7 +29,7 @@ namespace osu.Game.Tests.Visual.Gameplay private int iteration; private Bindable lastJudgementResult = new Bindable(); - private PerformancePointsCounter counter; + private ArgonPerformancePointsCounter counter; [SetUpSteps] public void SetUpSteps() => AddStep("create components", () => @@ -66,7 +65,7 @@ namespace osu.Game.Tests.Visual.Gameplay private void createCounter() => AddStep("Create counter", () => { - dependencyContainer.Child = counter = new PerformancePointsCounter + dependencyContainer.Child = counter = new ArgonPerformancePointsCounter { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Play/ArgonPerformancePointsCounter.cs b/osu.Game/Screens/Play/ArgonPerformancePointsCounter.cs new file mode 100644 index 0000000000..f0e0e1f0a4 --- /dev/null +++ b/osu.Game/Screens/Play/ArgonPerformancePointsCounter.cs @@ -0,0 +1,62 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Extensions.LocalisationExtensions; +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; +using osu.Game.Screens.Play.HUD; +using osu.Game.Skinning; + +namespace osu.Game.Screens.Play +{ + public partial class ArgonPerformancePointsCounter : GameplayPerformancePointsCounter, ISerialisableDrawable + { + public bool UsesFixedAnchor { get; set; } + + [BackgroundDependencyLoader] + private void load() + { + } + + protected override IHasText CreateText() => new TextComponent(); + + private partial class TextComponent : CompositeDrawable, IHasText + { + private readonly OsuSpriteText text; + + public LocalisableString Text + { + get => text.Text; + set => text.Text = value; + } + + public TextComponent() + { + AutoSizeAxes = Axes.Both; + + InternalChild = new FillFlowContainer + { + Direction = FillDirection.Vertical, + Children = new[] + { + new OsuSpriteText + { + Text = BeatmapsetsStrings.ShowScoreboardHeaderspp.ToUpper(), + Font = OsuFont.Torus.With(size: 12, weight: FontWeight.Bold), + }, + text = new OsuSpriteText + { + Font = OsuFont.Torus.With(size: 16.8f, weight: FontWeight.Regular), + } + } + }; + } + } + } +}