1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 10:42:54 +08:00

Only set button state once

This commit is contained in:
smoogipoo 2021-04-08 16:30:48 +09:00
parent b38d332268
commit fd2a14a0bf

View File

@ -105,14 +105,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
break; break;
} }
button.Enabled.Value = Client.Room?.State == MultiplayerRoomState.Open && !operationInProgress.Value; bool enableButton = Client.Room?.State == MultiplayerRoomState.Open && !operationInProgress.Value;
// When the local user is the host and spectating the match, the "start match" state should be enabled. // When the local user is the host and spectating the match, the "start match" state should be enabled if any users are ready.
if (localUser.State == MultiplayerUserState.Spectating) if (localUser.State == MultiplayerUserState.Spectating)
{ enableButton &= Room?.Host?.Equals(localUser) == true && newCountReady > 0;
button.Enabled.Value &= Room?.Host?.Equals(localUser) == true;
button.Enabled.Value &= newCountReady > 0; button.Enabled.Value = enableButton;
}
if (newCountReady != countReady) if (newCountReady != countReady)
{ {