【断线重连】重连功能提交

main
chenyuqi 2023-11-27 15:27:20 +08:00
parent ef0cd275a7
commit 16b672faa3
8 changed files with 63 additions and 9 deletions

View File

@ -15,7 +15,7 @@ MonoBehaviour:
m_DefaultGroup: 87cc8f526ab764b2ba576426816abb98
m_currentHash:
serializedVersion: 2
Hash: d9a625b3c6da76dbd144db85158b37c7
Hash: 55029d667caea4e25a46c8996d746932
m_OptimizeCatalogSize: 0
m_BuildRemoteCatalog: 1
m_BundleLocalCatalog: 0

View File

@ -40,6 +40,10 @@ namespace Framework
{
try
{
if (_tables != null)
{
return;
}
// 先预加载
Tables.PostPreload(_PostPreload);
await AssetManager.Instance.WaitAllPreloads();
@ -55,6 +59,11 @@ namespace Framework
}
}
public void UnLoad()
{
}
private void _UnlockJson(string fileName)
{
var fullPath = _CombiePath(fileName);

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0ca7ef808063421ab3354204c0911f15
timeCreated: 1701066842

View File

@ -0,0 +1,25 @@
using Gameplay;
public class GameReconnect
{
public static void BackToStart()
{
GameStateManager.Instance.ChangeState(new GameStateStart());
}
public static void TryReconnect()
{
_OpenReconnectingUI();
}
private static void _OpenReconnectingUI()
{
UINetManager.Instance.ShowReconnect();
}
private static void _CloseReconnectingUI()
{
UINetManager.Instance.HideReconnect();
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 83677ac95ce24d11a10e0e118e3aab19
timeCreated: 1701066852

View File

@ -31,9 +31,7 @@ namespace Gameplay
await LoadConfig();
_destProgress = 100f;
await _PreloadOthers();
PerformanceManager.CreateInstance();
await PerformanceManager.instance.LoadRes();
PerformanceManager.SetPerformance(PerformanceManager.instance.data);
await _LoadPerformance();
}
}
@ -109,5 +107,17 @@ namespace Gameplay
{
await TableManager.Instance.Load();
}
private async UniTask _LoadPerformance()
{
if (PerformanceManager.instance != null)
{
return;
}
PerformanceManager.CreateInstance();
await PerformanceManager.instance.LoadRes();
PerformanceManager.SetPerformance(PerformanceManager.instance.data);
}
}
}

View File

@ -43,8 +43,7 @@ namespace Gameplay.Net
DebugUtil.LogError("LoginStatusRelogin OnEventError, id={0}", nNetID);
// 需要提示玩家是否继续重连
UINetManager.Instance.ShowReconnect();
}
public override void OnLoginResult(uint nResult)
@ -67,11 +66,14 @@ namespace Gameplay.Net
DebugUtil.Log("LoginStatusRelogin OnGameLoginResult Success");
Actor.Instance.Login.NextStatus = LoginStatusID.Ok;
Actor.Instance.OnLoginOK();
UINetManager.Instance.HideReconnect();
}
else
{
DebugUtil.LogError("LoginStatusNet OnGameLoginResult nResult={0}", (NLDPB.LoginResult)nResult);
// todo
UINetManager.Instance.HideReconnect();
}
}
}

View File

@ -1,13 +1,15 @@
using PhxhSDK;
namespace Gameplay
{
public class UINetManager
public class UINetManager: Singlenton<UINetManager>
{
public static async void ShowReconnect()
public async void ShowReconnect()
{
await UIManager.Instance.OpenWindow(UINameConst.UIReconnnect);
}
public static void HideReconnect()
public void HideReconnect()
{
UIManager.Instance.CloseWindow(UINameConst.UIReconnnect, UIWindowCloseType.HideAndDestroy);
}