mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 09:04:53 -07:00
Add few more interfaces (#5063)
This commit is contained in:
parent
e261e16d99
commit
8687163cca
34 changed files with 359 additions and 90 deletions
21
webclient/src/websocket/commands/room/joinGame.ts
Normal file
21
webclient/src/websocket/commands/room/joinGame.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { RoomPersistence } from '../../persistence';
|
||||
import webClient from '../../WebClient';
|
||||
import { GameConfig, JoinGameParams } from 'types';
|
||||
|
||||
export function joinGame(roomId: number, joinGameParams: JoinGameParams): void {
|
||||
const command = webClient.protobuf.controller.Command_JoinGame.create(joinGameParams);
|
||||
const rc = webClient.protobuf.controller.RoomCommand.create({ '.Command_JoinGame.ext': command });
|
||||
|
||||
webClient.protobuf.sendRoomCommand(roomId, rc, (raw) => {
|
||||
const { responseCode } = raw;
|
||||
|
||||
switch (responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
RoomPersistence.joinedGame(roomId, joinGameParams.gameId);
|
||||
break;
|
||||
default:
|
||||
console.log('Failed to do the thing');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue