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