mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
Structure change (#4220)
* Structure change * Remove duplicate folders from previous structure * Cleanup websocket protocol * Updating from based off PR * Fixup - remove wrong files during conflict and get the websocket working * renaming tsx to ts Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
This commit is contained in:
parent
a0deb73df6
commit
1ddc9cc929
123 changed files with 424 additions and 228 deletions
50
webclient/src/websocket/services/RoomService.tsx
Normal file
50
webclient/src/websocket/services/RoomService.tsx
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { store, RoomsDispatch, RoomsSelectors } from "store";
|
||||
import { WebClient } from "../WebClient";
|
||||
|
||||
import { NormalizeService } from "websocket";
|
||||
|
||||
export default class RoomService {
|
||||
webClient: WebClient;
|
||||
|
||||
constructor(webClient) {
|
||||
this.webClient = webClient;
|
||||
}
|
||||
|
||||
clearStore() {
|
||||
RoomsDispatch.clearStore();
|
||||
}
|
||||
|
||||
joinRoom(roomInfo) {
|
||||
NormalizeService.normalizeRoomInfo(roomInfo);
|
||||
RoomsDispatch.joinRoom(roomInfo);
|
||||
}
|
||||
|
||||
updateRooms(rooms) {
|
||||
RoomsDispatch.updateRooms(rooms);
|
||||
}
|
||||
|
||||
updateGames(roomId, gameList) {
|
||||
const game = gameList[0];
|
||||
|
||||
if (!game.gameType) {
|
||||
const { gametypeMap } = RoomsSelectors.getRoom(store.getState(), roomId);
|
||||
NormalizeService.normalizeGameObject(game, gametypeMap);
|
||||
}
|
||||
|
||||
RoomsDispatch.updateGames(roomId, gameList);
|
||||
}
|
||||
|
||||
addMessage(roomId, message) {
|
||||
NormalizeService.normalizeUserMessage(message);
|
||||
|
||||
RoomsDispatch.addMessage(roomId, message);
|
||||
}
|
||||
|
||||
userJoined(roomId, user) {
|
||||
RoomsDispatch.userJoined(roomId, user);
|
||||
}
|
||||
|
||||
userLeft(roomId, name) {
|
||||
RoomsDispatch.userLeft(roomId, name);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue