Initial implementation completion and refactor (#6806)
Some checks failed
Build Desktop / Configure (push) Has been cancelled
Build Docker Image / amd64 & arm64 (push) Has been cancelled
Build Web / React (Node 16) (push) Has been cancelled
Build Web / React (Node lts/*) (push) Has been cancelled
Build Desktop / Debian 11 (push) Has been cancelled
Build Desktop / Debian 13 (push) Has been cancelled
Build Desktop / Debian 12 (push) Has been cancelled
Build Desktop / Fedora 43 (push) Has been cancelled
Build Desktop / Fedora 42 (push) Has been cancelled
Build Desktop / Servatrice_Debian 11 (push) Has been cancelled
Build Desktop / Ubuntu 24.04 (push) Has been cancelled
Build Desktop / Ubuntu 26.04 (push) Has been cancelled
Build Desktop / Ubuntu 22.04 (push) Has been cancelled
Build Desktop / Arch (push) Has been cancelled
Build Desktop / macOS 14 (push) Has been cancelled
Build Desktop / macOS 15 (push) Has been cancelled
Build Desktop / macOS 13 Intel (push) Has been cancelled
Build Desktop / macOS 15 Debug (push) Has been cancelled
Build Desktop / Windows 10 (push) Has been cancelled

This commit is contained in:
Jeremy Letto 2026-04-11 22:51:10 -05:00 committed by GitHub
parent 2e10b2f5d5
commit 8cc65b8967
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
76 changed files with 897 additions and 890 deletions

View file

@ -1,21 +1,11 @@
import { BackendService } from '../../services/BackendService';
import { RoomPersistence } from '../../persistence';
import webClient from '../../WebClient';
import { GameConfig } from 'types';
export function createGame(roomId: number, gameConfig: GameConfig): void {
const command = webClient.protobuf.controller.Command_CreateGame.create(gameConfig);
const rc = webClient.protobuf.controller.RoomCommand.create({ '.Command_CreateGame.ext': command });
webClient.protobuf.sendRoomCommand(roomId, rc, (raw) => {
const { responseCode } = raw;
switch (responseCode) {
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
RoomPersistence.gameCreated(roomId);
break;
default:
console.log('Failed to do the thing');
}
BackendService.sendRoomCommand(roomId, 'Command_CreateGame', gameConfig, {
onSuccess: () => {
RoomPersistence.gameCreated(roomId);
},
});
}

View file

@ -1,21 +1,11 @@
import { BackendService } from '../../services/BackendService';
import { RoomPersistence } from '../../persistence';
import webClient from '../../WebClient';
import { GameConfig, JoinGameParams } from 'types';
import { 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');
}
BackendService.sendRoomCommand(roomId, 'Command_JoinGame', joinGameParams, {
onSuccess: () => {
RoomPersistence.joinedGame(roomId, joinGameParams.gameId);
},
});
}

View file

@ -1,19 +1,10 @@
import { BackendService } from '../../services/BackendService';
import { RoomPersistence } from '../../persistence';
import webClient from '../../WebClient';
export function leaveRoom(roomId: number): void {
const command = webClient.protobuf.controller.Command_LeaveRoom.create();
const rc = webClient.protobuf.controller.RoomCommand.create({ '.Command_LeaveRoom.ext': command });
webClient.protobuf.sendRoomCommand(roomId, rc, (raw) => {
const { responseCode } = raw;
switch (responseCode) {
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
RoomPersistence.leaveRoom(roomId);
break;
default:
console.log(`Failed to leave Room ${roomId} [${responseCode}] : `, raw);
}
BackendService.sendRoomCommand(roomId, 'Command_LeaveRoom', {}, {
onSuccess: () => {
RoomPersistence.leaveRoom(roomId);
},
});
}

View file

@ -1,4 +1,4 @@
import webClient from '../../WebClient';
import { BackendService } from '../../services/BackendService';
export function roomSay(roomId: number, message: string): void {
const trimmed = message.trim();
@ -7,8 +7,5 @@ export function roomSay(roomId: number, message: string): void {
return;
}
const command = webClient.protobuf.controller.Command_RoomSay.create({ 'message': trimmed });
const rc = webClient.protobuf.controller.RoomCommand.create({ '.Command_RoomSay.ext': command });
webClient.protobuf.sendRoomCommand(roomId, rc);
BackendService.sendRoomCommand(roomId, 'Command_RoomSay', { message: trimmed }, {});
}