From e7214c3fb937eea2d287467e864b1ab84310a133 Mon Sep 17 00:00:00 2001
From: milimoe <110188673+milimoe@users.noreply.github.com>
Date: Thu, 23 Nov 2023 00:43:34 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=9A=84=E6=9E=9A?=
=?UTF-8?q?=E4=B8=BE=E3=80=81=E5=AD=97=E7=AC=A6=E5=B8=B8=E9=87=8F=E5=92=8C?=
=?UTF-8?q?=E6=96=B9=E6=B3=95=20(#59)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* 添加大量新的枚举,添加缺少的枚举字符串,修改枚举转字符串方法的位置
* 添加StartGame和Gaming的SocketHandler方法
* 添加MainInvokeType.StartGame
* 优化代码格式
* 添加默认的User.ToString()
* 添加EndGame
* 添加GameMode.GetTypeString
* 添加GameMode.GetRoomType
---
Api/Transmittal/DataRequest.cs | 32 +---
Api/Transmittal/SQLHelper.cs | 2 +-
Api/Utility/Factory.cs | 7 +-
Api/Utility/Implement.cs | 6 +-
Api/Utility/JsonTool.cs | 3 +-
Api/Utility/PluginLoader.cs | 168 +++++++++----------
Api/Utility/TextReader.cs | 6 +-
Api/Utility/TwoFactorAuthenticator.cs | 2 +-
Controller/RunTimeController.cs | 44 ++++-
Entity/BaseEntity.cs | 3 +-
Entity/Character/Character.cs | 6 +-
Entity/System/Room.cs | 2 +-
Entity/User/User.cs | 10 ++
Interface/Base/IMailSender.cs | 4 +-
Interface/Event/EventHandlers.cs | 168 +++++++++----------
Library/Common/Architecture/AsyncAwaiter.cs | 4 +-
Library/Common/Architecture/Authenticator.cs | 2 +-
Library/Common/Architecture/TaskAwaiter.cs | 2 +-
Library/Common/Network/ClientSocket.cs | 4 +-
Library/Common/Network/MailObject.cs | 2 +-
Library/Common/Network/ServerSocket.cs | 19 +--
Library/Common/Network/Socket.cs | 13 +-
Library/Common/Plugin/Example.cs | 2 +-
Library/Constant/ConstantSet.cs | 146 +++++++++++++++-
Library/Constant/ResultEnum.cs | 2 +-
Library/Constant/StateEnum.cs | 9 +
Library/Constant/TypeEnum.cs | 53 +++++-
Library/Exception/Exception.cs | 2 +-
Library/SQLScript/Entity/RoomQuery.cs | 4 +-
Library/SQLScript/Entity/UserQuery.cs | 12 +-
Model/FunGameConfig.cs | 2 +-
Service/JsonManager.cs | 8 +-
Service/MailManager.cs | 2 +-
Service/ModelManager.cs | 4 +-
Service/SocketManager.cs | 24 +--
35 files changed, 471 insertions(+), 308 deletions(-)
diff --git a/Api/Transmittal/DataRequest.cs b/Api/Transmittal/DataRequest.cs
index fdc81cc..580923a 100644
--- a/Api/Transmittal/DataRequest.cs
+++ b/Api/Transmittal/DataRequest.cs
@@ -87,7 +87,7 @@ namespace Milimoe.FunGame.Core.Api.Transmittal
Worker.SendRequest();
return Result;
}
-
+
///
/// 异步向服务器发送数据请求
///
@@ -142,7 +142,7 @@ namespace Milimoe.FunGame.Core.Api.Transmittal
_Error = e.GetErrorInfo();
}
}
-
+
public async Task SendRequestAsync()
{
try
@@ -195,34 +195,6 @@ namespace Milimoe.FunGame.Core.Api.Transmittal
}
}
- ///
- /// 获取Type的等效字符串
- ///
- ///
- ///
- public static string GetTypeString(DataRequestType type)
- {
- return type switch
- {
- DataRequestType.RunTime_Logout => DataRequestSet.RunTime_Logout,
- DataRequestType.Main_GetNotice => DataRequestSet.Main_GetNotice,
- DataRequestType.Main_CreateRoom => DataRequestSet.Main_CreateRoom,
- DataRequestType.Main_UpdateRoom => DataRequestSet.Main_UpdateRoom,
- DataRequestType.Main_IntoRoom => DataRequestSet.Main_IntoRoom,
- DataRequestType.Main_QuitRoom => DataRequestSet.Main_QuitRoom,
- DataRequestType.Main_MatchRoom => DataRequestSet.Main_MatchRoom,
- DataRequestType.Main_Chat => DataRequestSet.Main_Chat,
- DataRequestType.Reg_GetRegVerifyCode => DataRequestSet.Reg_GetRegVerifyCode,
- DataRequestType.Login_Login => DataRequestSet.Login_Login,
- DataRequestType.Login_GetFindPasswordVerifyCode => DataRequestSet.Login_GetFindPasswordVerifyCode,
- DataRequestType.Login_UpdatePassword => DataRequestSet.Login_UpdatePassword,
- DataRequestType.Room_GetRoomSettings => DataRequestSet.Room_GetRoomSettings,
- DataRequestType.Room_GetRoomPlayerCount => DataRequestSet.Room_GetRoomPlayerCount,
- DataRequestType.Room_UpdateRoomMaster => DataRequestSet.Room_UpdateRoomMaster,
- _ => DataRequestSet.UnKnown
- };
- }
-
///
/// 反序列化Hashtable中的Json对象
///
diff --git a/Api/Transmittal/SQLHelper.cs b/Api/Transmittal/SQLHelper.cs
index 506273c..eb669c3 100644
--- a/Api/Transmittal/SQLHelper.cs
+++ b/Api/Transmittal/SQLHelper.cs
@@ -57,7 +57,7 @@ namespace Milimoe.FunGame.Core.Api.Transmittal
{
return null;
}
-
+
///
/// 执行指定的命令查询DataRow(可选实现)
///
diff --git a/Api/Utility/Factory.cs b/Api/Utility/Factory.cs
index eb4f755..b509742 100644
--- a/Api/Utility/Factory.cs
+++ b/Api/Utility/Factory.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Data;
+using System.Data;
using Milimoe.FunGame.Core.Api.Factory;
using Milimoe.FunGame.Core.Entity;
using Milimoe.FunGame.Core.Library.Constant;
@@ -156,7 +155,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
{
return SkillFactory.Create(type);
}
-
+
///
/// 获取主动技能实例
///
@@ -165,7 +164,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
{
return (ActiveSkill)SkillFactory.Create(SkillType.Active);
}
-
+
///
/// 获取被动技能实例
///
diff --git a/Api/Utility/Implement.cs b/Api/Utility/Implement.cs
index e942047..f72eae5 100644
--- a/Api/Utility/Implement.cs
+++ b/Api/Utility/Implement.cs
@@ -1,5 +1,5 @@
-using Milimoe.FunGame.Core.Library.Constant;
-using System.Reflection;
+using System.Reflection;
+using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Api.Utility
{
@@ -88,7 +88,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
return value;
else return null;
}
-
+
return null;
}
}
diff --git a/Api/Utility/JsonTool.cs b/Api/Utility/JsonTool.cs
index f3af063..1a71fad 100644
--- a/Api/Utility/JsonTool.cs
+++ b/Api/Utility/JsonTool.cs
@@ -1,5 +1,4 @@
using System.Collections;
-using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using Milimoe.FunGame.Core.Library.Common.Architecture;
@@ -31,7 +30,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
if (!JsonSerializerOptions.Converters.Contains(converter))
JsonSerializerOptions.Converters.Add(converter);
}
-
+
///
/// 注册多个自定义转换器,支持
///
diff --git a/Api/Utility/PluginLoader.cs b/Api/Utility/PluginLoader.cs
index 939d7c5..7c4e799 100644
--- a/Api/Utility/PluginLoader.cs
+++ b/Api/Utility/PluginLoader.cs
@@ -20,7 +20,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
return loader;
}
- public void OnBeforeConnectEvent(object sender,ConnectEventArgs e)
+ public void OnBeforeConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -28,7 +28,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterConnectEvent(object sender,ConnectEventArgs e)
+ public void OnAfterConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -36,7 +36,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedConnectEvent(object sender,ConnectEventArgs e)
+ public void OnSucceedConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -44,7 +44,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedConnectEvent(object sender,ConnectEventArgs e)
+ public void OnFailedConnectEvent(object sender, ConnectEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -52,7 +52,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeDisconnectEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -60,7 +60,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterDisconnectEvent(object sender,GeneralEventArgs e)
+ public void OnAfterDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -68,7 +68,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedDisconnectEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -76,7 +76,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedDisconnectEvent(object sender,GeneralEventArgs e)
+ public void OnFailedDisconnectEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -84,7 +84,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeLoginEvent(object sender,LoginEventArgs e)
+ public void OnBeforeLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -92,7 +92,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterLoginEvent(object sender,LoginEventArgs e)
+ public void OnAfterLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -100,7 +100,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedLoginEvent(object sender,LoginEventArgs e)
+ public void OnSucceedLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -108,7 +108,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedLoginEvent(object sender,LoginEventArgs e)
+ public void OnFailedLoginEvent(object sender, LoginEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -116,7 +116,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeLogoutEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -124,7 +124,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterLogoutEvent(object sender,GeneralEventArgs e)
+ public void OnAfterLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -132,7 +132,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedLogoutEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -140,7 +140,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedLogoutEvent(object sender,GeneralEventArgs e)
+ public void OnFailedLogoutEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -148,7 +148,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeRegEvent(object sender,RegisterEventArgs e)
+ public void OnBeforeRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -156,7 +156,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterRegEvent(object sender,RegisterEventArgs e)
+ public void OnAfterRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -164,7 +164,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedRegEvent(object sender,RegisterEventArgs e)
+ public void OnSucceedRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -172,7 +172,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedRegEvent(object sender,RegisterEventArgs e)
+ public void OnFailedRegEvent(object sender, RegisterEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -180,7 +180,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeIntoRoomEvent(object sender,RoomEventArgs e)
+ public void OnBeforeIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -188,7 +188,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterIntoRoomEvent(object sender,RoomEventArgs e)
+ public void OnAfterIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -196,7 +196,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedIntoRoomEvent(object sender,RoomEventArgs e)
+ public void OnSucceedIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -204,7 +204,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedIntoRoomEvent(object sender,RoomEventArgs e)
+ public void OnFailedIntoRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -212,7 +212,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeSendTalkEvent(object sender,SendTalkEventArgs e)
+ public void OnBeforeSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -220,7 +220,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterSendTalkEvent(object sender,SendTalkEventArgs e)
+ public void OnAfterSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -228,7 +228,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedSendTalkEvent(object sender,SendTalkEventArgs e)
+ public void OnSucceedSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -236,7 +236,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedSendTalkEvent(object sender,SendTalkEventArgs e)
+ public void OnFailedSendTalkEvent(object sender, SendTalkEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -244,7 +244,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeCreateRoomEvent(object sender,RoomEventArgs e)
+ public void OnBeforeCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -252,7 +252,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterCreateRoomEvent(object sender,RoomEventArgs e)
+ public void OnAfterCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -260,7 +260,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedCreateRoomEvent(object sender,RoomEventArgs e)
+ public void OnSucceedCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -268,7 +268,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedCreateRoomEvent(object sender,RoomEventArgs e)
+ public void OnFailedCreateRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -276,7 +276,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeQuitRoomEvent(object sender,RoomEventArgs e)
+ public void OnBeforeQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -284,7 +284,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterQuitRoomEvent(object sender,RoomEventArgs e)
+ public void OnAfterQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -292,7 +292,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedQuitRoomEvent(object sender,RoomEventArgs e)
+ public void OnSucceedQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -300,7 +300,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedQuitRoomEvent(object sender,RoomEventArgs e)
+ public void OnFailedQuitRoomEvent(object sender, RoomEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -308,7 +308,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeChangeRoomSettingEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -316,7 +316,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterChangeRoomSettingEvent(object sender,GeneralEventArgs e)
+ public void OnAfterChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -324,7 +324,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedChangeRoomSettingEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -332,7 +332,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedChangeRoomSettingEvent(object sender,GeneralEventArgs e)
+ public void OnFailedChangeRoomSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -340,7 +340,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeStartMatchEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -348,7 +348,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterStartMatchEvent(object sender,GeneralEventArgs e)
+ public void OnAfterStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -356,7 +356,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedStartMatchEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -364,7 +364,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedStartMatchEvent(object sender,GeneralEventArgs e)
+ public void OnFailedStartMatchEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -372,7 +372,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeStartGameEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -380,7 +380,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterStartGameEvent(object sender,GeneralEventArgs e)
+ public void OnAfterStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -388,7 +388,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedStartGameEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -396,7 +396,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedStartGameEvent(object sender,GeneralEventArgs e)
+ public void OnFailedStartGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -404,7 +404,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeChangeProfileEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -412,7 +412,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterChangeProfileEvent(object sender,GeneralEventArgs e)
+ public void OnAfterChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -420,7 +420,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedChangeProfileEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -428,7 +428,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedChangeProfileEvent(object sender,GeneralEventArgs e)
+ public void OnFailedChangeProfileEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -436,7 +436,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeChangeAccountSettingEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -444,7 +444,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterChangeAccountSettingEvent(object sender,GeneralEventArgs e)
+ public void OnAfterChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -452,7 +452,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedChangeAccountSettingEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -460,7 +460,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedChangeAccountSettingEvent(object sender,GeneralEventArgs e)
+ public void OnFailedChangeAccountSettingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -468,7 +468,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeOpenInventoryEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -476,7 +476,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterOpenInventoryEvent(object sender,GeneralEventArgs e)
+ public void OnAfterOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -484,7 +484,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedOpenInventoryEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -492,7 +492,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedOpenInventoryEvent(object sender,GeneralEventArgs e)
+ public void OnFailedOpenInventoryEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -500,7 +500,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeSignInEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -508,7 +508,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterSignInEvent(object sender,GeneralEventArgs e)
+ public void OnAfterSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -516,7 +516,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedSignInEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -524,7 +524,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedSignInEvent(object sender,GeneralEventArgs e)
+ public void OnFailedSignInEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -532,7 +532,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeOpenStoreEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -540,7 +540,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterOpenStoreEvent(object sender,GeneralEventArgs e)
+ public void OnAfterOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -548,7 +548,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedOpenStoreEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -556,7 +556,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedOpenStoreEvent(object sender,GeneralEventArgs e)
+ public void OnFailedOpenStoreEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -564,7 +564,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeBuyItemEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -572,7 +572,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterBuyItemEvent(object sender,GeneralEventArgs e)
+ public void OnAfterBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -580,7 +580,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedBuyItemEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -588,7 +588,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedBuyItemEvent(object sender,GeneralEventArgs e)
+ public void OnFailedBuyItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -596,7 +596,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeShowRankingEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -604,7 +604,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterShowRankingEvent(object sender,GeneralEventArgs e)
+ public void OnAfterShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -612,7 +612,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedShowRankingEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -620,7 +620,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedShowRankingEvent(object sender,GeneralEventArgs e)
+ public void OnFailedShowRankingEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -628,7 +628,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeUseItemEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -636,7 +636,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterUseItemEvent(object sender,GeneralEventArgs e)
+ public void OnAfterUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -644,7 +644,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedUseItemEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -652,7 +652,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedUseItemEvent(object sender,GeneralEventArgs e)
+ public void OnFailedUseItemEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -660,7 +660,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnBeforeEndGameEvent(object sender,GeneralEventArgs e)
+ public void OnBeforeEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -668,7 +668,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnAfterEndGameEvent(object sender,GeneralEventArgs e)
+ public void OnAfterEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -676,7 +676,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnSucceedEndGameEvent(object sender,GeneralEventArgs e)
+ public void OnSucceedEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
@@ -684,7 +684,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
});
}
- public void OnFailedEndGameEvent(object sender,GeneralEventArgs e)
+ public void OnFailedEndGameEvent(object sender, GeneralEventArgs e)
{
Parallel.ForEach(Plugins.Values, plugin =>
{
diff --git a/Api/Utility/TextReader.cs b/Api/Utility/TextReader.cs
index 9d864e3..0bde9f7 100644
--- a/Api/Utility/TextReader.cs
+++ b/Api/Utility/TextReader.cs
@@ -1,6 +1,4 @@
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
+using System.Runtime.InteropServices;
using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Api.Utility
@@ -138,7 +136,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
public static string ReadTXT(string filename, string path = "")
{
if (path.Trim() != "") path = Path.Combine(path, filename);
- else path = $@"{Environment.CurrentDirectory}\{filename}";
+ else path = $@"{Environment.CurrentDirectory}\{filename}";
if (File.Exists(path))
{
string s = "";
diff --git a/Api/Utility/TwoFactorAuthenticator.cs b/Api/Utility/TwoFactorAuthenticator.cs
index a1aeae4..a53a9d5 100644
--- a/Api/Utility/TwoFactorAuthenticator.cs
+++ b/Api/Utility/TwoFactorAuthenticator.cs
@@ -19,7 +19,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
/// 不使用SQL模式
///
public TwoFactorAuthenticator() { }
-
+
///
/// 使用SQL模式 记录对应账号的密文到数据库中
///
diff --git a/Controller/RunTimeController.cs b/Controller/RunTimeController.cs
index 08abed9..5cf7f31 100644
--- a/Controller/RunTimeController.cs
+++ b/Controller/RunTimeController.cs
@@ -167,7 +167,7 @@ namespace Milimoe.FunGame.Core.Controller
{
return true;
}
-
+
///
/// 此方法将在连接服务器后触发(Connect结果返回前)
/// 客户端可以重写此方法
@@ -240,7 +240,7 @@ namespace Milimoe.FunGame.Core.Controller
}
throw new ConnectFailedException();
}
-
+
///
/// 基于本地已连接的Socket创建长时间运行的数据请求
///
@@ -310,7 +310,7 @@ namespace Milimoe.FunGame.Core.Controller
Close();
SocketHandler_Disconnect(ServerMessage);
break;
-
+
case SocketMessageType.System:
SocketHandler_System(ServerMessage);
break;
@@ -318,23 +318,35 @@ namespace Milimoe.FunGame.Core.Controller
case SocketMessageType.HeartBeat:
SocketHandler_HeartBeat(ServerMessage);
break;
-
+
case SocketMessageType.ForceLogout:
SocketHandler_ForceLogout(ServerMessage);
break;
-
+
case SocketMessageType.Chat:
SocketHandler_Chat(ServerMessage);
break;
-
+
case SocketMessageType.UpdateRoomMaster:
SocketHandler_UpdateRoomMaster(ServerMessage);
break;
-
+
case SocketMessageType.MatchRoom:
SocketHandler_MatchRoom(ServerMessage);
break;
+
+ case SocketMessageType.StartGame:
+ SocketHandler_StartGame(ServerMessage);
+ break;
+
+ case SocketMessageType.EndGame:
+ SocketHandler_EndGame(ServerMessage);
+ break;
+ case SocketMessageType.Gaming:
+ SocketHandler_Gaming(ServerMessage);
+ break;
+
case SocketMessageType.Unknown:
default:
break;
@@ -390,5 +402,23 @@ namespace Milimoe.FunGame.Core.Controller
///
///
protected abstract void SocketHandler_MatchRoom(SocketObject ServerMessage);
+
+ ///
+ /// 客户端接收到开始游戏信息后的处理方法
+ ///
+ ///
+ protected abstract void SocketHandler_StartGame(SocketObject ServerMessage);
+
+ ///
+ /// 客户端接收到游戏结束信息后的处理方法
+ ///
+ ///
+ protected abstract void SocketHandler_EndGame(SocketObject ServerMessage);
+
+ ///
+ /// 客户端接收到局内消息后的处理方法
+ ///
+ ///
+ protected abstract void SocketHandler_Gaming(SocketObject ServerMessage);
}
}
diff --git a/Entity/BaseEntity.cs b/Entity/BaseEntity.cs
index 62bbcab..59bcc0a 100644
--- a/Entity/BaseEntity.cs
+++ b/Entity/BaseEntity.cs
@@ -1,5 +1,4 @@
-using System.Collections;
-using Milimoe.FunGame.Core.Interface.Entity;
+using Milimoe.FunGame.Core.Interface.Entity;
namespace Milimoe.FunGame.Core.Entity
{
diff --git a/Entity/Character/Character.cs b/Entity/Character/Character.cs
index 001a4ea..ee96119 100644
--- a/Entity/Character/Character.cs
+++ b/Entity/Character/Character.cs
@@ -1,5 +1,5 @@
-using Milimoe.FunGame.Core.Library.Constant;
-using System.Collections;
+using System.Collections;
+using Milimoe.FunGame.Core.Library.Constant;
namespace Milimoe.FunGame.Core.Entity
{
@@ -55,7 +55,7 @@ namespace Milimoe.FunGame.Core.Entity
internal Character()
{
-
+
}
}
}
diff --git a/Entity/System/Room.cs b/Entity/System/Room.cs
index 6a227c2..237718d 100644
--- a/Entity/System/Room.cs
+++ b/Entity/System/Room.cs
@@ -6,7 +6,7 @@ namespace Milimoe.FunGame.Core.Entity
public class Room : BaseEntity
{
public static readonly Room Empty = new();
- public override long Id { get => base.Id ; set => base.Id = value; }
+ public override long Id { get => base.Id; set => base.Id = value; }
public string Roomid { get; set; } = "-1";
public DateTime CreateTime { get; set; } = General.DefaultTime;
public User RoomMaster { get; set; } = General.UnknownUserInstance;
diff --git a/Entity/User/User.cs b/Entity/User/User.cs
index 6ead0ce..6f3eb25 100644
--- a/Entity/User/User.cs
+++ b/Entity/User/User.cs
@@ -52,5 +52,15 @@ namespace Milimoe.FunGame.Core.Entity
if (((User)other).Id == Id) return true;
return false;
}
+
+ public override string ToString()
+ {
+ string str = Username;
+ if (NickName != "")
+ {
+ str += " ( " + NickName + " ) ";
+ }
+ return str;
+ }
}
}
diff --git a/Interface/Base/IMailSender.cs b/Interface/Base/IMailSender.cs
index 5a3adf9..daf5008 100644
--- a/Interface/Base/IMailSender.cs
+++ b/Interface/Base/IMailSender.cs
@@ -1,6 +1,4 @@
-using Milimoe.FunGame.Core.Library.Constant;
-
-namespace Milimoe.FunGame.Core.Interface.Base
+namespace Milimoe.FunGame.Core.Interface.Base
{
public interface IMailSender
{
diff --git a/Interface/Event/EventHandlers.cs b/Interface/Event/EventHandlers.cs
index b849cc9..c45d36f 100644
--- a/Interface/Event/EventHandlers.cs
+++ b/Interface/Event/EventHandlers.cs
@@ -25,10 +25,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedConnect;
public event FailedEventHandler? FailedConnect;
- public void OnBeforeConnectEvent(object sender,ConnectEventArgs e);
- public void OnAfterConnectEvent(object sender,ConnectEventArgs e);
- public void OnSucceedConnectEvent(object sender,ConnectEventArgs e);
- public void OnFailedConnectEvent(object sender,ConnectEventArgs e);
+ public void OnBeforeConnectEvent(object sender, ConnectEventArgs e);
+ public void OnAfterConnectEvent(object sender, ConnectEventArgs e);
+ public void OnSucceedConnectEvent(object sender, ConnectEventArgs e);
+ public void OnFailedConnectEvent(object sender, ConnectEventArgs e);
}
public interface IDisconnectEventHandler : IEventHandler
@@ -38,10 +38,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedDisconnect;
public event FailedEventHandler? FailedDisconnect;
- public void OnBeforeDisconnectEvent(object sender,GeneralEventArgs e);
- public void OnAfterDisconnectEvent(object sender,GeneralEventArgs e);
- public void OnSucceedDisconnectEvent(object sender,GeneralEventArgs e);
- public void OnFailedDisconnectEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeDisconnectEvent(object sender, GeneralEventArgs e);
+ public void OnAfterDisconnectEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedDisconnectEvent(object sender, GeneralEventArgs e);
+ public void OnFailedDisconnectEvent(object sender, GeneralEventArgs e);
}
public interface ILoginEventHandler : IEventHandler
@@ -56,10 +56,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedLogin;
public event FailedEventHandler? FailedLogin;
- public void OnBeforeLoginEvent(object sender,LoginEventArgs e);
- public void OnAfterLoginEvent(object sender,LoginEventArgs e);
- public void OnSucceedLoginEvent(object sender,LoginEventArgs e);
- public void OnFailedLoginEvent(object sender,LoginEventArgs e);
+ public void OnBeforeLoginEvent(object sender, LoginEventArgs e);
+ public void OnAfterLoginEvent(object sender, LoginEventArgs e);
+ public void OnSucceedLoginEvent(object sender, LoginEventArgs e);
+ public void OnFailedLoginEvent(object sender, LoginEventArgs e);
}
public interface ILogoutEventHandler : IEventHandler
@@ -69,10 +69,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedLogout;
public event FailedEventHandler? FailedLogout;
- public void OnBeforeLogoutEvent(object sender,GeneralEventArgs e);
- public void OnAfterLogoutEvent(object sender,GeneralEventArgs e);
- public void OnSucceedLogoutEvent(object sender,GeneralEventArgs e);
- public void OnFailedLogoutEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeLogoutEvent(object sender, GeneralEventArgs e);
+ public void OnAfterLogoutEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedLogoutEvent(object sender, GeneralEventArgs e);
+ public void OnFailedLogoutEvent(object sender, GeneralEventArgs e);
}
public interface IRegEventHandler : IEventHandler
@@ -87,10 +87,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedReg;
public event FailedEventHandler? FailedReg;
- public void OnBeforeRegEvent(object sender,RegisterEventArgs e);
- public void OnAfterRegEvent(object sender,RegisterEventArgs e);
- public void OnSucceedRegEvent(object sender,RegisterEventArgs e);
- public void OnFailedRegEvent(object sender,RegisterEventArgs e);
+ public void OnBeforeRegEvent(object sender, RegisterEventArgs e);
+ public void OnAfterRegEvent(object sender, RegisterEventArgs e);
+ public void OnSucceedRegEvent(object sender, RegisterEventArgs e);
+ public void OnFailedRegEvent(object sender, RegisterEventArgs e);
}
public interface IIntoRoomEventHandler : IEventHandler
@@ -105,10 +105,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedIntoRoom;
public event FailedEventHandler? FailedIntoRoom;
- public void OnBeforeIntoRoomEvent(object sender,RoomEventArgs e);
- public void OnAfterIntoRoomEvent(object sender,RoomEventArgs e);
- public void OnSucceedIntoRoomEvent(object sender,RoomEventArgs e);
- public void OnFailedIntoRoomEvent(object sender,RoomEventArgs e);
+ public void OnBeforeIntoRoomEvent(object sender, RoomEventArgs e);
+ public void OnAfterIntoRoomEvent(object sender, RoomEventArgs e);
+ public void OnSucceedIntoRoomEvent(object sender, RoomEventArgs e);
+ public void OnFailedIntoRoomEvent(object sender, RoomEventArgs e);
}
public interface ISendTalkEventHandler : IEventHandler
@@ -123,10 +123,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedSendTalk;
public event FailedEventHandler? FailedSendTalk;
- public void OnBeforeSendTalkEvent(object sender,SendTalkEventArgs e);
- public void OnAfterSendTalkEvent(object sender,SendTalkEventArgs e);
- public void OnSucceedSendTalkEvent(object sender,SendTalkEventArgs e);
- public void OnFailedSendTalkEvent(object sender,SendTalkEventArgs e);
+ public void OnBeforeSendTalkEvent(object sender, SendTalkEventArgs e);
+ public void OnAfterSendTalkEvent(object sender, SendTalkEventArgs e);
+ public void OnSucceedSendTalkEvent(object sender, SendTalkEventArgs e);
+ public void OnFailedSendTalkEvent(object sender, SendTalkEventArgs e);
}
public interface ICreateRoomEventHandler : IEventHandler
@@ -141,10 +141,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedCreateRoom;
public event FailedEventHandler? FailedCreateRoom;
- public void OnBeforeCreateRoomEvent(object sender,RoomEventArgs e);
- public void OnAfterCreateRoomEvent(object sender,RoomEventArgs e);
- public void OnSucceedCreateRoomEvent(object sender,RoomEventArgs e);
- public void OnFailedCreateRoomEvent(object sender,RoomEventArgs e);
+ public void OnBeforeCreateRoomEvent(object sender, RoomEventArgs e);
+ public void OnAfterCreateRoomEvent(object sender, RoomEventArgs e);
+ public void OnSucceedCreateRoomEvent(object sender, RoomEventArgs e);
+ public void OnFailedCreateRoomEvent(object sender, RoomEventArgs e);
}
public interface IQuitRoomEventHandler : IEventHandler
@@ -159,10 +159,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedQuitRoom;
public event FailedEventHandler? FailedQuitRoom;
- public void OnBeforeQuitRoomEvent(object sender,RoomEventArgs e);
- public void OnAfterQuitRoomEvent(object sender,RoomEventArgs e);
- public void OnSucceedQuitRoomEvent(object sender,RoomEventArgs e);
- public void OnFailedQuitRoomEvent(object sender,RoomEventArgs e);
+ public void OnBeforeQuitRoomEvent(object sender, RoomEventArgs e);
+ public void OnAfterQuitRoomEvent(object sender, RoomEventArgs e);
+ public void OnSucceedQuitRoomEvent(object sender, RoomEventArgs e);
+ public void OnFailedQuitRoomEvent(object sender, RoomEventArgs e);
}
public interface IChangeRoomSettingEventHandler : IEventHandler
@@ -172,10 +172,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedChangeRoomSetting;
public event FailedEventHandler? FailedChangeRoomSetting;
- public void OnBeforeChangeRoomSettingEvent(object sender,GeneralEventArgs e);
- public void OnAfterChangeRoomSettingEvent(object sender,GeneralEventArgs e);
- public void OnSucceedChangeRoomSettingEvent(object sender,GeneralEventArgs e);
- public void OnFailedChangeRoomSettingEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeChangeRoomSettingEvent(object sender, GeneralEventArgs e);
+ public void OnAfterChangeRoomSettingEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedChangeRoomSettingEvent(object sender, GeneralEventArgs e);
+ public void OnFailedChangeRoomSettingEvent(object sender, GeneralEventArgs e);
}
public interface IStartMatchEventHandler : IEventHandler
@@ -185,10 +185,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedStartMatch;
public event FailedEventHandler? FailedStartMatch;
- public void OnBeforeStartMatchEvent(object sender,GeneralEventArgs e);
- public void OnAfterStartMatchEvent(object sender,GeneralEventArgs e);
- public void OnSucceedStartMatchEvent(object sender,GeneralEventArgs e);
- public void OnFailedStartMatchEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeStartMatchEvent(object sender, GeneralEventArgs e);
+ public void OnAfterStartMatchEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedStartMatchEvent(object sender, GeneralEventArgs e);
+ public void OnFailedStartMatchEvent(object sender, GeneralEventArgs e);
}
public interface IStartGameEventHandler : IEventHandler
@@ -198,10 +198,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedStartGame;
public event FailedEventHandler? FailedStartGame;
- public void OnBeforeStartGameEvent(object sender,GeneralEventArgs e);
- public void OnAfterStartGameEvent(object sender,GeneralEventArgs e);
- public void OnSucceedStartGameEvent(object sender,GeneralEventArgs e);
- public void OnFailedStartGameEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeStartGameEvent(object sender, GeneralEventArgs e);
+ public void OnAfterStartGameEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedStartGameEvent(object sender, GeneralEventArgs e);
+ public void OnFailedStartGameEvent(object sender, GeneralEventArgs e);
}
public interface IChangeProfileEventHandler : IEventHandler
@@ -211,10 +211,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedChangeProfile;
public event FailedEventHandler? FailedChangeProfile;
- public void OnBeforeChangeProfileEvent(object sender,GeneralEventArgs e);
- public void OnAfterChangeProfileEvent(object sender,GeneralEventArgs e);
- public void OnSucceedChangeProfileEvent(object sender,GeneralEventArgs e);
- public void OnFailedChangeProfileEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeChangeProfileEvent(object sender, GeneralEventArgs e);
+ public void OnAfterChangeProfileEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedChangeProfileEvent(object sender, GeneralEventArgs e);
+ public void OnFailedChangeProfileEvent(object sender, GeneralEventArgs e);
}
public interface IChangeAccountSettingEventHandler : IEventHandler
@@ -224,10 +224,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedChangeAccountSetting;
public event FailedEventHandler? FailedChangeAccountSetting;
- public void OnBeforeChangeAccountSettingEvent(object sender,GeneralEventArgs e);
- public void OnAfterChangeAccountSettingEvent(object sender,GeneralEventArgs e);
- public void OnSucceedChangeAccountSettingEvent(object sender,GeneralEventArgs e);
- public void OnFailedChangeAccountSettingEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeChangeAccountSettingEvent(object sender, GeneralEventArgs e);
+ public void OnAfterChangeAccountSettingEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedChangeAccountSettingEvent(object sender, GeneralEventArgs e);
+ public void OnFailedChangeAccountSettingEvent(object sender, GeneralEventArgs e);
}
public interface IOpenInventoryEventHandler : IEventHandler
@@ -237,10 +237,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedOpenInventory;
public event FailedEventHandler? FailedOpenInventory;
- public void OnBeforeOpenInventoryEvent(object sender,GeneralEventArgs e);
- public void OnAfterOpenInventoryEvent(object sender,GeneralEventArgs e);
- public void OnSucceedOpenInventoryEvent(object sender,GeneralEventArgs e);
- public void OnFailedOpenInventoryEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeOpenInventoryEvent(object sender, GeneralEventArgs e);
+ public void OnAfterOpenInventoryEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedOpenInventoryEvent(object sender, GeneralEventArgs e);
+ public void OnFailedOpenInventoryEvent(object sender, GeneralEventArgs e);
}
public interface ISignInEventHandler : IEventHandler
@@ -250,10 +250,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedSignIn;
public event FailedEventHandler? FailedSignIn;
- public void OnBeforeSignInEvent(object sender,GeneralEventArgs e);
- public void OnAfterSignInEvent(object sender,GeneralEventArgs e);
- public void OnSucceedSignInEvent(object sender,GeneralEventArgs e);
- public void OnFailedSignInEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeSignInEvent(object sender, GeneralEventArgs e);
+ public void OnAfterSignInEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedSignInEvent(object sender, GeneralEventArgs e);
+ public void OnFailedSignInEvent(object sender, GeneralEventArgs e);
}
public interface IOpenStoreEventHandler : IEventHandler
@@ -263,10 +263,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedOpenStore;
public event FailedEventHandler? FailedOpenStore;
- public void OnBeforeOpenStoreEvent(object sender,GeneralEventArgs e);
- public void OnAfterOpenStoreEvent(object sender,GeneralEventArgs e);
- public void OnSucceedOpenStoreEvent(object sender,GeneralEventArgs e);
- public void OnFailedOpenStoreEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeOpenStoreEvent(object sender, GeneralEventArgs e);
+ public void OnAfterOpenStoreEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedOpenStoreEvent(object sender, GeneralEventArgs e);
+ public void OnFailedOpenStoreEvent(object sender, GeneralEventArgs e);
}
public interface IBuyItemEventHandler : IEventHandler
@@ -276,10 +276,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedBuyItem;
public event FailedEventHandler? FailedBuyItem;
- public void OnBeforeBuyItemEvent(object sender,GeneralEventArgs e);
- public void OnAfterBuyItemEvent(object sender,GeneralEventArgs e);
- public void OnSucceedBuyItemEvent(object sender,GeneralEventArgs e);
- public void OnFailedBuyItemEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeBuyItemEvent(object sender, GeneralEventArgs e);
+ public void OnAfterBuyItemEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedBuyItemEvent(object sender, GeneralEventArgs e);
+ public void OnFailedBuyItemEvent(object sender, GeneralEventArgs e);
}
public interface IShowRankingEventHandler : IEventHandler
@@ -289,10 +289,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedShowRanking;
public event FailedEventHandler? FailedShowRanking;
- public void OnBeforeShowRankingEvent(object sender,GeneralEventArgs e);
- public void OnAfterShowRankingEvent(object sender,GeneralEventArgs e);
- public void OnSucceedShowRankingEvent(object sender,GeneralEventArgs e);
- public void OnFailedShowRankingEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeShowRankingEvent(object sender, GeneralEventArgs e);
+ public void OnAfterShowRankingEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedShowRankingEvent(object sender, GeneralEventArgs e);
+ public void OnFailedShowRankingEvent(object sender, GeneralEventArgs e);
}
public interface IUseItemEventHandler : IEventHandler
@@ -302,10 +302,10 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedUseItem;
public event FailedEventHandler? FailedUseItem;
- public void OnBeforeUseItemEvent(object sender,GeneralEventArgs e);
- public void OnAfterUseItemEvent(object sender,GeneralEventArgs e);
- public void OnSucceedUseItemEvent(object sender,GeneralEventArgs e);
- public void OnFailedUseItemEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeUseItemEvent(object sender, GeneralEventArgs e);
+ public void OnAfterUseItemEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedUseItemEvent(object sender, GeneralEventArgs e);
+ public void OnFailedUseItemEvent(object sender, GeneralEventArgs e);
}
public interface IEndGameEventHandler : IEventHandler
@@ -315,9 +315,9 @@ namespace Milimoe.FunGame.Core.Interface
public event SucceedEventHandler? SucceedEndGame;
public event FailedEventHandler? FailedEndGame;
- public void OnBeforeEndGameEvent(object sender,GeneralEventArgs e);
- public void OnAfterEndGameEvent(object sender,GeneralEventArgs e);
- public void OnSucceedEndGameEvent(object sender,GeneralEventArgs e);
- public void OnFailedEndGameEvent(object sender,GeneralEventArgs e);
+ public void OnBeforeEndGameEvent(object sender, GeneralEventArgs e);
+ public void OnAfterEndGameEvent(object sender, GeneralEventArgs e);
+ public void OnSucceedEndGameEvent(object sender, GeneralEventArgs e);
+ public void OnFailedEndGameEvent(object sender, GeneralEventArgs e);
}
}
diff --git a/Library/Common/Architecture/AsyncAwaiter.cs b/Library/Common/Architecture/AsyncAwaiter.cs
index ceae319..03e5631 100644
--- a/Library/Common/Architecture/AsyncAwaiter.cs
+++ b/Library/Common/Architecture/AsyncAwaiter.cs
@@ -1,6 +1,4 @@
-using Milimoe.FunGame.Core.Model;
-
-namespace Milimoe.FunGame.Core.Library.Common.Architecture
+namespace Milimoe.FunGame.Core.Library.Common.Architecture
{
///
/// 继承这个类可以获得异步等待的功能
diff --git a/Library/Common/Architecture/Authenticator.cs b/Library/Common/Architecture/Authenticator.cs
index a6a02d3..b7cbe70 100644
--- a/Library/Common/Architecture/Authenticator.cs
+++ b/Library/Common/Architecture/Authenticator.cs
@@ -53,7 +53,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
}
return false;
}
-
+
public bool Authenticate(string username, string password)
{
if (!BeforeAuthenticator(AuthenticationType.Username, username, password)) return false;
diff --git a/Library/Common/Architecture/TaskAwaiter.cs b/Library/Common/Architecture/TaskAwaiter.cs
index c528b51..fada6e9 100644
--- a/Library/Common/Architecture/TaskAwaiter.cs
+++ b/Library/Common/Architecture/TaskAwaiter.cs
@@ -11,7 +11,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
/// 任务是否完成
///
public readonly bool IsCompleted => awaiter.IsCompleted;
-
+
///
/// 捕获到的异常
///
diff --git a/Library/Common/Network/ClientSocket.cs b/Library/Common/Network/ClientSocket.cs
index 22bf36d..ffa710e 100644
--- a/Library/Common/Network/ClientSocket.cs
+++ b/Library/Common/Network/ClientSocket.cs
@@ -25,7 +25,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Network
public ClientSocket(System.Net.Sockets.Socket Instance, int ServerPort, string ClientIP, string ClientName, Guid Token)
{
- this.Instance= Instance;
+ this.Instance = Instance;
this.ServerPort = ServerPort;
this.ClientIP = ClientIP;
this._ClientName = ClientName;
@@ -49,7 +49,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Network
throw new SocketWrongInfoException();
}
}
-
+
public SocketObject[] ReceiveArray()
{
try
diff --git a/Library/Common/Network/MailObject.cs b/Library/Common/Network/MailObject.cs
index 0fc6941..a6b59c2 100644
--- a/Library/Common/Network/MailObject.cs
+++ b/Library/Common/Network/MailObject.cs
@@ -65,7 +65,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Network
this.Sender = Sender.SmtpClientInfo.SenderMailAddress;
this.SenderName = Sender.SmtpClientInfo.SenderName;
}
-
+
///
/// 使用地址和名称创建邮件对象
///
diff --git a/Library/Common/Network/ServerSocket.cs b/Library/Common/Network/ServerSocket.cs
index cd7ceb2..e7892fd 100644
--- a/Library/Common/Network/ServerSocket.cs
+++ b/Library/Common/Network/ServerSocket.cs
@@ -65,43 +65,43 @@ namespace Milimoe.FunGame.Core.Library.Common.Network
name = name.ToLower();
return OnlineClients.Add(name, t);
}
-
+
public bool RemoveClient(string name)
{
name = name.ToLower();
return OnlineClients.Remove(name);
}
-
+
public bool ContainsClient(string name)
{
name = name.ToLower();
return OnlineClients.ContainsKey(name);
}
-
+
public IServerModel GetClient(string name)
{
name = name.ToLower();
return OnlineClients[name];
}
-
+
public bool AddUser(string name, IServerModel t)
{
name = name.ToLower();
return OnlineUsers.Add(name, t);
}
-
+
public bool RemoveUser(string name)
{
name = name.ToLower();
return OnlineUsers.Remove(name);
}
-
+
public bool ContainsUser(string name)
{
name = name.ToLower();
return OnlineUsers.ContainsKey(name);
}
-
+
public IServerModel GetUser(string name)
{
name = name.ToLower();
@@ -113,9 +113,6 @@ namespace Milimoe.FunGame.Core.Library.Common.Network
Instance?.Close();
}
- public static string GetTypeString(SocketMessageType type)
- {
- return Socket.GetTypeString(type);
- }
+ public static string GetTypeString(SocketMessageType type) => SocketSet.GetTypeString(type);
}
}
diff --git a/Library/Common/Network/Socket.cs b/Library/Common/Network/Socket.cs
index 9d6b3e1..6f94079 100644
--- a/Library/Common/Network/Socket.cs
+++ b/Library/Common/Network/Socket.cs
@@ -29,7 +29,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Network
private Socket(System.Net.Sockets.Socket Instance, string ServerIP, int ServerPort)
{
this.Instance = Instance;
- this.ServerIP= ServerIP;
+ this.ServerIP = ServerIP;
this.ServerPort = ServerPort;
this.StartSendingHeartBeat();
}
@@ -40,7 +40,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Network
if (socket != null) return new Socket(socket, IP, Port);
else throw new ConnectFailedException();
}
-
+
public SocketResult Send(SocketMessageType type, params object[] objs)
{
if (Instance != null)
@@ -71,7 +71,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Network
throw new SocketWrongInfoException();
}
}
-
+
public SocketObject[] ReceiveArray()
{
try
@@ -156,7 +156,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Network
Thread.Sleep(100);
while (Connected)
{
- if (!SendingHeartBeat) _SendingHeartBeat= true;
+ if (!SendingHeartBeat) _SendingHeartBeat = true;
// 发送心跳包
if (Send(SocketMessageType.HeartBeat) == SocketResult.Success)
{
@@ -179,9 +179,6 @@ namespace Milimoe.FunGame.Core.Library.Common.Network
throw new LostConnectException();
}
- public static string GetTypeString(SocketMessageType type)
- {
- return SocketManager.GetTypeString(type);
- }
+ public static string GetTypeString(SocketMessageType type) => SocketSet.GetTypeString(type);
}
}
diff --git a/Library/Common/Plugin/Example.cs b/Library/Common/Plugin/Example.cs
index 0b5f6ae..dfda4e4 100644
--- a/Library/Common/Plugin/Example.cs
+++ b/Library/Common/Plugin/Example.cs
@@ -34,7 +34,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Plugin
public void SucceedLoginEvent(object sender, LoginEventArgs e)
{
-
+
}
}
}
diff --git a/Library/Constant/ConstantSet.cs b/Library/Constant/ConstantSet.cs
index fa6c895..29939d3 100644
--- a/Library/Constant/ConstantSet.cs
+++ b/Library/Constant/ConstantSet.cs
@@ -20,9 +20,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
}
///
- /// 需要同步更新
- /// Milimoe.FunGame.Core.Library.Constant.SocketMessageType,
- /// Milimoe.FunGame.Core.Service.SocketManager.GetTypeString(SocketMessageType type)
+ /// 需要同步更新
///
public class SocketSet
{
@@ -36,16 +34,44 @@ namespace Milimoe.FunGame.Core.Library.Constant
public const string DataRequest = "DataRequest";
public const string Connect = "Connect";
public const string Disconnect = "Disconnect";
+ public const string System = "System";
public const string HeartBeat = "HeartBeat";
public const string ForceLogout = "ForceLogout";
public const string Chat = "Chat";
public const string UpdateRoomMaster = "UpdateRoomMaster";
+ public const string MatchRoom = "MatchRoom";
+ public const string StartGame = "StartGame";
+ public const string EndGame = "EndGame";
+ public const string Gaming = "Gaming";
+
+ ///
+ /// 将通信类型的枚举转换为字符串
+ ///
+ /// 通信类型
+ /// 等效字符串
+ public static string GetTypeString(SocketMessageType type)
+ {
+ return type switch
+ {
+ SocketMessageType.DataRequest => DataRequest,
+ SocketMessageType.Connect => Connect,
+ SocketMessageType.Disconnect => Disconnect,
+ SocketMessageType.System => System,
+ SocketMessageType.HeartBeat => HeartBeat,
+ SocketMessageType.ForceLogout => ForceLogout,
+ SocketMessageType.Chat => Chat,
+ SocketMessageType.UpdateRoomMaster => UpdateRoomMaster,
+ SocketMessageType.MatchRoom => MatchRoom,
+ SocketMessageType.StartGame => StartGame,
+ SocketMessageType.EndGame => EndGame,
+ SocketMessageType.Gaming => Gaming,
+ _ => Unknown
+ };
+ }
}
///
- /// 需要同步更新
- /// Milimoe.FunGame.Core.Library.Constant.DataRequestType,
- /// Milimoe.FunGame.Core.Api.Transmittal.DataRequest.GetTypeString(DataRequestType type)
+ /// 需要同步更新
///
public class DataRequestSet
{
@@ -64,6 +90,9 @@ namespace Milimoe.FunGame.Core.Library.Constant
public const string Main_UpdateRoom = "Main::UpdateRoom";
public const string Main_MatchRoom = "Main::MatchRoom";
public const string Main_Chat = "Main::Chat";
+ public const string Main_Ready = "Main::Ready";
+ public const string Main_CancelReady = "Main::CancelReady";
+ public const string Main_StartGame = "Main::StartGame";
/**
* Register
*/
@@ -80,6 +109,75 @@ namespace Milimoe.FunGame.Core.Library.Constant
public const string Room_GetRoomSettings = "Room::GetRoomSettings";
public const string Room_GetRoomPlayerCount = "Room::GetRoomPlayerCount";
public const string Room_UpdateRoomMaster = "Room::UpdateRoomMaster";
+ /**
+ * Gaming
+ */
+ public const string Gaming_Connect = "Gaming::Connect";
+ public const string Gaming_Disconnect = "Gaming::Disconnect";
+ public const string Gaming_Reconnect = "Gaming::Reconnect";
+ public const string Gaming_Ban = "Gaming::Ban";
+ public const string Gaming_Pick = "Gaming::Pick";
+ public const string Gaming_Random = "Gaming::Random";
+ public const string Gaming_Move = "Gaming::Move";
+ public const string Gaming_Attack = "Gaming::Attack";
+ public const string Gaming_Skill = "Gaming::Skill";
+ public const string Gaming_Item = "Gaming::Item";
+ public const string Gaming_Magic = "Gaming::Magic";
+ public const string Gaming_Buy = "Gaming::Buy";
+ public const string Gaming_SuperSkill = "Gaming::SuperSkill";
+ public const string Gaming_Pause = "Gaming::Pause";
+ public const string Gaming_Unpause = "Gaming::Unpause";
+ public const string Gaming_Surrender = "Gaming::Surrender";
+ public const string Gaming_UpdateUserInfo = "Gaming::UpdateUserInfo";
+
+ ///
+ /// 获取Type的等效字符串
+ ///
+ ///
+ ///
+ public static string GetTypeString(DataRequestType type)
+ {
+ return type switch
+ {
+ DataRequestType.RunTime_Logout => RunTime_Logout,
+ DataRequestType.Main_GetNotice => Main_GetNotice,
+ DataRequestType.Main_CreateRoom => Main_CreateRoom,
+ DataRequestType.Main_UpdateRoom => Main_UpdateRoom,
+ DataRequestType.Main_IntoRoom => Main_IntoRoom,
+ DataRequestType.Main_QuitRoom => Main_QuitRoom,
+ DataRequestType.Main_MatchRoom => Main_MatchRoom,
+ DataRequestType.Main_Chat => Main_Chat,
+ DataRequestType.Main_Ready => Main_Ready,
+ DataRequestType.Main_CancelReady => Main_CancelReady,
+ DataRequestType.Main_StartGame => Main_StartGame,
+ DataRequestType.Reg_GetRegVerifyCode => Reg_GetRegVerifyCode,
+ DataRequestType.Login_Login => Login_Login,
+ DataRequestType.Login_GetFindPasswordVerifyCode => Login_GetFindPasswordVerifyCode,
+ DataRequestType.Login_UpdatePassword => Login_UpdatePassword,
+ DataRequestType.Room_GetRoomSettings => Room_GetRoomSettings,
+ DataRequestType.Room_GetRoomPlayerCount => Room_GetRoomPlayerCount,
+ DataRequestType.Room_UpdateRoomMaster => Room_UpdateRoomMaster,
+ DataRequestType.Gaming_Connect => Gaming_Connect,
+ DataRequestType.Gaming_Disconnect => Gaming_Disconnect,
+ DataRequestType.Gaming_Reconnect => Gaming_Reconnect,
+ DataRequestType.Gaming_Ban => Gaming_Ban,
+ DataRequestType.Gaming_Pick => Gaming_Pick,
+ DataRequestType.Gaming_Random => Gaming_Random,
+ DataRequestType.Gaming_Move => Gaming_Move,
+ DataRequestType.Gaming_Attack => Gaming_Attack,
+ DataRequestType.Gaming_Skill => Gaming_Skill,
+ DataRequestType.Gaming_Item => Gaming_Item,
+ DataRequestType.Gaming_Magic => Gaming_Magic,
+ DataRequestType.Gaming_Buy => Gaming_Buy,
+ DataRequestType.Gaming_SuperSkill => Gaming_SuperSkill,
+ DataRequestType.Gaming_Pause => Gaming_Pause,
+ DataRequestType.Gaming_Unpause => Gaming_Unpause,
+ DataRequestType.Gaming_Surrender => Gaming_Surrender,
+ DataRequestType.Gaming_UpdateUserInfo => Gaming_UpdateUserInfo,
+ _ => UnKnown
+ };
+ }
+
}
public class ReflectionSet
@@ -108,5 +206,41 @@ namespace Milimoe.FunGame.Core.Library.Constant
public const string MixHasPass = "带密码的混战模式";
public const string Team = "团队模式";
public const string TeamHasPass = "带密码的团队模式";
+
+ ///
+ /// 获取Type的等效字符串
+ ///
+ ///
+ ///
+ public static string GetTypeString(RoomType type)
+ {
+ return type switch
+ {
+ RoomType.Mix => Mix,
+ RoomType.Team => Team,
+ RoomType.MixHasPass => MixHasPass,
+ RoomType.TeamHasPass => TeamHasPass,
+ RoomType.AllHasPass => AllHasPass,
+ _ => All
+ };
+ }
+
+ ///
+ /// 获取字符串对应的枚举
+ ///
+ ///
+ ///
+ public static RoomType GetRoomType(string typestring)
+ {
+ return typestring switch
+ {
+ Mix => RoomType.Mix,
+ Team => RoomType.Team,
+ MixHasPass => RoomType.MixHasPass,
+ TeamHasPass => RoomType.TeamHasPass,
+ AllHasPass => RoomType.AllHasPass,
+ _ => RoomType.All
+ };
+ }
}
}
diff --git a/Library/Constant/ResultEnum.cs b/Library/Constant/ResultEnum.cs
index c1ff875..856fb00 100644
--- a/Library/Constant/ResultEnum.cs
+++ b/Library/Constant/ResultEnum.cs
@@ -26,7 +26,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
NotSent,
NotReceived
}
-
+
public enum RequestResult
{
Success,
diff --git a/Library/Constant/StateEnum.cs b/Library/Constant/StateEnum.cs
index 6ac3ba8..d95854b 100644
--- a/Library/Constant/StateEnum.cs
+++ b/Library/Constant/StateEnum.cs
@@ -20,6 +20,15 @@ namespace Milimoe.FunGame.Core.Library.Constant
Complete
}
+ public enum SelectState
+ {
+ None,
+ SelectingOne,
+ SelectingMultiple,
+ SelectingRange,
+ SelectingLine
+ }
+
public enum OnlineState
{
Offline,
diff --git a/Library/Constant/TypeEnum.cs b/Library/Constant/TypeEnum.cs
index d50d4ce..b01ce46 100644
--- a/Library/Constant/TypeEnum.cs
+++ b/Library/Constant/TypeEnum.cs
@@ -54,7 +54,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
}
///
- /// 需要同步更新Milimoe.FunGame.Core.Library.Constant.SocketSet
+ /// 需要同步更新
///
public enum SocketMessageType
{
@@ -67,11 +67,14 @@ namespace Milimoe.FunGame.Core.Library.Constant
ForceLogout,
Chat,
UpdateRoomMaster,
- MatchRoom
+ MatchRoom,
+ StartGame,
+ EndGame,
+ Gaming
}
///
- /// 需要同步更新Milimoe.FunGame.Core.Library.Constant.DataRequestSet
+ /// 需要同步更新
///
public enum DataRequestType
{
@@ -93,7 +96,25 @@ namespace Milimoe.FunGame.Core.Library.Constant
Login_UpdatePassword,
Room_GetRoomSettings,
Room_GetRoomPlayerCount,
- Room_UpdateRoomMaster
+ Room_UpdateRoomMaster,
+ Gaming_Connect,
+ Gaming_Disconnect,
+ Gaming_Reconnect,
+ Gaming_Ban,
+ Gaming_Pick,
+ Gaming_Random,
+ Gaming_Move,
+ Gaming_Attack,
+ Gaming_Skill,
+ Gaming_Item,
+ Gaming_Magic,
+ Gaming_Buy,
+ Gaming_SuperSkill,
+ Gaming_Pause,
+ Gaming_Unpause,
+ Gaming_Surrender,
+ Gaming_UpdateUserInfo,
+ Gaming_Punish
}
public enum SocketRuntimeType
@@ -208,6 +229,26 @@ namespace Milimoe.FunGame.Core.Library.Constant
Particle
}
+ public enum ActionType
+ {
+ None,
+ Ban,
+ Pick,
+ Random,
+ Move,
+ Attack,
+ Skill,
+ Item,
+ Magic,
+ Buy,
+ SuperSkill,
+ Pause,
+ Unpause,
+ Surrender,
+ UpdateUserInfo,
+ Punish
+ }
+
public enum VerifyCodeType
{
NumberVerifyCode,
@@ -302,7 +343,9 @@ namespace Milimoe.FunGame.Core.Library.Constant
Chat,
MatchRoom,
UpdateRoomMaster,
- GetRoomPlayerCount
+ GetRoomPlayerCount,
+ StartGame,
+ EndGame
}
public enum RegInvokeType
diff --git a/Library/Exception/Exception.cs b/Library/Exception/Exception.cs
index c6bd0ed..c9dcb61 100644
--- a/Library/Exception/Exception.cs
+++ b/Library/Exception/Exception.cs
@@ -149,7 +149,7 @@
{
public override string Message => "退出房间失败 (#10030)";
}
-
+
public class CreateRoomException : Exception
{
public override string Message => "创建房间失败 (#10031)";
diff --git a/Library/SQLScript/Entity/RoomQuery.cs b/Library/SQLScript/Entity/RoomQuery.cs
index 94bfaae..bbcc34f 100644
--- a/Library/SQLScript/Entity/RoomQuery.cs
+++ b/Library/SQLScript/Entity/RoomQuery.cs
@@ -32,12 +32,12 @@
{
return $"{Constant.Command_Delete} {Constant.Command_From} {TableName} {Constant.Command_Where} {Column_RoomID} = '{RoomID}' {Constant.Command_And} {Column_RoomMaster} = {RoomMaster}";
}
-
+
public static string Update_QuitRoom(string RoomID, long OldRoomMaster, long NewRoomMaster)
{
return $"{Constant.Command_Update} {TableName} {Constant.Command_Set} {Column_RoomMaster} = {NewRoomMaster} {Constant.Command_Where} {Column_RoomID} = '{RoomID}' {Constant.Command_And} {Column_RoomMaster} = {OldRoomMaster}";
}
-
+
public static string Select_IsExistRoom(string RoomID)
{
return $"{Constant.Command_Select} {Constant.Command_All} {Constant.Command_From} {TableName} {Constant.Command_Where} {Column_RoomID} = '{RoomID}'";
diff --git a/Library/SQLScript/Entity/UserQuery.cs b/Library/SQLScript/Entity/UserQuery.cs
index f494158..f1a7a91 100644
--- a/Library/SQLScript/Entity/UserQuery.cs
+++ b/Library/SQLScript/Entity/UserQuery.cs
@@ -2,7 +2,7 @@
{
public class UserQuery
{
- public const string TableName= "Users";
+ public const string TableName = "Users";
public const string Column_UID = "UID";
public const string Column_Username = "Username";
public const string Column_Password = "Password";
@@ -24,17 +24,17 @@
{
return $"{Select_Users} {Constant.Command_Where} {Column_Username} = '{Username}' and {Column_Password} = '{Password}'";
}
-
+
public static string Select_IsExistEmail(string Email)
{
return $"{Select_Users} {Constant.Command_Where} {Column_Email} = '{Email}'";
}
-
+
public static string Select_IsExistUsername(string Username)
{
return $"{Select_Users} {Constant.Command_Where} {Column_Username} = '{Username}'";
}
-
+
public static string Select_CheckEmailWithUsername(string Username, string email)
{
return $"{Select_Users} {Constant.Command_Where} {Column_Username} = '{Username}' and {Column_Email} = '{email}'";
@@ -54,12 +54,12 @@
{
return $"{Constant.Command_Update} {TableName} {Constant.Command_Set} {Column_LastTime} = '{DateTime.Now}', {Column_LastIP} = '{IP}' {Constant.Command_Where} {Column_Username} = '{Username}'";
}
-
+
public static string Update_Password(string Username, string Password)
{
return $"{Constant.Command_Update} {TableName} {Constant.Command_Set} {Column_Password} = '{Password}' {Constant.Command_Where} {Column_Username} = '{Username}'";
}
-
+
public static string Update_GameTime(string Username, int GameTimeMinutes)
{
return $"{Constant.Command_Update} {TableName} {Constant.Command_Set} {Column_GameTime} = {Column_GameTime} + {GameTimeMinutes} {Constant.Command_Where} {Column_Username} = '{Username}'";
diff --git a/Model/FunGameConfig.cs b/Model/FunGameConfig.cs
index 9f2d2fe..97641c1 100644
--- a/Model/FunGameConfig.cs
+++ b/Model/FunGameConfig.cs
@@ -33,7 +33,7 @@ namespace Milimoe.FunGame.Core.Model
/// 是否自动重连
///
public bool FunGame_isAutoRetry { get; set; } = true;
-
+
///
/// 是否在房间中
///
diff --git a/Service/JsonManager.cs b/Service/JsonManager.cs
index 12fb50f..b581afc 100644
--- a/Service/JsonManager.cs
+++ b/Service/JsonManager.cs
@@ -63,7 +63,7 @@ namespace Milimoe.FunGame.Core.Service
{
return JsonSerializer.Deserialize(json, options);
}
-
+
///
/// 反序列化Json对象,此方法可能无法返回正确的类型,请注意辨别
///
@@ -101,7 +101,7 @@ namespace Milimoe.FunGame.Core.Service
T? result = element.Deserialize(GeneralOptions);
return result;
}
-
+
///
/// 反序列化Hashtable中Key对应的Json对象
///
@@ -115,7 +115,7 @@ namespace Milimoe.FunGame.Core.Service
{
JsonElement? element = (JsonElement?)table[key];
if (element != null)
- {
+ {
T? result = ((JsonElement)element).Deserialize(GeneralOptions);
return result;
}
@@ -137,7 +137,7 @@ namespace Milimoe.FunGame.Core.Service
{
JsonElement? element = (JsonElement?)table[key];
if (element != null)
- {
+ {
T? result = ((JsonElement)element).Deserialize(options);
return result;
}
diff --git a/Service/MailManager.cs b/Service/MailManager.cs
index cbac279..65b4ab3 100644
--- a/Service/MailManager.cs
+++ b/Service/MailManager.cs
@@ -15,7 +15,7 @@ namespace Milimoe.FunGame.Core.Service
/// 一个邮件服务对应一个Smtp客户端
///
internal static Dictionary SmtpClients { get; } = new();
-
+
///
/// 用于保存邮件服务
/// 允许服务器同时存在多个服务
diff --git a/Service/ModelManager.cs b/Service/ModelManager.cs
index 9656706..86b3fbb 100644
--- a/Service/ModelManager.cs
+++ b/Service/ModelManager.cs
@@ -72,7 +72,7 @@ namespace Milimoe.FunGame.Core.Service
{
return Models.TryRemove(name, out t);
}
-
+
///
/// 将Model移除,并取得这个Model
///
@@ -96,7 +96,7 @@ namespace Milimoe.FunGame.Core.Service
{
Models.Clear();
}
-
+
///
/// 获取Model对象的列表
diff --git a/Service/SocketManager.cs b/Service/SocketManager.cs
index 75d84c5..ba79357 100644
--- a/Service/SocketManager.cs
+++ b/Service/SocketManager.cs
@@ -172,7 +172,7 @@ namespace Milimoe.FunGame.Core.Service
}
return result;
}
-
+
///
/// 用于服务器接收客户端信息
///
@@ -195,7 +195,7 @@ namespace Milimoe.FunGame.Core.Service
}
return result;
}
-
+
///
/// 用于客户端接收服务器信息(数组版)
///
@@ -247,26 +247,6 @@ namespace Milimoe.FunGame.Core.Service
return result.ToArray();
}
- ///
- /// 将通信类型的枚举转换为字符串
- ///
- /// 通信类型
- /// 等效字符串
- internal static string GetTypeString(SocketMessageType type)
- {
- return type switch
- {
- SocketMessageType.DataRequest => SocketSet.DataRequest,
- SocketMessageType.Connect => SocketSet.Connect,
- SocketMessageType.Disconnect => SocketSet.Disconnect,
- SocketMessageType.HeartBeat => SocketSet.HeartBeat,
- SocketMessageType.ForceLogout => SocketSet.ForceLogout,
- SocketMessageType.Chat => SocketSet.Chat,
- SocketMessageType.UpdateRoomMaster => SocketSet.UpdateRoomMaster,
- _ => SocketSet.Unknown,
- };
- }
-
#endregion
#region 事件