Use OverlayColourProvider for CounterPill in profile overlay

This commit is contained in:
Andrei Zavatski 2020-02-17 04:29:41 +03:00
parent e80c310ab2
commit 480e5677ed
2 changed files with 13 additions and 5 deletions

View File

@ -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 @@ public class TestSceneProfileCounterPill : OsuTestScene
typeof(CounterPill)
};
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Red);
private readonly CounterPill pill;
private readonly BindableInt value = new BindableInt();

View File

@ -7,6 +7,7 @@
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 @@ public class CounterPill : CircularContainer
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 @@ public CounterPill()
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 @@ private void onCurrentChanged(ValueChangedEvent<int> value)
return;
}
counter.Text = value.NewValue.ToString();
counter.Text = value.NewValue.ToString("N0");
this.FadeIn(duration, Easing.OutQuint);
}
}