添加连接断开事件接口

main
xiaohang 2023-09-18 11:02:00 +08:00
parent 2453fd8879
commit d5ca66eda0
1 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,7 @@ namespace DofLibrary
public class GameKcpClient : KcpListener
{
public Action OnConnected;
public Action OnDisConnected;
private KcpClient _kcpClient;
public IMessageSender sender { get; private set; } = new MessageSender();
@ -159,6 +160,13 @@ namespace DofLibrary
public void handleClose(Ukcp ukcp)
{
Debug.Log("[GameKcpClient]: Connection closed");
if (OnDisConnected != null)
{
Loom.QueueOnMainThread(() =>
{
OnDisConnected.Invoke();
});
}
}
/// <summary>