提交示例代码

This commit is contained in:
Bob.Song
2026-03-05 11:39:06 +08:00
commit 25958f58c3
2534 changed files with 209593 additions and 0 deletions

View File

@@ -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();
}

View File

@@ -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>();
}

View File

@@ -0,0 +1,8 @@
using Fantasy.Entitas;
namespace Fantasy;
public sealed class ChatUnitManageComponent : Entity
{
public readonly Dictionary<long, ChatUnit> Units = new();
}

View 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, // 位置节点
}

View 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; }
}

View 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>();
}