Add HSchool.Content project for JSONC definitions, catalog, and map validation. Update solution structure to include new content and tests projects. Enhance school management to support mod packs and map instances, ensuring proper loading and validation. Revise documentation to reflect these changes and update tests for new functionality.
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
namespace HSchool.Content;
|
||||
|
||||
/// <summary>One school's map instance: tree grouping plus a walkable graph of territory and rooms.</summary>
|
||||
public sealed class MapLayout
|
||||
{
|
||||
public TerritoryNode? Territory { get; init; }
|
||||
|
||||
public IReadOnlyList<BuildingNode> Buildings { get; init; } = [];
|
||||
|
||||
public IReadOnlyList<FloorNode> Floors { get; init; } = [];
|
||||
|
||||
public IReadOnlyList<RoomNode> Rooms { get; init; } = [];
|
||||
|
||||
public IReadOnlyList<MapLink> Links { get; init; } = [];
|
||||
|
||||
public static MapLayout Parse(string jsonc, string? source = null) =>
|
||||
Jsonc.Deserialize<MapLayout>(Jsonc.Parse(jsonc, source));
|
||||
}
|
||||
|
||||
public sealed class TerritoryNode
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
|
||||
public required string Def { get; init; }
|
||||
}
|
||||
|
||||
public sealed class BuildingNode
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
|
||||
public required string Def { get; init; }
|
||||
}
|
||||
|
||||
public sealed class FloorNode
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
|
||||
public required string Def { get; init; }
|
||||
|
||||
public required string Building { get; init; }
|
||||
|
||||
public string? Label { get; init; }
|
||||
}
|
||||
|
||||
public sealed class RoomNode
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
|
||||
public required string Def { get; init; }
|
||||
|
||||
public required string Building { get; init; }
|
||||
|
||||
public required string Floor { get; init; }
|
||||
|
||||
public IReadOnlyList<SlotFill> Slots { get; init; } = [];
|
||||
}
|
||||
|
||||
public sealed class SlotFill
|
||||
{
|
||||
public required string Key { get; init; }
|
||||
|
||||
public required string Thing { get; init; }
|
||||
}
|
||||
|
||||
public sealed class MapLink
|
||||
{
|
||||
public required string A { get; init; }
|
||||
|
||||
public required string B { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user