1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Avoid using update for fading logic

This commit is contained in:
Dean Herbert 2018-06-01 22:19:11 +09:00
parent ae6f603d16
commit 9b7741b353

View File

@ -223,34 +223,22 @@ namespace osu.Game.Overlays.Direct
{
Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None,
});
PreviewPlaying.ValueChanged += _ => updateStatusContainer();
}
protected override bool OnHover(InputState state)
{
statusContainer.FadeOut(120, Easing.InOutQuint);
updateStatusContainer();
return base.OnHover(state);
}
protected override void OnHoverLost(InputState state)
{
base.OnHoverLost(state);
statusContainer.FadeIn(120, Easing.InOutQuint);
updateStatusContainer();
}
protected override void Update()
{
base.Update();
if (PreviewPlaying)
{
statusContainer.Hide();
}
else if (!IsHovered)
{
statusContainer.Show();
}
}
private void updateStatusContainer() => statusContainer.FadeTo(IsHovered || PreviewPlaying ? 0 : 1, 120, Easing.InOutQuint);
}
}