From 4d8748e866373b4f1b33a7655b9cf359eec2d4dd Mon Sep 17 00:00:00 2001 From: bob <605277374@qq.com> Date: Sat, 26 Jul 2025 15:19:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=9C=8D=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../System/AuthenticationComponentSystem.cs | 2 +- .../Generate/NetworkProtocol/OuterMessage.cs | 485 ------------------ .../Generate/NetworkProtocol/OuterOpcode.cs | 28 - .../Generate/NetworkProtocol/RoamingType.cs | 18 - .../Generate/NetworkProtocol/RouteType.cs | 9 - 5 files changed, 1 insertion(+), 541 deletions(-) delete mode 100644 OutputClient/Generate/NetworkProtocol/OuterMessage.cs delete mode 100644 OutputClient/Generate/NetworkProtocol/OuterOpcode.cs delete mode 100644 OutputClient/Generate/NetworkProtocol/RoamingType.cs delete mode 100644 OutputClient/Generate/NetworkProtocol/RouteType.cs diff --git a/Hotfix/Outer/Authentication/System/AuthenticationComponentSystem.cs b/Hotfix/Outer/Authentication/System/AuthenticationComponentSystem.cs index 35c015a..e29417e 100644 --- a/Hotfix/Outer/Authentication/System/AuthenticationComponentSystem.cs +++ b/Hotfix/Outer/Authentication/System/AuthenticationComponentSystem.cs @@ -70,7 +70,7 @@ internal static class AuthenticationComponentSystem // 1、创建一个新的字典容器在AuthenticationComponent中存储登录的信息。 // 2、key:userName + password, Value = ? // 3、为了防止缓存暴涨、肯定需要一个定期清理的过程,Value肯定是要一个实体了。 - // 4、因为这个实体下面咱们可以挂载一个组件,这个组件的作用就是定时清理这个缓存。 + // 4、因为这个实体下面咱们可以挂载一个组件,这个组件的作用就是定时清理这个缓存。5 // 问题 // 1、如果用户的密码改了怎么办? diff --git a/OutputClient/Generate/NetworkProtocol/OuterMessage.cs b/OutputClient/Generate/NetworkProtocol/OuterMessage.cs deleted file mode 100644 index 3b84d3d..0000000 --- a/OutputClient/Generate/NetworkProtocol/OuterMessage.cs +++ /dev/null @@ -1,485 +0,0 @@ -using ProtoBuf; - -using System.Collections.Generic; -using Fantasy; -using Fantasy.Network.Interface; -using Fantasy.Serialize; -#pragma warning disable CS8618 - -namespace Fantasy -{ - [ProtoContract] - public partial class C2A_RegisterRequest : AMessage, IRequest, IProto - { - public static C2A_RegisterRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Username = default; - Password = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public A2C_RegisterResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2A_RegisterRequest; } - [ProtoMember(1)] - public string Username { get; set; } - [ProtoMember(2)] - public string Password { get; set; } - } - [ProtoContract] - public partial class A2C_RegisterResponse : AMessage, IResponse, IProto - { - public static A2C_RegisterResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.A2C_RegisterResponse; } - [ProtoMember(1)] - public uint ErrorCode { get; set; } - } - [ProtoContract] - public partial class C2A_LoginRequest : AMessage, IRequest, IProto - { - public static C2A_LoginRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Username = default; - Password = default; - LoginType = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public A2C_LoginResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2A_LoginRequest; } - [ProtoMember(1)] - public string Username { get; set; } - [ProtoMember(2)] - public string Password { get; set; } - [ProtoMember(3)] - public int LoginType { get; set; } - } - [ProtoContract] - public partial class A2C_LoginResponse : AMessage, IResponse, IProto - { - public static A2C_LoginResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; - ToKen = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.A2C_LoginResponse; } - [ProtoMember(1)] - public string ToKen { get; set; } - [ProtoMember(2)] - public uint ErrorCode { get; set; } - } - /// - /// 客户端登录到Gate服务器 - /// - [ProtoContract] - public partial class C2G_LoginRequest : AMessage, IRequest, IProto - { - public static C2G_LoginRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ToKen = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public G2C_LoginResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2G_LoginRequest; } - [ProtoMember(1)] - public string ToKen { get; set; } - } - [ProtoContract] - public partial class G2C_LoginResponse : AMessage, IResponse, IProto - { - public static G2C_LoginResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; - GameAccountInfo = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.G2C_LoginResponse; } - [ProtoMember(1)] - public GameAccountInfo GameAccountInfo { get; set; } - [ProtoMember(2)] - public uint ErrorCode { get; set; } - } - /// - /// 通知客户端重复登录 - /// - [ProtoContract] - public partial class G2C_RepeatLogin : AMessage, IMessage, IProto - { - public static G2C_RepeatLogin Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.G2C_RepeatLogin; } - } - /// - /// GameAccount实体类 - /// - [ProtoContract] - public partial class GameAccountInfo : AMessage, IProto - { - public static GameAccountInfo Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - CreateTime = default; - LoginTime = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoMember(1)] - public long CreateTime { get; set; } - [ProtoMember(2)] - public long LoginTime { get; set; } - } - /// - /// 拿到当前账号的信息 - /// - [ProtoContract] - public partial class C2G_GetAccountInfoRequest : AMessage, IRequest, IProto - { - public static C2G_GetAccountInfoRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public G2C_GetAccountInfoResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2G_GetAccountInfoRequest; } - } - [ProtoContract] - public partial class G2C_GetAccountInfoResponse : AMessage, IResponse, IProto - { - public static G2C_GetAccountInfoResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; - GameAccountInfo = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.G2C_GetAccountInfoResponse; } - [ProtoMember(1)] - public GameAccountInfo GameAccountInfo { get; set; } - [ProtoMember(2)] - public uint ErrorCode { get; set; } - } - [ProtoContract] - public partial class C2G_TestMessage : AMessage, IMessage, IProto - { - public static C2G_TestMessage Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Tag = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.C2G_TestMessage; } - [ProtoMember(1)] - public string Tag { get; set; } - } - [ProtoContract] - public partial class C2G_TestRequest : AMessage, IRequest, IProto - { - public static C2G_TestRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Tag = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public G2C_TestResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2G_TestRequest; } - [ProtoMember(1)] - public string Tag { get; set; } - } - [ProtoContract] - public partial class G2C_TestResponse : AMessage, IResponse, IProto - { - public static G2C_TestResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; - Tag = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.G2C_TestResponse; } - [ProtoMember(1)] - public string Tag { get; set; } - [ProtoMember(2)] - public uint ErrorCode { get; set; } - } - [ProtoContract] - public partial class C2G_CreateAddressableRequest : AMessage, IRequest, IProto - { - public static C2G_CreateAddressableRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public G2C_CreateAddressableResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2G_CreateAddressableRequest; } - } - [ProtoContract] - public partial class G2C_CreateAddressableResponse : AMessage, IResponse, IProto - { - public static G2C_CreateAddressableResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.G2C_CreateAddressableResponse; } - [ProtoMember(1)] - public uint ErrorCode { get; set; } - } - [ProtoContract] - public partial class C2M_TestMessage : AMessage, IAddressableRouteMessage, IProto - { - public static C2M_TestMessage Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Tag = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.C2M_TestMessage; } - [ProtoMember(1)] - public string Tag { get; set; } - } - [ProtoContract] - public partial class C2M_TestRequest : AMessage, IAddressableRouteRequest, IProto - { - public static C2M_TestRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Tag = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public M2C_TestResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2M_TestRequest; } - [ProtoMember(1)] - public string Tag { get; set; } - } - [ProtoContract] - public partial class M2C_TestResponse : AMessage, IAddressableRouteResponse, IProto - { - public static M2C_TestResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; - Tag = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.M2C_TestResponse; } - [ProtoMember(1)] - public string Tag { get; set; } - [ProtoMember(2)] - public uint ErrorCode { get; set; } - } - /// - /// 通知Gate服务器创建一个Chat的Route连接 - /// - [ProtoContract] - public partial class C2G_CreateChatRouteRequest : AMessage, IRequest, IProto - { - public static C2G_CreateChatRouteRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public G2C_CreateChatRouteResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2G_CreateChatRouteRequest; } - } - [ProtoContract] - public partial class G2C_CreateChatRouteResponse : AMessage, IResponse, IProto - { - public static G2C_CreateChatRouteResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.G2C_CreateChatRouteResponse; } - [ProtoMember(1)] - public uint ErrorCode { get; set; } - } - /// - /// 发送一个Route消息给Chat - /// - [ProtoContract] - public partial class C2Chat_TestMessage : AMessage, ICustomRouteMessage, IProto - { - public static C2Chat_TestMessage Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Tag = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.C2Chat_TestMessage; } - [ProtoIgnore] - public int RouteType => Fantasy.RouteType.ChatRoute; - [ProtoMember(1)] - public string Tag { get; set; } - } - /// - /// 发送一个RPCRoute消息给Chat - /// - [ProtoContract] - public partial class C2Chat_TestMessageRequest : AMessage, ICustomRouteRequest, IProto - { - public static C2Chat_TestMessageRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Tag = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public Chat2C_TestMessageResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2Chat_TestMessageRequest; } - [ProtoIgnore] - public int RouteType => Fantasy.RouteType.ChatRoute; - [ProtoMember(1)] - public string Tag { get; set; } - } - [ProtoContract] - public partial class Chat2C_TestMessageResponse : AMessage, ICustomRouteResponse, IProto - { - public static Chat2C_TestMessageResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; - Tag = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.Chat2C_TestMessageResponse; } - [ProtoMember(1)] - public string Tag { get; set; } - [ProtoMember(2)] - public uint ErrorCode { get; set; } - } -} diff --git a/OutputClient/Generate/NetworkProtocol/OuterOpcode.cs b/OutputClient/Generate/NetworkProtocol/OuterOpcode.cs deleted file mode 100644 index 9dd0ec8..0000000 --- a/OutputClient/Generate/NetworkProtocol/OuterOpcode.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace Fantasy -{ - public static partial class OuterOpcode - { - public const uint C2A_RegisterRequest = 268445457; - public const uint A2C_RegisterResponse = 402663185; - public const uint C2A_LoginRequest = 268445458; - public const uint A2C_LoginResponse = 402663186; - public const uint C2G_LoginRequest = 268445459; - public const uint G2C_LoginResponse = 402663187; - public const uint G2C_RepeatLogin = 134227729; - public const uint C2G_GetAccountInfoRequest = 268445460; - public const uint G2C_GetAccountInfoResponse = 402663188; - public const uint C2G_TestMessage = 134227730; - public const uint C2G_TestRequest = 268445461; - public const uint G2C_TestResponse = 402663189; - public const uint C2G_CreateAddressableRequest = 268445462; - public const uint G2C_CreateAddressableResponse = 402663190; - public const uint C2M_TestMessage = 1342187281; - public const uint C2M_TestRequest = 1476405009; - public const uint M2C_TestResponse = 1610622737; - public const uint C2G_CreateChatRouteRequest = 268445463; - public const uint G2C_CreateChatRouteResponse = 402663191; - public const uint C2Chat_TestMessage = 2147493649; - public const uint C2Chat_TestMessageRequest = 2281711377; - public const uint Chat2C_TestMessageResponse = 2415929105; - } -} diff --git a/OutputClient/Generate/NetworkProtocol/RoamingType.cs b/OutputClient/Generate/NetworkProtocol/RoamingType.cs deleted file mode 100644 index 96d932c..0000000 --- a/OutputClient/Generate/NetworkProtocol/RoamingType.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; -namespace Fantasy -{ - // Roaming协议定义(需要定义10000以上、因为10000以内的框架预留) - public static class RoamingType - { - public const int MapRoamingType = 10001; - public const int ChatRoamingType = 10002; - public static IEnumerable RoamingTypes - { - get - { - yield return 10001; - yield return 10002; - } - } - } -} diff --git a/OutputClient/Generate/NetworkProtocol/RouteType.cs b/OutputClient/Generate/NetworkProtocol/RouteType.cs deleted file mode 100644 index cdd0df0..0000000 --- a/OutputClient/Generate/NetworkProtocol/RouteType.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Fantasy -{ - // Route协议定义(需要定义1000以上、因为1000以内的框架预留) - public static class RouteType - { - public const int GateRoute = 1001; // Gate - public const int ChatRoute = 1002; // Chat - } -}