1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 13:32:54 +08:00

Update overlay ruleset selector design

This commit is contained in:
Salman Ahmed 2022-04-29 12:19:22 +03:00
parent 43ff4635a2
commit 3829d27845

View File

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