Update the type structure, and rename the "game.*" events to "lobby.*"
This commit is contained in:
parent
3b5e643232
commit
c5449f1153
4 changed files with 35 additions and 18 deletions
|
|
@ -1,14 +1,19 @@
|
||||||
// Enums
|
// Enums
|
||||||
export { Status } from "./enums/Status";
|
export { Status } from "./enums/Status";
|
||||||
|
|
||||||
// Data Structures
|
// Data Structures
|
||||||
export * from "./types/Colour";
|
export * from "./types/Colour";
|
||||||
export * from "./types/Spaceship";
|
export * from "./types/Spaceship";
|
||||||
export * from "./types/PlayerData";
|
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";
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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[];
|
||||||
}
|
}
|
||||||
10
common/src/types/events/players/update.ts
Normal file
10
common/src/types/events/players/update.ts
Normal 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[];
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue