From 1b0fc8ca9d8740d9c61aa20dcbace2f72357cd96 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 1 Dec 2023 19:02:27 +0900 Subject: [PATCH] Refactor --- .../Multiplayer/Match/ConfirmAbortDialog.cs | 2 +- .../Match/MultiplayerReadyButton.cs | 24 ++++++------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/ConfirmAbortDialog.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/ConfirmAbortDialog.cs index 8aca96a918..06f2b2c8f6 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/ConfirmAbortDialog.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/ConfirmAbortDialog.cs @@ -11,7 +11,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match { public ConfirmAbortDialog(Action onConfirm, Action onCancel) { - HeaderText = "Are you sure you want to go abort the match?"; + HeaderText = "Are you sure you want to abort the match?"; Icon = FontAwesome.Solid.ExclamationTriangle; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs index 8a9d027469..368e5210de 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs @@ -155,19 +155,14 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match case MultiplayerUserState.Spectating: case MultiplayerUserState.Ready: - Text = room.Host?.Equals(localUser) == true + Text = multiplayerClient.IsHost ? $"Start match {countText}" : $"Waiting for host... {countText}"; break; - case MultiplayerUserState.Idle: - if (room.State == MultiplayerRoomState.Open || room.Host?.Equals(localUser) != true) - { - Text = "Ready"; - break; - } - - Text = "Abort!"; + // Show the abort button for the host as long as gameplay is in progress. + case MultiplayerUserState when multiplayerClient.IsHost && room.State != MultiplayerRoomState.Open: + Text = "Abort the match"; break; } } @@ -207,20 +202,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match case MultiplayerUserState.Spectating: case MultiplayerUserState.Ready: - if (room?.Host?.Equals(localUser) == true && !room.ActiveCountdowns.Any(c => c is MatchStartCountdown)) + if (multiplayerClient.IsHost && !room.ActiveCountdowns.Any(c => c is MatchStartCountdown)) setGreen(); else setYellow(); break; - case MultiplayerUserState.Idle: - if (room.State == MultiplayerRoomState.Open || room.Host?.Equals(localUser) != true) - { - setGreen(); - break; - } - + // Show the abort button for the host as long as gameplay is in progress. + case MultiplayerUserState when multiplayerClient.IsHost && room.State != MultiplayerRoomState.Open: setRed(); break; }