diff --git a/Config/NetworkProtocol/Outer/data/GlobalData.proto b/Config/NetworkProtocol/Outer/data/GlobalData.proto index 9c73aa1..c3f545f 100644 --- a/Config/NetworkProtocol/Outer/data/GlobalData.proto +++ b/Config/NetworkProtocol/Outer/data/GlobalData.proto @@ -12,5 +12,5 @@ message ChatMessageInfo int32 Type = 1; //消息类型 int32 Source = 2; //消息来源 ChatUserInfo Trigger = 3; //触发者 - repeated byte Content = 4; //内容 + string Content = 4; //内容 } \ No newline at end of file diff --git a/Entity/Chat/ChatChannel.cs b/Entity/Chat/ChatChannel.cs index 494397e..1bb0766 100644 --- a/Entity/Chat/ChatChannel.cs +++ b/Entity/Chat/ChatChannel.cs @@ -3,24 +3,26 @@ using MongoDB.Bson.Serialization.Attributes; namespace NB.Chat; - /// /// 聊天频道实体 /// public class ChatChannel : Entity { - [BsonElement("type")] public uint ChannelType; - /// - /// 频道Id + /// 频道类型 0.地图 1.公开 2.私密 /// - [BsonElement("cid")] public long ChannelId; + [BsonElement("type")] public uint ChannelType; /// /// 频道名称 /// [BsonElement("name")] public string Name = ""; + /// + /// 频道密码 + /// + [BsonElement("pass")] public string Password = ""; + /// /// 创建者 /// @@ -32,9 +34,12 @@ public class ChatChannel : Entity [BsonElement("ct")] public long CreateTime; /// - /// 频道地区 + /// 频道地区 0,全球 非0地区 如果是地图频道则表示地图位置 /// [BsonElement("region")] public int Region; - + + /// + /// 当前频道在线人数 + /// [BsonElement("ids")] public readonly HashSet Units = new HashSet(); } \ No newline at end of file diff --git a/Entity/Chat/ChatUnit.cs b/Entity/Chat/ChatUnit.cs index a6f8ae4..ca20e98 100644 --- a/Entity/Chat/ChatUnit.cs +++ b/Entity/Chat/ChatUnit.cs @@ -1,3 +1,4 @@ +using Fantasy; using Fantasy.Entitas; namespace NB.Chat; @@ -5,16 +6,8 @@ namespace NB.Chat; public sealed class ChatUnit : Entity { public long GateRouteId; - - public long RoleId; - - public string NickName = string.Empty; - - public string Head = string.Empty; - - public string Country = string.Empty; - - public int Level; + + public RoleSimpleInfo Role; public override void Dispose() { @@ -23,12 +16,8 @@ public sealed class ChatUnit : Entity return; } - RoleId = 0; GateRouteId = 0; - NickName = string.Empty; - Head = string.Empty; - Country = string.Empty; - Level = 0; + Role = null; base.Dispose(); } } \ No newline at end of file diff --git a/Entity/Entity.csproj b/Entity/Entity.csproj index a23094a..ae06c88 100644 --- a/Entity/Entity.csproj +++ b/Entity/Entity.csproj @@ -28,7 +28,7 @@ - + diff --git a/Entity/Game/Achievement/Achievement.cs b/Entity/Game/Achievement/Achievement.cs new file mode 100644 index 0000000..abc1597 --- /dev/null +++ b/Entity/Game/Achievement/Achievement.cs @@ -0,0 +1,7 @@ +using Fantasy.Entitas; + +namespace NB.Game; + +public class Achievement : Entity +{ +} \ No newline at end of file diff --git a/Entity/Game/Achievement/AchievementContainer.cs b/Entity/Game/Achievement/AchievementContainer.cs new file mode 100644 index 0000000..3d0cef4 --- /dev/null +++ b/Entity/Game/Achievement/AchievementContainer.cs @@ -0,0 +1,10 @@ +using Fantasy.Entitas; + +namespace NB.Game; + +/// +/// 成就容器 + /// +public class AchievementContainer : Entity +{ +} \ No newline at end of file diff --git a/Entity/Game/Activity/Activity.cs b/Entity/Game/Activity/Activity.cs new file mode 100644 index 0000000..ff9c6e1 --- /dev/null +++ b/Entity/Game/Activity/Activity.cs @@ -0,0 +1,8 @@ +using Fantasy.Entitas; + +namespace NB.Game; + +public class Activity : Entity +{ + +} \ No newline at end of file diff --git a/Entity/Game/Player/Player.cs b/Entity/Game/Player/Player.cs index 9244c58..b2d3f97 100644 --- a/Entity/Game/Player/Player.cs +++ b/Entity/Game/Player/Player.cs @@ -36,6 +36,15 @@ public sealed class Player : Entity /// public FishContainer FishContainer; + /// + /// 技能 + /// + public SkillContainer SkillContainer; + + /// + /// 成就 + /// + public AchievementContainer AchievementContainer; [BsonIgnore] public long SessionRunTimeId; diff --git a/Entity/Game/Skill/SkillContainer.cs b/Entity/Game/Skill/SkillContainer.cs new file mode 100644 index 0000000..2b50391 --- /dev/null +++ b/Entity/Game/Skill/SkillContainer.cs @@ -0,0 +1,7 @@ +using Fantasy.Entitas; + +namespace NB.Game; + +public class SkillContainer : Entity +{ +} \ No newline at end of file diff --git a/Entity/Generate/NetworkProtocol/GlobalData.cs b/Entity/Generate/NetworkProtocol/GlobalData.cs index 80a4367..316cf4a 100644 --- a/Entity/Generate/NetworkProtocol/GlobalData.cs +++ b/Entity/Generate/NetworkProtocol/GlobalData.cs @@ -49,7 +49,7 @@ namespace Fantasy Type = default; Source = default; Trigger = default; - Content.Clear(); + Content = default; #if FANTASY_NET || FANTASY_UNITY GetScene().MessagePoolComponent.Return(this); #endif @@ -61,6 +61,6 @@ namespace Fantasy [ProtoMember(3)] public ChatUserInfo Trigger { get; set; } [ProtoMember(4)] - public List Content = new List(); + public string Content { get; set; } } } diff --git a/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs b/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs index c50520b..7ba0266 100644 --- a/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs +++ b/Hotfix/Chat/Handler/C2Chat_SendMessageRequestHandler.cs @@ -1,4 +1,5 @@ -using Fantasy; +using System.Text; +using Fantasy; using Fantasy.Async; using Fantasy.Network.Interface; @@ -10,7 +11,10 @@ public sealed class protected override async FTask Run(ChatUnit chatUnit, C2Chat_SendMessageRequest request, Caht2C_SendMessageResponse response, Action reply) { - // ChatSceneHelper.Broadcast(chatUnit.Scene, request.Message); + ChatSceneHelper.Broadcast(chatUnit.Scene, new ChatMessageInfo() + { + Content = request.Message, + }); await FTask.CompletedTask; } } \ No newline at end of file diff --git a/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs b/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs index c6ae5dd..fa5c977 100644 --- a/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs +++ b/Hotfix/Chat/System/ChatChannelCenterComponentSystem.cs @@ -20,7 +20,7 @@ public static class ChatChannelCenterComponentSystem } channel = Entity.Create(self.Scene, channelId, true, true); - channel.Creator = unit.RoleId; + channel.Creator = unit.Role.RoleId; channel.CreateTime = TimeHelper.Now; self.Channels.Add(channelId, channel); return channel; diff --git a/Hotfix/Chat/System/ChatUnitManageComponentSystem.cs b/Hotfix/Chat/System/ChatUnitManageComponentSystem.cs index af69c5d..d6eb199 100644 --- a/Hotfix/Chat/System/ChatUnitManageComponentSystem.cs +++ b/Hotfix/Chat/System/ChatUnitManageComponentSystem.cs @@ -28,11 +28,7 @@ public static class ChatUnitManageComponentSystem if (account != null) { account.GateRouteId = gateRouteId; - account.RoleId = accountId; - account.Head = roleSimpleInfo.Head; - account.Level = roleSimpleInfo.Level; - account.NickName = roleSimpleInfo.NickName; - account.Country = roleSimpleInfo.Country; + account.Role = roleSimpleInfo; } await FTask.CompletedTask; diff --git a/Hotfix/Gate/Handler/Inner/Chat2G_ChatMessageHandler.cs b/Hotfix/Gate/Handler/Inner/Chat2G_ChatMessageHandler.cs index 0cac019..9ada6a5 100644 --- a/Hotfix/Gate/Handler/Inner/Chat2G_ChatMessageHandler.cs +++ b/Hotfix/Gate/Handler/Inner/Chat2G_ChatMessageHandler.cs @@ -13,8 +13,9 @@ public class Chat2G_ChatMessageHandler : Route { var chatMessage = new Chat2C_Message() { - Message = new ChatMessageInfo(), + Message = message.Message, }; + var gateUnitManage = scene.GetComponent();