diff --git a/Runtime/GameKcpClient.cs b/Runtime/GameKcpClient.cs index 3a74ed8..cf16b97 100644 --- a/Runtime/GameKcpClient.cs +++ b/Runtime/GameKcpClient.cs @@ -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(); + }); + } } ///