diff --git a/Entity/Game/Player/Player.cs b/Entity/Game/Player/Player.cs index 093f21f..72b7b8a 100644 --- a/Entity/Game/Player/Player.cs +++ b/Entity/Game/Player/Player.cs @@ -1,4 +1,5 @@ using Fantasy.Entitas; +using Fantasy.Helper; using MongoDB.Bson.Serialization.Attributes; using MongoDB.Bson.Serialization.Options; @@ -33,11 +34,7 @@ public sealed class Player : Entity /// 当前经验 /// [BsonElement("exp")] public int Exp; - - /// - /// 是否是vip - /// - [BsonElement("vip")] public bool IsVip; + /// /// 星数 @@ -49,6 +46,41 @@ public sealed class Player : Entity /// [BsonElement("high")] public int Highlight; + /// + /// 角色vip信息 + /// + [BsonElement("vInfo")] public PlayerVip? Vip; + + /// + /// 钱包 + /// + [BsonElement("wallet")] public PlayerWallet? Wallet; + + /// + /// 背包 + /// + [BsonElement("bag")] public ItemContainer? ItemContainer; + + /// + /// 鱼护 + /// + [BsonElement("fish")] public FishContainer? FishContainer; + + /// + /// 技能 + /// + [BsonElement("skill")] public SkillContainer? SkillContainer; + + /// + /// 成就 + /// + [BsonElement("achievement")] public AchievementContainer? AchievementContainer; + + /// + /// 是否是vip + /// + [BsonIgnore] + public bool IsVip => Vip != null && Vip.ExpirationTime > TimeHelper.Now; [BsonIgnore] public long SessionRunTimeId; diff --git a/Entity/Game/Player/PlayerBasic.cs b/Entity/Game/Player/PlayerBasic.cs deleted file mode 100644 index 18040fc..0000000 --- a/Entity/Game/Player/PlayerBasic.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Fantasy.Entitas; -using MongoDB.Bson.Serialization.Attributes; - -namespace NB.Game; - -/// -/// 用户核心信息 -/// -public class PlayerPrivate : Entity -{ - /// - /// 角色vip信息 - /// - [BsonElement("vInfo")] public PlayerVip Vip; - - /// - /// 钱包 - /// - [BsonElement("wallet")] public PlayerWallet Wallet; - - /// - /// 背包 - /// - [BsonElement("bag")] public ItemContainer ItemContainer; - - /// - /// 鱼护 - /// - [BsonElement("fish")] public FishContainer FishContainer; - - /// - /// 技能 - /// - [BsonElement("skill")] public SkillContainer SkillContainer; - - /// - /// 成就 - /// - [BsonElement("achievement")] public AchievementContainer AchievementContainer; -} \ No newline at end of file diff --git a/Hotfix/Game/Player/Entity/PlayerSystem.cs b/Hotfix/Game/Player/Entity/PlayerSystem.cs index b1e2609..37b6be1 100644 --- a/Hotfix/Game/Player/Entity/PlayerSystem.cs +++ b/Hotfix/Game/Player/Entity/PlayerSystem.cs @@ -16,7 +16,6 @@ public sealed class PlayerDestroySystem : DestroySystem self.Level = 0; self.Exp = 0; self.Country = string.Empty; - self.IsVip = false; self.Head = string.Empty; // self.ItemContainer.Dispose(); diff --git a/Hotfix/Game/Player/Helper/PlayerHelper.cs b/Hotfix/Game/Player/Helper/PlayerHelper.cs index 3b597c6..23e0d24 100644 --- a/Hotfix/Game/Player/Helper/PlayerHelper.cs +++ b/Hotfix/Game/Player/Helper/PlayerHelper.cs @@ -12,26 +12,36 @@ public static class PlayerHelper public static void InitializeChildEntity(this Player self) { - // if (self.ItemContainer == null) - // { - // self.ItemContainer = Entity.Create(self.Scene, true, true); - // } - // - // if (self.FishContainer == null) - // { - // self.FishContainer = Entity.Create(self.Scene, true, true); - // } - // - // if (self.Wallet == null) - // { - // self.Wallet = Entity.Create(self.Scene, true, true); - // } - // - // if (self.Vip == null) - // { - // self.Vip = Entity.Create(self.Scene, true, true); - // } - // + + if (self.Vip == null) + { + self.Vip = Entity.Create(self.Scene, true, true); + } + if (self.Wallet == null) + { + self.Wallet = Entity.Create(self.Scene, true, true); + } + + if (self.ItemContainer == null) + { + self.ItemContainer = Entity.Create(self.Scene, true, true); + } + + if (self.FishContainer == null) + { + self.FishContainer = Entity.Create(self.Scene, true, true); + } + + if (self.SkillContainer == null) + { + self.SkillContainer = Entity.Create(self.Scene, true, true); + } + + if (self.AchievementContainer == null) + { + self.AchievementContainer = Entity.Create(self.Scene, true, true); + } + // if (self.Statistics == null) // { // self.Statistics = Entity.Create(self.Scene, true, true); diff --git a/Main/Properties/launchSettings.json b/Main/Properties/launchSettings.json index c31a6c9..90a0233 100644 --- a/Main/Properties/launchSettings.json +++ b/Main/Properties/launchSettings.json @@ -3,7 +3,7 @@ "profiles": { "Main": { "commandName": "Project", -// "workingDirectory": "$(OutputPath)", + "workingDirectory": "$(OutputPath)", "environmentVariables": {}, "commandLineArgs": "--m Develop" } diff --git a/Server.sln.DotSettings.user b/Server.sln.DotSettings.user index 5c51dc1..2ace019 100644 --- a/Server.sln.DotSettings.user +++ b/Server.sln.DotSettings.user @@ -22,6 +22,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded