Remove ugly underscore from attribute name
This commit is contained in:
parent
c4a16e5695
commit
8fb4c538f0
1 changed files with 6 additions and 6 deletions
|
|
@ -1,19 +1,19 @@
|
||||||
class Game {
|
class Game {
|
||||||
readonly code: string;
|
readonly code: string;
|
||||||
#_players: players;
|
#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.add_player(host, true);
|
this.add_player(host, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
get players(): players {
|
get players(): players {
|
||||||
return this.#_players;
|
return this.#players;
|
||||||
};
|
};
|
||||||
|
|
||||||
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
|
||||||
|
|
@ -22,7 +22,7 @@ class Game {
|
||||||
|
|
||||||
public toString(): string {
|
public toString(): string {
|
||||||
let players: string[] = [];
|
let players: string[] = [];
|
||||||
for (var player in this.#_players) {
|
for (var player in this.#players) {
|
||||||
let p: player = this.players[player];
|
let p: player = this.players[player];
|
||||||
players.push(`${player}(host=${p.host},pos=${p.position || 'none'},role=${p.role || 'none'}`);
|
players.push(`${player}(host=${p.host},pos=${p.position || 'none'},role=${p.role || 'none'}`);
|
||||||
};
|
};
|
||||||
|
|
@ -32,7 +32,7 @@ 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