diff --git a/Config/NetworkProtocol/Inner/InnerMessage.proto b/Config/NetworkProtocol/Inner/InnerMessage.proto
index 1db896c..44a945b 100644
--- a/Config/NetworkProtocol/Inner/InnerMessage.proto
+++ b/Config/NetworkProtocol/Inner/InnerMessage.proto
@@ -29,4 +29,10 @@ message Chat2G_EnterResponse // IRouteResponse
message Chat2G_ChatMessage // IRouteMessage
{
ChatMessageInfo Message = 1; //聊天内容
-}
\ No newline at end of file
+}
+
+///创建聊天频道
+message Club2Chat_CreateChannel // IRouteMessage
+{
+ int64 ChannelId = 1; //频道id
+}
diff --git a/Config/NetworkProtocol/Outer/ChatMessage.proto b/Config/NetworkProtocol/Outer/ChatMessage.proto
new file mode 100644
index 0000000..fd97047
--- /dev/null
+++ b/Config/NetworkProtocol/Outer/ChatMessage.proto
@@ -0,0 +1,86 @@
+syntax = "proto3";
+package Fantasy.Network.Message;
+
+///请求邮件列表
+message C2Game_GetMailsRequest // ICustomRouteRequest,Game2C_GetMailsResponse,GameRoute
+{
+
+}
+///获取邮件列表响应
+message Game2C_GetMailsResponse // ICustomRouteResponse
+{
+ repeated MailInfo Mail = 1;
+}
+
+///新邮件推送
+message Game2C_HaveMail // ICustomRouteMessage,GameRoute
+{
+ MailInfo Mail = 1;
+}
+
+message Game2C_MailState // ICustomRouteMessage,GameRoute
+{
+ int32 MailState = 1;
+ int64 MailId = 2;
+}
+
+
+////////////// ******** 聊天 *******/////////////
+
+///创建频道
+message C2Chat_CreateChannelRequest // ICustomRouteRequest,Caht2C_CreateChannelResponse,ChatRoute
+{
+ string Name = 1; //频道名称
+}
+
+///创建频道响应
+message Caht2C_CreateChannelResponse // ICustomRouteResponse
+{
+ int64 ChannelId = 1; //创建的频道id
+}
+
+///请求进入频道
+message C2Chat_JoinChannelRequest // ICustomRouteRequest,Caht2C_JoinChannelResponse,ChatRoute
+{
+ int64 Target = 1; // 频道id
+}
+
+///进入频道响应
+message Caht2C_JoinChannelResponse // ICustomRouteResponse
+{
+
+}
+
+///发送聊天
+message C2Chat_SendMessageRequest // ICustomRouteRequest,Caht2C_SendMessageResponse,ChatRoute
+{
+ int32 Type = 1; //消息类型 0.频道聊天 1.私聊
+ string Message = 2;
+ int64 Target = 3; //目标id,频道id或者好友id
+}
+
+///发送聊天响应
+message Caht2C_SendMessageResponse // ICustomRouteResponse
+{
+
+}
+
+///推送消息
+message Chat2C_Message // ICustomRouteMessage,ChatRoute
+{
+ ChatMessageInfo Message = 1;
+}
+
+
+///获取聊天记录请求
+message C2Chat_GetChatRecordRequest // ICustomRouteRequest,Caht2C_GetChatRecordResponse,ChatRoute
+{
+ int64 Target = 1; // 好友id或频道id
+ int32 Type = 2; // 获取聊天记录类型 0.频道 1.好友
+}
+
+///获取聊天记录响应
+message Caht2C_GetChatRecordResponse // ICustomRouteResponse
+{
+ repeated ChatMessageInfo Messages = 1; //聊天记录
+}
diff --git a/Config/NetworkProtocol/Outer/OuterMessage.proto b/Config/NetworkProtocol/Outer/OuterMessage.proto
index e969873..88236dc 100644
--- a/Config/NetworkProtocol/Outer/OuterMessage.proto
+++ b/Config/NetworkProtocol/Outer/OuterMessage.proto
@@ -2,7 +2,6 @@ syntax = "proto3";
package Fantasy.Network.Message;
-
// 协议分为:
// ProtoBuf:可以在Outer和Inner文件里使用。
// MemoryPack:可以在Outer和Inner文件里使用。
@@ -51,65 +50,5 @@ message C2Game_GetRoleInfoRequest // ICustomRouteRequest,Game2C_GetRoleInfoRespo
message Game2C_GetRoleInfoResponse // ICustomRouteResponse
{
- string Name;
- string RoleId;
-}
-
-///请求邮件列表
-message C2Game_GetMailsRequest // ICustomRouteRequest,Game2C_GetMailsResponse,GameRoute
-{
-
-}
-///获取邮件列表响应
-message Game2C_GetMailsResponse // ICustomRouteResponse
-{
- repeated MailInfo Mail = 1;
-}
-
-///新邮件推送
-message Game2C_HaveMail // ICustomRouteMessage,GameRoute
-{
- MailInfo Mail = 1;
-}
-
-message Game2C_MailState // ICustomRouteMessage,GameRoute
-{
- int32 MailState = 1;
- int64 MailId = 2;
-}
-
-message C2Chat_JoinChannelRequest // ICustomRouteRequest,Caht2C_JoinChannelResponse,ChatRoute
-{
- int64 Target = 1; // 频道id
-}
-
-///进入频道响应
-message Caht2C_JoinChannelResponse // ICustomRouteResponse
-{
-
-}
-
-///发送聊天
-message C2Chat_SendMessageRequest // ICustomRouteRequest,Caht2C_SendMessageResponse,ChatRoute
-{
- int32 Type = 1; //消息类型 0.频道聊天 1.私聊
- string Message = 2;
- int64 Target = 3; //目标id,频道id或者好友id
-}
-
-///发送聊天响应
-message Caht2C_SendMessageResponse // ICustomRouteResponse
-{
-
-}
-
-///推送消息
-message Chat2C_Message // ICustomRouteMessage,ChatRoute
-{
- ChatMessageInfo Message = 1;
-}
-
-message C2G_LoginRequest1 // IRequest,G2C_LoginResponse
-{
- string ToKen = 1;
-}
+ RoleSimpleInfo Roles = 1; //角色列表
+}
\ No newline at end of file
diff --git a/Config/NetworkProtocol/Outer/SocialMessage.proto b/Config/NetworkProtocol/Outer/SocialMessage.proto
new file mode 100644
index 0000000..9f85331
--- /dev/null
+++ b/Config/NetworkProtocol/Outer/SocialMessage.proto
@@ -0,0 +1,116 @@
+syntax = "proto3";
+package Fantasy.Network.Message;
+
+message ClubInfo
+{
+ int64 Id = 1; //工会ID
+ string Name = 2; //工会名称
+ int64 CreateTime = 3; //创建时间
+ int64 OwnerId = 4; //工会创建者ID
+ int32 MemberCount = 5; //成员数量
+}
+
+///请求创建工会
+message C2S_CreateRequest // ICustomRouteRequest,Caht2C_GetChatRecordResponse,SocialRoute
+{
+ string Name = 1; //工会名称
+}
+
+///创建工会响应
+message S2C_CreateResponse // ICustomRouteResponse
+{
+ ClubInfo Club = 1; //创建的工会信息
+}
+
+///请求工会信息
+message C2S_GetClubInfoRequest // ICustomRouteRequest,S2C_GetClubInfoResponse,SocialRoute
+{
+ int64 ClubId = 1; //工会ID
+}
+///响应工会信息
+message S2C_GetClubInfoResponse // ICustomRouteResponse
+{
+ string Name = 1; //工会名称
+}
+
+/// 请求工会成员列表
+message C2S_GetMemberListRequest // ICustomRouteRequest,S2C_GetMemberListResponse,SocialRoute
+{
+ int64 ClubId = 1; //工会ID
+}
+
+/// 响应工会成员列表
+message S2C_GetMemberListResponse // ICustomRouteResponse
+{
+ repeated RoleSimpleInfo Members = 1; //工会成员列表
+}
+
+///获取工会列表请求
+message C2S_GetClubListRequest // ICustomRouteRequest,S2C_GetClubListResponse,SocialRoute
+{
+
+}
+///获取工会列表响应
+message S2C_GetClubListResponse // ICustomRouteResponse
+{
+ repeated ClubInfo Clubs = 1; //工会列表
+}
+
+/// 请求加入工会
+message C2S_JoinClubRequest // ICustomRouteRequest,S2C_JoinClubResponse,SocialRoute
+{
+ int64 ClubId = 1; //工会ID
+}
+
+/// 响应加入工会
+message S2C_JoinClubResponse // ICustomRouteResponse
+{
+ ClubInfo Club = 1; //加入的工会信息
+}
+
+/// 请求退出工会
+message C2S_LeaveClubRequest // ICustomRouteRequest,S2C_LeaveClubResponse,SocialRoute
+{
+ int64 ClubId = 1; //工会ID
+}
+
+/// 响应退出工会
+message S2C_LeaveClubResponse // ICustomRouteResponse
+{
+ int64 ClubId = 1; //退出的工会ID
+}
+
+/// 请求解散工会
+message C2S_DissolveClubRequest // ICustomRouteRequest,S2C_DissolveClubResponse,SocialRoute
+{
+ int64 ClubId = 1; //工会ID
+}
+
+/// 响应解散工会
+message S2C_DissolveClubResponse // ICustomRouteResponse
+{
+ int64 ClubId = 1; //解散的工会ID
+}
+
+/// 请求操作申请
+message C2S_DisposeJoinRequest // ICustomRouteRequest,S2C_DisposeJoinResponse,SocialRoute
+{
+ int64 ClubId = 1; //工会ID
+ int64 ApplicantId = 2; //申请人ID
+ int32 Agree = 3; //是否同意申请,1表示同意,0表示拒绝
+}
+
+/// 响应操作申请
+message S2C_DisposeJoinResponse // ICustomRouteResponse
+{
+ int64 ClubId = 1; //工会ID
+ int64 ApplicantId = 2; //申请人ID
+ int32 Agree = 3; //是否同意申请,1表示同意,0表示拒绝
+}
+
+///推送消息
+message S2C_ClubChange // ICustomRouteMessage,SocialRoute
+{
+ ClubInfo Club = 1;
+ int32 ChangeType = 2; //变更类型 0.创建 1.解散 2.加入 3.退出 4.申请处理
+}
diff --git a/Config/NetworkProtocol/RouteType.Config b/Config/NetworkProtocol/RouteType.Config
index 38a8683..e1b6155 100644
--- a/Config/NetworkProtocol/RouteType.Config
+++ b/Config/NetworkProtocol/RouteType.Config
@@ -1,4 +1,5 @@
// Route协议定义(需要定义1000以上、因为1000以内的框架预留)
GateRoute = 1001 // Gate
ChatRoute = 1002 // Chat
-GameRoute = 1003 // Game
\ No newline at end of file
+GameRoute = 1003 // Game
+SocialRoute = 1004 // Social
\ No newline at end of file
diff --git a/Entity/Entity.csproj b/Entity/Entity.csproj
index caaa6e3..1bd82ef 100644
--- a/Entity/Entity.csproj
+++ b/Entity/Entity.csproj
@@ -28,6 +28,8 @@
+
+
diff --git a/Entity/Club/Club.cs b/Entity/Game/Club/Club.cs
similarity index 100%
rename from Entity/Club/Club.cs
rename to Entity/Game/Club/Club.cs
diff --git a/Entity/Game/Club/ClubManageComponent.cs b/Entity/Game/Club/ClubManageComponent.cs
new file mode 100644
index 0000000..d8bb1dc
--- /dev/null
+++ b/Entity/Game/Club/ClubManageComponent.cs
@@ -0,0 +1,8 @@
+using Fantasy.Entitas;
+
+namespace NB.Club;
+
+public class ClubManageComponent : Entity
+{
+ public readonly Dictionary Clubs = new();
+}
\ No newline at end of file
diff --git a/Entity/Generate/NetworkProtocol/ChatMessage.cs b/Entity/Generate/NetworkProtocol/ChatMessage.cs
new file mode 100644
index 0000000..26e34c5
--- /dev/null
+++ b/Entity/Generate/NetworkProtocol/ChatMessage.cs
@@ -0,0 +1,337 @@
+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 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/InnerMessage.cs b/Entity/Generate/NetworkProtocol/InnerMessage.cs
index c2ee871..92003f5 100644
--- a/Entity/Generate/NetworkProtocol/InnerMessage.cs
+++ b/Entity/Generate/NetworkProtocol/InnerMessage.cs
@@ -132,4 +132,25 @@ namespace Fantasy
[ProtoMember(1)]
public ChatMessageInfo Message { get; set; }
}
+ ///
+ /// 创建聊天频道
+ ///
+ [ProtoContract]
+ public partial class Club2Chat_CreateChannel : AMessage, IRouteMessage, IProto
+ {
+ public static Club2Chat_CreateChannel Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ChannelId = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return InnerOpcode.Club2Chat_CreateChannel; }
+ [ProtoMember(1)]
+ public long ChannelId { get; set; }
+ }
}
diff --git a/Entity/Generate/NetworkProtocol/InnerOpcode.cs b/Entity/Generate/NetworkProtocol/InnerOpcode.cs
index 96bcb3c..bd618a4 100644
--- a/Entity/Generate/NetworkProtocol/InnerOpcode.cs
+++ b/Entity/Generate/NetworkProtocol/InnerOpcode.cs
@@ -7,5 +7,6 @@ namespace Fantasy
public const uint G2Chat_EnterRequest = 1073751826;
public const uint Chat2G_EnterResponse = 1207969554;
public const uint Chat2G_ChatMessage = 939534097;
+ public const uint Club2Chat_CreateChannel = 939534098;
}
}
diff --git a/Entity/Generate/NetworkProtocol/OuterMessage.cs b/Entity/Generate/NetworkProtocol/OuterMessage.cs
index f01561b..92d82e4 100644
--- a/Entity/Generate/NetworkProtocol/OuterMessage.cs
+++ b/Entity/Generate/NetworkProtocol/OuterMessage.cs
@@ -181,248 +181,15 @@ namespace Fantasy
public override void Dispose()
{
ErrorCode = default;
- Name = default;
- RoleId = default;
+ Roles = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return(this);
#endif
}
public uint OpCode() { return OuterOpcode.Game2C_GetRoleInfoResponse; }
[ProtoMember(1)]
- public string Name { get; set; }
- [ProtoMember(2)]
- public string RoleId { get; set; }
- [ProtoMember(3)]
- public uint ErrorCode { get; set; }
- }
- ///
- /// 请求邮件列表
- ///
- [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();
+ public RoleSimpleInfo Roles { get; set; }
[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_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 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 C2G_LoginRequest1 : AMessage, IRequest, IProto
- {
- public static C2G_LoginRequest1 Create(Scene scene)
- {
- return scene.MessagePoolComponent.Rent();
- }
- public override void Dispose()
- {
- ToKen = default;
-#if FANTASY_NET || FANTASY_UNITY
- GetScene().MessagePoolComponent.Return(this);
-#endif
- }
- [ProtoIgnore]
- public G2C_LoginResponse ResponseType { get; set; }
- public uint OpCode() { return OuterOpcode.C2G_LoginRequest1; }
- [ProtoMember(1)]
- public string ToKen { get; set; }
- }
}
diff --git a/Entity/Generate/NetworkProtocol/OuterOpcode.cs b/Entity/Generate/NetworkProtocol/OuterOpcode.cs
index 62a9e0e..cdfadff 100644
--- a/Entity/Generate/NetworkProtocol/OuterOpcode.cs
+++ b/Entity/Generate/NetworkProtocol/OuterOpcode.cs
@@ -2,22 +2,42 @@ namespace Fantasy
{
public static partial class OuterOpcode
{
- 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 = 2281711377;
- public const uint Game2C_GetRoleInfoResponse = 2415929105;
- public const uint C2Game_GetMailsRequest = 2281711378;
- public const uint Game2C_GetMailsResponse = 2415929106;
+ 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 Chat2C_Message = 2147493651;
- public const uint C2G_LoginRequest1 = 268445459;
+ public const uint C2Chat_GetChatRecordRequest = 2281711381;
+ public const uint Caht2C_GetChatRecordResponse = 2415929109;
+ 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 = 2281711382;
+ public const uint Game2C_GetRoleInfoResponse = 2415929110;
+ public const uint C2S_CreateRequest = 2281711383;
+ public const uint S2C_CreateResponse = 2415929111;
+ public const uint C2S_GetClubInfoRequest = 2281711384;
+ public const uint S2C_GetClubInfoResponse = 2415929112;
+ public const uint C2S_GetMemberListRequest = 2281711385;
+ public const uint S2C_GetMemberListResponse = 2415929113;
+ public const uint C2S_GetClubListRequest = 2281711386;
+ public const uint S2C_GetClubListResponse = 2415929114;
+ public const uint C2S_JoinClubRequest = 2281711387;
+ public const uint S2C_JoinClubResponse = 2415929115;
+ public const uint C2S_LeaveClubRequest = 2281711388;
+ public const uint S2C_LeaveClubResponse = 2415929116;
+ public const uint C2S_DissolveClubRequest = 2281711389;
+ public const uint S2C_DissolveClubResponse = 2415929117;
+ public const uint C2S_DisposeJoinRequest = 2281711390;
+ public const uint S2C_DisposeJoinResponse = 2415929118;
+ public const uint S2C_ClubChange = 2147493652;
}
}
diff --git a/Entity/Generate/NetworkProtocol/RouteType.cs b/Entity/Generate/NetworkProtocol/RouteType.cs
index 8bd8a52..ff44fc5 100644
--- a/Entity/Generate/NetworkProtocol/RouteType.cs
+++ b/Entity/Generate/NetworkProtocol/RouteType.cs
@@ -6,5 +6,6 @@ namespace Fantasy
public const int GateRoute = 1001; // Gate
public const int ChatRoute = 1002; // Chat
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
new file mode 100644
index 0000000..0cb7c95
--- /dev/null
+++ b/Entity/Generate/NetworkProtocol/SocialMessage.cs
@@ -0,0 +1,476 @@
+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 ClubInfo : AMessage, IProto
+ {
+ public static ClubInfo Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ Id = default;
+ Name = default;
+ CreateTime = default;
+ OwnerId = default;
+ MemberCount = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoMember(1)]
+ public long Id { get; set; }
+ [ProtoMember(2)]
+ public string Name { get; set; }
+ [ProtoMember(3)]
+ public long CreateTime { get; set; }
+ [ProtoMember(4)]
+ public long OwnerId { get; set; }
+ [ProtoMember(5)]
+ public int MemberCount { get; set; }
+ }
+ ///
+ /// 请求创建工会
+ ///
+ [ProtoContract]
+ public partial class C2S_CreateRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2S_CreateRequest 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_GetChatRecordResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2S_CreateRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.SocialRoute;
+ [ProtoMember(1)]
+ public string Name { get; set; }
+ }
+ ///
+ /// 创建工会响应
+ ///
+ [ProtoContract]
+ public partial class S2C_CreateResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static S2C_CreateResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ Club = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.S2C_CreateResponse; }
+ [ProtoMember(1)]
+ public ClubInfo Club { get; set; }
+ [ProtoMember(2)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// 请求工会信息
+ ///
+ [ProtoContract]
+ public partial class C2S_GetClubInfoRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2S_GetClubInfoRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ClubId = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public S2C_GetClubInfoResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2S_GetClubInfoRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.SocialRoute;
+ [ProtoMember(1)]
+ public long ClubId { get; set; }
+ }
+ ///
+ /// 响应工会信息
+ ///
+ [ProtoContract]
+ public partial class S2C_GetClubInfoResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static S2C_GetClubInfoResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ Name = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.S2C_GetClubInfoResponse; }
+ [ProtoMember(1)]
+ public string Name { get; set; }
+ [ProtoMember(2)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// 请求工会成员列表
+ ///
+ [ProtoContract]
+ public partial class C2S_GetMemberListRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2S_GetMemberListRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ClubId = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public S2C_GetMemberListResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2S_GetMemberListRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.SocialRoute;
+ [ProtoMember(1)]
+ public long ClubId { get; set; }
+ }
+ ///
+ /// 响应工会成员列表
+ ///
+ [ProtoContract]
+ public partial class S2C_GetMemberListResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static S2C_GetMemberListResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ Members.Clear();
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.S2C_GetMemberListResponse; }
+ [ProtoMember(1)]
+ public List Members = new List();
+ [ProtoMember(2)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// 获取工会列表请求
+ ///
+ [ProtoContract]
+ public partial class C2S_GetClubListRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2S_GetClubListRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public S2C_GetClubListResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2S_GetClubListRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.SocialRoute;
+ }
+ ///
+ /// 获取工会列表响应
+ ///
+ [ProtoContract]
+ public partial class S2C_GetClubListResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static S2C_GetClubListResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ Clubs.Clear();
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.S2C_GetClubListResponse; }
+ [ProtoMember(1)]
+ public List Clubs = new List();
+ [ProtoMember(2)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// 请求加入工会
+ ///
+ [ProtoContract]
+ public partial class C2S_JoinClubRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2S_JoinClubRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ClubId = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public S2C_JoinClubResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2S_JoinClubRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.SocialRoute;
+ [ProtoMember(1)]
+ public long ClubId { get; set; }
+ }
+ ///
+ /// 响应加入工会
+ ///
+ [ProtoContract]
+ public partial class S2C_JoinClubResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static S2C_JoinClubResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ Club = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.S2C_JoinClubResponse; }
+ [ProtoMember(1)]
+ public ClubInfo Club { get; set; }
+ [ProtoMember(2)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// 请求退出工会
+ ///
+ [ProtoContract]
+ public partial class C2S_LeaveClubRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2S_LeaveClubRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ClubId = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public S2C_LeaveClubResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2S_LeaveClubRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.SocialRoute;
+ [ProtoMember(1)]
+ public long ClubId { get; set; }
+ }
+ ///
+ /// 响应退出工会
+ ///
+ [ProtoContract]
+ public partial class S2C_LeaveClubResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static S2C_LeaveClubResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ ClubId = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.S2C_LeaveClubResponse; }
+ [ProtoMember(1)]
+ public long ClubId { get; set; }
+ [ProtoMember(2)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// 请求解散工会
+ ///
+ [ProtoContract]
+ public partial class C2S_DissolveClubRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2S_DissolveClubRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ClubId = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public S2C_DissolveClubResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2S_DissolveClubRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.SocialRoute;
+ [ProtoMember(1)]
+ public long ClubId { get; set; }
+ }
+ ///
+ /// 响应解散工会
+ ///
+ [ProtoContract]
+ public partial class S2C_DissolveClubResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static S2C_DissolveClubResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ ClubId = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.S2C_DissolveClubResponse; }
+ [ProtoMember(1)]
+ public long ClubId { get; set; }
+ [ProtoMember(2)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// 请求操作申请
+ ///
+ [ProtoContract]
+ public partial class C2S_DisposeJoinRequest : AMessage, ICustomRouteRequest, IProto
+ {
+ public static C2S_DisposeJoinRequest Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ClubId = default;
+ ApplicantId = default;
+ Agree = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ [ProtoIgnore]
+ public S2C_DisposeJoinResponse ResponseType { get; set; }
+ public uint OpCode() { return OuterOpcode.C2S_DisposeJoinRequest; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.SocialRoute;
+ [ProtoMember(1)]
+ public long ClubId { get; set; }
+ [ProtoMember(2)]
+ public long ApplicantId { get; set; }
+ [ProtoMember(3)]
+ public int Agree { get; set; }
+ }
+ ///
+ /// 响应操作申请
+ ///
+ [ProtoContract]
+ public partial class S2C_DisposeJoinResponse : AMessage, ICustomRouteResponse, IProto
+ {
+ public static S2C_DisposeJoinResponse Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ ErrorCode = default;
+ ClubId = default;
+ ApplicantId = default;
+ Agree = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.S2C_DisposeJoinResponse; }
+ [ProtoMember(1)]
+ public long ClubId { get; set; }
+ [ProtoMember(2)]
+ public long ApplicantId { get; set; }
+ [ProtoMember(3)]
+ public int Agree { get; set; }
+ [ProtoMember(4)]
+ public uint ErrorCode { get; set; }
+ }
+ ///
+ /// 推送消息
+ ///
+ [ProtoContract]
+ public partial class S2C_ClubChange : AMessage, ICustomRouteMessage, IProto
+ {
+ public static S2C_ClubChange Create(Scene scene)
+ {
+ return scene.MessagePoolComponent.Rent();
+ }
+ public override void Dispose()
+ {
+ Club = default;
+ ChangeType = default;
+#if FANTASY_NET || FANTASY_UNITY
+ GetScene().MessagePoolComponent.Return(this);
+#endif
+ }
+ public uint OpCode() { return OuterOpcode.S2C_ClubChange; }
+ [ProtoIgnore]
+ public int RouteType => Fantasy.RouteType.SocialRoute;
+ [ProtoMember(1)]
+ public ClubInfo Club { get; set; }
+ [ProtoMember(2)]
+ public int ChangeType { get; set; }
+ }
+}
diff --git a/Hotfix/Chat/Handler/C2Chat_CreateChannelRequestHandler.cs b/Hotfix/Chat/Handler/C2Chat_CreateChannelRequestHandler.cs
new file mode 100644
index 0000000..7b12fec
--- /dev/null
+++ b/Hotfix/Chat/Handler/C2Chat_CreateChannelRequestHandler.cs
@@ -0,0 +1,26 @@
+using Fantasy;
+using Fantasy.Async;
+using Fantasy.Network.Interface;
+
+namespace NB.Chat;
+
+///
+/// 请求创建频道
+///
+public class
+ C2Chat_CreateChannelRequestHandler : RouteRPC
+{
+ protected override async FTask Run(ChatUnit entity, C2Chat_CreateChannelRequest request,
+ Caht2C_CreateChannelResponse response, Action reply)
+ {
+ var channelCenter = entity.Scene.GetComponent();
+ if (channelCenter == null)
+ {
+ response.ErrorCode = ErrorCode.ErrServer;
+ return;
+ }
+
+ var channel = await channelCenter.Create(entity);
+
+ }
+}
\ No newline at end of file
diff --git a/Hotfix/Chat/Handler/C2Chat_JoinChannelRequestHandler.cs b/Hotfix/Chat/Handler/C2Chat_JoinChannelRequestHandler.cs
index 722c4d4..9805851 100644
--- a/Hotfix/Chat/Handler/C2Chat_JoinChannelRequestHandler.cs
+++ b/Hotfix/Chat/Handler/C2Chat_JoinChannelRequestHandler.cs
@@ -24,22 +24,22 @@ public class
if (oldChannelId > 0)
{
//退出旧的频道
- if (channelCenter.TryGet(oldChannelId, out var oldChannel) && oldChannel != null)
+ var oldChannel = await channelCenter.Get(oldChannelId);
+ if (oldChannel != null)
{
oldChannel.Exit(entity);
}
}
//加入新频道
- if (channelCenter.TryGet(request.Target, out var channel) && channel != null)
+ var newChannel = await channelCenter.Get(request.Target);
+ if (newChannel != null)
{
- channel.Enter(entity);
+ newChannel.Enter(entity);
}
else
{
response.ErrorCode = ErrorCode.ChatNotChannel;
}
-
- await FTask.CompletedTask;
}
}
\ No newline at end of file
diff --git a/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs b/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs
index 7ba0266..d3a08e9 100644
--- a/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs
+++ b/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs
@@ -11,6 +11,14 @@ public sealed class
protected override async FTask Run(ChatUnit chatUnit, C2Chat_SendMessageRequest request,
Caht2C_SendMessageResponse response, Action reply)
{
+ if (request.Type == 0) //频道聊天
+ {
+
+ }
+ else if (request.Type == 1) //私聊
+ {
+
+ }
ChatSceneHelper.Broadcast(chatUnit.Scene, new ChatMessageInfo()
{
Content = request.Message,
diff --git a/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs b/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs
index 8ae1b4f..bb3188e 100644
--- a/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs
+++ b/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs
@@ -1,4 +1,5 @@
-using Fantasy.Entitas;
+using Fantasy.Async;
+using Fantasy.Entitas;
using Fantasy.Entitas.Interface;
using Fantasy.Helper;
@@ -22,15 +23,22 @@ public class ChatChannelCenterComponentDestroySystem : DestroySystem
- /// 获取
+ /// 获取一个频道
///
///
///
- ///
///
- public static bool TryGet(this ChatChannelCenterComponent self, long channelId, out ChatChannel? channel)
+ public static async FTask Get(this ChatChannelCenterComponent self, long channelId)
{
- return self.Channels.TryGetValue(channelId, out channel);
+ if (self.Channels.TryGetValue(channelId, out var channel))
+ {
+ return channel;
+ }
+
+ //查数据库
+ channel = await self.Scene.World.DataBase.Query(channelId, true);
+ self.Channels.Add(channel.Id, channel);
+ return channel;
}
///
@@ -38,22 +46,20 @@ public static class ChatChannelCenterComponentSystem
///
///
///
- ///
///
- public static ChatChannel Apply(this ChatChannelCenterComponent self, ChatUnit unit, long channelId)
+ public static async FTask Create(this ChatChannelCenterComponent self, ChatUnit unit)
{
- if (self.Channels.TryGetValue(channelId, out var channel))
- {
- return channel;
- }
-
- channel = Entity.Create(self.Scene, channelId, true, true);
+ var channel = Entity.Create(self.Scene, true, true);
channel.Creator = unit.Role.RoleId;
channel.CreateTime = TimeHelper.Now;
- self.Channels.Add(channelId, channel);
+ self.Channels.Add(channel.Id, channel);
+ //保存到数据库
+ await self.Scene.World.DataBase.Save(channel);
+
return channel;
}
+
///
/// 解散
///