From d5689258fc2bb21e432c8ef3ca8911175f44be64 Mon Sep 17 00:00:00 2001 From: BobSong <605277374@qq.com> Date: Thu, 14 Aug 2025 23:56:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Config/Binary/SceneConfigData.bytes | 1 - Config/Excel/Server/SceneConfig.xlsx | Bin 16913 -> 16798 bytes Config/Excel/Version.txt | 2 +- Config/Json/Server/SceneConfigData.Json | 1 - .../NetworkProtocol/Inner/InnerMessage.proto | 10 +- .../NetworkProtocol/Outer/ChatMessage.proto | 98 ---- .../NetworkProtocol/Outer/SocialMessage.proto | 116 +++++ .../NetworkProtocol/Outer/data/Friend.proto | 14 - .../Outer/data/GlobalData.proto | 16 - Config/NetworkProtocol/RouteType.Config | 5 +- Entity/Entity.csproj | 3 +- Entity/Generate/CustomExport/SceneType.cs | 4 +- .../Generate/NetworkProtocol/ChatMessage.cs | 383 ---------------- Entity/Generate/NetworkProtocol/Friend.cs | 58 --- Entity/Generate/NetworkProtocol/GlobalData.cs | 66 --- .../Generate/NetworkProtocol/InnerMessage.cs | 54 +-- .../Generate/NetworkProtocol/InnerOpcode.cs | 10 +- .../Generate/NetworkProtocol/OuterOpcode.cs | 34 +- Entity/Generate/NetworkProtocol/RouteType.cs | 3 +- .../Generate/NetworkProtocol/SocialMessage.cs | 424 ++++++++++++++++++ .../Entity => Social/Chat}/ChatChannel.cs | 6 +- .../Chat}/ChatChannelCenterComponent.cs | 0 Entity/{Game => Social}/Club/Club.cs | 0 .../Club/ClubManageComponent.cs | 0 .../Mail/Components/MailComponent.cs | 0 Entity/{Game => Social}/Mail/Entity/Mail.cs | 0 .../{Game => Social}/Mail/Entity/MailBox.cs | 0 Entity/{Game => Social}/Mail/Enum/MailEnum.cs | 0 .../ChatUnit.cs => Social/SocialUnit.cs} | 2 +- .../SocialUnitManageComponent.cs} | 6 +- .../C2Chat_SendMessageRequestHandler.cs | 45 -- .../Inner/G2Chat_ExitRequestHandler.cs | 16 - .../Components/PlayerManageComponentSystem.cs | 15 - ...geHandler.cs => S2G_ChatMessageHandler.cs} | 6 +- Hotfix/Gate/Helper/GateLoginHelper.cs | 6 +- Hotfix/OnCreateSceneEvent.cs | 2 +- Hotfix/OnSceneCreate_Init.cs | 4 +- .../C2S_CreateChannelRequestHandler.cs} | 6 +- .../C2S_GetOfflineMessageRequestHandler.cs} | 10 +- .../Handler/C2S_JoinChannelRequestHandler.cs} | 16 +- .../Handler/C2S_SendMessageRequestHandler.cs | 41 ++ .../Handler/Inner/G2S_EnterRequestHandler.cs} | 8 +- .../Handler/Inner/G2S_ExitRequestHandler.cs | 16 + .../Helper/ChatUnitFactory.cs | 4 +- .../Helper/SocialSceneHelper.cs} | 24 +- .../ChatChannelCenterComponentSystem.cs | 2 +- .../System/ChatChannelSystem.cs | 8 +- .../System/ChatUnitManageComponentSystem.cs | 52 ++- Hotfix/Social/System/ChatUnitSystem.cs | 11 + .../test002/Protocol/C2S_CreateChannelRequest | 1 + .../test002/Protocol/C2S_JoinChannelRequest | 1 + .../test002/Protocol/C2S_SendMessageRequest | 1 + .../Protocol/C2Chat_SendMessageRequest | 2 +- .../test003/Protocol/C2S_JoinChannelRequest | 1 + 54 files changed, 775 insertions(+), 839 deletions(-) delete mode 100644 Config/NetworkProtocol/Outer/ChatMessage.proto delete mode 100644 Config/NetworkProtocol/Outer/data/Friend.proto delete mode 100644 Config/NetworkProtocol/Outer/data/GlobalData.proto delete mode 100644 Entity/Generate/NetworkProtocol/ChatMessage.cs delete mode 100644 Entity/Generate/NetworkProtocol/Friend.cs delete mode 100644 Entity/Generate/NetworkProtocol/GlobalData.cs rename Entity/{Chat/Entity => Social/Chat}/ChatChannel.cs (90%) rename Entity/{Chat/Component => Social/Chat}/ChatChannelCenterComponent.cs (100%) rename Entity/{Game => Social}/Club/Club.cs (100%) rename Entity/{Game => Social}/Club/ClubManageComponent.cs (100%) rename Entity/{Game => Social}/Mail/Components/MailComponent.cs (100%) rename Entity/{Game => Social}/Mail/Entity/Mail.cs (100%) rename Entity/{Game => Social}/Mail/Entity/MailBox.cs (100%) rename Entity/{Game => Social}/Mail/Enum/MailEnum.cs (100%) rename Entity/{Chat/Entity/ChatUnit.cs => Social/SocialUnit.cs} (92%) rename Entity/{Chat/Component/ChatUnitManageComponent.cs => Social/SocialUnitManageComponent.cs} (56%) delete mode 100644 Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs delete mode 100644 Hotfix/Chat/Handler/Inner/G2Chat_ExitRequestHandler.cs rename Hotfix/Gate/Handler/Inner/{Chat2G_ChatMessageHandler.cs => S2G_ChatMessageHandler.cs} (84%) rename Hotfix/{Chat/Handler/C2Chat_CreateChannelRequestHandler.cs => Social/Handler/C2S_CreateChannelRequestHandler.cs} (64%) rename Hotfix/{Chat/Handler/C2Chat_GetOfflineMessageRequestHandler.cs => Social/Handler/C2S_GetOfflineMessageRequestHandler.cs} (51%) rename Hotfix/{Chat/Handler/C2Chat_JoinChannelRequestHandler.cs => Social/Handler/C2S_JoinChannelRequestHandler.cs} (67%) create mode 100644 Hotfix/Social/Handler/C2S_SendMessageRequestHandler.cs rename Hotfix/{Chat/Handler/Inner/G2Chat_EnterRequestHandler.cs => Social/Handler/Inner/G2S_EnterRequestHandler.cs} (52%) create mode 100644 Hotfix/Social/Handler/Inner/G2S_ExitRequestHandler.cs rename Hotfix/{Chat => Social}/Helper/ChatUnitFactory.cs (76%) rename Hotfix/{Chat/Helper/ChatSceneHelper.cs => Social/Helper/SocialSceneHelper.cs} (85%) rename Hotfix/{Chat => Social}/System/ChatChannelCenterComponentSystem.cs (98%) rename Hotfix/{Chat => Social}/System/ChatChannelSystem.cs (72%) rename Hotfix/{Chat => Social}/System/ChatUnitManageComponentSystem.cs (50%) create mode 100644 Hotfix/Social/System/ChatUnitSystem.cs create mode 100644 Tools/ProtocolTest/test002/Protocol/C2S_CreateChannelRequest create mode 100644 Tools/ProtocolTest/test002/Protocol/C2S_JoinChannelRequest create mode 100644 Tools/ProtocolTest/test002/Protocol/C2S_SendMessageRequest create mode 100644 Tools/ProtocolTest/test003/Protocol/C2S_JoinChannelRequest diff --git a/Config/Binary/SceneConfigData.bytes b/Config/Binary/SceneConfigData.bytes index c4839ac..01dd45b 100644 --- a/Config/Binary/SceneConfigData.bytes +++ b/Config/Binary/SceneConfigData.bytes @@ -3,5 +3,4 @@ &" MultiThread* Addressable@VH (" MultiThread*Gate2KCP8@VH " MultiThread*Game@VH -" MultiThread*Game@VH " MultiThread*Chat@VH \ No newline at end of file diff --git a/Config/Excel/Server/SceneConfig.xlsx b/Config/Excel/Server/SceneConfig.xlsx index cb288fb63d70ccc1709228b67ae6161d3ec1bc4f..ead6f3ece3931fd3e08678a05bb21af0e0c36963 100644 GIT binary patch delta 7616 zcmZX3Wl)?=)Ai!AxVyW%%i<2fL+}7ga3}cU7JPAc4-gi23GM`U4FrM)f+g@K_j7;s zy>k8NI@NQo>8`2ind&*o;c)q3a1AAJNWq|FYI$fS96Q9*Jgf99#m@T>4?6X(OHO1x zniB`q`P<*FbCHXTdpFS6M}*dxqK5Ag{ZhpRR^6UxY_6?pgAV)X z92&(Nf>vQt;Zz5pmH~N#S?C9N7142x1gtIc*iZW?m6>X?auKc-PD25&*Cd7FAPtf` zxU~ExA-0fE-$-%`M?X3-dZdfwuV2zRL9Q5#dWBtsb}4%WbtuN|(%4O7g+?k6zFiI5 zO@;*0kbtiT)O@d2!4@iNhUSeB1MkHv~gNm__ol0471Z3tZg40J|0~F91tR_T3{$X_;-+GS5Ma38xYu;fBsDu>)oet)be%y%U zj?e}K=wwiQteTG?U`@c1i>n;9Hj7>-*bWdA&$KAT#1-AunI&+k8fJ#Ix+I*MFp_t_ zLIs3t?g$RCTU9fldbSiZ&P6pAL*Ny&^cZdsj0LVSoEcdW^V_`!#*b2e=q7(Gz2+*n{`OJ* zdi7GI;h~`%2-pw(wCdw3kgfUNYUwaCZ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RO&;(gZ8+1Rml4QY+ zoHKIEA#4JuVp4=-Zwn$=kF6yV%)-XSKCJH(mt2sOQh!5hz_MK-rZap#Lrr=17s`PK zRe*o|od1Ah?_a1+{>u>D_zUt%4Q&l*G6rl8M_qc!P1kGTDNWbLY+Y5re+W5FHF{cS zJHE}DvF`i(`;8YTlS*<=Da)16FjoQx)_h>j{+rhqxG81bc0SH{Cv76fCRPRl$ZWln z^z*LkIOG!{bw`#@%pGz{eQn-o*$$m3i!OVYQvDZL^5)|_h8>0@4{S&Fm~ll%}lE6gIhWYxFDp zEUV3r^}uNj`ft`&+WjB1GsV3rfKBc3NAQTpYSC_HI9Z@i(>IBBf#+$Cv6Tlf2o>kO z*}8|r27_CC=G2QQxx}3pNRs~7)_4Jw}fuG9IrXtYIVmWXiW}h0Frc5>H!~Tf=o| zZ#ho zLif7ImO)m+cWcMcO{MMJt3Avo5tr-SG^5rQ=y&D}=T*`@nmYKEAH7W#u zsQbH&w0}`}_&_)-mcBHyG6Ov|buFhoK0fc)a8KW0ju92K!^`=nvn*sPW5jFW@`%Vh zls6s{N(HCk{wRw0LqkSJnWFOYo*+0*j=$OYM8%L1bwIsJQRTn|?drVPgIFZ$U z6W6VuAw^*!@_+5K^#qkjfzU@3?t#86NIodyJj~+^)9=us6s?Ip2(SHI>|3V_y+dl! zShS^<{^27Z-FjN!^8R{M7JO)X@`u!0xx~#6H2_F6*WvochT{hRFx_yv z2iLAgpTE}KY7bsq`8226K+=Z>-*JfjYiw8P|N<C4S1X~sa!X72@DF3HCgMdK# tkI>)tZ!9N5m_G#(Ozb@o<^TO&`kR9MzoaFKza(;4_ - + + diff --git a/Entity/Generate/CustomExport/SceneType.cs b/Entity/Generate/CustomExport/SceneType.cs index 692a905..87363cb 100644 --- a/Entity/Generate/CustomExport/SceneType.cs +++ b/Entity/Generate/CustomExport/SceneType.cs @@ -10,7 +10,7 @@ namespace Fantasy public const int Map = 5; public const int Activity = 6; public const int Cache = 7; - public const int Chat = 8; + public const int Social = 8; public static readonly Dictionary SceneTypeDic = new Dictionary() { @@ -21,7 +21,7 @@ namespace Fantasy { "Map", 5 }, { "Activity", 6 }, { "Cache", 7 }, - { "Chat", 8 }, + { "Social", 8 }, }; } } diff --git a/Entity/Generate/NetworkProtocol/ChatMessage.cs b/Entity/Generate/NetworkProtocol/ChatMessage.cs deleted file mode 100644 index 9e608fd..0000000 --- a/Entity/Generate/NetworkProtocol/ChatMessage.cs +++ /dev/null @@ -1,383 +0,0 @@ -using ProtoBuf; - -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using Fantasy; -using Fantasy.Network.Interface; -using Fantasy.Serialize; -// ReSharper disable InconsistentNaming -// ReSharper disable RedundantUsingDirective -// ReSharper disable RedundantOverriddenMember -// ReSharper disable PartialTypeWithSinglePart -// ReSharper disable UnusedAutoPropertyAccessor.Global -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable CheckNamespace -#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. -#pragma warning disable CS8618 - -namespace Fantasy -{ - /// - /// 请求邮件列表 - /// - [ProtoContract] - public partial class C2Game_GetMailsRequest : AMessage, ICustomRouteRequest, IProto - { - public static C2Game_GetMailsRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public Game2C_GetMailsResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2Game_GetMailsRequest; } - [ProtoIgnore] - public int RouteType => Fantasy.RouteType.GameRoute; - } - /// - /// 获取邮件列表响应 - /// - [ProtoContract] - public partial class Game2C_GetMailsResponse : AMessage, ICustomRouteResponse, IProto - { - public static Game2C_GetMailsResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; - Mail.Clear(); -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.Game2C_GetMailsResponse; } - [ProtoMember(1)] - public List Mail = new List(); - [ProtoMember(2)] - public uint ErrorCode { get; set; } - } - /// - /// 新邮件推送 - /// - [ProtoContract] - public partial class Game2C_HaveMail : AMessage, ICustomRouteMessage, IProto - { - public static Game2C_HaveMail Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Mail = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.Game2C_HaveMail; } - [ProtoIgnore] - public int RouteType => Fantasy.RouteType.GameRoute; - [ProtoMember(1)] - public MailInfo Mail { get; set; } - } - [ProtoContract] - public partial class Game2C_MailState : AMessage, ICustomRouteMessage, IProto - { - public static Game2C_MailState Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - MailState = default; - MailId = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.Game2C_MailState; } - [ProtoIgnore] - public int RouteType => Fantasy.RouteType.GameRoute; - [ProtoMember(1)] - public int MailState { get; set; } - [ProtoMember(2)] - public long MailId { get; set; } - } - /// - /// /////////// ******** 聊天 *******///////////// - /// - /// - /// 创建频道 - /// - [ProtoContract] - public partial class C2Chat_CreateChannelRequest : AMessage, ICustomRouteRequest, IProto - { - public static C2Chat_CreateChannelRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Name = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public Caht2C_CreateChannelResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2Chat_CreateChannelRequest; } - [ProtoIgnore] - public int RouteType => Fantasy.RouteType.ChatRoute; - [ProtoMember(1)] - public string Name { get; set; } - } - /// - /// 创建频道响应 - /// - [ProtoContract] - public partial class Caht2C_CreateChannelResponse : AMessage, ICustomRouteResponse, IProto - { - public static Caht2C_CreateChannelResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; - ChannelId = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.Caht2C_CreateChannelResponse; } - [ProtoMember(1)] - public long ChannelId { get; set; } - [ProtoMember(2)] - public uint ErrorCode { get; set; } - } - /// - /// 请求进入频道 - /// - [ProtoContract] - public partial class C2Chat_JoinChannelRequest : AMessage, ICustomRouteRequest, IProto - { - public static C2Chat_JoinChannelRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Target = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public Caht2C_JoinChannelResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2Chat_JoinChannelRequest; } - [ProtoIgnore] - public int RouteType => Fantasy.RouteType.ChatRoute; - [ProtoMember(1)] - public long Target { get; set; } - } - /// - /// 进入频道响应 - /// - [ProtoContract] - public partial class Caht2C_JoinChannelResponse : AMessage, ICustomRouteResponse, IProto - { - public static Caht2C_JoinChannelResponse 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.Caht2C_JoinChannelResponse; } - [ProtoMember(1)] - public uint ErrorCode { get; set; } - } - /// - /// 发送聊天 - /// - [ProtoContract] - public partial class C2Chat_SendMessageRequest : AMessage, ICustomRouteRequest, IProto - { - public static C2Chat_SendMessageRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Type = default; - Message = default; - Target = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public Caht2C_SendMessageResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2Chat_SendMessageRequest; } - [ProtoIgnore] - public int RouteType => Fantasy.RouteType.ChatRoute; - [ProtoMember(1)] - public int Type { get; set; } - [ProtoMember(2)] - public string Message { get; set; } - [ProtoMember(3)] - public long Target { get; set; } - } - /// - /// 发送聊天响应 - /// - [ProtoContract] - public partial class Caht2C_SendMessageResponse : AMessage, ICustomRouteResponse, IProto - { - public static Caht2C_SendMessageResponse 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.Caht2C_SendMessageResponse; } - [ProtoMember(1)] - public uint ErrorCode { get; set; } - } - /// - /// 获取离线时的未读私聊 - /// - [ProtoContract] - public partial class C2Chat_GetOfflineMessageRequest : AMessage, ICustomRouteRequest, IProto - { - public static C2Chat_GetOfflineMessageRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public Caht2C_GetOfflineMessageResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2Chat_GetOfflineMessageRequest; } - [ProtoIgnore] - public int RouteType => Fantasy.RouteType.ChatRoute; - } - /// - /// 发送聊天响应 - /// - [ProtoContract] - public partial class Caht2C_GetOfflineMessageResponse : AMessage, ICustomRouteResponse, IProto - { - public static Caht2C_GetOfflineMessageResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; - Message.Clear(); -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.Caht2C_GetOfflineMessageResponse; } - [ProtoMember(1)] - public List Message = new List(); - [ProtoMember(2)] - public uint ErrorCode { get; set; } - } - /// - /// 推送消息 - /// - [ProtoContract] - public partial class Chat2C_Message : AMessage, ICustomRouteMessage, IProto - { - public static Chat2C_Message Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Message = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.Chat2C_Message; } - [ProtoIgnore] - public int RouteType => Fantasy.RouteType.ChatRoute; - [ProtoMember(1)] - public ChatMessageInfo Message { get; set; } - } - /// - /// 获取聊天记录请求 - /// - [ProtoContract] - public partial class C2Chat_GetChatRecordRequest : AMessage, ICustomRouteRequest, IProto - { - public static C2Chat_GetChatRecordRequest Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Target = default; - Type = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoIgnore] - public Caht2C_GetChatRecordResponse ResponseType { get; set; } - public uint OpCode() { return OuterOpcode.C2Chat_GetChatRecordRequest; } - [ProtoIgnore] - public int RouteType => Fantasy.RouteType.ChatRoute; - [ProtoMember(1)] - public long Target { get; set; } - [ProtoMember(2)] - public int Type { get; set; } - } - /// - /// 获取聊天记录响应 - /// - [ProtoContract] - public partial class Caht2C_GetChatRecordResponse : AMessage, ICustomRouteResponse, IProto - { - public static Caht2C_GetChatRecordResponse Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - ErrorCode = default; - Messages.Clear(); -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - public uint OpCode() { return OuterOpcode.Caht2C_GetChatRecordResponse; } - [ProtoMember(1)] - public List Messages = new List(); - [ProtoMember(2)] - public uint ErrorCode { get; set; } - } -} diff --git a/Entity/Generate/NetworkProtocol/Friend.cs b/Entity/Generate/NetworkProtocol/Friend.cs deleted file mode 100644 index 6847b97..0000000 --- a/Entity/Generate/NetworkProtocol/Friend.cs +++ /dev/null @@ -1,58 +0,0 @@ -using ProtoBuf; - -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using Fantasy; -using Fantasy.Network.Interface; -using Fantasy.Serialize; -// ReSharper disable InconsistentNaming -// ReSharper disable RedundantUsingDirective -// ReSharper disable RedundantOverriddenMember -// ReSharper disable PartialTypeWithSinglePart -// ReSharper disable UnusedAutoPropertyAccessor.Global -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable CheckNamespace -#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. -#pragma warning disable CS8618 - -namespace Fantasy -{ - /// - /// 好友信息 - /// - [ProtoContract] - public partial class FriendInfo : AMessage, IProto - { - public static FriendInfo Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Id = default; - AddTime = default; - NickName = default; - Head = default; - Level = default; - Country = default; - OnlineStatus = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoMember(1)] - public long Id { get; set; } - [ProtoMember(2)] - public long AddTime { get; set; } - [ProtoMember(3)] - public string NickName { get; set; } - [ProtoMember(4)] - public string Head { get; set; } - [ProtoMember(5)] - public int Level { get; set; } - [ProtoMember(6)] - public string Country { get; set; } - [ProtoMember(7)] - public int OnlineStatus { get; set; } - } -} diff --git a/Entity/Generate/NetworkProtocol/GlobalData.cs b/Entity/Generate/NetworkProtocol/GlobalData.cs deleted file mode 100644 index 4b42718..0000000 --- a/Entity/Generate/NetworkProtocol/GlobalData.cs +++ /dev/null @@ -1,66 +0,0 @@ -using ProtoBuf; - -using System.Collections.Generic; -using MongoDB.Bson.Serialization.Attributes; -using Fantasy; -using Fantasy.Network.Interface; -using Fantasy.Serialize; -// ReSharper disable InconsistentNaming -// ReSharper disable RedundantUsingDirective -// ReSharper disable RedundantOverriddenMember -// ReSharper disable PartialTypeWithSinglePart -// ReSharper disable UnusedAutoPropertyAccessor.Global -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable CheckNamespace -#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. -#pragma warning disable CS8618 - -namespace Fantasy -{ - [ProtoContract] - public partial class ChatUserInfo : AMessage, IProto - { - public static ChatUserInfo Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Id = default; - Name = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoMember(1)] - public long Id { get; set; } - [ProtoMember(2)] - public long Name { get; set; } - } - [ProtoContract] - public partial class ChatMessageInfo : AMessage, IProto - { - public static ChatMessageInfo Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - Type = default; - Source = default; - Trigger = default; - Content = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoMember(1)] - public int Type { get; set; } - [ProtoMember(2)] - public long Source { get; set; } - [ProtoMember(3)] - public ChatUserInfo Trigger { get; set; } - [ProtoMember(4)] - public string Content { get; set; } - } -} diff --git a/Entity/Generate/NetworkProtocol/InnerMessage.cs b/Entity/Generate/NetworkProtocol/InnerMessage.cs index 28e4889..f483672 100644 --- a/Entity/Generate/NetworkProtocol/InnerMessage.cs +++ b/Entity/Generate/NetworkProtocol/InnerMessage.cs @@ -112,106 +112,106 @@ namespace Fantasy /// 通知游戏服角色进入该聊天服 /// [ProtoContract] - public partial class G2Chat_EnterRequest : AMessage, IRouteRequest, IProto + public partial class G2S_EnterRequest : AMessage, IRouteRequest, IProto { - public static G2Chat_EnterRequest Create(Scene scene) + public static G2S_EnterRequest Create(Scene scene) { - return scene.MessagePoolComponent.Rent(); + return scene.MessagePoolComponent.Rent(); } public override void Dispose() { Role = default; GateRouteId = default; #if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); + GetScene().MessagePoolComponent.Return(this); #endif } [ProtoIgnore] - public Chat2G_EnterResponse ResponseType { get; set; } - public uint OpCode() { return InnerOpcode.G2Chat_EnterRequest; } + public S2G_EnterResponse ResponseType { get; set; } + public uint OpCode() { return InnerOpcode.G2S_EnterRequest; } [ProtoMember(1)] public RoleSimpleInfo Role { get; set; } [ProtoMember(2)] public long GateRouteId { get; set; } } [ProtoContract] - public partial class Chat2G_EnterResponse : AMessage, IRouteResponse, IProto + public partial class S2G_EnterResponse : AMessage, IRouteResponse, IProto { - public static Chat2G_EnterResponse Create(Scene scene) + public static S2G_EnterResponse Create(Scene scene) { - return scene.MessagePoolComponent.Rent(); + return scene.MessagePoolComponent.Rent(); } public override void Dispose() { ErrorCode = default; RoleRouteId = default; #if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); + GetScene().MessagePoolComponent.Return(this); #endif } - public uint OpCode() { return InnerOpcode.Chat2G_EnterResponse; } + public uint OpCode() { return InnerOpcode.S2G_EnterResponse; } [ProtoMember(1)] public long RoleRouteId { get; set; } [ProtoMember(2)] public uint ErrorCode { get; set; } } [ProtoContract] - public partial class G2Chat_ExitRequest : AMessage, IRouteRequest, IProto + public partial class G2S_ExitRequest : AMessage, IRouteRequest, IProto { - public static G2Chat_ExitRequest Create(Scene scene) + public static G2S_ExitRequest Create(Scene scene) { - return scene.MessagePoolComponent.Rent(); + return scene.MessagePoolComponent.Rent(); } public override void Dispose() { AccountId = default; GateRouteId = default; #if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); + GetScene().MessagePoolComponent.Return(this); #endif } [ProtoIgnore] - public Chat2G_ExitResponse ResponseType { get; set; } - public uint OpCode() { return InnerOpcode.G2Chat_ExitRequest; } + public S2G_ExitResponse ResponseType { get; set; } + public uint OpCode() { return InnerOpcode.G2S_ExitRequest; } [ProtoMember(1)] public long AccountId { get; set; } [ProtoMember(2)] public long GateRouteId { get; set; } } [ProtoContract] - public partial class Chat2G_ExitResponse : AMessage, IRouteResponse, IProto + public partial class S2G_ExitResponse : AMessage, IRouteResponse, IProto { - public static Chat2G_ExitResponse Create(Scene scene) + public static S2G_ExitResponse Create(Scene scene) { - return scene.MessagePoolComponent.Rent(); + return scene.MessagePoolComponent.Rent(); } public override void Dispose() { ErrorCode = default; #if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); + GetScene().MessagePoolComponent.Return(this); #endif } - public uint OpCode() { return InnerOpcode.Chat2G_ExitResponse; } + public uint OpCode() { return InnerOpcode.S2G_ExitResponse; } [ProtoMember(1)] public uint ErrorCode { get; set; } } [ProtoContract] - public partial class Chat2G_ChatMessage : AMessage, IRouteMessage, IProto + public partial class S2G_ChatMessage : AMessage, IRouteMessage, IProto { - public static Chat2G_ChatMessage Create(Scene scene) + public static S2G_ChatMessage Create(Scene scene) { - return scene.MessagePoolComponent.Rent(); + return scene.MessagePoolComponent.Rent(); } public override void Dispose() { Message = default; IdList.Clear(); #if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); + GetScene().MessagePoolComponent.Return(this); #endif } - public uint OpCode() { return InnerOpcode.Chat2G_ChatMessage; } + public uint OpCode() { return InnerOpcode.S2G_ChatMessage; } [ProtoMember(1)] public ChatMessageInfo Message { get; set; } [ProtoMember(2)] diff --git a/Entity/Generate/NetworkProtocol/InnerOpcode.cs b/Entity/Generate/NetworkProtocol/InnerOpcode.cs index bbc80f6..d4ed182 100644 --- a/Entity/Generate/NetworkProtocol/InnerOpcode.cs +++ b/Entity/Generate/NetworkProtocol/InnerOpcode.cs @@ -6,11 +6,11 @@ namespace Fantasy public const uint Game2G_EnterResponse = 1207969553; public const uint G2Game_ExitRequest = 1073751826; public const uint Game2G_ExitResponse = 1207969554; - public const uint G2Chat_EnterRequest = 1073751827; - public const uint Chat2G_EnterResponse = 1207969555; - public const uint G2Chat_ExitRequest = 1073751828; - public const uint Chat2G_ExitResponse = 1207969556; - public const uint Chat2G_ChatMessage = 939534097; + public const uint G2S_EnterRequest = 1073751827; + public const uint S2G_EnterResponse = 1207969555; + public const uint G2S_ExitRequest = 1073751828; + public const uint S2G_ExitResponse = 1207969556; + public const uint S2G_ChatMessage = 939534097; public const uint Club2Chat_CreateChannel = 939534098; } } diff --git a/Entity/Generate/NetworkProtocol/OuterOpcode.cs b/Entity/Generate/NetworkProtocol/OuterOpcode.cs index 82a8453..1fc5291 100644 --- a/Entity/Generate/NetworkProtocol/OuterOpcode.cs +++ b/Entity/Generate/NetworkProtocol/OuterOpcode.cs @@ -2,28 +2,28 @@ namespace Fantasy { public static partial class OuterOpcode { - public const uint C2Game_GetMailsRequest = 2281711377; - public const uint Game2C_GetMailsResponse = 2415929105; - public const uint Game2C_HaveMail = 2147493649; - public const uint Game2C_MailState = 2147493650; - public const uint C2Chat_CreateChannelRequest = 2281711378; - public const uint Caht2C_CreateChannelResponse = 2415929106; - public const uint C2Chat_JoinChannelRequest = 2281711379; - public const uint Caht2C_JoinChannelResponse = 2415929107; - public const uint C2Chat_SendMessageRequest = 2281711380; - public const uint Caht2C_SendMessageResponse = 2415929108; - public const uint C2Chat_GetOfflineMessageRequest = 2281711381; - public const uint Caht2C_GetOfflineMessageResponse = 2415929109; - public const uint Chat2C_Message = 2147493651; - public const uint C2Chat_GetChatRecordRequest = 2281711382; - public const uint Caht2C_GetChatRecordResponse = 2415929110; public const uint C2A_LoginRequest = 268445457; public const uint A2C_LoginResponse = 402663185; public const uint C2G_LoginRequest = 268445458; public const uint G2C_LoginResponse = 402663186; public const uint G2C_RepeatLogin = 134227729; - public const uint C2Game_GetRoleInfoRequest = 2281711383; - public const uint Game2C_GetRoleInfoResponse = 2415929111; + public const uint C2Game_GetRoleInfoRequest = 2281711377; + public const uint Game2C_GetRoleInfoResponse = 2415929105; + public const uint C2Game_GetMailsRequest = 2281711378; + public const uint Game2C_GetMailsResponse = 2415929106; + public const uint Game2C_HaveMail = 2147493649; + public const uint Game2C_MailState = 2147493650; + public const uint C2S_CreateChannelRequest = 2281711379; + public const uint S2C_CreateChannelResponse = 2415929107; + public const uint C2S_JoinChannelRequest = 2281711380; + public const uint S2C_JoinChannelResponse = 2415929108; + public const uint C2S_SendMessageRequest = 2281711381; + public const uint S2C_SendMessageResponse = 2415929109; + public const uint C2S_GetOfflineMessageRequest = 2281711382; + public const uint S2C_GetOfflineMessageResponse = 2415929110; + public const uint S2C_Message = 2147493651; + public const uint C2S_GetChatRecordRequest = 2281711383; + public const uint S2C_GetChatRecordResponse = 2415929111; public const uint C2S_CreateClubRequest = 2281711384; public const uint S2C_CreateClubResponse = 2415929112; public const uint C2S_GetClubInfoRequest = 2281711385; diff --git a/Entity/Generate/NetworkProtocol/RouteType.cs b/Entity/Generate/NetworkProtocol/RouteType.cs index ff44fc5..ec20017 100644 --- a/Entity/Generate/NetworkProtocol/RouteType.cs +++ b/Entity/Generate/NetworkProtocol/RouteType.cs @@ -4,8 +4,7 @@ namespace Fantasy public static class RouteType { public const int GateRoute = 1001; // Gate - public const int ChatRoute = 1002; // Chat + public const int SocialRoute = 1002; // Social public const int GameRoute = 1003; // Game - public const int SocialRoute = 1004; // Social } } diff --git a/Entity/Generate/NetworkProtocol/SocialMessage.cs b/Entity/Generate/NetworkProtocol/SocialMessage.cs index d93441f..92cd9f7 100644 --- a/Entity/Generate/NetworkProtocol/SocialMessage.cs +++ b/Entity/Generate/NetworkProtocol/SocialMessage.cs @@ -17,6 +17,430 @@ using Fantasy.Serialize; namespace Fantasy { + /// + /// /////////// ******** 邮件 *******///////////// + /// + /// + /// 请求邮件列表 + /// + [ProtoContract] + public partial class C2Game_GetMailsRequest : AMessage, ICustomRouteRequest, IProto + { + public static C2Game_GetMailsRequest Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoIgnore] + public Game2C_GetMailsResponse ResponseType { get; set; } + public uint OpCode() { return OuterOpcode.C2Game_GetMailsRequest; } + [ProtoIgnore] + public int RouteType => Fantasy.RouteType.GameRoute; + } + /// + /// 获取邮件列表响应 + /// + [ProtoContract] + public partial class Game2C_GetMailsResponse : AMessage, ICustomRouteResponse, IProto + { + public static Game2C_GetMailsResponse Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + ErrorCode = default; + Mail.Clear(); +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + public uint OpCode() { return OuterOpcode.Game2C_GetMailsResponse; } + [ProtoMember(1)] + public List Mail = new List(); + [ProtoMember(2)] + public uint ErrorCode { get; set; } + } + /// + /// 新邮件推送 + /// + [ProtoContract] + public partial class Game2C_HaveMail : AMessage, ICustomRouteMessage, IProto + { + public static Game2C_HaveMail Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Mail = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + public uint OpCode() { return OuterOpcode.Game2C_HaveMail; } + [ProtoIgnore] + public int RouteType => Fantasy.RouteType.GameRoute; + [ProtoMember(1)] + public MailInfo Mail { get; set; } + } + [ProtoContract] + public partial class Game2C_MailState : AMessage, ICustomRouteMessage, IProto + { + public static Game2C_MailState Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + MailState = default; + MailId = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + public uint OpCode() { return OuterOpcode.Game2C_MailState; } + [ProtoIgnore] + public int RouteType => Fantasy.RouteType.GameRoute; + [ProtoMember(1)] + public int MailState { get; set; } + [ProtoMember(2)] + public long MailId { get; set; } + } + /// + /// /////////// ******** 聊天 *******///////////// + /// + [ProtoContract] + public partial class ChatUserInfo : AMessage, IProto + { + public static ChatUserInfo Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Id = default; + Name = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public long Id { get; set; } + [ProtoMember(2)] + public long Name { get; set; } + } + [ProtoContract] + public partial class ChatMessageInfo : AMessage, IProto + { + public static ChatMessageInfo Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Type = default; + Source = default; + Trigger = default; + Content = default; + SendTime = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public int Type { get; set; } + [ProtoMember(2)] + public long Source { get; set; } + [ProtoMember(3)] + public ChatUserInfo Trigger { get; set; } + [ProtoMember(4)] + public string Content { get; set; } + [ProtoMember(5)] + public long SendTime { get; set; } + } + /// + /// 创建频道 + /// + [ProtoContract] + public partial class C2S_CreateChannelRequest : AMessage, ICustomRouteRequest, IProto + { + public static C2S_CreateChannelRequest Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Name = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoIgnore] + public S2C_CreateChannelResponse ResponseType { get; set; } + public uint OpCode() { return OuterOpcode.C2S_CreateChannelRequest; } + [ProtoIgnore] + public int RouteType => Fantasy.RouteType.SocialRoute; + [ProtoMember(1)] + public string Name { get; set; } + } + /// + /// 创建频道响应 + /// + [ProtoContract] + public partial class S2C_CreateChannelResponse : AMessage, ICustomRouteResponse, IProto + { + public static S2C_CreateChannelResponse Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + ErrorCode = default; + ChannelId = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + public uint OpCode() { return OuterOpcode.S2C_CreateChannelResponse; } + [ProtoMember(1)] + public long ChannelId { get; set; } + [ProtoMember(2)] + public uint ErrorCode { get; set; } + } + /// + /// 请求进入频道 + /// + [ProtoContract] + public partial class C2S_JoinChannelRequest : AMessage, ICustomRouteRequest, IProto + { + public static C2S_JoinChannelRequest Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Target = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoIgnore] + public S2C_JoinChannelResponse ResponseType { get; set; } + public uint OpCode() { return OuterOpcode.C2S_JoinChannelRequest; } + [ProtoIgnore] + public int RouteType => Fantasy.RouteType.SocialRoute; + [ProtoMember(1)] + public long Target { get; set; } + } + /// + /// 进入频道响应 + /// + [ProtoContract] + public partial class S2C_JoinChannelResponse : AMessage, ICustomRouteResponse, IProto + { + public static S2C_JoinChannelResponse 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.S2C_JoinChannelResponse; } + [ProtoMember(1)] + public uint ErrorCode { get; set; } + } + /// + /// 发送聊天 + /// + [ProtoContract] + public partial class C2S_SendMessageRequest : AMessage, ICustomRouteRequest, IProto + { + public static C2S_SendMessageRequest Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Type = default; + Message = default; + Target = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoIgnore] + public S2C_SendMessageResponse ResponseType { get; set; } + public uint OpCode() { return OuterOpcode.C2S_SendMessageRequest; } + [ProtoIgnore] + public int RouteType => Fantasy.RouteType.SocialRoute; + [ProtoMember(1)] + public int Type { get; set; } + [ProtoMember(2)] + public string Message { get; set; } + [ProtoMember(3)] + public long Target { get; set; } + } + /// + /// 发送聊天响应 + /// + [ProtoContract] + public partial class S2C_SendMessageResponse : AMessage, ICustomRouteResponse, IProto + { + public static S2C_SendMessageResponse 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.S2C_SendMessageResponse; } + [ProtoMember(1)] + public uint ErrorCode { get; set; } + } + /// + /// 发送聊天 + /// + [ProtoContract] + public partial class C2S_GetOfflineMessageRequest : AMessage, ICustomRouteRequest, IProto + { + public static C2S_GetOfflineMessageRequest Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Type = default; + Message = default; + Target = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoIgnore] + public S2C_GetOfflineMessageResponse ResponseType { get; set; } + public uint OpCode() { return OuterOpcode.C2S_GetOfflineMessageRequest; } + [ProtoIgnore] + public int RouteType => Fantasy.RouteType.SocialRoute; + [ProtoMember(1)] + public int Type { get; set; } + [ProtoMember(2)] + public string Message { get; set; } + [ProtoMember(3)] + public long Target { get; set; } + } + /// + /// 发送聊天响应 + /// + [ProtoContract] + public partial class S2C_GetOfflineMessageResponse : AMessage, ICustomRouteResponse, IProto + { + public static S2C_GetOfflineMessageResponse Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + ErrorCode = default; + Message.Clear(); +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + public uint OpCode() { return OuterOpcode.S2C_GetOfflineMessageResponse; } + [ProtoMember(1)] + public List Message = new List(); + [ProtoMember(2)] + public uint ErrorCode { get; set; } + } + /// + /// 推送消息 + /// + [ProtoContract] + public partial class S2C_Message : AMessage, ICustomRouteMessage, IProto + { + public static S2C_Message Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Message = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + public uint OpCode() { return OuterOpcode.S2C_Message; } + [ProtoIgnore] + public int RouteType => Fantasy.RouteType.SocialRoute; + [ProtoMember(1)] + public ChatMessageInfo Message { get; set; } + } + /// + /// 获取聊天记录请求 + /// + [ProtoContract] + public partial class C2S_GetChatRecordRequest : AMessage, ICustomRouteRequest, IProto + { + public static C2S_GetChatRecordRequest Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Target = default; + Type = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoIgnore] + public S2C_GetChatRecordResponse ResponseType { get; set; } + public uint OpCode() { return OuterOpcode.C2S_GetChatRecordRequest; } + [ProtoIgnore] + public int RouteType => Fantasy.RouteType.SocialRoute; + [ProtoMember(1)] + public long Target { get; set; } + [ProtoMember(2)] + public int Type { get; set; } + } + /// + /// 获取聊天记录响应 + /// + [ProtoContract] + public partial class S2C_GetChatRecordResponse : AMessage, ICustomRouteResponse, IProto + { + public static S2C_GetChatRecordResponse Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + ErrorCode = default; + Messages.Clear(); +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + public uint OpCode() { return OuterOpcode.S2C_GetChatRecordResponse; } + [ProtoMember(1)] + public List Messages = new List(); + [ProtoMember(2)] + public uint ErrorCode { get; set; } + } [ProtoContract] public partial class ClubInfo : AMessage, IProto { diff --git a/Entity/Chat/Entity/ChatChannel.cs b/Entity/Social/Chat/ChatChannel.cs similarity index 90% rename from Entity/Chat/Entity/ChatChannel.cs rename to Entity/Social/Chat/ChatChannel.cs index ac12b3f..2d1edb0 100644 --- a/Entity/Chat/Entity/ChatChannel.cs +++ b/Entity/Social/Chat/ChatChannel.cs @@ -9,12 +9,12 @@ namespace NB.Chat; public class ChatChannel : Entity { /// - /// 频道短id + /// 频道绑定id /// - [BsonElement("cid")] public uint ChannelId; + [BsonElement("cid")] public long ChannelId; /// - /// 频道类型 0.地图 1.公开 2.私密 + /// 频道类型 0.地图 1.工会频道 /// [BsonElement("type")] public uint ChannelType; diff --git a/Entity/Chat/Component/ChatChannelCenterComponent.cs b/Entity/Social/Chat/ChatChannelCenterComponent.cs similarity index 100% rename from Entity/Chat/Component/ChatChannelCenterComponent.cs rename to Entity/Social/Chat/ChatChannelCenterComponent.cs diff --git a/Entity/Game/Club/Club.cs b/Entity/Social/Club/Club.cs similarity index 100% rename from Entity/Game/Club/Club.cs rename to Entity/Social/Club/Club.cs diff --git a/Entity/Game/Club/ClubManageComponent.cs b/Entity/Social/Club/ClubManageComponent.cs similarity index 100% rename from Entity/Game/Club/ClubManageComponent.cs rename to Entity/Social/Club/ClubManageComponent.cs diff --git a/Entity/Game/Mail/Components/MailComponent.cs b/Entity/Social/Mail/Components/MailComponent.cs similarity index 100% rename from Entity/Game/Mail/Components/MailComponent.cs rename to Entity/Social/Mail/Components/MailComponent.cs diff --git a/Entity/Game/Mail/Entity/Mail.cs b/Entity/Social/Mail/Entity/Mail.cs similarity index 100% rename from Entity/Game/Mail/Entity/Mail.cs rename to Entity/Social/Mail/Entity/Mail.cs diff --git a/Entity/Game/Mail/Entity/MailBox.cs b/Entity/Social/Mail/Entity/MailBox.cs similarity index 100% rename from Entity/Game/Mail/Entity/MailBox.cs rename to Entity/Social/Mail/Entity/MailBox.cs diff --git a/Entity/Game/Mail/Enum/MailEnum.cs b/Entity/Social/Mail/Enum/MailEnum.cs similarity index 100% rename from Entity/Game/Mail/Enum/MailEnum.cs rename to Entity/Social/Mail/Enum/MailEnum.cs diff --git a/Entity/Chat/Entity/ChatUnit.cs b/Entity/Social/SocialUnit.cs similarity index 92% rename from Entity/Chat/Entity/ChatUnit.cs rename to Entity/Social/SocialUnit.cs index 78bcd04..cf86eb2 100644 --- a/Entity/Chat/Entity/ChatUnit.cs +++ b/Entity/Social/SocialUnit.cs @@ -3,7 +3,7 @@ using Fantasy.Entitas; namespace NB.Chat; -public sealed class ChatUnit : Entity +public sealed class SocialUnit : Entity { public long GateRouteId; diff --git a/Entity/Chat/Component/ChatUnitManageComponent.cs b/Entity/Social/SocialUnitManageComponent.cs similarity index 56% rename from Entity/Chat/Component/ChatUnitManageComponent.cs rename to Entity/Social/SocialUnitManageComponent.cs index 9fa5da8..7db93ea 100644 --- a/Entity/Chat/Component/ChatUnitManageComponent.cs +++ b/Entity/Social/SocialUnitManageComponent.cs @@ -4,14 +4,12 @@ using Fantasy.Entitas; namespace NB.Chat; -public class ChatUnitManageComponent : Entity +public class SocialUnitManageComponent : Entity { - public readonly Dictionary ChatUnits = new(); + public readonly Dictionary Units = new(); /// /// 不在线消息缓存 /// public readonly OneToManyList NotSendMessage = new(); - - public readonly OneToManyList PrivateMessage = new(); } \ No newline at end of file diff --git a/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs b/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs deleted file mode 100644 index 8851a9e..0000000 --- a/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Text; -using Fantasy; -using Fantasy.Async; -using Fantasy.Network.Interface; - -namespace NB.Chat; - -public sealed class - C2Chat_SendMessageRequestHandler : RouteRPC -{ - protected override async FTask Run(ChatUnit chatUnit, C2Chat_SendMessageRequest request, - Caht2C_SendMessageResponse response, Action reply) - { - if (request.Target < 1) - { - response.ErrorCode = ErrorCode.ErrArgs; - return; - } - - if (request.Type == 0) //频道聊天 - { - ChatSceneHelper.BroadcastChannel(chatUnit.Scene, request.Target, new ChatMessageInfo() - { - Content = request.Message, - }); - } - else if (request.Type == 1) //私聊 - { - //发送私聊 - ChatSceneHelper.PrivateMessage(chatUnit.Scene, chatUnit.Id, request.Target, new ChatMessageInfo() - { - Content = request.Message, - }); - } - else if (request.Type == 3) //广播聊天 - { - ChatSceneHelper.BroadcastAll(chatUnit.Scene, new ChatMessageInfo() - { - Content = request.Message, - }); - } - - await FTask.CompletedTask; - } -} \ No newline at end of file diff --git a/Hotfix/Chat/Handler/Inner/G2Chat_ExitRequestHandler.cs b/Hotfix/Chat/Handler/Inner/G2Chat_ExitRequestHandler.cs deleted file mode 100644 index c99489d..0000000 --- a/Hotfix/Chat/Handler/Inner/G2Chat_ExitRequestHandler.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Fantasy; -using Fantasy.Async; -using Fantasy.Network.Interface; - -namespace NB.Chat; - -public class G2Chat_ExitRequestHandler : RouteRPC -{ - protected override async FTask Run(Scene scene, G2Chat_ExitRequest request, Chat2G_ExitResponse response, - Action reply) - { - // 在缓存中检查该账号是否存在 - var chatUnitManageComponent = scene.GetComponent(); - await chatUnitManageComponent.Offline(scene, request.AccountId, request.GateRouteId); - } -} \ No newline at end of file diff --git a/Hotfix/Game/Player/Components/PlayerManageComponentSystem.cs b/Hotfix/Game/Player/Components/PlayerManageComponentSystem.cs index 5b99bee..492c71d 100644 --- a/Hotfix/Game/Player/Components/PlayerManageComponentSystem.cs +++ b/Hotfix/Game/Player/Components/PlayerManageComponentSystem.cs @@ -105,21 +105,6 @@ public static class PlayerManageComponentSystem account.Statistics.LoginTime = TimeHelper.Now; - - if (account.GetComponent() == null) - { - var mailComponent = await scene.World.DataBase.Query(account.Id, true); - if (mailComponent == null) - { - //如果没有邮件组件 - account.AddComponent(); - } - else - { - account.AddComponent(mailComponent); - } - } - await account.Save(); return account; diff --git a/Hotfix/Gate/Handler/Inner/Chat2G_ChatMessageHandler.cs b/Hotfix/Gate/Handler/Inner/S2G_ChatMessageHandler.cs similarity index 84% rename from Hotfix/Gate/Handler/Inner/Chat2G_ChatMessageHandler.cs rename to Hotfix/Gate/Handler/Inner/S2G_ChatMessageHandler.cs index 02caf9b..546ef19 100644 --- a/Hotfix/Gate/Handler/Inner/Chat2G_ChatMessageHandler.cs +++ b/Hotfix/Gate/Handler/Inner/S2G_ChatMessageHandler.cs @@ -7,11 +7,11 @@ using Fantasy.PacketParser; namespace NB.Gate; -public class Chat2G_ChatMessageHandler : Route +public class S2G_ChatMessageHandler : Route { - protected override async FTask Run(Scene scene, Chat2G_ChatMessage message) + protected override async FTask Run(Scene scene, S2G_ChatMessage message) { - var chatMessage = new Chat2C_Message() + var chatMessage = new S2C_Message() { Message = message.Message, }; diff --git a/Hotfix/Gate/Helper/GateLoginHelper.cs b/Hotfix/Gate/Helper/GateLoginHelper.cs index 3477a1d..c8eac7c 100644 --- a/Hotfix/Gate/Helper/GateLoginHelper.cs +++ b/Hotfix/Gate/Helper/GateLoginHelper.cs @@ -58,13 +58,13 @@ public static class GateLoginHelper //安排进入的聊天服 var (chatRouteId, sceneRouteId) = - await ChatSceneHelper.Online(session.Scene, roleSimpleInfo, session.RuntimeId); + await SocialSceneHelper.Online(session.Scene, roleSimpleInfo, session.RuntimeId); if (chatRouteId <= 0) { return ErrorCode.OnlineSceneFailed; } - routeComponent.AddAddress(RouteType.ChatRoute, chatRouteId); + routeComponent.AddAddress(RouteType.SocialRoute, chatRouteId); gateUnit.ChatSceneRouteId = sceneRouteId; Log.Info($"连接聊天服成功,gameRouteId:{gameRouteId}"); return ErrorCode.Successful; @@ -84,7 +84,7 @@ public static class GateLoginHelper //通知服务器下线 Log.Info($"断线的session id={sessionId} ChatSceneRouteId={gateUnit.ChatSceneRouteId}"); await GameSceneHelper.Offline(gateUnit.Scene, gateUnit.AccountID, sessionId); - await ChatSceneHelper.Offline(gateUnit.Scene, gateUnit.AccountID, sessionId, + await SocialSceneHelper.Offline(gateUnit.Scene, gateUnit.AccountID, sessionId, gateUnit.ChatSceneRouteId); return ErrorCode.Successful; } diff --git a/Hotfix/OnCreateSceneEvent.cs b/Hotfix/OnCreateSceneEvent.cs index bb041ce..f43ea11 100644 --- a/Hotfix/OnCreateSceneEvent.cs +++ b/Hotfix/OnCreateSceneEvent.cs @@ -67,7 +67,7 @@ public sealed class OnCreateSceneEvent : AsyncEventSystem Log.Debug($"Map Scene SceneRuntimeId:{scene.RuntimeId}"); break; } - case SceneType.Chat: + case SceneType.Social: { break; } diff --git a/Hotfix/OnSceneCreate_Init.cs b/Hotfix/OnSceneCreate_Init.cs index b0bfddf..7e6af12 100644 --- a/Hotfix/OnSceneCreate_Init.cs +++ b/Hotfix/OnSceneCreate_Init.cs @@ -38,10 +38,10 @@ public class OnSceneCreate_Init : AsyncEventSystem scene.AddComponent(); break; } - case SceneType.Chat: + case SceneType.Social: { //用于管理玩家的组件 - scene.AddComponent(); + scene.AddComponent(); scene.AddComponent(); break; } diff --git a/Hotfix/Chat/Handler/C2Chat_CreateChannelRequestHandler.cs b/Hotfix/Social/Handler/C2S_CreateChannelRequestHandler.cs similarity index 64% rename from Hotfix/Chat/Handler/C2Chat_CreateChannelRequestHandler.cs rename to Hotfix/Social/Handler/C2S_CreateChannelRequestHandler.cs index d50bd8f..25a99e6 100644 --- a/Hotfix/Chat/Handler/C2Chat_CreateChannelRequestHandler.cs +++ b/Hotfix/Social/Handler/C2S_CreateChannelRequestHandler.cs @@ -8,10 +8,10 @@ namespace NB.Chat; /// 请求创建频道 /// public class - C2Chat_CreateChannelRequestHandler : RouteRPC + C2S_CreateChannelRequestHandler : RouteRPC { - protected override async FTask Run(ChatUnit entity, C2Chat_CreateChannelRequest request, - Caht2C_CreateChannelResponse response, Action reply) + protected override async FTask Run(SocialUnit entity, C2S_CreateChannelRequest request, + S2C_CreateChannelResponse response, Action reply) { var channelCenter = entity.Scene.GetComponent(); if (channelCenter == null) diff --git a/Hotfix/Chat/Handler/C2Chat_GetOfflineMessageRequestHandler.cs b/Hotfix/Social/Handler/C2S_GetOfflineMessageRequestHandler.cs similarity index 51% rename from Hotfix/Chat/Handler/C2Chat_GetOfflineMessageRequestHandler.cs rename to Hotfix/Social/Handler/C2S_GetOfflineMessageRequestHandler.cs index 9c6fb7d..3e5b64d 100644 --- a/Hotfix/Chat/Handler/C2Chat_GetOfflineMessageRequestHandler.cs +++ b/Hotfix/Social/Handler/C2S_GetOfflineMessageRequestHandler.cs @@ -5,14 +5,14 @@ using Fantasy.Network.Interface; namespace NB.Chat; public class - C2Chat_GetOfflineMessageRequestHandler : RouteRPC + C2S_GetOfflineMessageRequestHandler : RouteRPC { - protected override async FTask Run(ChatUnit entity, C2Chat_GetOfflineMessageRequest request, - Caht2C_GetOfflineMessageResponse response, + protected override async FTask Run(SocialUnit entity, C2S_GetOfflineMessageRequest request, + S2C_GetOfflineMessageResponse response, Action reply) { - var chatUnitManage = entity.Scene.GetComponent(); + var chatUnitManage = entity.Scene.GetComponent(); if (chatUnitManage.NotSendMessage.TryGetValue(entity.Id, out var list)) { response.Message.AddRange(list); diff --git a/Hotfix/Chat/Handler/C2Chat_JoinChannelRequestHandler.cs b/Hotfix/Social/Handler/C2S_JoinChannelRequestHandler.cs similarity index 67% rename from Hotfix/Chat/Handler/C2Chat_JoinChannelRequestHandler.cs rename to Hotfix/Social/Handler/C2S_JoinChannelRequestHandler.cs index 6b05fa6..f3b1f02 100644 --- a/Hotfix/Chat/Handler/C2Chat_JoinChannelRequestHandler.cs +++ b/Hotfix/Social/Handler/C2S_JoinChannelRequestHandler.cs @@ -8,16 +8,17 @@ namespace NB.Chat; /// 请求进入频道 /// public class - C2Chat_JoinChannelRequestHandler : RouteRPC + C2S_JoinChannelRequestHandler : RouteRPC { - protected override async FTask Run(ChatUnit entity, C2Chat_JoinChannelRequest request, - Caht2C_JoinChannelResponse response, Action reply) + protected override async FTask Run(SocialUnit entity, C2S_JoinChannelRequest request, + S2C_JoinChannelResponse response, Action reply) { if (request.Target < 1) { response.ErrorCode = ErrorCode.ErrArgs; return; } + var channelCenter = entity.Scene.GetComponent(); if (channelCenter == null) { @@ -40,6 +41,15 @@ public class var newChannel = await channelCenter.Get(request.Target); if (newChannel != null) { + if (newChannel.ChannelType == 1) + { + //工会频道需要再工会才能加入 + } + else if (newChannel.ChannelType == 0) + { + //地图频道需要判断在这个地图才能加入 + } + newChannel.Enter(entity); } else diff --git a/Hotfix/Social/Handler/C2S_SendMessageRequestHandler.cs b/Hotfix/Social/Handler/C2S_SendMessageRequestHandler.cs new file mode 100644 index 0000000..01f9a3e --- /dev/null +++ b/Hotfix/Social/Handler/C2S_SendMessageRequestHandler.cs @@ -0,0 +1,41 @@ +using System.Text; +using Fantasy; +using Fantasy.Async; +using Fantasy.Helper; +using Fantasy.Network.Interface; + +namespace NB.Chat; + +public sealed class + C2S_SendMessageRequestHandler : RouteRPC +{ + protected override async FTask Run(SocialUnit socialUnit, C2S_SendMessageRequest request, + S2C_SendMessageResponse response, Action reply) + { + if (request.Target < 1) + { + response.ErrorCode = ErrorCode.ErrArgs; + return; + } + + if (request.Type == 0) //频道聊天 + { + SocialSceneHelper.BroadcastChannel(socialUnit.Scene, request.Target, new ChatMessageInfo() + { + SendTime = TimeHelper.Now, + Content = request.Message, + }); + } + else if (request.Type == 1) //私聊 + { + //发送私聊 + SocialSceneHelper.PrivateMessage(socialUnit.Scene, socialUnit.Id, request.Target, new ChatMessageInfo() + { + SendTime = TimeHelper.Now, + Content = request.Message, + }); + } + + await FTask.CompletedTask; + } +} \ No newline at end of file diff --git a/Hotfix/Chat/Handler/Inner/G2Chat_EnterRequestHandler.cs b/Hotfix/Social/Handler/Inner/G2S_EnterRequestHandler.cs similarity index 52% rename from Hotfix/Chat/Handler/Inner/G2Chat_EnterRequestHandler.cs rename to Hotfix/Social/Handler/Inner/G2S_EnterRequestHandler.cs index 276b9bd..60c2b87 100644 --- a/Hotfix/Chat/Handler/Inner/G2Chat_EnterRequestHandler.cs +++ b/Hotfix/Social/Handler/Inner/G2S_EnterRequestHandler.cs @@ -5,16 +5,16 @@ using NB.Game; namespace NB.Chat; -public class G2Chat_EnterRequestHandler : RouteRPC +public class G2S_EnterRequestHandler : RouteRPC { - protected override async FTask Run(Scene scene, G2Chat_EnterRequest request, Chat2G_EnterResponse response, + protected override async FTask Run(Scene scene, G2S_EnterRequest request, S2G_EnterResponse response, Action reply) { var roleId = request.Role.RoleId; - Log.Debug($"收到 G2Chat_EnterRequestHandler {roleId}"); + Log.Debug($"收到 G2S_EnterRequestHandler {roleId}"); // 在缓存中检查该账号是否存在 - var chatUnitManageComponent = scene.GetComponent(); + var chatUnitManageComponent = scene.GetComponent(); var account = await chatUnitManageComponent.Online(scene, request.Role, request.GateRouteId); response.RoleRouteId = account.RuntimeId; diff --git a/Hotfix/Social/Handler/Inner/G2S_ExitRequestHandler.cs b/Hotfix/Social/Handler/Inner/G2S_ExitRequestHandler.cs new file mode 100644 index 0000000..c2e4bbc --- /dev/null +++ b/Hotfix/Social/Handler/Inner/G2S_ExitRequestHandler.cs @@ -0,0 +1,16 @@ +using Fantasy; +using Fantasy.Async; +using Fantasy.Network.Interface; + +namespace NB.Chat; + +public class G2S_ExitRequestHandler : RouteRPC +{ + protected override async FTask Run(Scene scene, G2S_ExitRequest request, S2G_ExitResponse response, + Action reply) + { + // 在缓存中检查该账号是否存在 + var chatUnitManageComponent = scene.GetComponent(); + await chatUnitManageComponent.Offline(scene, request.AccountId, request.GateRouteId); + } +} \ No newline at end of file diff --git a/Hotfix/Chat/Helper/ChatUnitFactory.cs b/Hotfix/Social/Helper/ChatUnitFactory.cs similarity index 76% rename from Hotfix/Chat/Helper/ChatUnitFactory.cs rename to Hotfix/Social/Helper/ChatUnitFactory.cs index e41a934..9df3471 100644 --- a/Hotfix/Chat/Helper/ChatUnitFactory.cs +++ b/Hotfix/Social/Helper/ChatUnitFactory.cs @@ -12,9 +12,9 @@ public static class ChatUnitFactory /// ToKen令牌传递过来的aId /// 是否在创建的过程中保存到数据库 /// - public static ChatUnit Create(Scene scene, long aId) + public static SocialUnit Create(Scene scene, long aId) { - var player = Entity.Create(scene, aId, true, true); + var player = Entity.Create(scene, aId, true, true); return player; } } \ No newline at end of file diff --git a/Hotfix/Chat/Helper/ChatSceneHelper.cs b/Hotfix/Social/Helper/SocialSceneHelper.cs similarity index 85% rename from Hotfix/Chat/Helper/ChatSceneHelper.cs rename to Hotfix/Social/Helper/SocialSceneHelper.cs index 298c289..c5955e9 100644 --- a/Hotfix/Chat/Helper/ChatSceneHelper.cs +++ b/Hotfix/Social/Helper/SocialSceneHelper.cs @@ -4,7 +4,7 @@ using Fantasy.Platform.Net; namespace NB.Chat; -public static class ChatSceneHelper +public static class SocialSceneHelper { #region 消息发送 @@ -17,7 +17,7 @@ public static class ChatSceneHelper /// public static void PrivateMessage(Scene scene, long selfId, long targetId, ChatMessageInfo message) { - var chatUnitManage = scene.GetComponent(); + var chatUnitManage = scene.GetComponent(); if (chatUnitManage == null) return; var chatUnit = chatUnitManage.Get(targetId); message.Type = 1; @@ -42,10 +42,10 @@ public static class ChatSceneHelper /// public static void BroadcastMap(Scene scene, long mapId, ChatMessageInfo message) { - var chatUnitManage = scene.GetComponent(); + var chatUnitManage = scene.GetComponent(); if (chatUnitManage == null) return; HashSet targets = new HashSet(); - foreach (var (_, chatUnit) in chatUnitManage.ChatUnits) + foreach (var (_, chatUnit) in chatUnitManage.Units) { if (chatUnit.MapId == mapId) { @@ -70,10 +70,10 @@ public static class ChatSceneHelper /// public static void BroadcastChannel(Scene scene, long channelId, ChatMessageInfo message) { - var chatUnitManage = scene.GetComponent(); + var chatUnitManage = scene.GetComponent(); if (chatUnitManage == null) return; HashSet targets = new HashSet(); - foreach (var (_, chatUnit) in chatUnitManage.ChatUnits) + foreach (var (_, chatUnit) in chatUnitManage.Units) { if (chatUnit.CurrentChannel == channelId) { @@ -100,7 +100,7 @@ public static class ChatSceneHelper { //发送给所有Gate服务器,让Gate转发给其他客户端 var gateConfigs = SceneConfigData.Instance.GetSceneBySceneType(SceneType.Gate); - var sendMessage = new Chat2G_ChatMessage() + var sendMessage = new S2G_ChatMessage() { Message = message, }; @@ -127,8 +127,8 @@ public static class ChatSceneHelper var gameSceneConfig = GetSceneConfig(); var gameRouteId = gameSceneConfig.RouteId; //连接到游戏中心服 - var gameResponse = (Chat2G_EnterResponse)await scene.NetworkMessagingComponent.CallInnerRoute( - gameRouteId, new G2Chat_EnterRequest() + var gameResponse = (S2G_EnterResponse)await scene.NetworkMessagingComponent.CallInnerRoute( + gameRouteId, new G2S_EnterRequest() { Role = roleSimple, GateRouteId = gateRuntimeId @@ -147,8 +147,8 @@ public static class ChatSceneHelper { for (int i = 0; i < 10; i++) { - var gameResponse = (Chat2G_ExitResponse)await scene.NetworkMessagingComponent.CallInnerRoute( - sceneRouteId, new G2Chat_ExitRequest() + var gameResponse = (S2G_ExitResponse)await scene.NetworkMessagingComponent.CallInnerRoute( + sceneRouteId, new G2S_ExitRequest() { AccountId = accountId, GateRouteId = gateRuntimeId @@ -164,7 +164,7 @@ public static class ChatSceneHelper private static SceneConfig GetSceneConfig() { - var gameSceneConfigs = SceneConfigData.Instance.GetSceneBySceneType(SceneType.Chat); + var gameSceneConfigs = SceneConfigData.Instance.GetSceneBySceneType(SceneType.Social); return gameSceneConfigs.First(); } diff --git a/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs b/Hotfix/Social/System/ChatChannelCenterComponentSystem.cs similarity index 98% rename from Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs rename to Hotfix/Social/System/ChatChannelCenterComponentSystem.cs index 851e9d2..d2e2ef5 100644 --- a/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs +++ b/Hotfix/Social/System/ChatChannelCenterComponentSystem.cs @@ -51,7 +51,7 @@ public static class ChatChannelCenterComponentSystem /// /// /// - public static async FTask Create(this ChatChannelCenterComponent self, ChatUnit unit) + public static async FTask Create(this ChatChannelCenterComponent self, SocialUnit unit) { var channel = Entity.Create(self.Scene, true, true); channel.Creator = unit.Role.RoleId; diff --git a/Hotfix/Chat/System/ChatChannelSystem.cs b/Hotfix/Social/System/ChatChannelSystem.cs similarity index 72% rename from Hotfix/Chat/System/ChatChannelSystem.cs rename to Hotfix/Social/System/ChatChannelSystem.cs index 4625d55..3f0b845 100644 --- a/Hotfix/Chat/System/ChatChannelSystem.cs +++ b/Hotfix/Social/System/ChatChannelSystem.cs @@ -1,4 +1,6 @@ -namespace NB.Chat; +using Fantasy; + +namespace NB.Chat; public static class ChatChannelSystem { @@ -7,7 +9,7 @@ public static class ChatChannelSystem /// /// /// - public static void Enter(this ChatChannel channel, ChatUnit unit) + public static void Enter(this ChatChannel channel, SocialUnit unit) { channel.Units.Add(unit.Id); unit.CurrentChannel = channel.Id; @@ -18,7 +20,7 @@ public static class ChatChannelSystem /// /// /// - public static void Exit(this ChatChannel channel, ChatUnit unit) + public static void Exit(this ChatChannel channel, SocialUnit unit) { channel.Units.Remove(unit.Id); unit.CurrentChannel = 0; diff --git a/Hotfix/Chat/System/ChatUnitManageComponentSystem.cs b/Hotfix/Social/System/ChatUnitManageComponentSystem.cs similarity index 50% rename from Hotfix/Chat/System/ChatUnitManageComponentSystem.cs rename to Hotfix/Social/System/ChatUnitManageComponentSystem.cs index ba86221..85352e6 100644 --- a/Hotfix/Chat/System/ChatUnitManageComponentSystem.cs +++ b/Hotfix/Social/System/ChatUnitManageComponentSystem.cs @@ -1,5 +1,6 @@ using Fantasy; using Fantasy.Async; +using Fantasy.Entitas; using NB.Game; namespace NB.Chat; @@ -14,11 +15,11 @@ public static class ChatUnitManageComponentSystem /// /// /// - public static void SaveOfflineMessage(this ChatUnitManageComponent self, long targetId, ChatMessageInfo message) + public static void SaveOfflineMessage(this SocialUnitManageComponent self, long targetId, ChatMessageInfo message) { self.NotSendMessage.Add(targetId, message); } - + #endregion #region 上线下线 @@ -30,7 +31,7 @@ public static class ChatUnitManageComponentSystem /// /// /// - public static async FTask Online(this ChatUnitManageComponent self, Scene scene, + public static async FTask Online(this SocialUnitManageComponent self, Scene scene, RoleSimpleInfo roleSimpleInfo, long gateRouteId) { @@ -43,6 +44,7 @@ public static class ChatUnitManageComponentSystem if (account != null) { + await account.TryComponent(); account.GateRouteId = gateRouteId; account.Role = roleSimpleInfo; } @@ -51,7 +53,7 @@ public static class ChatUnitManageComponentSystem return account; } - public static async FTask Offline(this ChatUnitManageComponent self, Scene scene, long accountId, long gateRouteId) + public static async FTask Offline(this SocialUnitManageComponent self, Scene scene, long accountId, long gateRouteId) { if (self.TryGet(accountId, out var unit) && unit != null) { @@ -69,24 +71,24 @@ public static class ChatUnitManageComponentSystem #region 获取&移除 - public static void Add(this ChatUnitManageComponent self, ChatUnit account) + public static void Add(this SocialUnitManageComponent self, SocialUnit account) { - self.ChatUnits.Add(account.Id, account); + self.Units.Add(account.Id, account); } - public static ChatUnit? Get(this ChatUnitManageComponent self, long accountId) + public static SocialUnit? Get(this SocialUnitManageComponent self, long accountId) { - return self.ChatUnits.GetValueOrDefault(accountId); + return self.Units.GetValueOrDefault(accountId); } - public static bool TryGet(this ChatUnitManageComponent self, long accountId, out ChatUnit? account) + public static bool TryGet(this SocialUnitManageComponent self, long accountId, out SocialUnit? account) { - return self.ChatUnits.TryGetValue(accountId, out account); + return self.Units.TryGetValue(accountId, out account); } - public static void Remove(this ChatUnitManageComponent self, long accountId, bool isDispose = true) + public static void Remove(this SocialUnitManageComponent self, long accountId, bool isDispose = true) { - if (!self.ChatUnits.Remove(accountId, out var account)) + if (!self.Units.Remove(accountId, out var account)) { return; } @@ -100,4 +102,30 @@ public static class ChatUnitManageComponentSystem } #endregion + + #region 组件 + + /// + /// 尝试给增加相关组件 + /// + /// + /// + public static async FTask TryComponent(this SocialUnit socialUnit) where T : Entity, new() + { + if (socialUnit.GetComponent() == null) + { + var mailComponent = await socialUnit.Scene.World.DataBase.Query(socialUnit.Id, true); + if (mailComponent == null) + { + //如果没有邮件组件 + socialUnit.AddComponent(); + } + else + { + socialUnit.AddComponent(mailComponent); + } + } + } + + #endregion } \ No newline at end of file diff --git a/Hotfix/Social/System/ChatUnitSystem.cs b/Hotfix/Social/System/ChatUnitSystem.cs new file mode 100644 index 0000000..8c5199c --- /dev/null +++ b/Hotfix/Social/System/ChatUnitSystem.cs @@ -0,0 +1,11 @@ +using Fantasy.Entitas.Interface; + +namespace NB.Chat; + +public class ChatUnitSystem : AwakeSystem +{ + protected override void Awake(SocialUnit self) + { + + } +} \ No newline at end of file diff --git a/Tools/ProtocolTest/test002/Protocol/C2S_CreateChannelRequest b/Tools/ProtocolTest/test002/Protocol/C2S_CreateChannelRequest new file mode 100644 index 0000000..5d8d033 --- /dev/null +++ b/Tools/ProtocolTest/test002/Protocol/C2S_CreateChannelRequest @@ -0,0 +1 @@ +{"ResponseType":null,"RouteType":1002,"Name":"34535"} \ No newline at end of file diff --git a/Tools/ProtocolTest/test002/Protocol/C2S_JoinChannelRequest b/Tools/ProtocolTest/test002/Protocol/C2S_JoinChannelRequest new file mode 100644 index 0000000..67281cd --- /dev/null +++ b/Tools/ProtocolTest/test002/Protocol/C2S_JoinChannelRequest @@ -0,0 +1 @@ +{"ResponseType":null,"RouteType":1002,"Target":334918114171158528} \ No newline at end of file diff --git a/Tools/ProtocolTest/test002/Protocol/C2S_SendMessageRequest b/Tools/ProtocolTest/test002/Protocol/C2S_SendMessageRequest new file mode 100644 index 0000000..5d79aaa --- /dev/null +++ b/Tools/ProtocolTest/test002/Protocol/C2S_SendMessageRequest @@ -0,0 +1 @@ +{"ResponseType":null,"RouteType":1002,"Type":1,"Message":"\u90FD\u662F\u6CD5\u5E08\u6253\u53D1\u65AF\u8482\u82AC\u6492\u61C2\u6CD5\u5B88\u6CD53434","Target":323063059205849090} \ No newline at end of file diff --git a/Tools/ProtocolTest/test003/Protocol/C2Chat_SendMessageRequest b/Tools/ProtocolTest/test003/Protocol/C2Chat_SendMessageRequest index 534374c..d2d6bae 100644 --- a/Tools/ProtocolTest/test003/Protocol/C2Chat_SendMessageRequest +++ b/Tools/ProtocolTest/test003/Protocol/C2Chat_SendMessageRequest @@ -1 +1 @@ -{"ResponseType":null,"RouteType":1002,"Type":0,"Message":"\u554A\u6536\u5230\u53D1\u65AF\u8482\u82AC334","Target":323063059205849090} \ No newline at end of file +{"ResponseType":null,"RouteType":1002,"Type":1,"Message":"\u554A\u6536\u5230\u53D1\u65AF\u8482\u82AC334","Target":324468767642091522} \ No newline at end of file diff --git a/Tools/ProtocolTest/test003/Protocol/C2S_JoinChannelRequest b/Tools/ProtocolTest/test003/Protocol/C2S_JoinChannelRequest new file mode 100644 index 0000000..67281cd --- /dev/null +++ b/Tools/ProtocolTest/test003/Protocol/C2S_JoinChannelRequest @@ -0,0 +1 @@ +{"ResponseType":null,"RouteType":1002,"Target":334918114171158528} \ No newline at end of file