From 480e5677edaa8cb93201042b8a1158bb3f4e9d51 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Mon, 17 Feb 2020 04:29:41 +0300 Subject: [PATCH] Use OverlayColourProvider for CounterPill in profile overlay --- .../Visual/Online/TestSceneProfileCounterPill.cs | 5 +++++ osu.Game/Overlays/Profile/Sections/CounterPill.cs | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneProfileCounterPill.cs b/osu.Game.Tests/Visual/Online/TestSceneProfileCounterPill.cs index 468239cf08..5e2b125521 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneProfileCounterPill.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneProfileCounterPill.cs @@ -4,8 +4,10 @@ using System; using System.Collections.Generic; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Game.Overlays; using osu.Game.Overlays.Profile.Sections; namespace osu.Game.Tests.Visual.Online @@ -17,6 +19,9 @@ namespace osu.Game.Tests.Visual.Online typeof(CounterPill) }; + [Cached] + private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Red); + private readonly CounterPill pill; private readonly BindableInt value = new BindableInt(); diff --git a/osu.Game/Overlays/Profile/Sections/CounterPill.cs b/osu.Game/Overlays/Profile/Sections/CounterPill.cs index bd760c4139..52adefa4ad 100644 --- a/osu.Game/Overlays/Profile/Sections/CounterPill.cs +++ b/osu.Game/Overlays/Profile/Sections/CounterPill.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Framework.Bindables; using osu.Game.Graphics.Sprites; +using osu.Framework.Allocation; namespace osu.Game.Overlays.Profile.Sections { @@ -16,9 +17,10 @@ namespace osu.Game.Overlays.Profile.Sections public readonly BindableInt Current = new BindableInt(); - private readonly OsuSpriteText counter; + private OsuSpriteText counter; - public CounterPill() + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) { AutoSizeAxes = Axes.Both; Alpha = 0; @@ -28,14 +30,15 @@ namespace osu.Game.Overlays.Profile.Sections new Box { RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(0.05f) + Colour = colourProvider.Background6 }, counter = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, - Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold) + Font = OsuFont.GetFont(weight: FontWeight.Bold), + Colour = colourProvider.Foreground1 } }; } @@ -54,7 +57,7 @@ namespace osu.Game.Overlays.Profile.Sections return; } - counter.Text = value.NewValue.ToString(); + counter.Text = value.NewValue.ToString("N0"); this.FadeIn(duration, Easing.OutQuint); } }