协议提交
This commit is contained in:
@@ -12,5 +12,5 @@ message ChatMessageInfo
|
||||
int32 Type = 1; //消息类型
|
||||
int32 Source = 2; //消息来源
|
||||
ChatUserInfo Trigger = 3; //触发者
|
||||
repeated byte Content = 4; //内容
|
||||
string Content = 4; //内容
|
||||
}
|
||||
@@ -3,24 +3,26 @@ using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 聊天频道实体
|
||||
/// </summary>
|
||||
public class ChatChannel : Entity
|
||||
{
|
||||
[BsonElement("type")] public uint ChannelType;
|
||||
|
||||
/// <summary>
|
||||
/// 频道Id
|
||||
/// 频道类型 0.地图 1.公开 2.私密
|
||||
/// </summary>
|
||||
[BsonElement("cid")] public long ChannelId;
|
||||
[BsonElement("type")] public uint ChannelType;
|
||||
|
||||
/// <summary>
|
||||
/// 频道名称
|
||||
/// </summary>
|
||||
[BsonElement("name")] public string Name = "";
|
||||
|
||||
/// <summary>
|
||||
/// 频道密码
|
||||
/// </summary>
|
||||
[BsonElement("pass")] public string Password = "";
|
||||
|
||||
/// <summary>
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
@@ -32,9 +34,12 @@ public class ChatChannel : Entity
|
||||
[BsonElement("ct")] public long CreateTime;
|
||||
|
||||
/// <summary>
|
||||
/// 频道地区
|
||||
/// 频道地区 0,全球 非0地区 如果是地图频道则表示地图位置
|
||||
/// </summary>
|
||||
[BsonElement("region")] public int Region;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当前频道在线人数
|
||||
/// </summary>
|
||||
[BsonElement("ids")] public readonly HashSet<long> Units = new HashSet<long>();
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Game\Activity\" />
|
||||
<Folder Include="Club\" />
|
||||
<Folder Include="Map\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
7
Entity/Game/Achievement/Achievement.cs
Normal file
7
Entity/Game/Achievement/Achievement.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class Achievement : Entity
|
||||
{
|
||||
}
|
||||
10
Entity/Game/Achievement/AchievementContainer.cs
Normal file
10
Entity/Game/Achievement/AchievementContainer.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
/// <summary>
|
||||
/// 成就容器
|
||||
/// </summary>
|
||||
public class AchievementContainer : Entity
|
||||
{
|
||||
}
|
||||
8
Entity/Game/Activity/Activity.cs
Normal file
8
Entity/Game/Activity/Activity.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class Activity : Entity
|
||||
{
|
||||
|
||||
}
|
||||
@@ -36,6 +36,15 @@ public sealed class Player : Entity
|
||||
/// </summary>
|
||||
public FishContainer FishContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 技能
|
||||
/// </summary>
|
||||
public SkillContainer SkillContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 成就
|
||||
/// </summary>
|
||||
public AchievementContainer AchievementContainer;
|
||||
|
||||
[BsonIgnore] public long SessionRunTimeId;
|
||||
|
||||
|
||||
7
Entity/Game/Skill/SkillContainer.cs
Normal file
7
Entity/Game/Skill/SkillContainer.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class SkillContainer : Entity
|
||||
{
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace Fantasy
|
||||
Type = default;
|
||||
Source = default;
|
||||
Trigger = default;
|
||||
Content.Clear();
|
||||
Content = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<ChatMessageInfo>(this);
|
||||
#endif
|
||||
@@ -61,6 +61,6 @@ namespace Fantasy
|
||||
[ProtoMember(3)]
|
||||
public ChatUserInfo Trigger { get; set; }
|
||||
[ProtoMember(4)]
|
||||
public List<byte> Content = new List<byte>();
|
||||
public string Content { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public static class ChatChannelCenterComponentSystem
|
||||
}
|
||||
|
||||
channel = Entity.Create<ChatChannel>(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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -13,8 +13,9 @@ public class Chat2G_ChatMessageHandler : Route<Scene, Chat2G_ChatMessage>
|
||||
{
|
||||
var chatMessage = new Chat2C_Message()
|
||||
{
|
||||
Message = new ChatMessageInfo(),
|
||||
Message = message.Message,
|
||||
};
|
||||
|
||||
|
||||
var gateUnitManage = scene.GetComponent<GateUnitManageComponent>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user