Merge branch 'develop' of https://git.pthub.vn/Unity/perfect-world-unity into develop
This commit is contained in:
@@ -13,6 +13,7 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BrewMonster.Managers;
|
||||
using BrewMonster.Scripts.Task;
|
||||
using BrewMonster.UI;
|
||||
using UnityEngine;
|
||||
@@ -107,7 +108,7 @@ namespace BrewMonster.Network
|
||||
public static void LogoutAccount()
|
||||
{
|
||||
if (Instance == null) return;
|
||||
_ = Instance.LogoutAndReturnAsync(outType: 0, entryTarget: LogoutFlowState.LoginEntryTarget.LoginUI, clearSavedCreds: true);
|
||||
_ = Instance.LogoutAndReturnAsync(outType: 0, entryTarget: LogoutFlowState.LoginEntryTarget.LoginUI, clearSavedCreds: false);
|
||||
}
|
||||
public static void c2s_CmdCastSkill(int idSkill, byte byPVPMask, int iNumTarget, int[] aTargets)
|
||||
{
|
||||
@@ -182,6 +183,8 @@ namespace BrewMonster.Network
|
||||
{
|
||||
// Tell LoginScene what to show next.
|
||||
LogoutFlowState.NextLoginEntry = entryTarget;
|
||||
_gameSession.Disconnected -= OnUnexpectedDisconnect;
|
||||
EC_ManMessageMono.Instance.CECNPCMan.Release();
|
||||
|
||||
if (clearSavedCreds)
|
||||
{
|
||||
@@ -197,11 +200,12 @@ namespace BrewMonster.Network
|
||||
// Mark this as an intentional disconnect to prevent showing error message
|
||||
_isIntentionalDisconnect = true;
|
||||
|
||||
// We call after receive LOGOUT(0) or LOGOUT(1) from server, but the server may choose to disconnect immediately or not.
|
||||
// Send LOGOUT(outType) like the original client.
|
||||
_gameSession.SendPlayerLogout(outType);
|
||||
// _gameSession.SendPlayerLogout(outType);
|
||||
|
||||
// Wait briefly for server-driven disconnect.
|
||||
await WaitForDisconnectAsync(timeoutMs: 4000);
|
||||
if(outType == 0) await WaitForDisconnectAsync(timeoutMs: 100);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -211,10 +215,11 @@ namespace BrewMonster.Network
|
||||
finally
|
||||
{
|
||||
// Fallback: if server didn't close, close locally.
|
||||
if (_gameSession != null && _gameSession.IsConnected)
|
||||
if (_gameSession != null && _gameSession.IsConnected && outType == 0)
|
||||
{
|
||||
_gameSession.Disconnect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Return to LoginScene.
|
||||
@@ -245,7 +250,8 @@ namespace BrewMonster.Network
|
||||
if (ui == null) continue;
|
||||
if (!ui.gameObject.scene.IsValid() || ui.gameObject.scene.name != LoginSceneName) continue;
|
||||
// Avoid hard dependency on method existence (merges may edit LoginScreenUI).
|
||||
ui.SendMessage("ApplyLoginEntry", entryTarget, SendMessageOptions.DontRequireReceiver);
|
||||
// ui.SendMessage("ApplyLoginEntry", entryTarget, SendMessageOptions.DontRequireReceiver);
|
||||
ui.ApplyLoginEntry( entryTarget );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -293,6 +299,12 @@ namespace BrewMonster.Network
|
||||
{
|
||||
// get current active scene
|
||||
var currentScene = SceneManager.GetActiveScene();
|
||||
if ( currentScene.IsValid() && currentScene.name == LoginSceneName)
|
||||
{
|
||||
// LoginScene is already active, nothing to do.
|
||||
return;
|
||||
}
|
||||
|
||||
// Load LoginScene additively if needed (do not unload keepSceneName, e.g., a61).
|
||||
var loginScene = SceneManager.GetSceneByName(LoginSceneName);
|
||||
if (!loginScene.IsValid() || !loginScene.isLoaded)
|
||||
|
||||
Reference in New Issue
Block a user