mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 16:44:48 -07:00
13 lines
550 B
TypeScript
13 lines
550 B
TypeScript
import { create } from '@bufbuild/protobuf';
|
|
import webClient from '../../WebClient';
|
|
import { Command_CreateGame_ext, Command_CreateGameSchema } from 'generated/proto/room_commands_pb';
|
|
import { RoomPersistence } from '../../persistence';
|
|
import { GameConfig } from 'types';
|
|
|
|
export function createGame(roomId: number, gameConfig: GameConfig): void {
|
|
webClient.protobuf.sendRoomCommand(roomId, Command_CreateGame_ext, create(Command_CreateGameSchema, gameConfig), {
|
|
onSuccess: () => {
|
|
RoomPersistence.gameCreated(roomId);
|
|
},
|
|
});
|
|
}
|