Use existing AccentColour logic instead of weird BoxColour

This commit is contained in:
Andrei Zavatski 2019-08-12 14:33:30 +03:00
parent ba49a4c2da
commit 9c36cb4af4
2 changed files with 23 additions and 17 deletions

View File

@ -24,7 +24,13 @@ namespace osu.Game.Graphics.UserInterface
Height = 30; Height = 30;
} }
public class PageTabItem : TabItem<T> [BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AccentColour = colours.Yellow;
}
public class PageTabItem : TabItem<T>, IHasAccentColour
{ {
private const float transition_duration = 100; private const float transition_duration = 100;
@ -32,10 +38,16 @@ namespace osu.Game.Graphics.UserInterface
protected readonly SpriteText Text; protected readonly SpriteText Text;
protected Color4 BoxColour private Color4 accentColour;
public Color4 AccentColour
{ {
get => box.Colour; get => accentColour;
set => box.Colour = value; set
{
accentColour = value;
box.Colour = accentColour;
}
} }
public PageTabItem(T value) public PageTabItem(T value)
@ -69,12 +81,6 @@ namespace osu.Game.Graphics.UserInterface
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Exo, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true); Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Exo, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
} }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BoxColour = colours.Yellow;
}
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
if (!Active.Value) if (!Active.Value)

View File

@ -39,6 +39,12 @@ namespace osu.Game.Overlays.BeatmapSet
}); });
} }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AccentColour = colours.Blue;
}
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
{ {
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
@ -57,15 +63,9 @@ namespace osu.Game.Overlays.BeatmapSet
Text.Font = OsuFont.GetFont(size: 16); Text.Font = OsuFont.GetFont(size: 16);
} }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BoxColour = colours.Blue;
}
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
Text.FadeColour(BoxColour); Text.FadeColour(AccentColour);
return base.OnHover(e); return base.OnHover(e);
} }