47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { GameResponseDTO } from "./dto/gameresponse.dto";
|
|
import { PlayerResponseDTO } from "./dto/playerresponse.dto";
|
|
import type { ConceptEvent } from "./events";
|
|
|
|
export class LobbyCreateEvent implements ConceptEvent {
|
|
type = "create";
|
|
game: GameResponseDTO;
|
|
constructor(game: GameResponseDTO) {
|
|
this.game = new GameResponseDTO(game);
|
|
}
|
|
}
|
|
|
|
export class LobbyStartEvent implements ConceptEvent {
|
|
type = "start";
|
|
constructor(public game: GameResponseDTO) {
|
|
this.game = new GameResponseDTO(game);
|
|
}
|
|
}
|
|
|
|
export class LobbyDeleteEvent implements ConceptEvent {
|
|
type = "delete";
|
|
constructor(public id: number) {}
|
|
}
|
|
|
|
export class LobbyJoinEvent implements ConceptEvent {
|
|
type = "joingame";
|
|
constructor(
|
|
public player: PlayerResponseDTO,
|
|
public game: GameResponseDTO,
|
|
) {
|
|
this.player = new PlayerResponseDTO(player);
|
|
this.game = new GameResponseDTO(game);
|
|
}
|
|
}
|
|
|
|
export class LobbyLeaveEvent implements ConceptEvent {
|
|
type = "leavegame";
|
|
gameId?: number;
|
|
constructor(
|
|
public player: PlayerResponseDTO,
|
|
public game: GameResponseDTO,
|
|
) {
|
|
this.player = new PlayerResponseDTO(player);
|
|
this.game = new GameResponseDTO(game);
|
|
}
|
|
}
|