mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 00:53:22 +08:00
Clean up state change logic
This commit is contained in:
parent
63d366ea4b
commit
461c8e8be0
@ -128,32 +128,25 @@ namespace osu.Game.Screens.Edit.Components
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
if (!Active)
|
||||
toBold();
|
||||
updateState();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
if (!Active)
|
||||
toNormal();
|
||||
updateState();
|
||||
}
|
||||
|
||||
private void toBold()
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
text.FadeOut(fade_duration);
|
||||
textBold.FadeIn(fade_duration);
|
||||
text.FadeTo(Active || IsHovered ? 0 : 1, fade_duration);
|
||||
textBold.FadeTo(Active || IsHovered ? 1 : 0, fade_duration);
|
||||
}
|
||||
|
||||
private void toNormal()
|
||||
{
|
||||
text.FadeIn(fade_duration);
|
||||
textBold.FadeOut(fade_duration);
|
||||
}
|
||||
protected override void OnActivated() => updateState();
|
||||
|
||||
protected override void OnActivated() => toBold();
|
||||
|
||||
protected override void OnDeactivated() => toNormal();
|
||||
protected override void OnDeactivated() => updateState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user