增加相关协议
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Game\Activity\" />
|
||||
<Folder Include="Game\Mail\" />
|
||||
<Folder Include="Game\Skill\" />
|
||||
<Folder Include="Map\" />
|
||||
</ItemGroup>
|
||||
|
||||
17
Entity/Game/Item/AwardItem.cs
Normal file
17
Entity/Game/Item/AwardItem.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Fantasy.Entitas;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public class AwardItem : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 拥有的数量
|
||||
/// </summary>
|
||||
[BsonElement("c")] public int Count;
|
||||
|
||||
/// <summary>
|
||||
/// 配置id
|
||||
/// </summary>
|
||||
[BsonElement("cid")] public int ConfigId;
|
||||
}
|
||||
@@ -11,6 +11,8 @@ public enum ItemType
|
||||
Fish,
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class Item : Entity
|
||||
{
|
||||
/// <summary>
|
||||
@@ -27,4 +29,19 @@ public class Item : Entity
|
||||
/// 是否绑定
|
||||
/// </summary>
|
||||
[BsonElement("ib")] public bool IsBind;
|
||||
|
||||
/// <summary>
|
||||
/// 失效时间
|
||||
/// </summary>
|
||||
[BsonElement("et")] public long ExpirationTime;
|
||||
|
||||
/// <summary>
|
||||
/// 获得时间
|
||||
/// </summary>
|
||||
[BsonElement("gt")] public long GetTime;
|
||||
|
||||
/// <summary>
|
||||
/// 耐久度
|
||||
/// </summary>
|
||||
[BsonElement("a")] public int Abrasion;
|
||||
}
|
||||
34
Entity/Game/Mail/Components/MailComponent.cs
Normal file
34
Entity/Game/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/Game/Mail/Entity/Mail.cs
Normal file
46
Entity/Game/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/Game/Mail/Entity/MailBox.cs
Normal file
41
Entity/Game/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/Game/Mail/Enum/MailEnum.cs
Normal file
54
Entity/Game/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
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using Fantasy.Entitas;
|
||||
|
||||
namespace NB;
|
||||
|
||||
/// <summary>
|
||||
/// 角色基础数据
|
||||
/// </summary>
|
||||
public class PlayerBasic
|
||||
{
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// </summary>
|
||||
public string NickName;
|
||||
|
||||
/// <summary>
|
||||
/// 头像
|
||||
/// </summary>
|
||||
public string Head;
|
||||
|
||||
/// <summary>
|
||||
/// 国家
|
||||
/// </summary>
|
||||
public string Country;
|
||||
|
||||
/// <summary>
|
||||
/// 等级
|
||||
/// </summary>
|
||||
public int Level;
|
||||
|
||||
/// <summary>
|
||||
/// 当前经验
|
||||
/// </summary>
|
||||
public int Exp;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace NB;
|
||||
/// <summary>
|
||||
/// 角色统计数据
|
||||
/// </summary>
|
||||
public class PlayerStatistics
|
||||
public class PlayerStatistics : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录次数
|
||||
|
||||
@@ -9,10 +9,30 @@ public sealed class Player : Entity
|
||||
[BsonElement("ct")] public long CreateTime;
|
||||
[BsonElement("lt")] public long LoginTime;
|
||||
|
||||
public PlayerBasic Basic = new PlayerBasic();
|
||||
public PlayerStatistics Statistics = new PlayerStatistics();
|
||||
public PlayerDayFlags DayFlags = new PlayerDayFlags();
|
||||
public PlayerVip Vip = new PlayerVip();
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// </summary>
|
||||
[BsonElement("name")] public string NickName;
|
||||
|
||||
/// <summary>
|
||||
/// 头像
|
||||
/// </summary>
|
||||
public string Head;
|
||||
|
||||
/// <summary>
|
||||
/// 国家
|
||||
/// </summary>
|
||||
public string Country;
|
||||
|
||||
/// <summary>
|
||||
/// 等级
|
||||
/// </summary>
|
||||
[BsonElement("lv")] public int Level;
|
||||
|
||||
/// <summary>
|
||||
/// 当前经验
|
||||
/// </summary>
|
||||
public int Exp;
|
||||
|
||||
/// <summary>
|
||||
/// 余额
|
||||
@@ -24,6 +44,11 @@ public sealed class Player : Entity
|
||||
/// </summary>
|
||||
public int Gold;
|
||||
|
||||
// public PlayerStatistics Statistics = new PlayerStatistics();
|
||||
// public PlayerDayFlags DayFlags = new PlayerDayFlags();
|
||||
// public PlayerVip Vip = new PlayerVip();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 其他货币
|
||||
/// </summary>
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace Fantasy
|
||||
[ProtoMember(5)]
|
||||
public long GetTime { get; set; }
|
||||
[ProtoMember(6)]
|
||||
public long Abrasion { get; set; }
|
||||
public int Abrasion { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// fish信息
|
||||
|
||||
@@ -29,10 +29,11 @@ namespace Fantasy
|
||||
Id = default;
|
||||
Title = default;
|
||||
Content = default;
|
||||
SendTime = default;
|
||||
Type = default;
|
||||
CreateTime = default;
|
||||
ExpireTime = default;
|
||||
MailType = default;
|
||||
MailState = default;
|
||||
Items.Clear();
|
||||
IsRead = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<MailInfo>(this);
|
||||
#endif
|
||||
@@ -44,12 +45,14 @@ namespace Fantasy
|
||||
[ProtoMember(3)]
|
||||
public string Content { get; set; }
|
||||
[ProtoMember(4)]
|
||||
public long SendTime { get; set; }
|
||||
public long CreateTime { get; set; }
|
||||
[ProtoMember(5)]
|
||||
public int Type { get; set; }
|
||||
public long ExpireTime { get; set; }
|
||||
[ProtoMember(6)]
|
||||
public List<AwardInfo> Items = new List<AwardInfo>();
|
||||
public int MailType { get; set; }
|
||||
[ProtoMember(7)]
|
||||
public bool IsRead { get; set; }
|
||||
public int MailState { get; set; }
|
||||
[ProtoMember(8)]
|
||||
public List<AwardInfo> Items = new List<AwardInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,4 +192,96 @@ namespace Fantasy
|
||||
[ProtoMember(3)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 请求邮件列表
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2Game_GetMailsRequest : AMessage, ICustomRouteRequest, IProto
|
||||
{
|
||||
public static C2Game_GetMailsRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2Game_GetMailsRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Game_GetMailsRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public Game2C_GetMailsResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2Game_GetMailsRequest; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.GameRoute;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取邮件列表响应
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class Game2C_GetMailsResponse : AMessage, ICustomRouteResponse, IProto
|
||||
{
|
||||
public static Game2C_GetMailsResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Game2C_GetMailsResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
Mail.Clear();
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Game2C_GetMailsResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Game2C_GetMailsResponse; }
|
||||
[ProtoMember(1)]
|
||||
public List<MailInfo> Mail = new List<MailInfo>();
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 新邮件推送
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class Game2C_HaveMail : AMessage, ICustomRouteMessage, IProto
|
||||
{
|
||||
public static Game2C_HaveMail Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Game2C_HaveMail>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Mail = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Game2C_HaveMail>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Game2C_HaveMail; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.GameRoute;
|
||||
[ProtoMember(1)]
|
||||
public MailInfo Mail { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class Game2C_MailState : AMessage, ICustomRouteMessage, IProto
|
||||
{
|
||||
public static Game2C_MailState Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Game2C_MailState>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
MailState = default;
|
||||
MailId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Game2C_MailState>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Game2C_MailState; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.GameRoute;
|
||||
[ProtoMember(1)]
|
||||
public int MailState { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public long MailId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,5 +9,9 @@ namespace Fantasy
|
||||
public const uint G2C_RepeatLogin = 134227729;
|
||||
public const uint C2Game_GetRoleInfoRequest = 2281711377;
|
||||
public const uint Game2C_GetRoleInfoResponse = 2415929105;
|
||||
public const uint C2Game_GetMailsRequest = 2281711378;
|
||||
public const uint Game2C_GetMailsResponse = 2415929106;
|
||||
public const uint Game2C_HaveMail = 2147493649;
|
||||
public const uint Game2C_MailState = 2147493650;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user