大修改
This commit is contained in:
50
Entity/Social/Chat/ChatChannel.cs
Normal file
50
Entity/Social/Chat/ChatChannel.cs
Normal 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>();
|
||||
}
|
||||
11
Entity/Social/Chat/ChatChannelCenterComponent.cs
Normal file
11
Entity/Social/Chat/ChatChannelCenterComponent.cs
Normal 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>();
|
||||
}
|
||||
8
Entity/Social/Club/Club.cs
Normal file
8
Entity/Social/Club/Club.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Club;
|
||||
|
||||
public class Club : Entity
|
||||
{
|
||||
|
||||
}
|
||||
8
Entity/Social/Club/ClubManageComponent.cs
Normal file
8
Entity/Social/Club/ClubManageComponent.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB.Club;
|
||||
|
||||
public class ClubManageComponent : Entity
|
||||
{
|
||||
public readonly Dictionary<long, Club> Clubs = new();
|
||||
}
|
||||
34
Entity/Social/Mail/Components/MailComponent.cs
Normal file
34
Entity/Social/Mail/Components/MailComponent.cs
Normal 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>();
|
||||
}
|
||||
46
Entity/Social/Mail/Entity/Mail.cs
Normal file
46
Entity/Social/Mail/Entity/Mail.cs
Normal 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>();
|
||||
}
|
||||
41
Entity/Social/Mail/Entity/MailBox.cs
Normal file
41
Entity/Social/Mail/Entity/MailBox.cs
Normal 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>();
|
||||
}
|
||||
54
Entity/Social/Mail/Enum/MailEnum.cs
Normal file
54
Entity/Social/Mail/Enum/MailEnum.cs
Normal 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
|
||||
}
|
||||
33
Entity/Social/SocialUnit.cs
Normal file
33
Entity/Social/SocialUnit.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
15
Entity/Social/SocialUnitManageComponent.cs
Normal file
15
Entity/Social/SocialUnitManageComponent.cs
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user