mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 01:37:46 +08:00
Refactor class layout for readability
This commit is contained in:
parent
fae5bf0f18
commit
d9d8712360
@ -17,11 +17,6 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
public class OverlayRulesetTabItem : TabItem<RulesetInfo>
|
public class OverlayRulesetTabItem : TabItem<RulesetInfo>
|
||||||
{
|
{
|
||||||
protected readonly OsuSpriteText Text;
|
|
||||||
private readonly FillFlowContainer content;
|
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
|
||||||
|
|
||||||
private Color4 accentColour;
|
private Color4 accentColour;
|
||||||
|
|
||||||
protected virtual Color4 AccentColour
|
protected virtual Color4 AccentColour
|
||||||
@ -30,13 +25,17 @@ namespace osu.Game.Overlays
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
accentColour = value;
|
accentColour = value;
|
||||||
Text.FadeColour(value, 120, Easing.OutQuint);
|
text.FadeColour(value, 120, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Container<Drawable> Content { get; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OverlayColourProvider colourProvider { get; set; }
|
private OverlayColourProvider colourProvider { get; set; }
|
||||||
|
|
||||||
|
private readonly OsuSpriteText text;
|
||||||
|
|
||||||
public OverlayRulesetTabItem(RulesetInfo value)
|
public OverlayRulesetTabItem(RulesetInfo value)
|
||||||
: base(value)
|
: base(value)
|
||||||
{
|
{
|
||||||
@ -44,12 +43,12 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
content = new FillFlowContainer
|
Content = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(3, 0),
|
Spacing = new Vector2(3, 0),
|
||||||
Child = Text = new OsuSpriteText
|
Child = text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -87,7 +86,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
{
|
{
|
||||||
Text.Font = Text.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.Medium);
|
text.Font = text.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.Medium);
|
||||||
AccentColour = IsHovered || Active.Value ? Color4.White : colourProvider.Highlight1;
|
AccentColour = IsHovered || Active.Value ? Color4.White : colourProvider.Highlight1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user