diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index 05c1150c86..4bcd7bb5a8 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -52,6 +52,8 @@ namespace CSNetwork private Action _createRoleCallback; private RoleInfo _selectedRole; public bool IsConnected => _networkManager?.IsConnected ?? false; + public bool IsConnectedInternet => Application.internetReachability != NetworkReachability.NotReachable; + // When true, suppress *gameplay traffic* (mostly gamedatasend C2S commands) during logout/scene transitions. // We still allow account/role flow protocols like rolelist/selectrole so "Return to Select Role" can work. private volatile bool _suppressGameplayTraffic = false; diff --git a/Assets/PerfectWorld/Scripts/UI/Login/BtnBackToSelectRole.cs b/Assets/PerfectWorld/Scripts/UI/Login/BtnBackToSelectRole.cs index 1c13540f72..5d5abc9835 100644 --- a/Assets/PerfectWorld/Scripts/UI/Login/BtnBackToSelectRole.cs +++ b/Assets/PerfectWorld/Scripts/UI/Login/BtnBackToSelectRole.cs @@ -11,17 +11,17 @@ namespace BrewMonster.UI public void OnClick() { // CECUIManager.Instance.ShowMessageBox( - // title: "Thoát", + // title: "Thoát", // message: "Đang rời khỏi Thế Giới Hoàn Mỹ", // messageBoxType: MessageBoxType.YesButton // ); - + // CECGameRun.Instance.GetPendingLogOut().AppendForSaveConfig(new CECPendingLogoutHalf()); // UnityGameSession.ReturnToSelectRole(); OnCommandRepick(); } - + // void CDlgSystem3::OnCommandRepick(const char *szCommand) // { // a_LogOutput(1, "CDlgSystem3::OnCommandRepick "); @@ -36,8 +36,8 @@ namespace BrewMonster.UI // pMsgBox->SetIsModal(false); // } // } - - + + void OnCommandRepick() { CECUIManager.Instance.ShowMessageBoxYes("Thoát", @@ -47,8 +47,13 @@ namespace BrewMonster.UI void OnClickYes() { CECGameRun.Instance.GetPendingLogOut().AppendForSaveConfig(new CECPendingLogoutHalf()); + if (!UnityGameSession.Instance.GameSession.IsConnectedInternet) + { + //force log out half + EC_Game.GetGameRun().SetLogoutFlag(1); + } } - + } }