1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

Merge pull request #7866 from EVAST9919/profile-counter-pill-recolour

Use OverlayColourProvider for CounterPill in profile overlay
This commit is contained in:
Dean Herbert 2020-02-17 13:39:44 +09:00 committed by GitHub
commit 6fd5667ff4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -4,8 +4,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Profile.Sections; using osu.Game.Overlays.Profile.Sections;
namespace osu.Game.Tests.Visual.Online namespace osu.Game.Tests.Visual.Online
@ -17,6 +19,9 @@ namespace osu.Game.Tests.Visual.Online
typeof(CounterPill) typeof(CounterPill)
}; };
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Red);
private readonly CounterPill pill; private readonly CounterPill pill;
private readonly BindableInt value = new BindableInt(); private readonly BindableInt value = new BindableInt();

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Framework.Allocation;
namespace osu.Game.Overlays.Profile.Sections namespace osu.Game.Overlays.Profile.Sections
{ {
@ -16,9 +17,10 @@ namespace osu.Game.Overlays.Profile.Sections
public readonly BindableInt Current = new BindableInt(); public readonly BindableInt Current = new BindableInt();
private readonly OsuSpriteText counter; private OsuSpriteText counter;
public CounterPill() [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Alpha = 0; Alpha = 0;
@ -28,14 +30,15 @@ namespace osu.Game.Overlays.Profile.Sections
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.05f) Colour = colourProvider.Background6
}, },
counter = new OsuSpriteText counter = new OsuSpriteText
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, 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; return;
} }
counter.Text = value.NewValue.ToString(); counter.Text = value.NewValue.ToString("N0");
this.FadeIn(duration, Easing.OutQuint); this.FadeIn(duration, Easing.OutQuint);
} }
} }