聊天频道相关
This commit is contained in:
40
Entity/Chat/ChatChannel.cs
Normal file
40
Entity/Chat/ChatChannel.cs
Normal 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>();
|
||||
}
|
||||
@@ -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>();
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
/// <summary>
|
||||
/// 聊天频道实体
|
||||
/// </summary>
|
||||
public class ChatChannelComponent : Entity
|
||||
{
|
||||
public readonly HashSet<long> Units = new HashSet<long>();
|
||||
}
|
||||
25
Entity/Chat/ChatContentBase.cs
Normal file
25
Entity/Chat/ChatContentBase.cs
Normal 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
|
||||
{
|
||||
}
|
||||
4
Entity/Chat/ChatMessageRecord.cs
Normal file
4
Entity/Chat/ChatMessageRecord.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Chat;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -151,6 +151,38 @@ namespace Fantasy
|
||||
public List<SkillInfo> Skills = new List<SkillInfo>();
|
||||
}
|
||||
/// <summary>
|
||||
/// 角色信息
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class RoleSimpleInfo : AMessage, IProto
|
||||
{
|
||||
public static RoleSimpleInfo Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<RoleSimpleInfo>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
RoleId = default;
|
||||
NickName = default;
|
||||
Head = default;
|
||||
Country = default;
|
||||
Level = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<RoleSimpleInfo>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoMember(1)]
|
||||
public long RoleId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public string NickName { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public string Head { get; set; }
|
||||
[ProtoMember(4)]
|
||||
public string Country { get; set; }
|
||||
[ProtoMember(5)]
|
||||
public int Level { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// VIP信息
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace Fantasy
|
||||
public override void Dispose()
|
||||
{
|
||||
Type = default;
|
||||
Source = default;
|
||||
Trigger = default;
|
||||
Content.Clear();
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
@@ -56,8 +57,10 @@ namespace Fantasy
|
||||
[ProtoMember(1)]
|
||||
public int Type { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public ChatUserInfo Trigger { get; set; }
|
||||
public int Source { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public List<string> Content = new List<string>();
|
||||
public ChatUserInfo Trigger { get; set; }
|
||||
[ProtoMember(4)]
|
||||
public List<byte> Content = new List<byte>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace Fantasy
|
||||
{
|
||||
ErrorCode = default;
|
||||
RoleRouteId = default;
|
||||
RoleInfo = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Game2G_EnterResponse>(this);
|
||||
#endif
|
||||
@@ -62,6 +63,8 @@ namespace Fantasy
|
||||
[ProtoMember(1)]
|
||||
public long RoleRouteId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public RoleSimpleInfo RoleInfo { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
@@ -76,7 +79,7 @@ namespace Fantasy
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
AccountId = default;
|
||||
Role = default;
|
||||
GateRouteId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2Chat_EnterRequest>(this);
|
||||
@@ -86,7 +89,7 @@ namespace Fantasy
|
||||
public Game2G_EnterResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return InnerOpcode.G2Chat_EnterRequest; }
|
||||
[ProtoMember(1)]
|
||||
public long AccountId { get; set; }
|
||||
public RoleSimpleInfo Role { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public long GateRouteId { get; set; }
|
||||
}
|
||||
@@ -127,6 +130,6 @@ namespace Fantasy
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.Chat2G_ChatMessage; }
|
||||
[ProtoMember(1)]
|
||||
public string Message { get; set; }
|
||||
public ChatMessageInfo Message { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user