From ea9008e9084e4047ba99e7b40768e22b80432f65 Mon Sep 17 00:00:00 2001 From: Mili Date: Sun, 2 Apr 2023 12:14:18 +0800 Subject: [PATCH 1/2] Add CreateRoomException and BaseMode.WaitForWorkDone() --- Library/Common/Architecture/BaseModel.cs | 11 +++++++++++ Library/Exception/Exception.cs | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Library/Common/Architecture/BaseModel.cs b/Library/Common/Architecture/BaseModel.cs index 2868c5d..56afac4 100644 --- a/Library/Common/Architecture/BaseModel.cs +++ b/Library/Common/Architecture/BaseModel.cs @@ -82,5 +82,16 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture Working = true; Work = default; } + + /// + /// 调用Socket.Send() == Success后,请等待任务完成 + /// + protected void WaitForWorkDone() + { + while (true) + { + if (!Working) break; + } + } } } diff --git a/Library/Exception/Exception.cs b/Library/Exception/Exception.cs index dace84e..c6bd0ed 100644 --- a/Library/Exception/Exception.cs +++ b/Library/Exception/Exception.cs @@ -149,9 +149,14 @@ { public override string Message => "退出房间失败 (#10030)"; } + + public class CreateRoomException : Exception + { + public override string Message => "创建房间失败 (#10031)"; + } public class GetInstanceException : Exception { - public override string Message => "构造对象实例遇到错误 (#10031)"; + public override string Message => "构造对象实例遇到错误 (#10032)"; } } From 08e3637623813b77b77e7c776f2e6cc9b0ed376d Mon Sep 17 00:00:00 2001 From: Mili Date: Sun, 2 Apr 2023 19:20:20 +0800 Subject: [PATCH 2/2] Add ForceLogout --- Library/Constant/TypeEnum.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Constant/TypeEnum.cs b/Library/Constant/TypeEnum.cs index 9f68b6b..715a90d 100644 --- a/Library/Constant/TypeEnum.cs +++ b/Library/Constant/TypeEnum.cs @@ -56,6 +56,7 @@ Login, CheckLogin, Logout, + ForceLogout, Disconnect, HeartBeat, IntoRoom,