diff --git a/FunGame.Core/Api/Factory/CharacterFactory.cs b/FunGame.Core/Api/Factory/CharacterFactory.cs index be958c2..c83ad8f 100644 --- a/FunGame.Core/Api/Factory/CharacterFactory.cs +++ b/FunGame.Core/Api/Factory/CharacterFactory.cs @@ -7,8 +7,8 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Api.Factory { - public class CharacterFactory + internal class CharacterFactory { - + } } diff --git a/FunGame.Core/Api/Factory/InventoryFactory.cs b/FunGame.Core/Api/Factory/InventoryFactory.cs index 3378d26..b821ba4 100644 --- a/FunGame.Core/Api/Factory/InventoryFactory.cs +++ b/FunGame.Core/Api/Factory/InventoryFactory.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Api.Factory { - public class InventoryFactory + internal class InventoryFactory { } diff --git a/FunGame.Core/Api/Factory/ItemFactory.cs b/FunGame.Core/Api/Factory/ItemFactory.cs index 31db9a6..b553c70 100644 --- a/FunGame.Core/Api/Factory/ItemFactory.cs +++ b/FunGame.Core/Api/Factory/ItemFactory.cs @@ -6,9 +6,9 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Api.Factory { - public class ItemFactory + internal class ItemFactory { - public static Milimoe.FunGame.Core.Entity.General.Item? GetInstance(Milimoe.FunGame.Core.Entity.Enum.ItemType type, string Name) + internal static Milimoe.FunGame.Core.Entity.General.Item? GetInstance(Milimoe.FunGame.Core.Entity.Enum.ItemType type, string Name) { Milimoe.FunGame.Core.Entity.General.Item? item = null; switch (type) diff --git a/FunGame.Core/Api/Factory/RoomFactory.cs b/FunGame.Core/Api/Factory/RoomFactory.cs index d2c38d1..5f52e9a 100644 --- a/FunGame.Core/Api/Factory/RoomFactory.cs +++ b/FunGame.Core/Api/Factory/RoomFactory.cs @@ -9,9 +9,9 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Api.Factory { - public class RoomFactory + internal class RoomFactory { - public static Milimoe.FunGame.Core.Entity.General.Room GetInstanceByRandomID(Milimoe.FunGame.Core.Entity.Enum.RoomType type, Milimoe.FunGame.Core.Entity.General.User? user) + internal static Milimoe.FunGame.Core.Entity.General.Room GetInstanceByRandomID(Milimoe.FunGame.Core.Entity.Enum.RoomType type, Milimoe.FunGame.Core.Entity.General.User? user) { Milimoe.FunGame.Core.Entity.General.Room room = new(user) { @@ -21,7 +21,7 @@ namespace Milimoe.FunGame.Core.Api.Factory return room; } - public static Milimoe.FunGame.Core.Entity.General.Room GetInstanceByRoomID(Milimoe.FunGame.Core.Entity.Enum.RoomType type, string roomid, Milimoe.FunGame.Core.Entity.General.User? user) + internal static Milimoe.FunGame.Core.Entity.General.Room GetInstanceByRoomID(Milimoe.FunGame.Core.Entity.Enum.RoomType type, string roomid, Milimoe.FunGame.Core.Entity.General.User? user) { Milimoe.FunGame.Core.Entity.General.Room room = new(roomid, user) { diff --git a/FunGame.Core/Api/Factory/SkillFactory.cs b/FunGame.Core/Api/Factory/SkillFactory.cs index 45f3b3d..5f6996d 100644 --- a/FunGame.Core/Api/Factory/SkillFactory.cs +++ b/FunGame.Core/Api/Factory/SkillFactory.cs @@ -6,9 +6,9 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Api.Factory { - public class SkillFactory + internal class SkillFactory { - public static Milimoe.FunGame.Core.Entity.General.Skill? GetInstance(Milimoe.FunGame.Core.Entity.Enum.SkillType type, string Name) + internal static Milimoe.FunGame.Core.Entity.General.Skill? GetInstance(Milimoe.FunGame.Core.Entity.Enum.SkillType type, string Name) { Milimoe.FunGame.Core.Entity.General.Skill? skill = null; switch (type) diff --git a/FunGame.Core/Api/Factory/UserFactory.cs b/FunGame.Core/Api/Factory/UserFactory.cs index dd616c7..3f1af83 100644 --- a/FunGame.Core/Api/Factory/UserFactory.cs +++ b/FunGame.Core/Api/Factory/UserFactory.cs @@ -6,19 +6,19 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Api.Factory { - public class UserFactory + internal class UserFactory { - public static Milimoe.FunGame.Core.Entity.General.User GetInstance() + internal static Milimoe.FunGame.Core.Entity.General.User GetInstance() { return new Milimoe.FunGame.Core.Entity.General.User(); } - public static Milimoe.FunGame.Core.Entity.General.User GetInstance(string username) + internal static Milimoe.FunGame.Core.Entity.General.User GetInstance(string username) { return new Milimoe.FunGame.Core.Entity.General.User(username); } - public static Milimoe.FunGame.Core.Entity.General.User GetInstance(string username, string password) + internal static Milimoe.FunGame.Core.Entity.General.User GetInstance(string username, string password) { return new Milimoe.FunGame.Core.Entity.General.User(username, password); } diff --git a/FunGame.Core/Api/Proxy/SQLProxy.cs b/FunGame.Core/Api/Proxy/SQLProxy.cs index 50f5109..0417150 100644 --- a/FunGame.Core/Api/Proxy/SQLProxy.cs +++ b/FunGame.Core/Api/Proxy/SQLProxy.cs @@ -1,12 +1,94 @@ -using System; +using Milimoe.FunGame.Core.Entity.Enum; +using Milimoe.FunGame.Core.Interface.Base; +using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Api.Proxy { - public class SQLProxy + public class SQLProxy : ISQLProxy { + public ProxyResult Execute() + { + throw new NotImplementedException(); + } + + public ProxyResult Execute(object[]? objs = null) + { + throw new NotImplementedException(); + } + + public ProxyResult Execute(StringBuilder script) + { + throw new NotImplementedException(); + } + + public int ExecuteRow() + { + throw new NotImplementedException(); + } + + public int ExecuteRow(object[]? objs = null) + { + throw new NotImplementedException(); + } + + public int ExecuteRow(StringBuilder script) + { + throw new NotImplementedException(); + } + + public DataSet GetData(EntityType type, object[]? objs = null) + { + throw new NotImplementedException(); + } + + public DataSet GetData(object[]? objs = null) + { + throw new NotImplementedException(); + } + + public DataSet GetData(StringBuilder script) + { + throw new NotImplementedException(); + } + + public DataRow GetDataRow(EntityType type, object[]? objs = null) + { + throw new NotImplementedException(); + } + + public DataRow GetDataRow(DataSet set, object[]? objs = null) + { + throw new NotImplementedException(); + } + + public DataRow GetDataRow(DataTable table, object[]? objs = null) + { + throw new NotImplementedException(); + } + + public DataRow GetDataRow(StringBuilder script) + { + throw new NotImplementedException(); + } + + public DataTable GetDataTable(EntityType type, object[]? objs = null) + { + throw new NotImplementedException(); + } + + public DataTable GetDataTable(object[]? objs = null) + { + throw new NotImplementedException(); + } + + public DataTable GetDataTable(StringBuilder script) + { + throw new NotImplementedException(); + } } } diff --git a/FunGame.Core/Api/Utility/FactoryHelper.cs b/FunGame.Core/Api/Utility/FactoryHelper.cs new file mode 100644 index 0000000..e005bef --- /dev/null +++ b/FunGame.Core/Api/Utility/FactoryHelper.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Api.Utility +{ + public class FactoryHelper + { + /// + /// 获取一个可能为NULL的实例 + /// + /// Entity类 + /// 构造函数的参数 + /// + public static object? GetInstance(params object[]? objs) + { + object? instance = null; + if (objs is null || objs.Length == 0) return instance; + if (typeof(T) == typeof(Entity.General.User)) + { + instance = Factory.UserFactory.GetInstance("Mili"); + } + else if (typeof(T) == typeof(Entity.General.Skill)) + { + + } + return instance; + } + + /// + /// 获取一个不可能为NULL的实例 + /// Item默认返回PassiveItem + /// Skill默认返回PassiveSkill + /// 若无法找到T,返回唯一的空对象 + /// + /// Entity类 + /// 构造函数的参数 + /// + public static object New(params object[]? objs) + { + object instance = Core.Others.Config.EntityInstance; + if (objs is null || objs.Length == 0) return instance; + if (typeof(T) == typeof(Entity.General.User)) + { + instance = Factory.UserFactory.GetInstance("Mili"); + } + else if (typeof(T) == typeof(Entity.General.Skill)) + { + + } + return instance; + } + } +} diff --git a/FunGame.Core/Api/Utility/INIHelper.cs b/FunGame.Core/Api/Utility/INIHelper.cs index fc578d0..46a9c66 100644 --- a/FunGame.Core/Api/Utility/INIHelper.cs +++ b/FunGame.Core/Api/Utility/INIHelper.cs @@ -57,14 +57,14 @@ namespace Milimoe.FunGame.Core.Api.Utility /// /// 初始化ini模板文件 /// - public static void Init(FunGameEnums.FunGame FunGameType) + public static void Init(FunGameEnum.FunGame FunGameType) { switch (FunGameType) { - case FunGameEnums.FunGame.FunGame_Core: - case FunGameEnums.FunGame.FunGame_Core_Api: - case FunGameEnums.FunGame.FunGame_Console: - case FunGameEnums.FunGame.FunGame_Desktop: + case FunGameEnum.FunGame.FunGame_Core: + case FunGameEnum.FunGame.FunGame_Core_Api: + case FunGameEnum.FunGame.FunGame_Console: + case FunGameEnum.FunGame.FunGame_Desktop: /** * Config */ @@ -77,7 +77,7 @@ namespace Milimoe.FunGame.Core.Api.Utility WriteINI("Account", "Password", ""); WriteINI("Account", "AutoKey", ""); break; - case FunGameEnums.FunGame.FunGame_Server: + case FunGameEnum.FunGame.FunGame_Server: /** * Server */ diff --git a/FunGame.Core/Api/Utility/Singleton.cs b/FunGame.Core/Api/Utility/Singleton.cs new file mode 100644 index 0000000..497bd34 --- /dev/null +++ b/FunGame.Core/Api/Utility/Singleton.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Api.Utility +{ + /// + /// 单例表:表中的对象以类名作为Key保存,并以Key获取该对象,Key具有唯一约束 + /// 用于储存单例对象使用 + /// + public class Singleton + { + + } +} diff --git a/FunGame.Core/Entity/Enum/FunGameEnums.cs b/FunGame.Core/Entity/Enum/FunGameEnum.cs similarity index 97% rename from FunGame.Core/Entity/Enum/FunGameEnums.cs rename to FunGame.Core/Entity/Enum/FunGameEnum.cs index 177999b..ab78291 100644 --- a/FunGame.Core/Entity/Enum/FunGameEnums.cs +++ b/FunGame.Core/Entity/Enum/FunGameEnum.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Entity.Enum { - public static class FunGameEnums + public static class FunGameEnum { public enum FunGame { diff --git a/FunGame.Core/Entity/Enum/MethodEnum.cs b/FunGame.Core/Entity/Enum/MethodEnum.cs new file mode 100644 index 0000000..01cd70e --- /dev/null +++ b/FunGame.Core/Entity/Enum/MethodEnum.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Entity.Enum +{ + public enum SocketHelperMethod + { + CreateSocket, + CloseSocket, + StartSocketHelper, + Login, + Logout, + Disconnect + } + + public enum InterfaceMethod + { + RemoteServerIP, + DBConnection, + GetServerSettings + } +} diff --git a/FunGame.Core/Entity/Enum/ResultEnum.cs b/FunGame.Core/Entity/Enum/ResultEnum.cs new file mode 100644 index 0000000..3a36da2 --- /dev/null +++ b/FunGame.Core/Entity/Enum/ResultEnum.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Entity.Enum +{ + public enum MessageResult + { + OK, + Cancel, + Yes, + No, + Retry + } + + public enum EventResult + { + Success, + Fail + } + + public enum ProxyResult + { + Success, + Fail, + NotFound + } +} diff --git a/FunGame.Core/Entity/Enum/StateEnum.cs b/FunGame.Core/Entity/Enum/StateEnum.cs new file mode 100644 index 0000000..040b050 --- /dev/null +++ b/FunGame.Core/Entity/Enum/StateEnum.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Entity.Enum +{ + public enum StartMatchState + { + Matching, + Success, + Enable, + Cancel + } + + public enum CreateRoomState + { + Creating, + Success + } + + public enum RoomState + { + Created, + Gaming, + Close, + Complete + } + + public enum OnlineState + { + Offline, + Online, + Matching, + InRoom, + Gaming + } + + public enum ClientState + { + Online, + WaitConnect, + WaitLogin + } +} diff --git a/FunGame.Core/Entity/Enum/CommonEnums.cs b/FunGame.Core/Entity/Enum/TypeEnum.cs similarity index 53% rename from FunGame.Core/Entity/Enum/CommonEnums.cs rename to FunGame.Core/Entity/Enum/TypeEnum.cs index 4a99fb6..8895380 100644 --- a/FunGame.Core/Entity/Enum/CommonEnums.cs +++ b/FunGame.Core/Entity/Enum/TypeEnum.cs @@ -1,61 +1,11 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; -using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Entity.Enum { - /** - * ſʵصState Type Result Method - * Milimoe.FunGame.Core.ApiӿںʵʱҪͬӣInterfaceTypeInterfaceMethod - */ - - #region State - - public enum StartMatch_State - { - Matching, - Success, - Enable, - Cancel - } - - public enum CreateRoom_State - { - Creating, - Success - } - - public enum RoomState - { - Created, - Gaming, - Close, - Complete - } - - public enum OnlineState - { - Offline, - Online, - Matching, - InRoom, - Gaming - } - - public enum ClientState - { - Online, - WaitConnect, - WaitLogin - } - - #endregion - - #region Type - public enum RoomType { Mix, @@ -142,46 +92,21 @@ namespace Milimoe.FunGame.Core.Entity.Enum Passive } - #endregion - - #region Result - - public enum MessageResult + public enum EntityType { - OK, - Cancel, - Yes, - No, - Retry + Empty, + User, + UserStatistics, + Room, + Inventory, + Item, + ActiveItem, + PassiveItem, + Skill, + ActiveSkill, + PassiveSkill, + GameStatistics, + Character, + CharacterStatistics } - - public enum EventResult - { - Success, - Fail - } - - #endregion - - #region Method - - public enum SocketHelperMethod - { - CreateSocket, - CloseSocket, - StartSocketHelper, - Login, - Logout, - Disconnect - } - - public enum InterfaceMethod - { - RemoteServerIP, - DBConnection, - GetServerSettings - } - - #endregion - } diff --git a/FunGame.Core/Service/MySQLManager.cs b/FunGame.Core/Entity/General/Empty.cs similarity index 54% rename from FunGame.Core/Service/MySQLManager.cs rename to FunGame.Core/Entity/General/Empty.cs index 8687e1d..a5cf964 100644 --- a/FunGame.Core/Service/MySQLManager.cs +++ b/FunGame.Core/Entity/General/Empty.cs @@ -4,9 +4,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Milimoe.FunGame.Core.Service +namespace Milimoe.FunGame.Core.Entity.General { - public class MySQLManager + public class Empty { + internal Empty() + { + + } } } diff --git a/FunGame.Core/Interface/Base/ISQLProxy.cs b/FunGame.Core/Interface/Base/ISQLProxy.cs new file mode 100644 index 0000000..c5a3a2a --- /dev/null +++ b/FunGame.Core/Interface/Base/ISQLProxy.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Interface.Base +{ + public interface ISQLProxy + { + public Entity.Enum.ProxyResult Execute(); + public Entity.Enum.ProxyResult Execute(object[]? objs = null); + public Entity.Enum.ProxyResult Execute(StringBuilder script); + public int ExecuteRow(); + public int ExecuteRow(object[]? objs = null); + public int ExecuteRow(StringBuilder script); + public System.Data.DataSet GetData(Entity.Enum.EntityType type, object[]? objs = null); + public System.Data.DataSet GetData(object[]? objs = null); + public System.Data.DataSet GetData(StringBuilder script); + public System.Data.DataTable GetDataTable(Entity.Enum.EntityType type, object[]? objs = null); + public System.Data.DataTable GetDataTable(object[]? objs = null); + public System.Data.DataTable GetDataTable(StringBuilder script); + public System.Data.DataRow GetDataRow(Entity.Enum.EntityType type, object[]? objs = null); + public System.Data.DataRow GetDataRow(System.Data.DataSet set, object[]? objs = null); + public System.Data.DataRow GetDataRow(System.Data.DataTable table, object[]? objs = null); + public System.Data.DataRow GetDataRow(StringBuilder script); + } +} diff --git a/FunGame.Core/Interface/Base/ISQLService.cs b/FunGame.Core/Interface/Base/ISQLService.cs new file mode 100644 index 0000000..0879186 --- /dev/null +++ b/FunGame.Core/Interface/Base/ISQLService.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Interface.Base +{ + internal interface ISQLService + { + internal Entity.Enum.ProxyResult Execute(); + internal Entity.Enum.ProxyResult Execute(object[]? objs = null); + internal Entity.Enum.ProxyResult Execute(StringBuilder script); + internal int UpdateRow(object[]? objs = null); + internal int UpdateRow(StringBuilder script); + internal int DeleteRow(object[]? objs = null); + internal int DeleteRow(StringBuilder script); + internal int AddRow(object[]? objs = null); + internal int AddRow(StringBuilder script); + internal System.Data.DataSet GetData(Entity.Enum.EntityType type, object[]? objs = null); + internal System.Data.DataSet GetData(object[]? objs = null); + internal System.Data.DataSet GetData(StringBuilder script); + internal System.Data.DataTable GetDataTable(Entity.Enum.EntityType type, object[]? objs = null); + internal System.Data.DataTable GetDataTable(object[]? objs); + internal System.Data.DataTable GetDataTable(StringBuilder script); + internal System.Data.DataRow GetDataRow(Entity.Enum.EntityType type, object[]? objs = null); + internal System.Data.DataRow GetDataRow(System.Data.DataSet set, object[]? objs = null); + internal System.Data.DataRow GetDataRow(System.Data.DataTable table, object[]? objs = null); + internal System.Data.DataRow GetDataRow(StringBuilder script); + } +} diff --git a/FunGame.Core/Interface/Base/ISocket.cs b/FunGame.Core/Interface/Base/ISocket.cs new file mode 100644 index 0000000..fec6584 --- /dev/null +++ b/FunGame.Core/Interface/Base/ISocket.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Interface.Base +{ + internal interface ISocket + { + internal int Send(); + internal int Read(); + } +} diff --git a/FunGame.Core/Others/Config/Config.cs b/FunGame.Core/Others/Config/Config.cs index e49014f..1b036e5 100644 --- a/FunGame.Core/Others/Config/Config.cs +++ b/FunGame.Core/Others/Config/Config.cs @@ -8,6 +8,6 @@ namespace Milimoe.FunGame.Core.Others { public class Config { - + public static Entity.General.Empty EntityInstance = new Entity.General.Empty(); } } diff --git a/FunGame.Core/Service/PluginManager.cs b/FunGame.Core/Service/PluginManager.cs index 6941e62..74bacb9 100644 --- a/FunGame.Core/Service/PluginManager.cs +++ b/FunGame.Core/Service/PluginManager.cs @@ -6,7 +6,8 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Service { - public class PluginManager + internal class PluginManager { + } } diff --git a/FunGame.Core/Service/RedisManager.cs b/FunGame.Core/Service/RedisManager.cs index 438def3..df8da97 100644 --- a/FunGame.Core/Service/RedisManager.cs +++ b/FunGame.Core/Service/RedisManager.cs @@ -6,7 +6,8 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Service { - public class RedisManager + internal class RedisManager { + } } diff --git a/FunGame.Core/Service/ResourceManager.cs b/FunGame.Core/Service/ResourceManager.cs index c1973c2..9c930af 100644 --- a/FunGame.Core/Service/ResourceManager.cs +++ b/FunGame.Core/Service/ResourceManager.cs @@ -6,7 +6,8 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Service { - public class ResourceManager + internal class ResourceManager { + } } diff --git a/FunGame.Core/Service/SQLManager.cs b/FunGame.Core/Service/SQLManager.cs new file mode 100644 index 0000000..20748c0 --- /dev/null +++ b/FunGame.Core/Service/SQLManager.cs @@ -0,0 +1,109 @@ +using Milimoe.FunGame.Core.Entity.Enum; +using Milimoe.FunGame.Core.Interface.Base; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Milimoe.FunGame.Core.Service +{ + internal class SQLManager : ISQLService + { + int ISQLService.AddRow(object[]? objs) + { + throw new NotImplementedException(); + } + + int ISQLService.AddRow(StringBuilder script) + { + throw new NotImplementedException(); + } + + int ISQLService.DeleteRow(object[]? objs) + { + throw new NotImplementedException(); + } + + int ISQLService.DeleteRow(StringBuilder script) + { + throw new NotImplementedException(); + } + + ProxyResult ISQLService.Execute() + { + throw new NotImplementedException(); + } + + ProxyResult ISQLService.Execute(object[]? objs) + { + throw new NotImplementedException(); + } + + ProxyResult ISQLService.Execute(StringBuilder script) + { + throw new NotImplementedException(); + } + + DataSet ISQLService.GetData(EntityType type, object[]? objs) + { + throw new NotImplementedException(); + } + + DataSet ISQLService.GetData(object[]? objs) + { + throw new NotImplementedException(); + } + + DataSet ISQLService.GetData(StringBuilder script) + { + throw new NotImplementedException(); + } + + DataRow ISQLService.GetDataRow(EntityType type, object[]? objs) + { + throw new NotImplementedException(); + } + + DataRow ISQLService.GetDataRow(DataSet set, object[]? objs) + { + throw new NotImplementedException(); + } + + DataRow ISQLService.GetDataRow(DataTable table, object[]? objs) + { + throw new NotImplementedException(); + } + + DataRow ISQLService.GetDataRow(StringBuilder script) + { + throw new NotImplementedException(); + } + + DataTable ISQLService.GetDataTable(EntityType type, object[]? objs) + { + throw new NotImplementedException(); + } + + DataTable ISQLService.GetDataTable(object[]? objs) + { + throw new NotImplementedException(); + } + + DataTable ISQLService.GetDataTable(StringBuilder script) + { + throw new NotImplementedException(); + } + + int ISQLService.UpdateRow(object[]? objs) + { + throw new NotImplementedException(); + } + + int ISQLService.UpdateRow(StringBuilder script) + { + throw new NotImplementedException(); + } + } +} diff --git a/FunGame.Core/Service/SocketManager.cs b/FunGame.Core/Service/SocketManager.cs index 474d0a9..efb847b 100644 --- a/FunGame.Core/Service/SocketManager.cs +++ b/FunGame.Core/Service/SocketManager.cs @@ -1,4 +1,5 @@ -using System; +using Milimoe.FunGame.Core.Interface.Base; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +7,16 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Service { - public class SocketManager + internal class SocketManager : ISocket { + int ISocket.Read() + { + throw new NotImplementedException(); + } + + int ISocket.Send() + { + throw new NotImplementedException(); + } } } diff --git a/FunGame.Core/Service/ThreadManager.cs b/FunGame.Core/Service/ThreadManager.cs index 7bedeee..d4abb68 100644 --- a/FunGame.Core/Service/ThreadManager.cs +++ b/FunGame.Core/Service/ThreadManager.cs @@ -6,7 +6,8 @@ using System.Threading.Tasks; namespace Milimoe.FunGame.Core.Service { - public class ThreadManager + internal class ThreadManager { + } } diff --git a/FunGame.Desktop/Others/Config/Config.cs b/FunGame.Desktop/Others/Config/Config.cs index 83f12ad..2753cb7 100644 --- a/FunGame.Desktop/Others/Config/Config.cs +++ b/FunGame.Desktop/Others/Config/Config.cs @@ -14,7 +14,7 @@ namespace Milimoe.FunGame.Desktop.Others /** * Game Configs */ - public static FunGameEnums.FunGame FunGameType = FunGameEnums.FunGame.FunGame_Desktop; + public static FunGameEnum.FunGame FunGameType = FunGameEnum.FunGame.FunGame_Desktop; public static ReflectionHelper ReflectionHelper = new(); /** diff --git a/FunGame.Desktop/UI/Main/Main.cs b/FunGame.Desktop/UI/Main/Main.cs index 6f1b3bd..18b6c86 100644 --- a/FunGame.Desktop/UI/Main/Main.cs +++ b/FunGame.Desktop/UI/Main/Main.cs @@ -255,7 +255,7 @@ namespace Milimoe.FunGame.Desktop.UI if (SocketHelper != null && Config.FunGame_isAutoLogin) { // 自动登录 - SocketHelper.WebHelpMethod((int)SocketHelperMethod.Login); + SocketHelper.GetSocketHelperMethod((int)SocketHelperMethod.Login); } }; if (InvokeRequired) @@ -355,13 +355,13 @@ namespace Milimoe.FunGame.Desktop.UI { if (SocketHelper != null) { - SocketHelper.WebHelpMethod((int)SocketHelperMethod.CloseSocket); + SocketHelper.GetSocketHelperMethod((int)SocketHelperMethod.CloseSocket); SocketHelper = null; } Config.FunGame_isRetrying = true; Application.DoEvents(); SocketHelper = new SocketHelper(main); - SocketHelper.WebHelpMethod((int)SocketHelperMethod.CreateSocket); // Invoke -> CreateSocket + SocketHelper.GetSocketHelperMethod((int)SocketHelperMethod.CreateSocket); // Invoke -> CreateSocket } } catch @@ -643,7 +643,7 @@ namespace Milimoe.FunGame.Desktop.UI { switch (i) { - case (int)StartMatch_State.Matching: + case (int)StartMatchState.Matching: // 开始匹配 Config.FunGame_isMatching = true; int loop = 0; @@ -665,18 +665,18 @@ namespace Milimoe.FunGame.Desktop.UI }; if (InvokeRequired) { - Invoke(StartMatch_Action, (int)StartMatch_State.Success, new object[] { roomid }); + Invoke(StartMatch_Action, (int)StartMatchState.Success, new object[] { roomid }); } else { - StartMatch_Action((int)StartMatch_State.Success, new object[] { roomid }); + StartMatch_Action((int)StartMatchState.Success, new object[] { roomid }); } break; } } }); break; - case (int)StartMatch_State.Success: + case (int)StartMatchState.Success: Config.FunGame_isMatching = false; // 匹配成功返回房间号 roomid = "-1"; @@ -701,15 +701,15 @@ namespace Milimoe.FunGame.Desktop.UI }; if (InvokeRequired) { - Invoke(StartMatch_Action, (int)StartMatch_State.Enable, new object[] { true }); + Invoke(StartMatch_Action, (int)StartMatchState.Enable, new object[] { true }); } else { - StartMatch_Action((int)StartMatch_State.Enable, new object[] { true }); + StartMatch_Action((int)StartMatchState.Enable, new object[] { true }); } MatchFunGame = null; break; - case (int)StartMatch_State.Enable: + case (int)StartMatchState.Enable: // 设置匹配过程中的各种按钮是否可用 bool isPause = false; if (objs != null) isPause = (bool)objs[0]; @@ -720,7 +720,7 @@ namespace Milimoe.FunGame.Desktop.UI RoomBox.Enabled = isPause; Login.Enabled = isPause; break; - case (int)StartMatch_State.Cancel: + case (int)StartMatchState.Cancel: WritelnGameInfo(GetNowShortTime() + " 终止匹配"); WritelnGameInfo("[ " + Usercfg.LoginUserName + " ] 已终止匹配。"); Config.FunGame_isMatching = false; @@ -730,11 +730,11 @@ namespace Milimoe.FunGame.Desktop.UI }; if (InvokeRequired) { - Invoke(StartMatch_Action, (int)StartMatch_State.Enable, new object[] { true }); + Invoke(StartMatch_Action, (int)StartMatchState.Enable, new object[] { true }); } else { - StartMatch_Action((int)StartMatch_State.Enable, new object[] { true }); + StartMatch_Action((int)StartMatchState.Enable, new object[] { true }); } MatchFunGame = null; StopMatch.Visible = false; @@ -783,11 +783,11 @@ namespace Milimoe.FunGame.Desktop.UI }; if (InvokeRequired) { - Invoke(StartMatch_Action, (int)StartMatch_State.Cancel, new object[] { true }); + Invoke(StartMatch_Action, (int)StartMatchState.Cancel, new object[] { true }); } else { - StartMatch_Action((int)StartMatch_State.Cancel, new object[] { true }); + StartMatch_Action((int)StartMatchState.Cancel, new object[] { true }); } } @@ -854,21 +854,21 @@ namespace Milimoe.FunGame.Desktop.UI } switch (i) { - case (int)CreateRoom_State.Creating: + case (int)CreateRoomState.Creating: CreateRoom_Action = (i, objs) => { CreateRoom_Method(i, objs); }; if (InvokeRequired) { - Invoke(CreateRoom_Action, (int)CreateRoom_State.Success, new object[] { roomtype }); + Invoke(CreateRoom_Action, (int)CreateRoomState.Success, new object[] { roomtype }); } else { - CreateRoom_Action((int)CreateRoom_State.Success, new object[] { roomtype }); + CreateRoom_Action((int)CreateRoomState.Success, new object[] { roomtype }); } break; - case (int)CreateRoom_State.Success: + case (int)CreateRoomState.Success: roomid = Convert.ToString(new Random().Next(1, 10000)); SetRoomid(roomid); InRoom(); @@ -919,7 +919,7 @@ namespace Milimoe.FunGame.Desktop.UI /// private void ShowFunGameInfo() { - WritelnGameInfo(FunGameEnums.GetInfo(Config.FunGameType)); + WritelnGameInfo(FunGameEnum.GetInfo(Config.FunGameType)); } #endregion @@ -937,7 +937,7 @@ namespace Milimoe.FunGame.Desktop.UI { if (SocketHelper != null) { - SocketHelper.WebHelpMethod((int)SocketHelperMethod.CloseSocket); + SocketHelper.GetSocketHelperMethod((int)SocketHelperMethod.CloseSocket); SocketHelper = null; } Environment.Exit(0); @@ -997,7 +997,7 @@ namespace Milimoe.FunGame.Desktop.UI StartMatch.Visible = false; StopMatch.Visible = true; // 暂停其他按钮 - StartMatch_Method((int)StartMatch_State.Enable, new object[] { false }); + StartMatch_Method((int)StartMatchState.Enable, new object[] { false }); // 创建委托,开始匹配 StartMatch_Action = (i, objs) => { @@ -1009,11 +1009,11 @@ namespace Milimoe.FunGame.Desktop.UI if (InvokeRequired) { - Invoke(StartMatch_Action, (int)StartMatch_State.Matching, null); + Invoke(StartMatch_Action, (int)StartMatchState.Matching, null); } else { - StartMatch_Action((int)StartMatch_State.Matching, null); + StartMatch_Action((int)StartMatchState.Matching, null); } }); } @@ -1058,11 +1058,11 @@ namespace Milimoe.FunGame.Desktop.UI }; if (InvokeRequired) { - Invoke(CreateRoom_Action, (int)CreateRoom_State.Creating, new object[] { roomtype }); + Invoke(CreateRoom_Action, (int)CreateRoomState.Creating, new object[] { roomtype }); } else { - CreateRoom_Action((int)CreateRoom_State.Creating, new object[] { roomtype }); + CreateRoom_Action((int)CreateRoomState.Creating, new object[] { roomtype }); } } @@ -1105,7 +1105,7 @@ namespace Milimoe.FunGame.Desktop.UI { if (ShowMessage.OKCancelMessage("你确定要退出登录吗?", "退出登录") == MessageResult.OK) { - if (SocketHelper == null || !SocketHelper.WebHelpMethod((int)SocketHelperMethod.Logout)) + if (SocketHelper == null || !SocketHelper.GetSocketHelperMethod((int)SocketHelperMethod.Logout)) ShowMessage.WarningMessage("请求无效:退出登录失败!"); } } @@ -1118,7 +1118,7 @@ namespace Milimoe.FunGame.Desktop.UI private void Login_Click(object sender, EventArgs e) { if (SocketHelper != null && Config.FunGame_isConnected) - SocketHelper.WebHelpMethod((int)SocketHelperMethod.Login); + SocketHelper.GetSocketHelperMethod((int)SocketHelperMethod.Login); else ShowMessage.WarningMessage("请先连接服务器!"); } @@ -1352,11 +1352,11 @@ namespace Milimoe.FunGame.Desktop.UI }; if (InvokeRequired) { - Invoke(CreateRoom_Action, (int)CreateRoom_State.Creating, new object[] { Config.GameMode_Mix }); + Invoke(CreateRoom_Action, (int)CreateRoomState.Creating, new object[] { Config.GameMode_Mix }); } else { - CreateRoom_Action((int)CreateRoom_State.Creating, new object[] { Config.GameMode_Mix }); + CreateRoom_Action((int)CreateRoomState.Creating, new object[] { Config.GameMode_Mix }); } break; case Config.FunGame_CreateTeam: @@ -1366,11 +1366,11 @@ namespace Milimoe.FunGame.Desktop.UI }; if (InvokeRequired) { - Invoke(CreateRoom_Action, (int)CreateRoom_State.Creating, new object[] { Config.GameMode_Team }); + Invoke(CreateRoom_Action, (int)CreateRoomState.Creating, new object[] { Config.GameMode_Team }); } else { - CreateRoom_Action((int)CreateRoom_State.Creating, new object[] { Config.GameMode_Team }); + CreateRoom_Action((int)CreateRoomState.Creating, new object[] { Config.GameMode_Team }); } break; case Config.FunGame_StartGame: @@ -1402,13 +1402,13 @@ namespace Milimoe.FunGame.Desktop.UI case Config.FunGame_Disconnect: if (Config.FunGame_isConnected && SocketHelper != null) { - SocketHelper.WebHelpMethod((int)SocketHelperMethod.Disconnect); + SocketHelper.GetSocketHelperMethod((int)SocketHelperMethod.Disconnect); } break; case Config.FunGame_DisconnectWhenNotLogin: if (Config.FunGame_isConnected && SocketHelper != null) { - SocketHelper.WebHelpMethod((int)SocketHelperMethod.CloseSocket); + SocketHelper.GetSocketHelperMethod((int)SocketHelperMethod.CloseSocket); GetMessage(SocketHelper, Config.SocketHelper_Disconnect); WritelnGameInfo(GetNowShortTime() + " >> 你已成功断开与服务器的连接。 "); } diff --git a/FunGame.Desktop/Utils/SocketHelper.cs b/FunGame.Desktop/Utils/SocketHelper.cs index bbee433..5364b35 100644 --- a/FunGame.Desktop/Utils/SocketHelper.cs +++ b/FunGame.Desktop/Utils/SocketHelper.cs @@ -33,37 +33,37 @@ namespace Milimoe.FunGame.Desktop.Utils } /// - /// 选择WebHelp分支方法 + /// 选择SocketHelper分支方法 /// /// 分支方法ID - public bool WebHelpMethod(int i) + public bool GetSocketHelperMethod(int i) { switch (i) { - case (int)SocketHelperMethod.CreateSocket: + case (int)Core.Entity.Enum.SocketHelperMethod.CreateSocket: CreateSocket(); break; - case (int)SocketHelperMethod.CloseSocket: + case (int)Core.Entity.Enum.SocketHelperMethod.CloseSocket: Close(); break; - case (int)SocketHelperMethod.StartSocketHelper: + case (int)Core.Entity.Enum.SocketHelperMethod.StartSocketHelper: StartSocketHelper(); break; - case (int)SocketHelperMethod.Login: + case (int)Core.Entity.Enum.SocketHelperMethod.Login: if (client != null) { - Send((int)SocketMessageType.CheckLogin, new object[] { Main, client, UserFactory.GetInstance("Mili") }); + Send((int)SocketMessageType.CheckLogin, new object[] { Main, client, FactoryHelper.New("Mili") }); return true; } return false; - case (int)SocketHelperMethod.Logout: + case (int)Core.Entity.Enum.SocketHelperMethod.Logout: if (client != null && Usercfg.LoginUser != null) { Send((int)SocketMessageType.Logout, new object[] { Main, client, Usercfg.LoginUser }); return true; } return false; - case (int)SocketHelperMethod.Disconnect: + case (int)Core.Entity.Enum.SocketHelperMethod.Disconnect: if (client != null) { Send((int)SocketMessageType.Disconnect, new object[] { Main, client });