Compare commits
10
Commits
cdddb9a073
...
fc3f0e1677
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc3f0e1677 | ||
|
|
c1a22098f7 | ||
|
|
22656ba608 | ||
|
|
924806e4c8 | ||
|
|
47ed1ba851 | ||
|
|
27b1044832 | ||
|
|
813d942638 | ||
|
|
63f8cd45af | ||
|
|
e872eeea91 | ||
|
|
735e47cdbe |
@@ -5,6 +5,5 @@ export class ConceptResponseDTO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
import { UserResponseDTO } from './userresponse.dto';
|
import { UserResponseDTO } from './userresponse.dto';
|
||||||
import { PlayerResponseDTO } from './playerresponse.dto';
|
import { PlayerResponseDTO } from './playerresponse.dto';
|
||||||
import { ConceptInTurnResponseDTO } from './conceptinturnresponse.dto';
|
import { ConceptInTurnResponseDTO } from './conceptinturnresponse.dto';
|
||||||
|
import { MessageResponseDTO } from './messageresponse.dto';
|
||||||
|
|
||||||
export class GameResponseDTO {
|
export class GameResponseDTO {
|
||||||
constructor(partial: Partial<GameResponseDTO>) {
|
constructor(partial: Partial<GameResponseDTO>) {
|
||||||
this.id = partial.id;
|
this.id = partial.id;
|
||||||
this.started = partial.started;
|
this.started = partial.started;
|
||||||
this.owner = new UserResponseDTO(partial.owner);
|
this.ownerId = partial.ownerId;
|
||||||
|
if (partial.messages) {
|
||||||
|
this.messages = partial.messages.map((m) => new MessageResponseDTO(m));
|
||||||
|
}
|
||||||
if (partial.players) {
|
if (partial.players) {
|
||||||
this.players = partial.players.map((p) => new PlayerResponseDTO(p));
|
this.players = partial.players.map((p) => new PlayerResponseDTO(p));
|
||||||
}
|
}
|
||||||
@@ -24,7 +28,7 @@ export class GameResponseDTO {
|
|||||||
|
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
owner: UserResponseDTO;
|
ownerId: string;
|
||||||
|
|
||||||
players: PlayerResponseDTO[] = [];
|
players: PlayerResponseDTO[] = [];
|
||||||
|
|
||||||
@@ -33,4 +37,6 @@ export class GameResponseDTO {
|
|||||||
started: boolean;
|
started: boolean;
|
||||||
|
|
||||||
currentConcepts: ConceptInTurnResponseDTO[] = [];
|
currentConcepts: ConceptInTurnResponseDTO[] = [];
|
||||||
|
|
||||||
|
messages: MessageResponseDTO[] = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
export class MessageResponseDTO {
|
||||||
|
constructor(partial: Partial<MessageResponseDTO>) {
|
||||||
|
this.id = partial.id;
|
||||||
|
this.value = partial.value;
|
||||||
|
if (partial.authorId) this.authorId = partial.authorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
id: number;
|
||||||
|
value: string;
|
||||||
|
authorId?: string;
|
||||||
|
}
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
import { UserResponseDTO } from './userresponse.dto';
|
|
||||||
|
|
||||||
export class PlayerResponseDTO {
|
export class PlayerResponseDTO {
|
||||||
constructor(partial: Partial<PlayerResponseDTO>) {
|
constructor(partial: Partial<PlayerResponseDTO>) {
|
||||||
this.score = partial.score;
|
this.score = partial.score;
|
||||||
this.user = new UserResponseDTO(partial.user);
|
this.userId = partial.userId;
|
||||||
|
this.id = partial.id;
|
||||||
|
this.hasGuessed = partial.hasGuessed;
|
||||||
|
// this.user = new UserResponseDTO(partial.user);
|
||||||
}
|
}
|
||||||
|
|
||||||
user: UserResponseDTO;
|
id: number;
|
||||||
|
userId: string;
|
||||||
score: number;
|
score: number;
|
||||||
|
hasGuessed: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-1
@@ -1,7 +1,11 @@
|
|||||||
|
import { MessageResponseDTO } from './dto/messageresponse.dto';
|
||||||
import { PlayerResponseDTO } from './dto/playerresponse.dto';
|
import { PlayerResponseDTO } from './dto/playerresponse.dto';
|
||||||
|
|
||||||
export class GameStartEvent {
|
export class GameStartEvent {
|
||||||
type = 'start';
|
type = 'start';
|
||||||
|
constructor(public currentPlayer: PlayerResponseDTO) {
|
||||||
|
this.currentPlayer = new PlayerResponseDTO(currentPlayer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GameDeleteEvent {
|
export class GameDeleteEvent {
|
||||||
@@ -17,8 +21,26 @@ export class GameJoinEvent {
|
|||||||
|
|
||||||
export class GameLeaveEvent {
|
export class GameLeaveEvent {
|
||||||
type = 'leavegame';
|
type = 'leavegame';
|
||||||
gameId?: number;
|
|
||||||
constructor(public player: PlayerResponseDTO) {
|
constructor(public player: PlayerResponseDTO) {
|
||||||
this.player = new PlayerResponseDTO(player);
|
this.player = new PlayerResponseDTO(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class GameMessageEvent {
|
||||||
|
type = 'message';
|
||||||
|
constructor(public message: MessageResponseDTO) {
|
||||||
|
this.message = new MessageResponseDTO(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GameMessageDeleteEvent {
|
||||||
|
type = 'deleteMessage';
|
||||||
|
constructor(public messageId: number) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GameEndTurnEvent {
|
||||||
|
type = 'endTurn';
|
||||||
|
constructor(public currentPlayer: PlayerResponseDTO) {
|
||||||
|
this.currentPlayer = new PlayerResponseDTO(currentPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user