新增结构体

This commit is contained in:
2025-09-01 18:28:23 +08:00
parent 88d302bbe6
commit 7cdad80c7a
6 changed files with 69 additions and 67 deletions

View File

@@ -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
/// 当前经验
/// </summary>
[BsonElement("exp")] public int Exp;
/// <summary>
/// 是否是vip
/// </summary>
[BsonElement("vip")] public bool IsVip;
/// <summary>
/// 星数
@@ -49,6 +46,41 @@ public sealed class Player : Entity
/// </summary>
[BsonElement("high")] public int Highlight;
/// <summary>
/// 角色vip信息
/// </summary>
[BsonElement("vInfo")] public PlayerVip? Vip;
/// <summary>
/// 钱包
/// </summary>
[BsonElement("wallet")] public PlayerWallet? Wallet;
/// <summary>
/// 背包
/// </summary>
[BsonElement("bag")] public ItemContainer? ItemContainer;
/// <summary>
/// 鱼护
/// </summary>
[BsonElement("fish")] public FishContainer? FishContainer;
/// <summary>
/// 技能
/// </summary>
[BsonElement("skill")] public SkillContainer? SkillContainer;
/// <summary>
/// 成就
/// </summary>
[BsonElement("achievement")] public AchievementContainer? AchievementContainer;
/// <summary>
/// 是否是vip
/// </summary>
[BsonIgnore]
public bool IsVip => Vip != null && Vip.ExpirationTime > TimeHelper.Now;
[BsonIgnore] public long SessionRunTimeId;

View File

@@ -1,40 +0,0 @@
using Fantasy.Entitas;
using MongoDB.Bson.Serialization.Attributes;
namespace NB.Game;
/// <summary>
/// 用户核心信息
/// </summary>
public class PlayerPrivate : Entity
{
/// <summary>
/// 角色vip信息
/// </summary>
[BsonElement("vInfo")] public PlayerVip Vip;
/// <summary>
/// 钱包
/// </summary>
[BsonElement("wallet")] public PlayerWallet Wallet;
/// <summary>
/// 背包
/// </summary>
[BsonElement("bag")] public ItemContainer ItemContainer;
/// <summary>
/// 鱼护
/// </summary>
[BsonElement("fish")] public FishContainer FishContainer;
/// <summary>
/// 技能
/// </summary>
[BsonElement("skill")] public SkillContainer SkillContainer;
/// <summary>
/// 成就
/// </summary>
[BsonElement("achievement")] public AchievementContainer AchievementContainer;
}

View File

@@ -16,7 +16,6 @@ public sealed class PlayerDestroySystem : DestroySystem<Player>
self.Level = 0;
self.Exp = 0;
self.Country = string.Empty;
self.IsVip = false;
self.Head = string.Empty;
// self.ItemContainer.Dispose();

View File

@@ -12,26 +12,36 @@ public static class PlayerHelper
public static void InitializeChildEntity(this Player self)
{
// if (self.ItemContainer == null)
// {
// self.ItemContainer = Entity.Create<ItemContainer>(self.Scene, true, true);
// }
//
// if (self.FishContainer == null)
// {
// self.FishContainer = Entity.Create<FishContainer>(self.Scene, true, true);
// }
//
// if (self.Wallet == null)
// {
// self.Wallet = Entity.Create<PlayerWallet>(self.Scene, true, true);
// }
//
// if (self.Vip == null)
// {
// self.Vip = Entity.Create<PlayerVip>(self.Scene, true, true);
// }
//
if (self.Vip == null)
{
self.Vip = Entity.Create<PlayerVip>(self.Scene, true, true);
}
if (self.Wallet == null)
{
self.Wallet = Entity.Create<PlayerWallet>(self.Scene, true, true);
}
if (self.ItemContainer == null)
{
self.ItemContainer = Entity.Create<ItemContainer>(self.Scene, true, true);
}
if (self.FishContainer == null)
{
self.FishContainer = Entity.Create<FishContainer>(self.Scene, true, true);
}
if (self.SkillContainer == null)
{
self.SkillContainer = Entity.Create<SkillContainer>(self.Scene, true, true);
}
if (self.AchievementContainer == null)
{
self.AchievementContainer = Entity.Create<AchievementContainer>(self.Scene, true, true);
}
// if (self.Statistics == null)
// {
// self.Statistics = Entity.Create<PlayerStatistics>(self.Scene, true, true);

View File

@@ -3,7 +3,7 @@
"profiles": {
"Main": {
"commandName": "Project",
// "workingDirectory": "$(OutputPath)",
"workingDirectory": "$(OutputPath)",
"environmentVariables": {},
"commandLineArgs": "--m Develop"
}

View File

@@ -22,6 +22,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEnumerable_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fe8241d251b32455eb32cf531792be2de95400_003F8d_003F7f127f2d_003FEnumerable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExceptionDispatchInfo_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fbd1d5c50194fea68ff3559c160230b0ab50f5acf4ce3061bffd6d62958e2182_003FExceptionDispatchInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExceptionDispatchInfo_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb241c378a97f4447a2e6baf64e656013e8e910_003Fe2_003F09fd5ce3_003FExceptionDispatchInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExceptionDispatchInfo_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fbd1d5c50194fea68ff3559c160230b0ab50f5acf4ce3061bffd6d62958e2182_003FExceptionDispatchInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFileStream_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F77fc0eb92b774686bbae91cb92331703d83600_003Fd1_003Fe3244183_003FFileStream_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFilterDefinition_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F8ea7d078decf4c90ba8835b5c94f73f224de00_003Fbb_003F26ba78ed_003FFilterDefinition_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHttpListenerContext_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F39685ddee93747a69e157aaf821b46b74ec00_003F0c_003F83013c19_003FHttpListenerContext_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>