From 6b113cf32ba47b0f9115746865caa16ade7947df Mon Sep 17 00:00:00 2001 From: bob <605277374@qq.com> Date: Wed, 30 Jul 2025 20:35:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NetworkProtocol/Outer/OuterCommon.proto | 19 -- .../NetworkProtocol/Outer/data/Account.proto | 96 ++++++ .../NetworkProtocol/Outer/data/Friend.proto | 14 + .../Outer/data/GlobalData.proto | 0 Config/NetworkProtocol/Outer/data/Mail.proto | 13 + Entity/Entity.csproj | 5 +- Entity/Game/Fish/Fish.cs | 27 ++ Entity/Game/Item/Item.cs | 13 +- Entity/Game/Player/Child/PlayerInfo.cs | 16 - Entity/Game/Player/Child/PlayerVip.cs | 19 ++ Entity/Game/Player/Player.cs | 39 ++- Entity/Generate/NetworkProtocol/Account.cs | 318 ++++++++++++++++++ .../{OuterCommon.cs => Friend.cs} | 53 +-- Entity/Generate/NetworkProtocol/GlobalData.cs | 20 ++ Entity/Generate/NetworkProtocol/Mail.cs | 55 +++ .../Handler/G2Game_EnterRequestHandler.cs | 28 +- Hotfix/Game/System/Player/PlayerFactory.cs | 3 +- Hotfix/Hotfix.csproj | 2 +- 18 files changed, 646 insertions(+), 94 deletions(-) delete mode 100644 Config/NetworkProtocol/Outer/OuterCommon.proto create mode 100644 Config/NetworkProtocol/Outer/data/Account.proto create mode 100644 Config/NetworkProtocol/Outer/data/Friend.proto create mode 100644 Config/NetworkProtocol/Outer/data/GlobalData.proto create mode 100644 Config/NetworkProtocol/Outer/data/Mail.proto create mode 100644 Entity/Game/Fish/Fish.cs delete mode 100644 Entity/Game/Player/Child/PlayerInfo.cs create mode 100644 Entity/Game/Player/Child/PlayerVip.cs create mode 100644 Entity/Generate/NetworkProtocol/Account.cs rename Entity/Generate/NetworkProtocol/{OuterCommon.cs => Friend.cs} (56%) create mode 100644 Entity/Generate/NetworkProtocol/GlobalData.cs create mode 100644 Entity/Generate/NetworkProtocol/Mail.cs diff --git a/Config/NetworkProtocol/Outer/OuterCommon.proto b/Config/NetworkProtocol/Outer/OuterCommon.proto deleted file mode 100644 index f8e0148..0000000 --- a/Config/NetworkProtocol/Outer/OuterCommon.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; -package Fantasy.Network.Message; - -/// GameAccount实体类 -message RoleBaseInfo -{ - string NickName = 1;//昵称 - string Head = 2;//头像 - string Country = 3;//国家 - int32 Level = 4;//等级 - int32 Exp = 5;//当前等级 -} - -///角色信息 -message RoleInfo -{ - RoleBaseInfo BaseInfo = 1; - int64 RoleId = 2; //账号id -} \ No newline at end of file diff --git a/Config/NetworkProtocol/Outer/data/Account.proto b/Config/NetworkProtocol/Outer/data/Account.proto new file mode 100644 index 0000000..657b41e --- /dev/null +++ b/Config/NetworkProtocol/Outer/data/Account.proto @@ -0,0 +1,96 @@ +syntax = "proto3"; +package Fantasy.Network.Message; + +/// 角色基础信息 +message RoleBaseInfo +{ + string NickName = 1; //昵称 + string Head = 2; //头像 + string Country = 3; //国家 + int32 Level = 4; //等级 + int32 Exp = 5; //当前等级 +} + +message KeyValueStringInt64 +{ + string Key = 1; //键 + int64 Value = 2; //值 +} + +message KeyValueInt64 +{ + int64 Key = 1; //键 + int64 Value = 2; //值 +} + +message KeyValueString +{ + string Key = 1; //键 + string Value = 2; //值 +} + + +/// 角色信息 +message RoleInfo +{ + RoleBaseInfo BaseInfo = 1; + int64 RoleId = 2; //账号id + repeated ItemInfo Items = 3; //身上物品 + repeated FishInfo Fishs = 4; //鱼护 + repeated ActivityInfo Activities = 5; //活动信息 + repeated KeyValueInt64 Currency = 6; //货币信息 + repeated KeyValueInt64 Slots = 7; //插槽使用情况 + repeated SkillInfo Skills = 8; //技能信息 +} + +/// VIP信息 +message VipInfo +{ + int64 OpenTime = 1; //开通时间 + int64 ExpirationTime = 2; //到期时间 +} + +///奖励信息 +message AwardInfo +{ + int64 ConfigId = 1; //奖励id + int32 Count = 2; //数量 +} + +///物品信息 +message ItemInfo +{ + int32 ConfigId = 1; //配置id + int64 Id = 2; //物品id + int32 Count = 3; //数量 + int64 ExpirationTime = 4; //失效时间 + int64 GetTime = 5; //获得时间 + int64 Abrasion = 6; //耐久度 +} + +///fish信息 +message FishInfo +{ + int32 ConfigId = 1; //配置id + int64 Id = 2; //物品id + int32 Weight =3; //重量 + int64 GetTime = 4; //获得时间 + int64 ExpirationTime = 5; //失效时间 +} + +//活动信息 +message ActivityInfo +{ + int64 Id = 1; //活动id + int64 StartTime = 2; //开始时间 + int64 EndTime = 3; //结束时间 + repeated KeyValueStringInt64 Data = 4; //活动数据 +} + +///技能情况 +message SkillInfo +{ + int32 ConfigId = 1; //技能配置id + int32 Level = 2; //技能等级 + int32 Exp = 3; //技能经验 +} \ No newline at end of file diff --git a/Config/NetworkProtocol/Outer/data/Friend.proto b/Config/NetworkProtocol/Outer/data/Friend.proto new file mode 100644 index 0000000..7c87f0c --- /dev/null +++ b/Config/NetworkProtocol/Outer/data/Friend.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package Fantasy.Network.Message; + +/// 好友信息 +message FriendInfo +{ + int64 Id = 1; //好友id + int64 AddTime = 2; //添加时间 + string NickName = 3; //昵称 + string Head = 4; //头像 + int32 Level = 5; //等级 + string Country = 6; //国家 + int32 OnlineStatus = 7; //在线状态 +} \ No newline at end of file diff --git a/Config/NetworkProtocol/Outer/data/GlobalData.proto b/Config/NetworkProtocol/Outer/data/GlobalData.proto new file mode 100644 index 0000000..e69de29 diff --git a/Config/NetworkProtocol/Outer/data/Mail.proto b/Config/NetworkProtocol/Outer/data/Mail.proto new file mode 100644 index 0000000..4d3226d --- /dev/null +++ b/Config/NetworkProtocol/Outer/data/Mail.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; +package Fantasy.Network.Message; + +message MailInfo +{ + int64 Id = 1; //邮件id + string Title = 2; //标题 + string Content = 3; //内容 + int64 SendTime = 4; //发送时间 + int32 Type = 5; //邮件类型 + repeated AwardInfo Items = 6; //附件列表 + bool IsRead = 7; //是否已读 +} \ No newline at end of file diff --git a/Entity/Entity.csproj b/Entity/Entity.csproj index 1b63e6c..71ebf56 100644 --- a/Entity/Entity.csproj +++ b/Entity/Entity.csproj @@ -2,7 +2,7 @@ enable - disable + enable Linux default net9.0 @@ -28,6 +28,9 @@ + + + diff --git a/Entity/Game/Fish/Fish.cs b/Entity/Game/Fish/Fish.cs new file mode 100644 index 0000000..a15edfe --- /dev/null +++ b/Entity/Game/Fish/Fish.cs @@ -0,0 +1,27 @@ +using Fantasy.Entitas; +using MongoDB.Bson.Serialization.Attributes; + +namespace NB.Game; + +public class Fish : Entity +{ + /// + /// 配置id + /// + [BsonElement("cid")] public int ConfigId; + + /// + /// 重量 + /// + [BsonElement("w")] public int Weight; + + /// + /// 获取时间 + /// + [BsonElement("gt")] public long GetTime; + + /// + /// 失效时间 + /// + [BsonElement("et")] public long ExpirationTime; +} \ No newline at end of file diff --git a/Entity/Game/Item/Item.cs b/Entity/Game/Item/Item.cs index a7aeb7f..636077d 100644 --- a/Entity/Game/Item/Item.cs +++ b/Entity/Game/Item/Item.cs @@ -16,20 +16,15 @@ public class Item : Entity /// /// 拥有的数量 /// - public int Count; + [BsonElement("c")] public int Count; /// /// 配置id /// - public int ConfigId; + [BsonElement("cid")] public int ConfigId; /// /// 是否绑定 /// - public bool IsBind; - - /// - /// 当前所属的容器 - /// - [BsonIgnore] public Container Container; -} + [BsonElement("ib")] public bool IsBind; +} \ No newline at end of file diff --git a/Entity/Game/Player/Child/PlayerInfo.cs b/Entity/Game/Player/Child/PlayerInfo.cs deleted file mode 100644 index 11ccf92..0000000 --- a/Entity/Game/Player/Child/PlayerInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Fantasy.Entitas; - -namespace NB; - -public class PlayerInfo : Entity -{ - /// - /// 昵称 - /// - public string NickName; - - /// - /// 头像 - /// - public string Head; -} \ No newline at end of file diff --git a/Entity/Game/Player/Child/PlayerVip.cs b/Entity/Game/Player/Child/PlayerVip.cs new file mode 100644 index 0000000..7deddfe --- /dev/null +++ b/Entity/Game/Player/Child/PlayerVip.cs @@ -0,0 +1,19 @@ +namespace NB; + +public class PlayerVip +{ + /// + /// 是否是vip + /// + public bool IsVip; + + /// + /// 获取时间 + /// + public long GetTime; + + /// + /// 失效时间 + /// + public long ExpirationTime; +} \ No newline at end of file diff --git a/Entity/Game/Player/Player.cs b/Entity/Game/Player/Player.cs index 529681c..5e4345d 100644 --- a/Entity/Game/Player/Player.cs +++ b/Entity/Game/Player/Player.cs @@ -6,17 +6,48 @@ namespace NB.Game; public sealed class Player : Entity { - public long CreateTime; - public long LoginTime; + [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(); + /// + /// 余额 + /// + public int Money; + + /// + /// 金币 + /// + public int Gold; + + /// + /// 其他货币 + /// [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] public Dictionary Currency = new(); - - + + /// + /// 插槽 + /// + [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] + public Dictionary Slots = new Dictionary(); + + /// + /// 背包物品 + /// + [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] + public Dictionary Items = new Dictionary(); + + /// + /// 鱼护 + /// + [BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)] + public Dictionary Fishes = new Dictionary(); + [BsonIgnore] public long SessionRunTimeId; diff --git a/Entity/Generate/NetworkProtocol/Account.cs b/Entity/Generate/NetworkProtocol/Account.cs new file mode 100644 index 0000000..f5fe2c5 --- /dev/null +++ b/Entity/Generate/NetworkProtocol/Account.cs @@ -0,0 +1,318 @@ +using ProtoBuf; + +using System.Collections.Generic; +using MongoDB.Bson.Serialization.Attributes; +using Fantasy; +using Fantasy.Network.Interface; +using Fantasy.Serialize; +// ReSharper disable InconsistentNaming +// ReSharper disable RedundantUsingDirective +// ReSharper disable RedundantOverriddenMember +// ReSharper disable PartialTypeWithSinglePart +// ReSharper disable UnusedAutoPropertyAccessor.Global +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable CheckNamespace +#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. +#pragma warning disable CS8618 + +namespace Fantasy +{ + /// + /// 角色基础信息 + /// + [ProtoContract] + public partial class RoleBaseInfo : AMessage, IProto + { + public static RoleBaseInfo Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + NickName = default; + Head = default; + Country = default; + Level = default; + Exp = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public string NickName { get; set; } + [ProtoMember(2)] + public string Head { get; set; } + [ProtoMember(3)] + public string Country { get; set; } + [ProtoMember(4)] + public int Level { get; set; } + [ProtoMember(5)] + public int Exp { get; set; } + } + [ProtoContract] + public partial class KeyValueStringInt64 : AMessage, IProto + { + public static KeyValueStringInt64 Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Key = default; + Value = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public string Key { get; set; } + [ProtoMember(2)] + public long Value { get; set; } + } + [ProtoContract] + public partial class KeyValueInt64 : AMessage, IProto + { + public static KeyValueInt64 Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Key = default; + Value = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public long Key { get; set; } + [ProtoMember(2)] + public long Value { get; set; } + } + [ProtoContract] + public partial class KeyValueString : AMessage, IProto + { + public static KeyValueString Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Key = default; + Value = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public string Key { get; set; } + [ProtoMember(2)] + public string Value { get; set; } + } + /// + /// 角色信息 + /// + [ProtoContract] + public partial class RoleInfo : AMessage, IProto + { + public static RoleInfo Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + BaseInfo = default; + RoleId = default; + Items.Clear(); + Fishs.Clear(); + Activities.Clear(); + Currency.Clear(); + Slots.Clear(); + Skills.Clear(); +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public RoleBaseInfo BaseInfo { get; set; } + [ProtoMember(2)] + public long RoleId { get; set; } + [ProtoMember(3)] + public List Items = new List(); + [ProtoMember(4)] + public List Fishs = new List(); + [ProtoMember(5)] + public List Activities = new List(); + [ProtoMember(6)] + public List Currency = new List(); + [ProtoMember(7)] + public List Slots = new List(); + [ProtoMember(8)] + public List Skills = new List(); + } + /// + /// VIP信息 + /// + [ProtoContract] + public partial class VipInfo : AMessage, IProto + { + public static VipInfo Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + OpenTime = default; + ExpirationTime = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public long OpenTime { get; set; } + [ProtoMember(2)] + public long ExpirationTime { get; set; } + } + /// + /// 奖励信息 + /// + [ProtoContract] + public partial class AwardInfo : AMessage, IProto + { + public static AwardInfo Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + ConfigId = default; + Count = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public long ConfigId { get; set; } + [ProtoMember(2)] + public int Count { get; set; } + } + /// + /// 物品信息 + /// + [ProtoContract] + public partial class ItemInfo : AMessage, IProto + { + public static ItemInfo Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + ConfigId = default; + Id = default; + Count = default; + ExpirationTime = default; + GetTime = default; + Abrasion = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public int ConfigId { get; set; } + [ProtoMember(2)] + public long Id { get; set; } + [ProtoMember(3)] + public int Count { get; set; } + [ProtoMember(4)] + public long ExpirationTime { get; set; } + [ProtoMember(5)] + public long GetTime { get; set; } + [ProtoMember(6)] + public long Abrasion { get; set; } + } + /// + /// fish信息 + /// + [ProtoContract] + public partial class FishInfo : AMessage, IProto + { + public static FishInfo Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + ConfigId = default; + Id = default; + Weight = default; + GetTime = default; + ExpirationTime = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public int ConfigId { get; set; } + [ProtoMember(2)] + public long Id { get; set; } + [ProtoMember(3)] + public int Weight { get; set; } + [ProtoMember(4)] + public long GetTime { get; set; } + [ProtoMember(5)] + public long ExpirationTime { get; set; } + } + [ProtoContract] + public partial class ActivityInfo : AMessage, IProto + { + public static ActivityInfo Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Id = default; + StartTime = default; + EndTime = default; + Data.Clear(); +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public long Id { get; set; } + [ProtoMember(2)] + public long StartTime { get; set; } + [ProtoMember(3)] + public long EndTime { get; set; } + [ProtoMember(4)] + public List Data = new List(); + } + /// + /// 技能情况 + /// + [ProtoContract] + public partial class SkillInfo : AMessage, IProto + { + public static SkillInfo Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + ConfigId = default; + Level = default; + Exp = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public int ConfigId { get; set; } + [ProtoMember(2)] + public int Level { get; set; } + [ProtoMember(3)] + public int Exp { get; set; } + } +} diff --git a/Entity/Generate/NetworkProtocol/OuterCommon.cs b/Entity/Generate/NetworkProtocol/Friend.cs similarity index 56% rename from Entity/Generate/NetworkProtocol/OuterCommon.cs rename to Entity/Generate/NetworkProtocol/Friend.cs index 94e4fa2..6847b97 100644 --- a/Entity/Generate/NetworkProtocol/OuterCommon.cs +++ b/Entity/Generate/NetworkProtocol/Friend.cs @@ -18,58 +18,41 @@ using Fantasy.Serialize; namespace Fantasy { /// - /// GameAccount实体类 + /// 好友信息 /// [ProtoContract] - public partial class RoleBaseInfo : AMessage, IProto + public partial class FriendInfo : AMessage, IProto { - public static RoleBaseInfo Create(Scene scene) + public static FriendInfo Create(Scene scene) { - return scene.MessagePoolComponent.Rent(); + return scene.MessagePoolComponent.Rent(); } public override void Dispose() { + Id = default; + AddTime = default; NickName = default; Head = default; - Country = default; Level = default; - Exp = default; + Country = default; + OnlineStatus = default; #if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); + GetScene().MessagePoolComponent.Return(this); #endif } [ProtoMember(1)] - public string NickName { get; set; } + public long Id { get; set; } [ProtoMember(2)] - public string Head { get; set; } + public long AddTime { get; set; } [ProtoMember(3)] - public string Country { get; set; } + public string NickName { get; set; } [ProtoMember(4)] - public int Level { get; set; } + public string Head { get; set; } [ProtoMember(5)] - public int Exp { get; set; } - } - /// - /// 角色信息 - /// - [ProtoContract] - public partial class RoleInfo : AMessage, IProto - { - public static RoleInfo Create(Scene scene) - { - return scene.MessagePoolComponent.Rent(); - } - public override void Dispose() - { - BaseInfo = default; - RoleId = default; -#if FANTASY_NET || FANTASY_UNITY - GetScene().MessagePoolComponent.Return(this); -#endif - } - [ProtoMember(1)] - public RoleBaseInfo BaseInfo { get; set; } - [ProtoMember(2)] - public long RoleId { get; set; } + public int Level { get; set; } + [ProtoMember(6)] + public string Country { get; set; } + [ProtoMember(7)] + public int OnlineStatus { get; set; } } } diff --git a/Entity/Generate/NetworkProtocol/GlobalData.cs b/Entity/Generate/NetworkProtocol/GlobalData.cs new file mode 100644 index 0000000..c4f45da --- /dev/null +++ b/Entity/Generate/NetworkProtocol/GlobalData.cs @@ -0,0 +1,20 @@ +using ProtoBuf; + +using System.Collections.Generic; +using MongoDB.Bson.Serialization.Attributes; +using Fantasy; +using Fantasy.Network.Interface; +using Fantasy.Serialize; +// ReSharper disable InconsistentNaming +// ReSharper disable RedundantUsingDirective +// ReSharper disable RedundantOverriddenMember +// ReSharper disable PartialTypeWithSinglePart +// ReSharper disable UnusedAutoPropertyAccessor.Global +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable CheckNamespace +#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. +#pragma warning disable CS8618 + +namespace Fantasy +{ +} diff --git a/Entity/Generate/NetworkProtocol/Mail.cs b/Entity/Generate/NetworkProtocol/Mail.cs new file mode 100644 index 0000000..92eedc3 --- /dev/null +++ b/Entity/Generate/NetworkProtocol/Mail.cs @@ -0,0 +1,55 @@ +using ProtoBuf; + +using System.Collections.Generic; +using MongoDB.Bson.Serialization.Attributes; +using Fantasy; +using Fantasy.Network.Interface; +using Fantasy.Serialize; +// ReSharper disable InconsistentNaming +// ReSharper disable RedundantUsingDirective +// ReSharper disable RedundantOverriddenMember +// ReSharper disable PartialTypeWithSinglePart +// ReSharper disable UnusedAutoPropertyAccessor.Global +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable CheckNamespace +#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type. +#pragma warning disable CS8618 + +namespace Fantasy +{ + [ProtoContract] + public partial class MailInfo : AMessage, IProto + { + public static MailInfo Create(Scene scene) + { + return scene.MessagePoolComponent.Rent(); + } + public override void Dispose() + { + Id = default; + Title = default; + Content = default; + SendTime = default; + Type = default; + Items.Clear(); + IsRead = default; +#if FANTASY_NET || FANTASY_UNITY + GetScene().MessagePoolComponent.Return(this); +#endif + } + [ProtoMember(1)] + public long Id { get; set; } + [ProtoMember(2)] + public string Title { get; set; } + [ProtoMember(3)] + public string Content { get; set; } + [ProtoMember(4)] + public long SendTime { get; set; } + [ProtoMember(5)] + public int Type { get; set; } + [ProtoMember(6)] + public List Items = new List(); + [ProtoMember(7)] + public bool IsRead { get; set; } + } +} diff --git a/Hotfix/Game/Handler/G2Game_EnterRequestHandler.cs b/Hotfix/Game/Handler/G2Game_EnterRequestHandler.cs index e4d4032..5b94f4e 100644 --- a/Hotfix/Game/Handler/G2Game_EnterRequestHandler.cs +++ b/Hotfix/Game/Handler/G2Game_EnterRequestHandler.cs @@ -17,7 +17,7 @@ public class G2Game_EnterRequestHandler : RouteRPC(); Log.Debug("检查账号是否在缓存中"); @@ -32,16 +32,30 @@ public class G2Game_EnterRequestHandler : RouteRPC(scene, true, true); + account.Items.Add(item.Id, item); + } + + for (int i = 0; i < 500; i++) + { + var item = Entity.Create(scene, true, true); + account.Fishes.Add(item.Id, item); + } + // account.Items + account.NeedSave = true; + + await account.SaveDataBase(); } else { @@ -68,11 +82,11 @@ public class G2Game_EnterRequestHandler : RouteRPC(scene, aId, false, false); gameAccount.LoginTime = gameAccount.CreateTime = TimeHelper.Now; - - var info = gameAccount.AddComponent(); + if (isSaveDataBase) { diff --git a/Hotfix/Hotfix.csproj b/Hotfix/Hotfix.csproj index a86e143..2707d36 100644 --- a/Hotfix/Hotfix.csproj +++ b/Hotfix/Hotfix.csproj @@ -2,7 +2,7 @@ enable - disable + enable default net9.0