39 lines
1.6 KiB
C#
39 lines
1.6 KiB
C#
using HSchool.Content;
|
|
using HSchool.Simulation;
|
|
|
|
namespace HSchool.Server.Game;
|
|
|
|
/// <summary>
|
|
/// Work item handed from a request or connection thread to the supervisor. Create, delete and
|
|
/// name suggestions stay here; open/close/running/speed are forwarded to the school's worker.
|
|
/// </summary>
|
|
internal abstract record GameCommand
|
|
{
|
|
internal sealed record CreateSchool(
|
|
string Name,
|
|
DateTime StartDate,
|
|
IReadOnlyList<string>? ExtraModIds,
|
|
MapLayout? Map,
|
|
TaskCompletionSource<SchoolCreationOutcome> Result) : GameCommand;
|
|
|
|
internal sealed record DeleteSchool(int SchoolId, TaskCompletionSource<bool> Result) : GameCommand;
|
|
|
|
internal sealed record SuggestName(SchoolNameLanguage Language, TaskCompletionSource<string> Result) : GameCommand;
|
|
|
|
/// <summary>A connection starts watching a school; clock frames follow from that worker.</summary>
|
|
internal sealed record OpenSchool(uint PlayerId, int SchoolId) : GameCommand;
|
|
|
|
/// <summary>
|
|
/// Stops watching. The school id travels with the command because the connection may already
|
|
/// be gone from the registry by the time the supervisor gets here.
|
|
/// </summary>
|
|
internal sealed record CloseSchool(uint PlayerId, int SchoolId) : GameCommand;
|
|
|
|
internal sealed record SetRunning(uint PlayerId, bool Running) : GameCommand;
|
|
|
|
internal sealed record SetSpeed(uint PlayerId, byte SpeedIndex) : GameCommand;
|
|
|
|
/// <summary>Stops every worker, re-reads the save directory, starts workers from those files.</summary>
|
|
internal sealed record ReloadSaves(TaskCompletionSource Result) : GameCommand;
|
|
}
|