forked from project-redbud/FunGame-Core
完善工厂和添加枚举,接口等
This commit is contained in:
parent
77fc7042e4
commit
7858261974
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Factory
|
||||
{
|
||||
public class CharacterFactory
|
||||
internal class CharacterFactory
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Api.Factory
|
||||
{
|
||||
public class InventoryFactory
|
||||
internal class InventoryFactory
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
56
FunGame.Core/Api/Utility/FactoryHelper.cs
Normal file
56
FunGame.Core/Api/Utility/FactoryHelper.cs
Normal file
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取一个可能为NULL的实例
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Entity类</typeparam>
|
||||
/// <param name="objs">构造函数的参数</param>
|
||||
/// <returns></returns>
|
||||
public static object? GetInstance<T>(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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一个不可能为NULL的实例
|
||||
/// Item默认返回PassiveItem
|
||||
/// Skill默认返回PassiveSkill
|
||||
/// 若无法找到T,返回唯一的空对象
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Entity类</typeparam>
|
||||
/// <param name="objs">构造函数的参数</param>
|
||||
/// <returns></returns>
|
||||
public static object New<T>(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -57,14 +57,14 @@ namespace Milimoe.FunGame.Core.Api.Utility
|
||||
/// <summary>
|
||||
/// 初始化ini模板文件
|
||||
/// </summary>
|
||||
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
|
||||
*/
|
||||
|
||||
17
FunGame.Core/Api/Utility/Singleton.cs
Normal file
17
FunGame.Core/Api/Utility/Singleton.cs
Normal file
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 单例表:表中的对象以类名作为Key保存,并以Key获取该对象,Key具有唯一约束
|
||||
/// 用于储存单例对象使用
|
||||
/// </summary>
|
||||
public class Singleton
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
{
|
||||
26
FunGame.Core/Entity/Enum/MethodEnum.cs
Normal file
26
FunGame.Core/Entity/Enum/MethodEnum.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
30
FunGame.Core/Entity/Enum/ResultEnum.cs
Normal file
30
FunGame.Core/Entity/Enum/ResultEnum.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
46
FunGame.Core/Entity/Enum/StateEnum.cs
Normal file
46
FunGame.Core/Entity/Enum/StateEnum.cs
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
@ -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接口和实现时,需要在这里同步添加:InterfaceType、InterfaceMethod
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
}
|
||||
@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
28
FunGame.Core/Interface/Base/ISQLProxy.cs
Normal file
28
FunGame.Core/Interface/Base/ISQLProxy.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
31
FunGame.Core/Interface/Base/ISQLService.cs
Normal file
31
FunGame.Core/Interface/Base/ISQLService.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
14
FunGame.Core/Interface/Base/ISocket.cs
Normal file
14
FunGame.Core/Interface/Base/ISocket.cs
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
@ -8,6 +8,6 @@ namespace Milimoe.FunGame.Core.Others
|
||||
{
|
||||
public class Config
|
||||
{
|
||||
|
||||
public static Entity.General.Empty EntityInstance = new Entity.General.Empty();
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Service
|
||||
{
|
||||
public class PluginManager
|
||||
internal class PluginManager
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Service
|
||||
{
|
||||
public class RedisManager
|
||||
internal class RedisManager
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Service
|
||||
{
|
||||
public class ResourceManager
|
||||
internal class ResourceManager
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
109
FunGame.Core/Service/SQLManager.cs
Normal file
109
FunGame.Core/Service/SQLManager.cs
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,8 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Milimoe.FunGame.Core.Service
|
||||
{
|
||||
public class ThreadManager
|
||||
internal class ThreadManager
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
/**
|
||||
|
||||
@ -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
|
||||
/// </summary>
|
||||
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() + " >> 你已成功断开与服务器的连接。 ");
|
||||
}
|
||||
|
||||
@ -33,37 +33,37 @@ namespace Milimoe.FunGame.Desktop.Utils
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择WebHelp分支方法
|
||||
/// 选择SocketHelper分支方法
|
||||
/// </summary>
|
||||
/// <param name="i">分支方法ID</param>
|
||||
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<User>("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 });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user