Update overlay ruleset selector design

This commit is contained in:
Salman Ahmed 2022-04-29 12:19:22 +03:00
parent 43ff4635a2
commit 3829d27845
1 changed files with 9 additions and 13 deletions

View File

@ -5,14 +5,12 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osuTK.Graphics;
using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays
{
@ -26,7 +24,7 @@ protected virtual Color4 AccentColour
set
{
accentColour = value;
text.FadeColour(value, 120, Easing.OutQuint);
icon.FadeColour(value, 120, Easing.OutQuint);
}
}
@ -35,7 +33,7 @@ protected virtual Color4 AccentColour
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
private readonly OsuSpriteText text;
private readonly Drawable icon;
public OverlayRulesetTabItem(RulesetInfo value)
: base(value)
@ -48,15 +46,14 @@ public OverlayRulesetTabItem(RulesetInfo value)
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(3, 0),
Child = text = new OsuSpriteText
Spacing = new Vector2(5f, 0),
Child = icon = new ConstrainedIconContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Text = value.Name,
Font = OsuFont.GetFont(size: 14),
ShadowColour = Color4.Black.Opacity(0.75f)
}
Origin = Anchor.Centre,
Size = new Vector2(20f),
Icon = value.CreateInstance().CreateIcon(),
},
},
new HoverClickSounds()
});
@ -91,7 +88,6 @@ protected override void OnHoverLost(HoverLostEvent e)
private void updateState()
{
text.Font = text.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.Medium);
AccentColour = Enabled.Value ? getActiveColour() : colourProvider.Foreground1;
}