Refactor project structure and update documentation. Replace PixiJS with plain DOM for UI rendering, enhance README with game features, and revise protocol documentation for HTTP API. Remove unused files and streamline client code for better maintainability.
This commit is contained in:
@@ -1,37 +1,39 @@
|
||||
namespace HSchool.Protocol;
|
||||
|
||||
/// <summary>First frame from the client: protocol version handshake plus display name.</summary>
|
||||
public readonly record struct ClientHelloMessage(byte ProtocolVersion, string PlayerName);
|
||||
|
||||
/// <summary>
|
||||
/// Movement intent for one client frame. <paramref name="Sequence"/> is echoed back
|
||||
/// in future snapshots once client-side prediction lands.
|
||||
/// </summary>
|
||||
public readonly record struct ClientInputMessage(uint Sequence, InputButtons Buttons);
|
||||
/// <summary>First frame from the client; carries nothing but the version handshake.</summary>
|
||||
public readonly record struct ClientHelloMessage(byte ProtocolVersion);
|
||||
|
||||
/// <summary>Round-trip probe; the server mirrors <paramref name="ClientTimeMs"/> back untouched.</summary>
|
||||
public readonly record struct ClientPingMessage(long ClientTimeMs);
|
||||
|
||||
/// <summary>
|
||||
/// Sent once per connection, before the first snapshot.
|
||||
/// <paramref name="PlayerEntityId"/> is the replication id of this client's own avatar,
|
||||
/// so the renderer can tell it apart from everyone else.
|
||||
/// </summary>
|
||||
public readonly record struct ServerWelcomeMessage(
|
||||
byte ProtocolVersion,
|
||||
uint PlayerEntityId,
|
||||
byte TickRate,
|
||||
float WorldWidth,
|
||||
float WorldHeight);
|
||||
/// <summary>Asks for clock updates of one school. Starts its calendar running.</summary>
|
||||
public readonly record struct ClientOpenSchoolMessage(int SchoolId);
|
||||
|
||||
/// <summary>One entity inside a snapshot. Kept flat and blittable on purpose.</summary>
|
||||
public readonly record struct EntitySnapshot(
|
||||
uint Id,
|
||||
EntityKind Kind,
|
||||
float X,
|
||||
float Y,
|
||||
float Radius,
|
||||
uint Color);
|
||||
/// <summary>
|
||||
/// Play or pause the open school. Running and speed are separate messages on purpose: a button
|
||||
/// that also resent the other field would clobber it with whatever the client last saw.
|
||||
/// </summary>
|
||||
public readonly record struct ClientSetRunningMessage(bool Running);
|
||||
|
||||
/// <summary>Change the speed of the open school without touching whether it runs.</summary>
|
||||
public readonly record struct ClientSetSpeedMessage(byte SpeedIndex);
|
||||
|
||||
/// <summary>Sent once per connection, before anything else.</summary>
|
||||
public readonly record struct ServerWelcomeMessage(byte ProtocolVersion, byte TickRate, byte MaxSchools);
|
||||
|
||||
/// <summary>Answer to <see cref="ClientPingMessage"/>, carrying the current server tick.</summary>
|
||||
public readonly record struct ServerPongMessage(long ClientTimeMs, uint ServerTick);
|
||||
|
||||
/// <summary>
|
||||
/// State of the open school's calendar, sent every tick.
|
||||
/// <paramref name="GameTimeUnixMs"/> is the in-game date as milliseconds since the Unix epoch,
|
||||
/// interpreted as UTC — the game calendar has no time zone.
|
||||
/// </summary>
|
||||
public readonly record struct ServerClockMessage(
|
||||
int SchoolId,
|
||||
long GameTimeUnixMs,
|
||||
bool Running,
|
||||
byte SpeedIndex);
|
||||
|
||||
/// <summary>The open school no longer exists (deleted from another tab); the client returns to the menu.</summary>
|
||||
public readonly record struct ServerSchoolGoneMessage(int SchoolId);
|
||||
|
||||
Reference in New Issue
Block a user