大修改

This commit is contained in:
2025-08-14 23:56:51 +08:00
parent 022cc1ac3e
commit d5689258fc
54 changed files with 775 additions and 839 deletions

View File

@@ -28,7 +28,8 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Game\Friend\" />
<Folder Include="Social\Entity\" />
<Folder Include="Social\Mail\" />
<Folder Include="Generate\NetworkProtocol\" />
<Folder Include="Map\" />
</ItemGroup>

View File

@@ -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<string, int> SceneTypeDic = new Dictionary<string, int>()
{
@@ -21,7 +21,7 @@ namespace Fantasy
{ "Map", 5 },
{ "Activity", 6 },
{ "Cache", 7 },
{ "Chat", 8 },
{ "Social", 8 },
};
}
}

View File

@@ -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
{
/// <summary>
/// 请求邮件列表
/// </summary>
[ProtoContract]
public partial class C2Game_GetMailsRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2Game_GetMailsRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2Game_GetMailsRequest>();
}
public override void Dispose()
{
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Game_GetMailsRequest>(this);
#endif
}
[ProtoIgnore]
public Game2C_GetMailsResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2Game_GetMailsRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
}
/// <summary>
/// 获取邮件列表响应
/// </summary>
[ProtoContract]
public partial class Game2C_GetMailsResponse : AMessage, ICustomRouteResponse, IProto
{
public static Game2C_GetMailsResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Game2C_GetMailsResponse>();
}
public override void Dispose()
{
ErrorCode = default;
Mail.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_GetMailsResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Game2C_GetMailsResponse; }
[ProtoMember(1)]
public List<MailInfo> Mail = new List<MailInfo>();
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 新邮件推送
/// </summary>
[ProtoContract]
public partial class Game2C_HaveMail : AMessage, ICustomRouteMessage, IProto
{
public static Game2C_HaveMail Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Game2C_HaveMail>();
}
public override void Dispose()
{
Mail = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_HaveMail>(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<Game2C_MailState>();
}
public override void Dispose()
{
MailState = default;
MailId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_MailState>(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; }
}
/// <summary>
/// /////////// ******** 聊天 *******/////////////
/// </summary>
/// <summary>
/// 创建频道
/// </summary>
[ProtoContract]
public partial class C2Chat_CreateChannelRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2Chat_CreateChannelRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2Chat_CreateChannelRequest>();
}
public override void Dispose()
{
Name = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Chat_CreateChannelRequest>(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; }
}
/// <summary>
/// 创建频道响应
/// </summary>
[ProtoContract]
public partial class Caht2C_CreateChannelResponse : AMessage, ICustomRouteResponse, IProto
{
public static Caht2C_CreateChannelResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Caht2C_CreateChannelResponse>();
}
public override void Dispose()
{
ErrorCode = default;
ChannelId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Caht2C_CreateChannelResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Caht2C_CreateChannelResponse; }
[ProtoMember(1)]
public long ChannelId { get; set; }
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 请求进入频道
/// </summary>
[ProtoContract]
public partial class C2Chat_JoinChannelRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2Chat_JoinChannelRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2Chat_JoinChannelRequest>();
}
public override void Dispose()
{
Target = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Chat_JoinChannelRequest>(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; }
}
/// <summary>
/// 进入频道响应
/// </summary>
[ProtoContract]
public partial class Caht2C_JoinChannelResponse : AMessage, ICustomRouteResponse, IProto
{
public static Caht2C_JoinChannelResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Caht2C_JoinChannelResponse>();
}
public override void Dispose()
{
ErrorCode = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Caht2C_JoinChannelResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Caht2C_JoinChannelResponse; }
[ProtoMember(1)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 发送聊天
/// </summary>
[ProtoContract]
public partial class C2Chat_SendMessageRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2Chat_SendMessageRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2Chat_SendMessageRequest>();
}
public override void Dispose()
{
Type = default;
Message = default;
Target = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Chat_SendMessageRequest>(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; }
}
/// <summary>
/// 发送聊天响应
/// </summary>
[ProtoContract]
public partial class Caht2C_SendMessageResponse : AMessage, ICustomRouteResponse, IProto
{
public static Caht2C_SendMessageResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Caht2C_SendMessageResponse>();
}
public override void Dispose()
{
ErrorCode = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Caht2C_SendMessageResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Caht2C_SendMessageResponse; }
[ProtoMember(1)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 获取离线时的未读私聊
/// </summary>
[ProtoContract]
public partial class C2Chat_GetOfflineMessageRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2Chat_GetOfflineMessageRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2Chat_GetOfflineMessageRequest>();
}
public override void Dispose()
{
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Chat_GetOfflineMessageRequest>(this);
#endif
}
[ProtoIgnore]
public Caht2C_GetOfflineMessageResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2Chat_GetOfflineMessageRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.ChatRoute;
}
/// <summary>
/// 发送聊天响应
/// </summary>
[ProtoContract]
public partial class Caht2C_GetOfflineMessageResponse : AMessage, ICustomRouteResponse, IProto
{
public static Caht2C_GetOfflineMessageResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Caht2C_GetOfflineMessageResponse>();
}
public override void Dispose()
{
ErrorCode = default;
Message.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Caht2C_GetOfflineMessageResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Caht2C_GetOfflineMessageResponse; }
[ProtoMember(1)]
public List<ChatMessageInfo> Message = new List<ChatMessageInfo>();
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 推送消息
/// </summary>
[ProtoContract]
public partial class Chat2C_Message : AMessage, ICustomRouteMessage, IProto
{
public static Chat2C_Message Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Chat2C_Message>();
}
public override void Dispose()
{
Message = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Chat2C_Message>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Chat2C_Message; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.ChatRoute;
[ProtoMember(1)]
public ChatMessageInfo Message { get; set; }
}
/// <summary>
/// 获取聊天记录请求
/// </summary>
[ProtoContract]
public partial class C2Chat_GetChatRecordRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2Chat_GetChatRecordRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2Chat_GetChatRecordRequest>();
}
public override void Dispose()
{
Target = default;
Type = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Chat_GetChatRecordRequest>(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; }
}
/// <summary>
/// 获取聊天记录响应
/// </summary>
[ProtoContract]
public partial class Caht2C_GetChatRecordResponse : AMessage, ICustomRouteResponse, IProto
{
public static Caht2C_GetChatRecordResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Caht2C_GetChatRecordResponse>();
}
public override void Dispose()
{
ErrorCode = default;
Messages.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Caht2C_GetChatRecordResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Caht2C_GetChatRecordResponse; }
[ProtoMember(1)]
public List<ChatMessageInfo> Messages = new List<ChatMessageInfo>();
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
}

