新增私聊相关

This commit is contained in:
2025-08-18 23:24:33 +08:00
parent 34b25273a7
commit 8122c577f6
68 changed files with 1442 additions and 467 deletions

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
{
[ProtoContract]
public partial class MailInfo : AMessage, IProto
{
public static MailInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<MailInfo>();
}
public override void Dispose()
{
Id = default;
Title = default;
Content = default;
CreateTime = default;
ExpireTime = default;
MailType = default;
MailState = default;
Items.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<MailInfo>(this);
#endif
}
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
public string Title { get; set; }
[ProtoMember(3)]
public string Content { get; set; }
[ProtoMember(4)]
public long CreateTime { get; set; }
[ProtoMember(5)]
public long ExpireTime { get; set; }
[ProtoMember(6)]
public int MailType { get; set; }
[ProtoMember(7)]
public int MailState { get; set; }
[ProtoMember(8)]
public List<AwardInfo> Items = new List<AwardInfo>();
}
}

View File

@@ -9,21 +9,21 @@ namespace Fantasy
public const uint G2C_RepeatLogin = 134227729;
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 C2S_GetConversationsRequest = 2281711378;
public const uint S2C_GetConversationsResponse = 2415929106;
public const uint C2S_SendMailRequest = 2281711379;
public const uint S2C_SendMailResponse = 2415929107;
public const uint C2S_DeleteMailRequest = 2281711380;
public const uint S2C_DeleteMailResponse = 2415929108;
public const uint S2C_HaveMail = 2147493649;
public const uint S2C_MailState = 2147493650;
public const uint C2S_CreateChannelRequest = 2281711381;
public const uint S2C_CreateChannelResponse = 2415929109;
public const uint C2S_JoinChannelRequest = 2281711382;
public const uint S2C_JoinChannelResponse = 2415929110;
public const uint C2S_SendMessageRequest = 2281711383;
public const uint S2C_SendMessageResponse = 2415929111;
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

