提交示例代码
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
/// <summary>
|
||||
/// 聊天中控中心
|
||||
/// 1、申请、创建、解散聊天频道。
|
||||
/// 2、管理聊天频道成员。
|
||||
/// 3、根据频道ID找到对应的频道。
|
||||
/// </summary>
|
||||
public class ChatChannelCenterComponent : Entity
|
||||
{
|
||||
public readonly Dictionary<long, ChatChannelComponent> Channels = new();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Fantasy.Entitas;
|
||||
// ReSharper disable ArrangeObjectCreationWhenTypeEvident
|
||||
// ReSharper disable UsageOfDefaultStructEquality
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
/// <summary>
|
||||
/// 聊天频道实体
|
||||
/// 1、根据频道内的玩家进行广播聊天信息。
|
||||
/// 2、当前频道如果没有玩家的话,则自动销毁。
|
||||
/// 3、存放当前频道的玩家信息。
|
||||
/// </summary>
|
||||
public sealed class ChatChannelComponent : Entity
|
||||
{
|
||||
public readonly HashSet<long> Units = new HashSet<long>();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed class ChatUnitManageComponent : Entity
|
||||
{
|
||||
public readonly Dictionary<long, ChatUnit> Units = new();
|
||||
}
|
||||
49
聊天系统课程代码/Server/Entity/Chat/Enum/ChatChannelType.cs
Normal file
49
聊天系统课程代码/Server/Entity/Chat/Enum/ChatChannelType.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
namespace Fantasy;
|
||||
|
||||
/// <summary>
|
||||
/// 聊天频道类型
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ChatChannelType
|
||||
{
|
||||
None = 0,
|
||||
World = 1 << 1, // 世界频道
|
||||
Private = 1 << 2, // 私聊频道
|
||||
System = 1 << 3, // 系统频道
|
||||
Broadcast = 1 << 4, // 广播频道
|
||||
Notice = 1 << 5, // 公告频道
|
||||
Team = 1 << 6, // 队伍频道
|
||||
Near = 1 << 7, // 附近频道
|
||||
CurrentMap = 1 << 8, // 当前地图频道
|
||||
|
||||
// 所有频道
|
||||
All = World | Private | System | Broadcast | Notice | Team | Near,
|
||||
// 其他聊天栏显示的频道
|
||||
Display = World | Private | System | Broadcast | Notice | Team | Near | CurrentMap
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 聊天节点类型
|
||||
/// </summary>
|
||||
public enum ChatNodeType
|
||||
{
|
||||
None = 0,
|
||||
Position = 1, // 位置节点
|
||||
OpenUI = 2, // 打开UI节点
|
||||
Link = 3, // 链接节点
|
||||
Item = 4, // 物品节点
|
||||
Text = 5, // 文本节点
|
||||
Image = 6, // 图片节点
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 聊天节点事件类型
|
||||
/// </summary>
|
||||
public enum ChatNodeEvent
|
||||
{
|
||||
None = 0,
|
||||
OpenUI = 1, // 打开UI节点
|
||||
OpenLink = 2, // 点击链接节点
|
||||
UseItem = 3, // 使用物品节点
|
||||
Position = 4, // 位置节点
|
||||
}
|
||||
15
聊天系统课程代码/Server/Entity/Chat/Model/ChatInfoTree.cs
Normal file
15
聊天系统课程代码/Server/Entity/Chat/Model/ChatInfoTree.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Runtime.Serialization;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public partial class ChatInfoTree
|
||||
{
|
||||
[BsonIgnore]
|
||||
[JsonIgnore]
|
||||
[ProtoIgnore]
|
||||
[IgnoreDataMember]
|
||||
public Scene Scene { get; set; }
|
||||
}
|
||||
11
聊天系统课程代码/Server/Entity/Chat/Model/ChatUnit.cs
Normal file
11
聊天系统课程代码/Server/Entity/Chat/Model/ChatUnit.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed class ChatUnit : Entity
|
||||
{
|
||||
public string UserName;
|
||||
public long GateRouteId;
|
||||
public readonly Dictionary<long, ChatChannelComponent> Channels = new();
|
||||
public readonly Dictionary<int, long> SendTime = new Dictionary<int, long>();
|
||||
}
|
||||
Reference in New Issue
Block a user