View File

@@ -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
{
/// <summary>
/// 好友信息
/// </summary>
[ProtoContract]
public partial class FriendInfo : AMessage, IProto
{
public static FriendInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<FriendInfo>();
}
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<FriendInfo>(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; }
}
}

View File

@@ -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<ChatUserInfo>();
}
public override void Dispose()
{
Id = default;
Name = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<ChatUserInfo>(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<ChatMessageInfo>();
}
public override void Dispose()
{
Type = default;
Source = default;
Trigger = default;
Content = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<ChatMessageInfo>(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; }
}
}

View File

@@ -112,106 +112,106 @@ namespace Fantasy
/// 通知游戏服角色进入该聊天服
/// </summary>
[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<G2Chat_EnterRequest>();
return scene.MessagePoolComponent.Rent<G2S_EnterRequest>();
}
public override void Dispose()
{
Role = default;
GateRouteId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2Chat_EnterRequest>(this);
GetScene().MessagePoolComponent.Return<G2S_EnterRequest>(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<Chat2G_EnterResponse>();
return scene.MessagePoolComponent.Rent<S2G_EnterResponse>();
}
public override void Dispose()
{
ErrorCode = default;
RoleRouteId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Chat2G_EnterResponse>(this);
GetScene().MessagePoolComponent.Return<S2G_EnterResponse>(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<G2Chat_ExitRequest>();
return scene.MessagePoolComponent.Rent<G2S_ExitRequest>();
}
public override void Dispose()
{
AccountId = default;
GateRouteId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2Chat_ExitRequest>(this);
GetScene().MessagePoolComponent.Return<G2S_ExitRequest>(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<Chat2G_ExitResponse>();
return scene.MessagePoolComponent.Rent<S2G_ExitResponse>();
}
public override void Dispose()
{
ErrorCode = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Chat2G_ExitResponse>(this);
GetScene().MessagePoolComponent.Return<S2G_ExitResponse>(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<Chat2G_ChatMessage>();
return scene.MessagePoolComponent.Rent<S2G_ChatMessage>();
}
public override void Dispose()
{
Message = default;
IdList.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Chat2G_ChatMessage>(this);
GetScene().MessagePoolComponent.Return<S2G_ChatMessage>(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)]

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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
}
}

View File

@@ -17,6 +17,430 @@ using Fantasy.Serialize;
namespace Fantasy
{
/// <summary>
/// /////////// ******** 邮件 *******/////////////
/// </summary>
/// <summary>
/// 请求邮件列表
/// </summary>
[ProtoContract]
public partial class C2Game_GetMailsRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2Game_GetMailsRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2Game_GetMailsRequest>();
}
public override void Dispose()
{
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Game_GetMailsRequest>(this);
#endif
}
[ProtoIgnore]
public Game2C_GetMailsResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2Game_GetMailsRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
}
/// <summary>
/// 获取邮件列表响应
/// </summary>
[ProtoContract]
public partial class Game2C_GetMailsResponse : AMessage, ICustomRouteResponse, IProto
{
public static Game2C_GetMailsResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Game2C_GetMailsResponse>();
}
public override void Dispose()
{
ErrorCode = default;
Mail.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_GetMailsResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Game2C_GetMailsResponse; }
[ProtoMember(1)]
public List<MailInfo> Mail = new List<MailInfo>();
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 新邮件推送
/// </summary>
[ProtoContract]
public partial class Game2C_HaveMail : AMessage, ICustomRouteMessage, IProto
{
public static Game2C_HaveMail Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Game2C_HaveMail>();
}
public override void Dispose()
{
Mail = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_HaveMail>(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<Game2C_MailState>();
}
public override void Dispose()
{
MailState = default;
MailId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_MailState>(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; }
}
/// <summary>
/// /////////// ******** 聊天 *******/////////////
/// </summary>
[ProtoContract]
public partial class ChatUserInfo : AMessage, IProto
{
public static ChatUserInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<ChatUserInfo>();
}
public override void Dispose()
{
Id = default;
Name = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<ChatUserInfo>(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<ChatMessageInfo>();
}
public override void Dispose()
{
Type = default;
Source = default;
Trigger = default;
Content = default;
SendTime = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<ChatMessageInfo>(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; }
}
/// <summary>
/// 创建频道
/// </summary>
[ProtoContract]
public partial class C2S_CreateChannelRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2S_CreateChannelRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2S_CreateChannelRequest>();
}
public override void Dispose()
{
Name = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2S_CreateChannelRequest>(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; }
}
/// <summary>
/// 创建频道响应
/// </summary>
[ProtoContract]
public partial class S2C_CreateChannelResponse : AMessage, ICustomRouteResponse, IProto
{
public static S2C_CreateChannelResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<S2C_CreateChannelResponse>();
}
public override void Dispose()
{
ErrorCode = default;
ChannelId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<S2C_CreateChannelResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.S2C_CreateChannelResponse; }
[ProtoMember(1)]
public long ChannelId { get; set; }
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 请求进入频道
/// </summary>
[ProtoContract]
public partial class C2S_JoinChannelRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2S_JoinChannelRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2S_JoinChannelRequest>();
}
public override void Dispose()
{
Target = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2S_JoinChannelRequest>(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; }
}
/// <summary>
/// 进入频道响应
/// </summary>
[ProtoContract]
public partial class S2C_JoinChannelResponse : AMessage, ICustomRouteResponse, IProto
{
public static S2C_JoinChannelResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<S2C_JoinChannelResponse>();
}
public override void Dispose()
{
ErrorCode = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<S2C_JoinChannelResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.S2C_JoinChannelResponse; }
[ProtoMember(1)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 发送聊天
/// </summary>
[ProtoContract]
public partial class C2S_SendMessageRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2S_SendMessageRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2S_SendMessageRequest>();
}
public override void Dispose()
{
Type = default;
Message = default;
Target = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2S_SendMessageRequest>(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; }
}
/// <summary>
/// 发送聊天响应
/// </summary>
[ProtoContract]
public partial class S2C_SendMessageResponse : AMessage, ICustomRouteResponse, IProto
{
public static S2C_SendMessageResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<S2C_SendMessageResponse>();
}
public override void Dispose()
{
ErrorCode = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<S2C_SendMessageResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.S2C_SendMessageResponse; }
[ProtoMember(1)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 发送聊天
/// </summary>
[ProtoContract]
public partial class C2S_GetOfflineMessageRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2S_GetOfflineMessageRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2S_GetOfflineMessageRequest>();
}
public override void Dispose()
{
Type = default;
Message = default;
Target = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2S_GetOfflineMessageRequest>(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; }
}
/// <summary>
/// 发送聊天响应
/// </summary>
[ProtoContract]
public partial class S2C_GetOfflineMessageResponse : AMessage, ICustomRouteResponse, IProto
{
public static S2C_GetOfflineMessageResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<S2C_GetOfflineMessageResponse>();
}
public override void Dispose()
{
ErrorCode = default;
Message.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<S2C_GetOfflineMessageResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.S2C_GetOfflineMessageResponse; }
[ProtoMember(1)]
public List<ChatMessageInfo> Message = new List<ChatMessageInfo>();
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 推送消息
/// </summary>
[ProtoContract]
public partial class S2C_Message : AMessage, ICustomRouteMessage, IProto
{
public static S2C_Message Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<S2C_Message>();
}
public override void Dispose()
{
Message = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<S2C_Message>(this);
#endif
}
public uint OpCode() { return OuterOpcode.S2C_Message; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.SocialRoute;
[ProtoMember(1)]
public ChatMessageInfo Message { get; set; }
}
/// <summary>
/// 获取聊天记录请求
/// </summary>
[ProtoContract]
public partial class C2S_GetChatRecordRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2S_GetChatRecordRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2S_GetChatRecordRequest>();
}
public override void Dispose()
{
Target = default;
Type = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2S_GetChatRecordRequest>(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; }
}
/// <summary>
/// 获取聊天记录响应
/// </summary>
[ProtoContract]
public partial class S2C_GetChatRecordResponse : AMessage, ICustomRouteResponse, IProto
{
public static S2C_GetChatRecordResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<S2C_GetChatRecordResponse>();
}
public override void Dispose()
{
ErrorCode = default;
Messages.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<S2C_GetChatRecordResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.S2C_GetChatRecordResponse; }
[ProtoMember(1)]
public List<ChatMessageInfo> Messages = new List<ChatMessageInfo>();
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
[ProtoContract]
public partial class ClubInfo : AMessage, IProto
{

View File

@@ -9,12 +9,12 @@ namespace NB.Chat;
public class ChatChannel : Entity
{
/// <summary>
/// 频道id
/// 频道绑定id
/// </summary>
[BsonElement("cid")] public uint ChannelId;
[BsonElement("cid")] public long ChannelId;
/// <summary>
/// 频道类型 0.地图 1.公开 2.私密
/// 频道类型 0.地图 1.工会频道
/// </summary>
[BsonElement("type")] public uint ChannelType;

View File

@@ -3,7 +3,7 @@ using Fantasy.Entitas;
namespace NB.Chat;
public sealed class ChatUnit : Entity
public sealed class SocialUnit : Entity
{
public long GateRouteId;

View File

@@ -4,14 +4,12 @@ using Fantasy.Entitas;
namespace NB.Chat;
public class ChatUnitManageComponent : Entity
public class SocialUnitManageComponent : Entity
{
public readonly Dictionary<long, ChatUnit> ChatUnits = new();
public readonly Dictionary<long, SocialUnit> Units = new();
/// <summary>
/// 不在线消息缓存
/// </summary>
public readonly OneToManyList<long, ChatMessageInfo> NotSendMessage = new();
public readonly OneToManyList<string, ChatMessageInfo> PrivateMessage = new();
}