diff --git a/FunGame.Core.Api/FunGame.Core.Api.csproj b/FunGame.Core.Api/FunGame.Core.Api.csproj index e76e281..ac6b656 100644 --- a/FunGame.Core.Api/FunGame.Core.Api.csproj +++ b/FunGame.Core.Api/FunGame.Core.Api.csproj @@ -1,7 +1,7 @@ - net6.0-windows + net6.0 enable enable ..\bin @@ -13,4 +13,12 @@ FunGame + + embedded + + + + embedded + + diff --git a/FunGame.Core.Api/Interface/ServerInterface.cs b/FunGame.Core.Api/Interface/Interface.cs similarity index 82% rename from FunGame.Core.Api/Interface/ServerInterface.cs rename to FunGame.Core.Api/Interface/Interface.cs index bab149d..e382cfc 100644 --- a/FunGame.Core.Api/Interface/ServerInterface.cs +++ b/FunGame.Core.Api/Interface/Interface.cs @@ -13,7 +13,7 @@ namespace FunGame.Core.Api.Interface namespace FunGame.Core.Implement { - public class ServerInterfaceImpl : ServerInterface + public class ClientConnectInterfaceImpl : ClientConnectInterface { public string RemoteServerIP() { @@ -26,8 +26,13 @@ namespace FunGame.Core.Api.Interface } */ - public interface ServerInterface + public interface ClientConnectInterface { public string RemoteServerIP(); } + + public interface ServerInterface + { + public string ServerNotice(); + } } diff --git a/FunGame.Core.Api/Model/Enum/CommonEnums.cs b/FunGame.Core.Api/Model/Enum/CommonEnums.cs index 00c4251..11948d6 100644 --- a/FunGame.Core.Api/Model/Enum/CommonEnums.cs +++ b/FunGame.Core.Api/Model/Enum/CommonEnums.cs @@ -59,7 +59,8 @@ namespace FunGame.Core.Api.Model.Enum public enum InterfaceType { - ServerInterface = 1 + ClientConnectInterface = 1, + ServerInterface = 2 } #endregion @@ -88,7 +89,8 @@ namespace FunGame.Core.Api.Model.Enum public enum InterfaceMethod { - GetServerIP = 1 + RemoteServerIP = 1, + ServerNotice = 2 } #endregion diff --git a/FunGame.Core.Api/Util/AssemblyHelper.cs b/FunGame.Core.Api/Util/AssemblyHelper.cs index b89e63f..7634317 100644 --- a/FunGame.Core.Api/Util/AssemblyHelper.cs +++ b/FunGame.Core.Api/Util/AssemblyHelper.cs @@ -19,12 +19,14 @@ namespace FunGame.Core.Api.Util /** * 定义类名 */ + public const string ClientConnectInterface = "ClientConnectInterface"; public const string ServerInterface = "ServerInterface"; /** * 定义方法名 */ - public const string GetRemoteServerIP = "RemoteServerIP"; + public const string RemoteServerIP = "RemoteServerIP"; + public const string ServerNotice = "ServerNotice"; /** * 定义需要反射的DLL @@ -35,7 +37,8 @@ namespace FunGame.Core.Api.Util * 无需二次修改的 */ public const string Implement = "Impl"; // 实现类的后缀 - public static string PluginDocPath = System.Diagnostics.Process.GetCurrentProcess() + "/plugins/"; // 插件目录,反射插件DLL需要用LoadFile()方法 + public static string EXEDocPath = System.Environment.CurrentDirectory.ToString() + "\\"; // 程序目录 + public static string PluginDocPath = System.Environment.CurrentDirectory + "\\plugins\\"; // 插件目录 //////////////////////////////////////////////////////////////////// /////////////// * 下 面 是 工 具 类 实 现 * //////////////// @@ -59,7 +62,7 @@ namespace FunGame.Core.Api.Util // 通过类名获取获取命名空间+类名称 string ClassName = Interface switch { - (int)CommonEnums.InterfaceType.ServerInterface => ServerInterface + Implement, + (int)CommonEnums.InterfaceType.ClientConnectInterface => ClientConnectInterface + Implement, _ => "", }; List? Classes = null; @@ -84,8 +87,8 @@ namespace FunGame.Core.Api.Util // 通过AssemblyHelperType来获取方法名 switch (Method) { - case (int)CommonEnums.InterfaceMethod.GetServerIP: - return GetRemoteServerIP; + case (int)CommonEnums.InterfaceMethod.RemoteServerIP: + return RemoteServerIP; } return ""; } @@ -98,7 +101,7 @@ namespace FunGame.Core.Api.Util /// public object? GetFunGameCoreValue(int Interface, int Method) { - Assembly = Assembly.Load(@FUNGAME_CORE); + Assembly = Assembly.LoadFile(EXEDocPath + @FUNGAME_CORE + ".dll"); Type = GetFunGameCoreImplement(Interface); // 通过类名获取获取命名空间+类名称 string MethodName = GetMethodName(Method); // 获取方法名 if (Assembly != null && Type != null) this.Method = Type.GetMethod(MethodName); // 从Type中查找方法名 diff --git a/FunGame.Core/FunGame.Core.csproj b/FunGame.Core/FunGame.Core.csproj index c6eb69f..8ee0f18 100644 --- a/FunGame.Core/FunGame.Core.csproj +++ b/FunGame.Core/FunGame.Core.csproj @@ -1,7 +1,7 @@ - net6.0-windows + net6.0 enable enable Milimoe @@ -13,12 +13,19 @@ 1.0 - - - + + embedded + + + + embedded + - + + False + True + diff --git a/FunGame.Desktop/FunGame.Desktop.csproj b/FunGame.Desktop/FunGame.Desktop.csproj index 584ef70..31897a5 100644 --- a/FunGame.Desktop/FunGame.Desktop.csproj +++ b/FunGame.Desktop/FunGame.Desktop.csproj @@ -11,7 +11,7 @@ logo.ico Milimoe ..\bin - True + False False Milimoe FunGame @@ -21,6 +21,14 @@ 1.0 + + embedded + + + + embedded + + @@ -50,8 +58,12 @@ - - + + True + + + True + diff --git a/FunGame.Desktop/Models/Component/ShowMessage.cs b/FunGame.Desktop/Models/Component/ShowMessage.cs index f8bb91e..3511b20 100644 --- a/FunGame.Desktop/Models/Component/ShowMessage.cs +++ b/FunGame.Desktop/Models/Component/ShowMessage.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using FunGame.Desktop.Models.Enum; +using FunGame.Core.Api.Model.Enum; namespace FunGame.Desktop.Models.Component { diff --git a/FunGame.Desktop/Models/Enum/CommonEnums.cs b/FunGame.Desktop/Models/Enum/CommonEnums.cs deleted file mode 100644 index 4636b3b..0000000 --- a/FunGame.Desktop/Models/Enum/CommonEnums.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace FunGame.Desktop.Models.Enum -{ - /// - /// ſʵصState Type Result Method - /// FunGame.CoreӿںʵʱҪͬӣInterfaceTypeInterfaceMethod - /// - public static class CommonEnums - { - #region State - - public enum StartMatch_State - { - Matching = 1, - Success = 2, - Enable = 3, - Cancel = 4 - } - - public enum CreateRoom_State - { - Creating = 1, - Success = 2 - } - - public enum RoomState - { - Created = 1, - Gaming = 2, - Close = 3, - Complete = 4 - } - - public enum OnlineState - { - Offline = 1, - Online = 2, - Matching = 3, - InRoom = 4, - Gaming = 5 - } - - #endregion - - #region Type - - public enum RoomType - { - Mix = 1, - Team = 2, - MixHasPass = 3, - TeamHasPass = 4 - } - - public enum InterfaceType - { - ServerInterface = 1 - } - - #endregion - - #region Result - - public enum MessageResult - { - OK = 1, - Cancel = 2, - Yes = 3, - No = 4, - Retry = 5 - } - - #endregion - - #region Method - - public enum WebHelperMethod - { - CreateSocket = 1, - CloseSocket = 2, - StartWebHelper = 3, - } - - public enum InterfaceMethod - { - GetServerIP = 1 - } - - #endregion - - } -} diff --git a/FunGame.Desktop/Models/Enum/SocketEnums.cs b/FunGame.Desktop/Models/Enum/SocketEnums.cs deleted file mode 100644 index 0f700cf..0000000 --- a/FunGame.Desktop/Models/Enum/SocketEnums.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace FunGame.Desktop.Models.Enum -{ - public static class SocketEnums - { - public enum Type - { - GetNotice = 1, - Login = 2, - CheckLogin = 3, - Logout = 4, - HeartBeat = 5 - } - - public const string TYPE_UNKNOWN = "Unknown Type"; - public const string TYPE_GetNotice = "GetNotice"; - public const string TYPE_Login = "Login"; - public const string TYPE_CheckLogin = "CheckLogin"; - public const string TYPE_Logout = "Logout"; - public const string TYPE_HeartBeat = "HeartBeat"; - } -} diff --git a/FunGame.Desktop/UI/Main/Main.cs b/FunGame.Desktop/UI/Main/Main.cs index c04fdfc..4d7e371 100644 --- a/FunGame.Desktop/UI/Main/Main.cs +++ b/FunGame.Desktop/UI/Main/Main.cs @@ -3,13 +3,12 @@ using System.Diagnostics; using System.Net.Sockets; using System.Net; using System.Windows.Forms; -using static FunGame.Desktop.Models.Enum.CommonEnums; using System.Net.NetworkInformation; using System.Text; using FunGame.Core.Api.Model.Entity; -using FunGame.Desktop.Models.Enum; using FunGame.Desktop.Models.Config; using FunGame.Desktop.Utils; +using static FunGame.Core.Api.Model.Enum.CommonEnums; namespace FunGame.Desktop.UI { @@ -173,7 +172,7 @@ namespace FunGame.Desktop.UI { try { - string? ipaddress = (string?)Config.DefaultAssemblyHelper.GetFunGameCoreValue((int)InterfaceType.ServerInterface, (int)InterfaceMethod.GetServerIP); // 获取服务器IP + string? ipaddress = (string?)Config.DefaultAssemblyHelper.GetFunGameCoreValue((int)InterfaceType.ClientConnectInterface, (int)InterfaceMethod.RemoteServerIP); // 获取服务器IP if (ipaddress != null) { string[] s = ipaddress.Split(':'); @@ -685,6 +684,7 @@ namespace FunGame.Desktop.UI /// 设置服务器连接状态指示灯 /// /// + /// private void SetServerStatusLight(bool green, int ping = 0) { if (green) diff --git a/FunGame.Desktop/Utils/WebHelper.cs b/FunGame.Desktop/Utils/WebHelper.cs index a2b0749..0f879ea 100644 --- a/FunGame.Desktop/Utils/WebHelper.cs +++ b/FunGame.Desktop/Utils/WebHelper.cs @@ -9,7 +9,7 @@ using FunGame.Desktop.Models.Component; using System.ComponentModel.DataAnnotations; using System.Net.NetworkInformation; using FunGame.Core.Api.Model.Entity; -using FunGame.Desktop.Models.Enum; +using FunGame.Core.Api.Model.Enum; using FunGame.Desktop.Models.Config; using FunGame.Desktop.UI; diff --git a/FunGame.Plugin/FunGame.Plugin.csproj b/FunGame.Plugin/FunGame.Plugin.csproj index 4185a6b..9dc8a9b 100644 --- a/FunGame.Plugin/FunGame.Plugin.csproj +++ b/FunGame.Plugin/FunGame.Plugin.csproj @@ -1,10 +1,10 @@ - net6.0-windows + net6.0 enable enable - ..\bin + ..\bin\ Milimoe Milimoe FunGame @@ -13,4 +13,12 @@ ..\bin\plugin + + embedded + + + + embedded + +