Initial implementation completion and refactor

This commit is contained in:
seavor 2026-04-11 21:18:10 -05:00
parent e977f123ce
commit f0bf865646
76 changed files with 897 additions and 890 deletions

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);
},
});
}