Tidy up state change logic

This commit is contained in:
Dean Herbert
2018-02-06 14:30:01 +09:00
parent dd8955cd90
commit 9bfec9b233

View File

@ -155,16 +155,11 @@ namespace osu.Game.Screens.Play
public Visibility State public Visibility State
{ {
get get { return state; }
{
return state;
}
set set
{ {
if (state == value) bool stateChanged = value != state;
return;
var lastState = state;
state = value; state = value;
scheduledHide?.Cancel(); scheduledHide?.Cancel();
@ -172,7 +167,8 @@ namespace osu.Game.Screens.Play
switch (state) switch (state)
{ {
case Visibility.Visible: case Visibility.Visible:
if (lastState == Visibility.Hidden) // we may be triggered to become visible mnultiple times but we only want to transform once.
if (stateChanged)
this.FadeIn(500, Easing.OutExpo); this.FadeIn(500, Easing.OutExpo);
if (!IsHovered) if (!IsHovered)