@@ -18,51 +18,210 @@ using Fantasy.Serialize;
namespace Fantasy
{
/// <summary>
/// /////////// ******** 邮件 *******/////////////
/// /////////// ******** 私聊/邮件 *******/////////////
/// </summary>
/// <summary>
/// 请求邮件列表
/// 会话信息
/// </summary>
[ProtoContract]
public partial class C2Game_GetMailsRequest : AMessage, ICustomRouteRequest, IProto
public partial class ConversationInfo : AMessage, IProto
{
public static C2Game_GetMailsRequest Create(Scene scene)
public static ConversationInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2Game_GetMailsRequest>();
return scene.MessagePoolComponent.Rent<ConversationInfo>();
}
public override void Dispose()
{
RoleInfo = default;
List.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<ConversationInfo>(this);
#endif
}
[ProtoMember(1)]
public RoleSimpleInfo RoleInfo { get; set; }
[ProtoMember(2)]
public List<MailInfo> List = new List<MailInfo>();
}
[ProtoContract]
public partial class MailInfo : AMessage, IProto
{
public static MailInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<MailInfo>();
}
public override void Dispose()
{
Id = default;
Sender = default;
Content = default;
CreateTime = default;
MailType = default;
MailState = default;
Items.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<MailInfo>(this);
#endif
}
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
public long Sender { get; set; }
[ProtoMember(3)]
public string Content { get; set; }
[ProtoMember(4)]
public long CreateTime { get; set; }
[ProtoMember(5)]
public int MailType { get; set; }
[ProtoMember(6)]
public int MailState { get; set; }
[ProtoMember(7)]
public List<AwardInfo> Items = new List<AwardInfo>();
}
/// <summary>
/// 请求会话列表
/// </summary>
[ProtoContract]
public partial class C2S_GetConversationsRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2S_GetConversationsRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2S_GetConversationsRequest>();
}
public override void Dispose()
{
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Game_GetMailsRequest>(this);
GetScene().MessagePoolComponent.Return<C2S_GetConversationsRequest>(this);
#endif
}
[ProtoIgnore]
public Game2C_GetMailsResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2Game_GetMailsRequest; }
public S2C_GetConversationsResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2S_GetConversationsRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
public int RouteType => Fantasy.RouteType.SocialRoute;
}
/// <summary>
/// 获取邮件列表响应
/// 请求会话列表响应
/// </summary>
[ProtoContract]
public partial class Game2C_GetMailsResponse : AMessage, ICustomRouteResponse, IProto
public partial class S2C_GetConversationsResponse : AMessage, ICustomRouteResponse, IProto
{
public static Game2C_GetMailsResponse Create(Scene scene)
public static S2C_GetConversationsResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Game2C_GetMailsResponse>();
return scene.MessagePoolComponent.Rent<S2C_GetConversationsResponse>();
}
public override void Dispose()
{
ErrorCode = default;
Mail.Clear();
List.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_GetMailsResponse>(this);
GetScene().MessagePoolComponent.Return<S2C_GetConversationsResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Game2C_GetMailsResponse; }
public uint OpCode() { return OuterOpcode.S2C_GetConversationsResponse; }
[ProtoMember(1)]
public List<MailInfo> Mail = new List<MailInfo>();
public List<ConversationInfo> List = new List<ConversationInfo>();
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 发送邮件消息
/// </summary>
[ProtoContract]
public partial class C2S_SendMailRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2S_SendMailRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2S_SendMailRequest>();
}
public override void Dispose()
{
Target = default;
Content = default;
Items.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2S_SendMailRequest>(this);
#endif
}
[ProtoIgnore]
public S2C_SendMailResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2S_SendMailRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.SocialRoute;
[ProtoMember(1)]
public long Target { get; set; }
[ProtoMember(2)]
public string Content { get; set; }
[ProtoMember(3)]
public List<AwardInfo> Items = new List<AwardInfo>();
}
/// <summary>
/// 发送邮件消息响应
/// </summary>
[ProtoContract]
public partial class S2C_SendMailResponse : AMessage, ICustomRouteResponse, IProto
{
public static S2C_SendMailResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<S2C_SendMailResponse>();
}
public override void Dispose()
{
ErrorCode = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<S2C_SendMailResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.S2C_SendMailResponse; }
[ProtoMember(1)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 发送删除会话消息
/// </summary>
[ProtoContract]
public partial class C2S_DeleteMailRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2S_DeleteMailRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2S_DeleteMailRequest>();
}
public override void Dispose()
{
Id = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2S_DeleteMailRequest>(this);
#endif
}
[ProtoIgnore]
public S2C_DeleteMailResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2S_DeleteMailRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.SocialRoute;
[ProtoMember(1)]
public long Id { get; set; }
}
/// <summary>
/// 发送删除会话消息响应
/// </summary>
[ProtoContract]
public partial class S2C_DeleteMailResponse : AMessage, ICustomRouteResponse, IProto
{
public static S2C_DeleteMailResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<S2C_DeleteMailResponse>();
}
public override void Dispose()
{
ErrorCode = default;
Id = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<S2C_DeleteMailResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.S2C_DeleteMailResponse; }
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
@@ -70,50 +229,53 @@ namespace Fantasy
/// 新邮件推送
/// </summary>
[ProtoContract]
public partial class Game2C_HaveMail : AMessage, ICustomRouteMessage, IProto
public partial class S2C_HaveMail : AMessage, ICustomRouteMessage, IProto
{
public static Game2C_HaveMail Create(Scene scene)
public static S2C_HaveMail Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Game2C_HaveMail>();
return scene.MessagePoolComponent.Rent<S2C_HaveMail>();
}
public override void Dispose()
{
Mail = default;
Key = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_HaveMail>(this);
GetScene().MessagePoolComponent.Return<S2C_HaveMail>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Game2C_HaveMail; }
public uint OpCode() { return OuterOpcode.S2C_HaveMail; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
public int RouteType => Fantasy.RouteType.SocialRoute;
[ProtoMember(1)]
public MailInfo Mail { get; set; }
[ProtoMember(2)]
public string Key { get; set; }
}
[ProtoContract]
public partial class Game2C_MailState : AMessage, ICustomRouteMessage, IProto
public partial class S2C_MailState : AMessage, ICustomRouteMessage, IProto
{
public static Game2C_MailState Create(Scene scene)
public static S2C_MailState Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Game2C_MailState>();
return scene.MessagePoolComponent.Rent<S2C_MailState>();
}
public override void Dispose()
{
MailState = default;
MailId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_MailState>(this);
GetScene().MessagePoolComponent.Return<S2C_MailState>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Game2C_MailState; }
public uint OpCode() { return OuterOpcode.S2C_MailState; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
public int RouteType => Fantasy.RouteType.SocialRoute;
[ProtoMember(1)]
public int MailState { get; set; }
[ProtoMember(2)]
public long MailId { get; set; }
}
/// <summary>
/// /////////// ******** 聊天 *******/////////////
/// /////////// ******** 频道聊天 *******/////////////
/// </summary>
[ProtoContract]
public partial class ChatUserInfo : AMessage, IProto
@@ -260,7 +422,7 @@ namespace Fantasy
public uint ErrorCode { get; set; }
}
/// <summary>
/// 发送聊天
/// 发送消息
/// </summary>
[ProtoContract]
public partial class C2S_SendMessageRequest : AMessage, ICustomRouteRequest, IProto
@@ -271,7 +433,6 @@ namespace Fantasy
}
public override void Dispose()
{
Type = default;
Message = default;
Target = default;
#if FANTASY_NET || FANTASY_UNITY
@@ -284,14 +445,12 @@ namespace Fantasy
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.SocialRoute;
[ProtoMember(1)]
public int Type { get; set; }
[ProtoMember(2)]
public string Message { get; set; }
[ProtoMember(3)]
[ProtoMember(2)]
public long Target { get; set; }
}
/// <summary>
/// 发送聊天响应
/// 发送消息响应
/// </summary>
[ProtoContract]
public partial class S2C_SendMessageResponse : AMessage, ICustomRouteResponse, IProto
@@ -312,61 +471,6 @@ namespace Fantasy
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]
@@ -390,58 +494,6 @@ namespace Fantasy
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; }
}
/// <summary>
/// /////////// ******** 工会 *******/////////////
/// </summary>
[ProtoContract]