1
This commit is contained in:
@@ -585,9 +585,11 @@ public class GameManager : MonoSingleton<GameManager>
|
||||
IEnumerator yanchi(LoadingPanel loadingPanel)
|
||||
{
|
||||
yield return new WaitForSeconds(5);
|
||||
btn_Skip.gameObject.SetActive(true);
|
||||
if (btn_Skip != null) btn_Skip.gameObject.SetActive(true);
|
||||
yield return new WaitForSeconds(23f);
|
||||
loadingPanel.LoadBar(100);
|
||||
// ⭐ 防御:loadingPanel 可能已被 UIManager.CloseAll 销毁(如 Logout 时)
|
||||
if (loadingPanel != null)
|
||||
loadingPanel.LoadBar(100);
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
@@ -646,12 +648,16 @@ public class GameManager : MonoSingleton<GameManager>
|
||||
|
||||
public void Logout(Action onDone = null)
|
||||
{
|
||||
// 关闭所有 WebSocket 连接
|
||||
// ⭐ 标记登出中:阻止 WebSocket 关闭后触发自动重连(避免访问已 null 的 user)
|
||||
WebSocketManager.Instance.isLoggingOut = true;
|
||||
// 关闭所有 WebSocket 连接(内部会先 StopAllReconnects 停止所有重连协程)
|
||||
WebSocketManager.Instance.CloseAll();
|
||||
// 清空用户数据
|
||||
user = null;
|
||||
// 关闭所有 UI
|
||||
UIManager.Instance.CloseAll();
|
||||
// ⭐ 登出流程完成,立即恢复重连开关(不依赖 ShowAsync 回调,避免 UI 异常导致永不重置)
|
||||
WebSocketManager.Instance.isLoggingOut = false;
|
||||
// 切换到登录界面
|
||||
UIManager.Instance.ShowAsync(UIPanel.LoginPanel, null, (panel) =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user