77de740b63
Enum renamed in StatIds.cs (byte values unchanged - serialized definitions/saves never re-mean); all call sites + doc mentions swept (ClassTraits, PlayerAuthoring, CharacterStatsDefinition field type, menu/UI, tests). CharacterStatsDefinition SO CLASS name kept (asset-binding risk; deferred per plan). 390 green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
59 lines
2.3 KiB
C#
59 lines
2.3 KiB
C#
using System;
|
|
|
|
namespace ProjectM.Simulation
|
|
{
|
|
/// <summary>One serialized ledger row (item id + count). An array FIELD of <see cref="SaveData"/>.</summary>
|
|
[Serializable]
|
|
public struct LedgerRow
|
|
{
|
|
public int ItemId;
|
|
public int Count;
|
|
}
|
|
|
|
/// <summary>One persisted per-class PERMANENT meta-upgrade tier (v6). ClassId = the normalized FrameKind
|
|
/// (Warrior=2/Ranger=3); UpgradeId = the append-only meta-catalog key (unknown ids round-trip preserved and are
|
|
/// skipped live); Tier clamps to the catalog's MaxTier at seed/shop/spend, never at rest.</summary>
|
|
[Serializable]
|
|
public struct MetaUpgradeSave
|
|
{
|
|
public byte ClassId;
|
|
public byte UpgradeId;
|
|
public byte Tier;
|
|
}
|
|
|
|
/// <summary>One serialized player-built structure. Flat scalars (JsonUtility has no int2).</summary>
|
|
[Serializable]
|
|
public struct StructureSave
|
|
{
|
|
public byte Type;
|
|
public int CellX;
|
|
public int CellZ;
|
|
public float HP; // EB-1: hit points at save time (0 -> restored to baked Max)
|
|
}
|
|
|
|
/// <summary>
|
|
/// Versioned, host-authoritative save slice: the shared resource ledger + player-built structures + the
|
|
/// permanent meta. JsonUtility-friendly — a class with flat fields and an array FIELD (never a root array).
|
|
/// The schema is ADDITIVE going forward, gated by <see cref="Version"/> migration.
|
|
/// </summary>
|
|
[Serializable]
|
|
public class SaveData
|
|
{
|
|
public const int CurrentVersion = 7; // v7: LANTERN fresh epoch — goal/core/outcome + conveyor/machine-I/O fields dropped
|
|
|
|
/// <summary>Oldest save schema the loader accepts. v7 is a FRESH EPOCH (operator-approved): older saves are ignored.</summary>
|
|
public const int MinLoadableVersion = 7;
|
|
|
|
public int Version = CurrentVersion;
|
|
|
|
// Permanent meta-progression:
|
|
public int RunsCompleted; // boss-cleared runs (the HUD counter + the HostSalt fold at restore)
|
|
public int MaxDepthReached; // deepest room actually CLEARED across all runs (honest depth, never planned)
|
|
public MetaUpgradeSave[] MetaUpgrades = Array.Empty<MetaUpgradeSave>(); // sparse per-class tiers
|
|
|
|
public LedgerRow[] Ledger = Array.Empty<LedgerRow>();
|
|
public StructureSave[] Structures = Array.Empty<StructureSave>();
|
|
public long SavedAtMs;
|
|
}
|
|
}
|