Enhance school creation and map management features by updating the API to support mod packs and map layouts. Introduce a new map snapshot protocol for efficient data handling during school sessions. Revise documentation to reflect these changes, including updates to the protocol and architecture documents. Improve UI components for mod selection and map editing, ensuring a better user experience. Update tests to validate new functionalities and ensure robustness.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using HSchool.Content;
|
||||
using HSchool.Server.Game;
|
||||
using HSchool.Simulation;
|
||||
|
||||
@@ -47,6 +48,8 @@ internal static class SchoolEndpoints
|
||||
var command = new GameCommand.CreateSchool(
|
||||
request.Name ?? string.Empty,
|
||||
DateTime.SpecifyKind(request.StartDate, DateTimeKind.Utc),
|
||||
request.ModIds,
|
||||
request.Map,
|
||||
NewCompletion<SchoolCreationOutcome>());
|
||||
commands.Enqueue(command);
|
||||
|
||||
@@ -62,6 +65,12 @@ internal static class SchoolEndpoints
|
||||
Problem(StatusCodes.Status400BadRequest, "invalid-name", $"A name must be 1 to {School.MaxNameLength} characters."),
|
||||
SchoolCreationError.InvalidStartDate =>
|
||||
Problem(StatusCodes.Status400BadRequest, "invalid-start-date", "The start date is outside the supported range."),
|
||||
SchoolCreationError.InvalidMap =>
|
||||
Problem(StatusCodes.Status400BadRequest, "invalid-map", "The map is not a connected yard-and-rooms graph."),
|
||||
SchoolCreationError.UnknownMod =>
|
||||
Problem(StatusCodes.Status400BadRequest, "unknown-mod", "A selected mod is missing."),
|
||||
SchoolCreationError.InvalidCatalog =>
|
||||
Problem(StatusCodes.Status400BadRequest, "invalid-catalog", "The selected packs could not be loaded."),
|
||||
_ => Results.Problem("Unknown error."),
|
||||
};
|
||||
})
|
||||
@@ -98,7 +107,7 @@ internal static class SchoolEndpoints
|
||||
}
|
||||
|
||||
/// <summary>Body of <c>POST /api/schools</c>. The start date is a game calendar date, not a real one.</summary>
|
||||
internal sealed record CreateSchoolRequest(string? Name, DateTime StartDate);
|
||||
internal sealed record CreateSchoolRequest(string? Name, DateTime StartDate, IReadOnlyList<string>? ModIds, MapLayout? Map);
|
||||
|
||||
internal sealed record SchoolResponse(int Id, string Name, DateTime GameTime, bool Running, byte SpeedIndex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user