Implement per-school save functionality by introducing a dedicated save directory and updating the school management system to support loading and saving school states. Revise documentation to reflect these changes, including updates to the architecture and design documents, and enhance the API for reloading schools from disk. Update tests to ensure proper functionality of the new save and reload features.
This commit is contained in:
@@ -22,13 +22,25 @@ public sealed class School : IDisposable
|
||||
World = World.Create();
|
||||
}
|
||||
|
||||
/// <summary>A brand-new school: calendar running at the start date, empty world.</summary>
|
||||
public static School Create(int id, string name, DateTime startDate) => new(id, name, startDate);
|
||||
|
||||
/// <summary>Rebuilds a school from a save. Time, pause and speed come from disk, not defaults.</summary>
|
||||
public static School Load(int id, string name, DateTime time, bool running, int speedIndex)
|
||||
{
|
||||
var school = new School(id, name, time);
|
||||
school.Clock.IsRunning = running;
|
||||
school.Clock.SpeedIndex = speedIndex;
|
||||
return school;
|
||||
}
|
||||
|
||||
public int Id { get; }
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public GameClock Clock { get; }
|
||||
|
||||
/// <summary>The Arch world backing this school. Only the loop thread may touch it.</summary>
|
||||
/// <summary>The Arch world backing this school. Only this school's worker thread may touch it.</summary>
|
||||
public World World { get; }
|
||||
|
||||
/// <summary>Runs one fixed step of the school. Today that is only the calendar.</summary>
|
||||
|
||||
Reference in New Issue
Block a user