大修改

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,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
}