聊天频道相关

This commit is contained in:
bob
2025-08-08 18:21:11 +08:00
parent 61496d4616
commit 7a93c0f8f1
23 changed files with 256 additions and 95 deletions

View File

@@ -0,0 +1,40 @@
using Fantasy.Entitas;
using MongoDB.Bson.Serialization.Attributes;
namespace NB.Chat;
/// <summary>
/// 聊天频道实体
/// </summary>
public class ChatChannel : Entity
{
[BsonElement("type")] public uint ChannelType;
/// <summary>
/// 频道Id
/// </summary>
[BsonElement("cid")] public long ChannelId;
/// <summary>
/// 频道名称
/// </summary>
[BsonElement("name")] public string Name = "";
/// <summary>
/// 创建者
/// </summary>
[BsonElement("cr")] public long Creator;
/// <summary>
/// 创建时间
/// </summary>
[BsonElement("ct")] public long CreateTime;
/// <summary>
/// 频道地区
/// </summary>
[BsonElement("region")] public int Region;
[BsonElement("ids")] public readonly HashSet<long> Units = new HashSet<long>();
}

View File

@@ -7,5 +7,5 @@ namespace NB.Chat;
/// </summary>
public class ChatChannelCenterComponent : Entity
{
public readonly Dictionary<long, ChatChannelComponent> Channels = new Dictionary<long, ChatChannelComponent>();
public readonly Dictionary<long, ChatChannel> Channels = new Dictionary<long, ChatChannel>();
}

View File

@@ -1,11 +0,0 @@
using Fantasy.Entitas;
namespace NB.Chat;
/// <summary>
/// 聊天频道实体
/// </summary>
public class ChatChannelComponent : Entity
{
public readonly HashSet<long> Units = new HashSet<long>();
}

View File

@@ -0,0 +1,25 @@
namespace NB.Chat;
[Serializable]
public abstract class ChatContentData
{
}
[Serializable]
public class ChatContentNormal : ChatContentData
{
public string Content = "";
}
[Serializable]
public class ChatContentFished : ChatContentData
{
public long Id;
public int Weight;
public int Type;
}
[Serializable]
public class ChatContentRecord : ChatContentData
{
}

View File

@@ -0,0 +1,4 @@
using Fantasy.Entitas;
namespace NB.Chat;

View File

@@ -6,6 +6,16 @@ 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 override void Dispose()
{
if (IsDisposed)
@@ -13,7 +23,12 @@ public sealed class ChatUnit : Entity
return;
}
RoleId = 0;
GateRouteId = 0;
NickName = string.Empty;
Head = string.Empty;
Country = string.Empty;
Level = 0;
base.Dispose();
}
}