Update the type structure, and rename the "game.*" events to "lobby.*"

This commit is contained in:
Oliver-Akins 2022-01-06 16:25:38 -07:00
parent 3b5e643232
commit c5449f1153
4 changed files with 35 additions and 18 deletions

View file

@ -9,6 +9,11 @@ export * from "./types/PlayerData";
// Server-Client Communications // Server-Client Communications
export * from "./types/ServerResponse"; export * from "./types/ServerResponse";
export * from "./types/events/SaveShip"; export * from "./types/events/SaveShip";
export * from "./types/events/game_join";
export * from "./types/events/server_info"; export * from "./types/events/server_info";
export * from "./types/events/game_create";
// Lobby events
export * from "./types/events/lobby/join";
export * from "./types/events/lobby/create";
// Player events
export * from "./types/events/players/update";

View file

@ -1,15 +1,17 @@
import { ServerResponse } from "../ServerResponse"; import { ServerResponse } from "../../ServerResponse";
import { PlayerData } from "../PlayerData"; import { PlayerData } from "../../PlayerData";
/** /**
* The data that must be supplied to the server in order to create a game. * The data that must be supplied to the server in order to create a game.
*/ */
export interface IGameCreateRequest { export interface LobbyCreateRequest {
username: string; username: string;
} }
/** The data that is given to the client when they attempt to join a lobby. */ /**
export interface IGameCreateResponse extends ServerResponse { * The data that is given to the client when they attempt to create a lobby.
*/
export interface LobbyCreateResponse extends ServerResponse {
/** /**
* The ID of the lobby, this is used so that other players may join the * The ID of the lobby, this is used so that other players may join the

View file

@ -1,13 +1,13 @@
import { ServerResponse } from "../ServerResponse"; import { ServerResponse } from "../../ServerResponse";
import { PlayerData } from "../PlayerData"; import { PlayerData } from "../../PlayerData";
/** The data required by the server to be able to join a game */ /** The data required by the server to be able to join a game */
export interface IGameJoinRequest { export interface LobbyJoinRequest {
id: string; id: string;
name: string; name: string;
} }
/** The response that the player receives upon succesfully joining a game. */ /** The response that the player receives upon succesfully joining a game. */
export interface IGameJoinResponse extends ServerResponse { export interface LobbyJoinResponse extends ServerResponse {
players?: PlayerData[]; players?: PlayerData[];
} }

View file

@ -0,0 +1,10 @@
import { ServerResponse } from "../../ServerResponse";
import { PlayerData } from "../../PlayerData";
/**
* The data that the server is requesting connected clients use while updating
* their lobby information.
*/
export interface PlayerUpdateResponse extends ServerResponse {
players?: PlayerData[];
}