完善网络框架,增加服务器断开连接回调

This commit is contained in:
ALEXTANG
2023-07-18 17:36:48 +08:00
parent a473971cfb
commit 526baf45fa
39 changed files with 559 additions and 308 deletions

View File

@@ -79,7 +79,7 @@ namespace GameLogic
if (Scene.Session == null || Scene.Session.IsDisposed)
{
Scene.CreateSession(address, ProtocolType, OnConnectComplete, OnConnectFail);
Scene.CreateSession(address, ProtocolType, OnConnectComplete, OnConnectFail, OnConnectDisconnect);
}
}
@@ -95,6 +95,12 @@ namespace GameLogic
Log.Warning("Could not connect to server");
}
private void OnConnectDisconnect()
{
Status = GameClientStatus.StatusClose;
Log.Warning("OnConnectDisconnect server");
}
public virtual void Send(object message, uint rpcId = 0, long routeId = 0)
{
if (Scene.Session == null)