Change property name.
This commit is contained in:
parent
05dc6995e5
commit
d4d01bf3ac
1 changed files with 7 additions and 5 deletions
|
|
@ -1,17 +1,19 @@
|
||||||
export class Game {
|
export class Game {
|
||||||
readonly code: string;
|
readonly code: string;
|
||||||
public status: game_states;
|
public status: game_states;
|
||||||
#players: players;
|
private banned_players: string[];
|
||||||
|
private _players: players;
|
||||||
|
|
||||||
public constructor(code: string, host: string) {
|
public constructor(code: string, host: string) {
|
||||||
this.code = code;
|
this.code = code;
|
||||||
this.#players = {};
|
this._players = {};
|
||||||
this.status = `lobby`;
|
this.status = `lobby`;
|
||||||
|
this.banned_players = [];
|
||||||
this.add_player(host, true);
|
this.add_player(host, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
get players(): players {
|
get players(): players {
|
||||||
return this.#players;
|
return this._players;
|
||||||
};
|
};
|
||||||
|
|
||||||
get host(): string|null {
|
get host(): string|null {
|
||||||
|
|
@ -24,7 +26,7 @@ export class Game {
|
||||||
}
|
}
|
||||||
|
|
||||||
public add_player(player: string, is_host:boolean=false): void {
|
public add_player(player: string, is_host:boolean=false): void {
|
||||||
this.#players[player] = {
|
this._players[player] = {
|
||||||
position: undefined,
|
position: undefined,
|
||||||
role: undefined,
|
role: undefined,
|
||||||
host: is_host,
|
host: is_host,
|
||||||
|
|
@ -46,7 +48,7 @@ export class Game {
|
||||||
public toJSON(): string {
|
public toJSON(): string {
|
||||||
return JSON.stringify({
|
return JSON.stringify({
|
||||||
code: this.code,
|
code: this.code,
|
||||||
players: this.#players,
|
players: this._players,
|
||||||
}, undefined, `\t`)
|
}, undefined, `\t`)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue