mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:03:21 +08:00
Simplify active tab font changes and expose necessary fields in OsuTabItem
This commit is contained in:
parent
05de65937b
commit
e33055e2c4
@ -113,13 +113,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private const float transition_length = 500;
|
private const float transition_length = 500;
|
||||||
|
|
||||||
private void fadeActive()
|
protected void FadeHovered()
|
||||||
{
|
{
|
||||||
Bar.FadeIn(transition_length, Easing.OutQuint);
|
Bar.FadeIn(transition_length, Easing.OutQuint);
|
||||||
Text.FadeColour(Color4.White, transition_length, Easing.OutQuint);
|
Text.FadeColour(Color4.White, transition_length, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fadeInactive()
|
protected void FadeUnhovered()
|
||||||
{
|
{
|
||||||
Bar.FadeOut(transition_length, Easing.OutQuint);
|
Bar.FadeOut(transition_length, Easing.OutQuint);
|
||||||
Text.FadeColour(AccentColour, transition_length, Easing.OutQuint);
|
Text.FadeColour(AccentColour, transition_length, Easing.OutQuint);
|
||||||
@ -128,14 +128,14 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
if (!Active.Value)
|
if (!Active.Value)
|
||||||
fadeActive();
|
FadeHovered();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
if (!Active.Value)
|
if (!Active.Value)
|
||||||
fadeInactive();
|
FadeUnhovered();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -172,13 +172,19 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
},
|
},
|
||||||
new HoverClickSounds()
|
new HoverClickSounds()
|
||||||
};
|
};
|
||||||
|
|
||||||
Active.BindValueChanged(active => Text.Font = Text.Font.With(Typeface.Torus, weight: active.NewValue ? FontWeight.Bold : FontWeight.Medium), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnActivated() => fadeActive();
|
protected override void OnActivated()
|
||||||
|
{
|
||||||
|
Text.Font = Text.Font.With(weight: FontWeight.Bold);
|
||||||
|
FadeHovered();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnDeactivated() => fadeInactive();
|
protected override void OnDeactivated()
|
||||||
|
{
|
||||||
|
Text.Font = Text.Font.With(weight: FontWeight.Medium);
|
||||||
|
FadeUnhovered();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user