mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 19:22:54 +08:00
Correctly implement button enabled state
This commit is contained in:
parent
f3530a79b1
commit
c2644a5d5e
@ -401,6 +401,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
ClickButtonWhenEnabled<MultiplayerReadyButton>();
|
ClickButtonWhenEnabled<MultiplayerReadyButton>();
|
||||||
ClickButtonWhenEnabled<MultiplayerReadyButton>();
|
ClickButtonWhenEnabled<MultiplayerReadyButton>();
|
||||||
ClickButtonWhenEnabled<MultiplayerReadyButton>();
|
ClickButtonWhenEnabled<MultiplayerReadyButton>();
|
||||||
|
AddStep("check abort request received", () => multiplayerClient.Verify(m => m.AbortMatch(), Times.Once));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyGameplayStartFlow()
|
private void verifyGameplayStartFlow()
|
||||||
|
@ -130,7 +130,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
dialogOverlay.Push(new ConfirmAbortDialog(abortMatch, endOperation));
|
dialogOverlay.Push(new ConfirmAbortDialog(abortMatch, endOperation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (Room.State != MultiplayerRoomState.Closed)
|
||||||
toggleReady();
|
toggleReady();
|
||||||
|
|
||||||
bool isReady() => Client.LocalUser?.State == MultiplayerUserState.Ready || Client.LocalUser?.State == MultiplayerUserState.Spectating;
|
bool isReady() => Client.LocalUser?.State == MultiplayerUserState.Ready || Client.LocalUser?.State == MultiplayerUserState.Spectating;
|
||||||
@ -210,7 +210,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
}
|
}
|
||||||
|
|
||||||
readyButton.Enabled.Value = countdownButton.Enabled.Value =
|
readyButton.Enabled.Value = countdownButton.Enabled.Value =
|
||||||
Room.State == MultiplayerRoomState.Open
|
Room.State != MultiplayerRoomState.Closed
|
||||||
&& CurrentPlaylistItem.Value?.ID == Room.Settings.PlaylistItemId
|
&& CurrentPlaylistItem.Value?.ID == Room.Settings.PlaylistItemId
|
||||||
&& !Room.Playlist.Single(i => i.ID == Room.Settings.PlaylistItemId).Expired
|
&& !Room.Playlist.Single(i => i.ID == Room.Settings.PlaylistItemId).Expired
|
||||||
&& !operationInProgress.Value;
|
&& !operationInProgress.Value;
|
||||||
@ -219,7 +219,9 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
|||||||
if (localUser?.State == MultiplayerUserState.Spectating)
|
if (localUser?.State == MultiplayerUserState.Spectating)
|
||||||
readyButton.Enabled.Value &= Client.IsHost && newCountReady > 0 && !Room.ActiveCountdowns.Any(c => c is MatchStartCountdown);
|
readyButton.Enabled.Value &= Client.IsHost && newCountReady > 0 && !Room.ActiveCountdowns.Any(c => c is MatchStartCountdown);
|
||||||
|
|
||||||
readyButton.Enabled.Value = true;
|
// When the local user is not the host, the button should only be enabled when no match is in progress.
|
||||||
|
if (!Client.IsHost)
|
||||||
|
readyButton.Enabled.Value &= Room.State == MultiplayerRoomState.Open;
|
||||||
|
|
||||||
if (newCountReady == countReady)
|
if (newCountReady == countReady)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user