From 4d6fa4035f33151eb82646c8c0098c566ed3b1c1 Mon Sep 17 00:00:00 2001 From: Hazim Bin Ijaz Date: Tue, 11 Mar 2025 17:37:34 +0500 Subject: [PATCH] Added a new message in error messages --- Assets/Scripts/ConnectionManagement/ConnectionManager.cs | 3 ++- .../ConnectionManagement/ConnectionState/HostingState.cs | 2 +- .../ConnectionState/ServerListeningState.cs | 2 +- Assets/Scripts/Gameplay/UI/ConnectionStatusMessageUIManager.cs | 3 +++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/ConnectionManagement/ConnectionManager.cs b/Assets/Scripts/ConnectionManagement/ConnectionManager.cs index 420034fe..745bcc17 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionManager.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionManager.cs @@ -22,7 +22,8 @@ namespace Unity.BossRoom.ConnectionManagement IncompatibleBuildType, //client build type is incompatible with server. HostEndedSession, //host intentionally ended the session. StartHostFailed, // server failed to bind - StartClientFailed // failed to connect to server and/or invalid network endpoint + StartClientFailed, // failed to connect to server and/or invalid network endpoint + GameInProgress //failed to connect because a game is already in progress } diff --git a/Assets/Scripts/ConnectionManagement/ConnectionState/HostingState.cs b/Assets/Scripts/ConnectionManagement/ConnectionState/HostingState.cs index 095ff4df..41b64a15 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionState/HostingState.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionState/HostingState.cs @@ -124,7 +124,7 @@ namespace Unity.BossRoom.ConnectionManagement { Debug.Log($"Connection denied for client {clientId}: Game is already in progress."); response.Approved = false; - response.Reason = JsonUtility.ToJson(ConnectStatus.ServerFull); + response.Reason = JsonUtility.ToJson(ConnectStatus.GameInProgress); return; } diff --git a/Assets/Scripts/ConnectionManagement/ConnectionState/ServerListeningState.cs b/Assets/Scripts/ConnectionManagement/ConnectionState/ServerListeningState.cs index 2922f118..5e6616e4 100644 --- a/Assets/Scripts/ConnectionManagement/ConnectionState/ServerListeningState.cs +++ b/Assets/Scripts/ConnectionManagement/ConnectionState/ServerListeningState.cs @@ -88,7 +88,7 @@ namespace Unity.BossRoom.ConnectionManagement { Debug.Log($"Connection denied for client {clientId}: Game is already in progress."); response.Approved = false; - response.Reason = JsonUtility.ToJson(ConnectStatus.ServerFull); + response.Reason = JsonUtility.ToJson(ConnectStatus.GameInProgress); return; } diff --git a/Assets/Scripts/Gameplay/UI/ConnectionStatusMessageUIManager.cs b/Assets/Scripts/Gameplay/UI/ConnectionStatusMessageUIManager.cs index bb258921..f79bceeb 100644 --- a/Assets/Scripts/Gameplay/UI/ConnectionStatusMessageUIManager.cs +++ b/Assets/Scripts/Gameplay/UI/ConnectionStatusMessageUIManager.cs @@ -68,6 +68,9 @@ namespace Unity.BossRoom.Gameplay.UI case ConnectStatus.StartClientFailed: PopupManager.ShowPopupPanel("Connection Failed", "Starting client failed."); break; + case ConnectStatus.GameInProgress: + PopupManager.ShowPopupPanel("Connection Failed", "A Game is already in progress. Please try again when it has ended"); + break; default: Debug.LogWarning($"New ConnectStatus {status} has been added, but no connect message defined for it."); break;