BoardState.CaptureSave/RestoreFromSave deep-copy every mutable field (grid, pieces, demands, transformers, buffers, stock, campaign progress) into a WorldSave slot. GameSim.QuickSave/QuickLoad expose slotted saves and emit StateSavedEvent / StateRestoredEvent — the latter carries a fresh BoardSnapshot so the presentation can rebuild board, pieces, trajectories, objectives, stock, camera, and control bar in one pass. F5/F9 trigger it in Main; harness gains quick_save/quick_load commands so UI tests can checkpoint a scenario and resume without replaying from scratch. Seven xUnit tests cover the roundtrip (including independence from post-save mutations, campaign state, and multi-slot isolation).
27 lines
804 B
C#
27 lines
804 B
C#
namespace Chessistics.Engine.Model;
|
|
|
|
public class DemandState
|
|
{
|
|
public DemandDef Definition { get; }
|
|
public int ReceivedCount { get; set; }
|
|
public int MissionIndex { get; }
|
|
|
|
public DemandState(DemandDef definition, int missionIndex = 0)
|
|
{
|
|
Definition = definition;
|
|
MissionIndex = missionIndex;
|
|
ReceivedCount = 0;
|
|
}
|
|
|
|
public bool IsSatisfied => ReceivedCount >= Definition.Amount;
|
|
public Coords Position => Definition.Position;
|
|
public string Name => Definition.Name;
|
|
public CargoType Cargo => Definition.Cargo;
|
|
public int Required => Definition.Amount;
|
|
public int Deadline => Definition.Deadline;
|
|
|
|
public DemandState Clone()
|
|
{
|
|
return new DemandState(Definition, MissionIndex) { ReceivedCount = ReceivedCount };
|
|
}
|
|
}
|