diff --git a/FunGame.Core/Api/Utility/EnumHelper.cs b/FunGame.Core/Api/Utility/EnumHelper.cs index 8ad1ccb..8d5742c 100644 --- a/FunGame.Core/Api/Utility/EnumHelper.cs +++ b/FunGame.Core/Api/Utility/EnumHelper.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Milimoe.FunGame.Core.Entity.Enum; -using Milimoe.FunGame.Core.Others; +using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Core.Api.Utility { diff --git a/FunGame.Core/Api/Utility/FactoryHelper.cs b/FunGame.Core/Api/Utility/FactoryHelper.cs index 6cdf3ce..968eadb 100644 --- a/FunGame.Core/Api/Utility/FactoryHelper.cs +++ b/FunGame.Core/Api/Utility/FactoryHelper.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Core.Api.Utility { @@ -41,7 +42,7 @@ namespace Milimoe.FunGame.Core.Api.Utility /// public static object New(params object[]? objs) { - object instance = Core.Others.Constant.EntityInstance; + object instance = General.EntityInstance; if (!IsEntity()) return instance; if (objs is null || objs.Length == 0) return instance; if (typeof(T) == typeof(Entity.General.User)) @@ -66,7 +67,7 @@ namespace Milimoe.FunGame.Core.Api.Utility /// public static object NewSingle(params object[]? objs) { - object instance = Core.Others.Constant.EntityInstance; + object instance = General.EntityInstance; if (!IsEntity()) return instance; if (objs is null || objs.Length == 0) return instance; if (typeof(T) == typeof(Entity.General.User)) diff --git a/FunGame.Core/FunGame.Core.csproj b/FunGame.Core/FunGame.Core.csproj index 34de1c0..a265800 100644 --- a/FunGame.Core/FunGame.Core.csproj +++ b/FunGame.Core/FunGame.Core.csproj @@ -22,4 +22,8 @@ embedded + + + + diff --git a/FunGame.Core/Interface/Example.cs b/FunGame.Core/Interface/Example.cs index 7d167e7..f2c648d 100644 --- a/FunGame.Core/Interface/Example.cs +++ b/FunGame.Core/Interface/Example.cs @@ -1,7 +1,8 @@ namespace Milimoe.FunGame.Core.Interface { /** - * 接口需要在FunGame.Core项目中Implement文件夹创建新的类实现 + * 接口需要在FunGame.Core项目中创建新的类实现 + * namespace必须是Milimoe.FunGame.Core.Implement,文件夹位置随意 * 参考: * using Milimoe.FunGame.Core.Interface; diff --git a/FunGame.Core/Library/Constant/General.cs b/FunGame.Core/Library/Constant/General.cs new file mode 100644 index 0000000..f639571 --- /dev/null +++ b/FunGame.Core/Library/Constant/General.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Library.Constant +{ + public class General + { + public static Entity.General.Empty EntityInstance { get; } = new(); + } +} diff --git a/FunGame.Core/Others/InterfaceSet.cs b/FunGame.Core/Library/Constant/InterfaceSet.cs similarity index 87% rename from FunGame.Core/Others/InterfaceSet.cs rename to FunGame.Core/Library/Constant/InterfaceSet.cs index 3306e4e..8dd3106 100644 --- a/FunGame.Core/Others/InterfaceSet.cs +++ b/FunGame.Core/Library/Constant/InterfaceSet.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Milimoe.FunGame.Core.Others +namespace Milimoe.FunGame.Core.Library.Constant { public enum InterfaceType { diff --git a/FunGame.Core/Entity/Exception/SystemError.cs b/FunGame.Core/Library/Exception/SystemError.cs similarity index 92% rename from FunGame.Core/Entity/Exception/SystemError.cs rename to FunGame.Core/Library/Exception/SystemError.cs index ccae7b4..c7c65cc 100644 --- a/FunGame.Core/Entity/Exception/SystemError.cs +++ b/FunGame.Core/Library/Exception/SystemError.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Milimoe.FunGame.Core.Entity.Exception +namespace Milimoe.FunGame.Core.Library.Exception { public class SystemError : System.Exception { diff --git a/FunGame.Core/Others/Constant.cs b/FunGame.Core/Others/Others.cs similarity index 60% rename from FunGame.Core/Others/Constant.cs rename to FunGame.Core/Others/Others.cs index 003e34e..5cba823 100644 --- a/FunGame.Core/Others/Constant.cs +++ b/FunGame.Core/Others/Others.cs @@ -6,8 +6,7 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Others { - public class Constant + internal class Others { - public static Entity.General.Empty EntityInstance = new Entity.General.Empty(); } } diff --git a/FunGame.Core/Service/SocketManager.cs b/FunGame.Core/Service/SocketManager.cs index 7fad323..5f0cc11 100644 --- a/FunGame.Core/Service/SocketManager.cs +++ b/FunGame.Core/Service/SocketManager.cs @@ -12,6 +12,15 @@ namespace Milimoe.FunGame.Core.Service { internal class SocketManager { + internal static SocketManager? Instance { get; private set; } + + internal Socket? Socket { get; } = null; + + private SocketManager(Socket socket) + { + Socket = socket; + } + internal static Socket? Connect(string IP, int Port = 22222) { Socket? socket = null; @@ -29,6 +38,7 @@ namespace Milimoe.FunGame.Core.Service socket.Connect(ServerEndPoint); if (socket.Connected) { + Instance = new SocketManager(socket); return socket; } } diff --git a/FunGame.Desktop/UI/Main/Main.cs b/FunGame.Desktop/UI/Main/Main.cs index 90a9cd3..1211875 100644 --- a/FunGame.Desktop/UI/Main/Main.cs +++ b/FunGame.Desktop/UI/Main/Main.cs @@ -7,10 +7,10 @@ using System.Text; using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Entity.General; using Milimoe.FunGame.Core.Entity.Enum; -using Milimoe.FunGame.Core.Others; using Milimoe.FunGame.Desktop.Entity.Component; using Milimoe.FunGame.Desktop.Others; using Milimoe.FunGame.Desktop.Utils; +using Milimoe.FunGame.Core.Library.Constant; namespace Milimoe.FunGame.Desktop.UI {