From d5ca66eda0c5cdf38f3ac89b732ad4826186e9df Mon Sep 17 00:00:00 2001 From: xiaohang Date: Mon, 18 Sep 2023 11:02:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=9E=E6=8E=A5=E6=96=AD?= =?UTF-8?q?=E5=BC=80=E4=BA=8B=E4=BB=B6=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/GameKcpClient.cs | 8 ++++++++ 1 file changed, 8 insertions(+) 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(); + }); + } } ///