From 295943e172537ac280578e218699ee0ebd18a834 Mon Sep 17 00:00:00 2001 From: Mili Date: Mon, 19 Sep 2022 00:29:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FunGame.Core.Api/Interface/Events.cs | 223 ++++++++++++++++++ FunGame.Core.Api/Model/Enum/CommonEnums.cs | 55 ----- FunGame.Core.Api/Util/Utility.cs | 69 +++++- .../Models/Component/ShowMessage.cs | 1 - FunGame.Desktop/Utils/SocketHelper.cs | 1 + 5 files changed, 292 insertions(+), 57 deletions(-) create mode 100644 FunGame.Core.Api/Interface/Events.cs diff --git a/FunGame.Core.Api/Interface/Events.cs b/FunGame.Core.Api/Interface/Events.cs new file mode 100644 index 0000000..5e16b94 --- /dev/null +++ b/FunGame.Core.Api/Interface/Events.cs @@ -0,0 +1,223 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FunGame.Core.Api.Interface +{ + public interface FunGameEvent + { + + } + + public interface BeforeConnectEvent : FunGameEvent + { + + } + + public interface AfterConnectEvent : FunGameEvent + { + + } + + public interface BeforeDisconnectEvent : FunGameEvent + { + + } + + public interface AfterDisconnectEvent : FunGameEvent + { + + } + + public interface BeforeLoginEvent : FunGameEvent + { + + } + + public interface AfterLoginEvent : FunGameEvent + { + + } + + public interface BeforeLogoutEvent : FunGameEvent + { + + } + + public interface AfterLogoutEvent : FunGameEvent + { + + } + + public interface BeforeRegEvent : FunGameEvent + { + + } + + public interface AfterRegEvent : FunGameEvent + { + + } + + public interface BeforeIntoRoomEvent : FunGameEvent + { + + } + + public interface AfterIntoRoomEvent : FunGameEvent + { + + } + + public interface BeforeSendTalkEvent : FunGameEvent + { + + } + + public interface AfterSendTalkEvent : FunGameEvent + { + + } + + public interface BeforeCreateRoomEvent : FunGameEvent + { + + } + + public interface AfterCreateRoomEvent : FunGameEvent + { + + } + + public interface BeforeQuitRoomEvent : FunGameEvent + { + + } + + public interface AfterQuitRoomEvent : FunGameEvent + { + + } + + public interface BeforeChangeRoomSettingEvent : FunGameEvent + { + + } + + public interface AfterChangeRoomSettingEvent : FunGameEvent + { + + } + + public interface BeforeStartMatchEvent : FunGameEvent + { + + } + + public interface AfterStartMatchEvent : FunGameEvent + { + + } + + public interface BeforeStartGameEvent : FunGameEvent + { + + } + + public interface AfterStartGameEvent : FunGameEvent + { + + } + + public interface BeforeChangeProfileEvent : FunGameEvent + { + + } + + public interface AfterChangeProfileEvent : FunGameEvent + { + + } + + public interface BeforeChangeAccountSettingEvent : FunGameEvent + { + + } + + public interface AfterChangeAccountSettingEvent : FunGameEvent + { + + } + + public interface BeforeOpenStockEvent : FunGameEvent + { + + } + + public interface AfterOpenStockEvent : FunGameEvent + { + + } + + public interface BeforeSignInEvent : FunGameEvent + { + + } + + public interface AfterSignInEvent : FunGameEvent + { + + } + + public interface BeforeOpenStoreEvent : FunGameEvent + { + + } + + public interface AfterOpenStoreEvent : FunGameEvent + { + + } + + public interface BeforeBuyItemEvent : FunGameEvent + { + + } + + public interface AfterBuyItemEvent : FunGameEvent + { + + } + + public interface BeforeShowRankingEvent : FunGameEvent + { + + } + + public interface AfterShowRankingEvent : FunGameEvent + { + + } + + public interface BeforeUseItemEvent : FunGameEvent + { + + } + + public interface AfterUseItemEvent : FunGameEvent + { + + } + + public interface BeforeEndGameEvent : FunGameEvent + { + + } + + public interface AfterEndGameEvent : FunGameEvent + { + + } +} diff --git a/FunGame.Core.Api/Model/Enum/CommonEnums.cs b/FunGame.Core.Api/Model/Enum/CommonEnums.cs index 3216373..4449135 100644 --- a/FunGame.Core.Api/Model/Enum/CommonEnums.cs +++ b/FunGame.Core.Api/Model/Enum/CommonEnums.cs @@ -142,59 +142,4 @@ namespace FunGame.Core.Api.Model.Enum #endregion - - public class EnumHelper - { - #region 工具方法 - - /// - /// 获取实现类类名 - /// - /// 接口代号 - /// - public static string GetImplementClassName(int Interface) - { - foreach (string str in System.Enum.GetNames(typeof(InterfaceType))) - { - InterfaceType temp = (InterfaceType)System.Enum.Parse(typeof(InterfaceType), Interface.ToString(), true); - if (temp.ToString() == str) - return temp + "Impl"; - } - return ""; - } - - /// - /// 获取实现类的方法名 - /// - /// 方法代号 - /// - public static string GetImplementMethodName(int Method) - { - foreach (string str in System.Enum.GetNames(typeof(InterfaceMethod))) - { - InterfaceMethod temp = (InterfaceMethod)System.Enum.Parse(typeof(InterfaceMethod), Method.ToString(), true); - if (temp.ToString() == str) - return temp.ToString(); - } - return ""; - } - - /// - /// 获取Socket枚举名 - /// - /// Socket枚举 - /// - public static string GetSocketTypeName(int SocketType) - { - foreach (string str in System.Enum.GetNames(typeof(SocketMessageType))) - { - SocketMessageType temp = (SocketMessageType)System.Enum.Parse(typeof(SocketMessageType), SocketType.ToString(), true); - if (temp.ToString() == str) - return temp.ToString(); - } - return ""; - } - - #endregion - } } diff --git a/FunGame.Core.Api/Util/Utility.cs b/FunGame.Core.Api/Util/Utility.cs index b665b49..24a1bd3 100644 --- a/FunGame.Core.Api/Util/Utility.cs +++ b/FunGame.Core.Api/Util/Utility.cs @@ -10,8 +10,10 @@ using System.Threading.Tasks; namespace FunGame.Core.Api.Util { + #region 閫氱敤宸ュ叿绫 + /// - /// 宸ュ叿绫伙紝瀹㈡埛绔拰鏈嶅姟鍣ㄧ閮藉彲浠ョ洿鎺ヨ皟鐢ㄧ殑宸ュ叿鏂规硶閮藉彲浠ュ啓鍦ㄨ繖閲 + /// 閫氱敤宸ュ叿绫伙紝瀹㈡埛绔拰鏈嶅姟鍣ㄧ閮藉彲浠ョ洿鎺ヨ皟鐢ㄧ殑宸ュ叿鏂规硶閮藉彲浠ュ啓鍦ㄨ繖閲 /// public class Utility { @@ -79,6 +81,10 @@ namespace FunGame.Core.Api.Util } } + #endregion + + #region 璇诲啓INI鏂囦欢宸ュ叿绫 + public class INIHelper { /* @@ -177,6 +183,10 @@ namespace FunGame.Core.Api.Util } } + #endregion + + #region 鎺ュ彛鍙嶅皠宸ュ叿绫 + /// /// 鍦‵unGame.Core.Api涓坊鍔犳柊鎺ュ彛鍜屾柊瀹炵幇鏃讹紝闇瑕侊細 /// 鍦‵unGame.Core.Api.Model.Enum.CommonEnums閲屽悓姝ユ坊鍔營nterfaceType銆両nterfaceMethod @@ -253,4 +263,61 @@ namespace FunGame.Core.Api.Util else return null; } } + + #endregion + + #region 鏋氫妇鍙嶅皠宸ュ叿绫 + + public class EnumHelper + { + /// + /// 鑾峰彇瀹炵幇绫荤被鍚 + /// + /// 鎺ュ彛浠e彿 + /// + public static string GetImplementClassName(int Interface) + { + foreach (string str in System.Enum.GetNames(typeof(InterfaceType))) + { + InterfaceType temp = (InterfaceType)System.Enum.Parse(typeof(InterfaceType), Interface.ToString(), true); + if (temp.ToString() == str) + return temp + "Impl"; + } + return ""; + } + + /// + /// 鑾峰彇瀹炵幇绫荤殑鏂规硶鍚 + /// + /// 鏂规硶浠e彿 + /// + public static string GetImplementMethodName(int Method) + { + foreach (string str in System.Enum.GetNames(typeof(InterfaceMethod))) + { + InterfaceMethod temp = (InterfaceMethod)System.Enum.Parse(typeof(InterfaceMethod), Method.ToString(), true); + if (temp.ToString() == str) + return temp.ToString(); + } + return ""; + } + + /// + /// 鑾峰彇Socket鏋氫妇鍚 + /// + /// Socket鏋氫妇 + /// + public static string GetSocketTypeName(int SocketType) + { + foreach (string str in System.Enum.GetNames(typeof(SocketMessageType))) + { + SocketMessageType temp = (SocketMessageType)System.Enum.Parse(typeof(SocketMessageType), SocketType.ToString(), true); + if (temp.ToString() == str) + return temp.ToString(); + } + return ""; + } + } + + #endregion } diff --git a/FunGame.Desktop/Models/Component/ShowMessage.cs b/FunGame.Desktop/Models/Component/ShowMessage.cs index 1be9b9c..0c34c13 100644 --- a/FunGame.Desktop/Models/Component/ShowMessage.cs +++ b/FunGame.Desktop/Models/Component/ShowMessage.cs @@ -8,7 +8,6 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using FunGame.Core.Api.Model.Enum; -using static FunGame.Core.Api.Model.Enum.EnumHelper; namespace FunGame.Desktop.Models.Component { diff --git a/FunGame.Desktop/Utils/SocketHelper.cs b/FunGame.Desktop/Utils/SocketHelper.cs index eb0ca79..4ece43b 100644 --- a/FunGame.Desktop/Utils/SocketHelper.cs +++ b/FunGame.Desktop/Utils/SocketHelper.cs @@ -10,6 +10,7 @@ using System.ComponentModel.DataAnnotations; using System.Net.NetworkInformation; using FunGame.Core.Api.Model.Entity; using FunGame.Core.Api.Model.Enum; +using FunGame.Core.Api.Util; using FunGame.Desktop.Models.Config; using FunGame.Desktop.UI;