Class: Game
Get events from the game and put everything on the screen. Provide an interface for the players: play area, settings and others
Constructors
constructor
• new Game(options?
)
Parameters
Name | Type |
---|---|
options | IGameOptions |
Properties
client
• client: Client
lobby
• lobby: LobbyRoom
room
• room: Room
<Record
<string
, any
>, Record
<string
, unknown
>>
ws
• ws: WSOptions
Accessors
sessionID
• get
sessionID(): string
If connected to game room, will return its session ID
Returns
string
Methods
create
▸ create(roomName
, options?
): Promise
<Room
<Record
<string
, any
>, Record
<string
, unknown
>>>
Parameters
Name | Type |
---|---|
roomName | string |
options? | RoomCreateOptions |
Returns
Promise
<Room
<Record
<string
, any
>, Record
<string
, unknown
>>>
destroy
▸ destroy(): void
Returns
void
getAvailableRooms
▸ getAvailableRooms(gameName?
): Promise
<colRoomAvailable
<any
>[]>
Parameters
Name | Type |
---|---|
gameName? | string |
Returns
Promise
<colRoomAvailable
<any
>[]>
join
▸ join(roomName
, options?
): Promise
<Room
<Record
<string
, any
>, Record
<string
, unknown
>>>
This one is probably useless for game rooms.
Use joinOrCreate
instead.
Parameters
Name | Type |
---|---|
roomName | string |
options? | RoomCreateOptions |
Returns
Promise
<Room
<Record
<string
, any
>, Record
<string
, unknown
>>>
joinById
▸ joinById(roomId
, options?
): Promise
<Room
<Record
<string
, any
>, Record
<string
, unknown
>>>
Parameters
Name | Type |
---|---|
roomId | string |
options? | RoomCreateOptions |
Returns
Promise
<Room
<Record
<string
, any
>, Record
<string
, unknown
>>>
joinLobby
▸ joinLobby(): Promise
<LobbyRoom
>
Returns
Promise
<LobbyRoom
>
joinOrCreate
▸ joinOrCreate(roomName
, options?
): Promise
<Room
<Record
<string
, any
>, Record
<string
, unknown
>>>
Parameters
Name | Type |
---|---|
roomName | string |
options? | RoomCreateOptions |
Returns
Promise
<Room
<Record
<string
, any
>, Record
<string
, unknown
>>>