大修改

This commit is contained in:
2025-08-14 23:56:51 +08:00
parent 022cc1ac3e
commit d5689258fc
54 changed files with 775 additions and 839 deletions

View File

@@ -0,0 +1,50 @@
using Fantasy.Entitas;
using MongoDB.Bson.Serialization.Attributes;
namespace NB.Chat;
/// <summary>
/// 聊天频道实体
/// </summary>
public class ChatChannel : Entity
{
/// <summary>
/// 频道绑定id
/// </summary>
[BsonElement("cid")] public long ChannelId;
/// <summary>
/// 频道类型 0.地图 1.工会频道
/// </summary>
[BsonElement("type")] public uint ChannelType;
/// <summary>
/// 频道名称
/// </summary>
[BsonElement("name")] public string Name = "";
/// <summary>
/// 频道密码
/// </summary>
[BsonElement("pass")] public string Password = "";
/// <summary>
/// 创建者
/// </summary>
[BsonElement("cr")] public long Creator;
/// <summary>
/// 创建时间
/// </summary>
[BsonElement("ct")] public long CreateTime;
/// <summary>
/// 频道地区 0全球 非0地区 如果是地图频道则表示地图位置
/// </summary>
[BsonElement("region")] public int Region;
/// <summary>
/// 当前频道在线人数
/// </summary>
[BsonIgnore] public readonly HashSet<long> Units = new HashSet<long>();
}

View File

@@ -0,0 +1,11 @@
using Fantasy.Entitas;
namespace NB.Chat;
/// <summary>
/// 聊天频道管理
/// </summary>
public class ChatChannelCenterComponent : Entity
{
public readonly Dictionary<long, ChatChannel> Channels = new Dictionary<long, ChatChannel>();
}

View File

@@ -0,0 +1,8 @@
using Fantasy.Entitas;
namespace NB.Club;
public class Club : Entity
{
}

View File

@@ -0,0 +1,8 @@
using Fantasy.Entitas;
namespace NB.Club;
public class ClubManageComponent : Entity
{
public readonly Dictionary<long, Club> Clubs = new();
}

View File

@@ -0,0 +1,34 @@
using Fantasy.DataStructure.Collection;
using Fantasy.Entitas;
using Fantasy.Helper;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Options;
namespace NB.Game;
/// <summary>
/// 玩家邮件组件
/// </summary>
public class MailComponent : Entity
{
/// <summary>
/// 最大邮件数据
/// </summary>
public const int MaxMailCount = 50;
/// <summary>
/// 邮件最大保留时间
/// </summary>
public const long MaxExpireTime = TimeHelper.OneDay * 365;
/// <summary>
/// 邮件列表
/// </summary>
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
public Dictionary<long, Mail> Mails = new Dictionary<long, Mail>();
/// <summary>
/// 按照时间进行排序
/// </summary>
[BsonIgnore] public readonly SortedOneToManyListPool<long, long> Timer = new SortedOneToManyListPool<long, long>();
}

View File

@@ -0,0 +1,46 @@
using Fantasy.Entitas;
namespace NB.Game;
public sealed class Mail : Entity
{
/// <summary>
/// 邮件拥有者
/// </summary>
public long OwnerId;
/// <summary>
/// 邮件状态
/// </summary>
public MailState State = MailState.None;
/// <summary>
/// 邮件状态
/// </summary>
public MailType MailType = MailType.None;
/// <summary>
/// 邮件标题
/// </summary>
public string Title;
/// <summary>
/// 邮件内容
/// </summary>
public string Content;
/// <summary>
/// 创建时间
/// </summary>
public long CreateTime;
/// <summary>
/// 过期时间
/// </summary>
public long ExpireTime;
/// <summary>
/// 邮件的附件内容
/// </summary>
public List<AwardItem> Items = new List<AwardItem>();
}

View File

@@ -0,0 +1,41 @@
using Fantasy.Entitas;
namespace NB.Game;
public class MailBox : Entity
{
/// <summary>
/// 邮件
/// </summary>
public Mail Mail;
/// <summary>
/// 创建时间
/// </summary>
public long CreateTime;
/// <summary>
/// 失效时间
/// </summary>
public long ExpireTime;
/// <summary>
/// 邮箱类型
/// </summary>
public MailBoxType BoxType;
/// <summary>
/// 发送人
/// </summary>
public long SendAccountId = 0;
/// <summary>
/// 收件人
/// </summary>
public HashSet<long> AccountId = new HashSet<long>();
/// <summary>
/// 领取过的人
/// </summary>
public HashSet<long> Received = new HashSet<long>();
}

View File

@@ -0,0 +1,54 @@
namespace NB.Game;
public enum MailType
{
None = 0,
System = 1, //系统邮件
Rewards = 2, //奖励邮件
User = 3, //个人邮件
}
public enum MailState
{
None = 0,
/// <summary>
/// 未读
/// </summary>
Unread = 1,
/// <summary>
/// 已读
/// </summary>
HaveRead = 2,
/// <summary>
/// 未领取
/// </summary>
NotClaimed = 3,
/// <summary>
/// 已领取
/// </summary>
Received = 4,
/// <summary>
/// 已删除
/// </summary>
Deleted = 5,
}
public enum MailBoxType
{
None = 0,
/// <summary>
/// 指定目标
/// </summary>
Specify = 1,
/// <summary>
/// 全部人
/// </summary>
All = 2
}

View File

@@ -0,0 +1,33 @@
using Fantasy;
using Fantasy.Entitas;
namespace NB.Chat;
public sealed class SocialUnit : Entity
{
public long GateRouteId;
public RoleSimpleInfo Role;
/// <summary>
/// 当前所在地图
/// </summary>
public long MapId;
/// <summary>
/// 当前频道
/// </summary>
public long CurrentChannel;
public override void Dispose()
{
if (IsDisposed)
{
return;
}
GateRouteId = 0;
Role = null;
base.Dispose();
}
}

View File

@@ -0,0 +1,15 @@
using Fantasy;
using Fantasy.DataStructure.Collection;
using Fantasy.Entitas;
namespace NB.Chat;
public class SocialUnitManageComponent : Entity
{
public readonly Dictionary<long, SocialUnit> Units = new();
/// <summary>
/// 不在线消息缓存
/// </summary>
public readonly OneToManyList<long, ChatMessageInfo> NotSendMessage = new();
}