mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-12 15:49:28 -08:00
Add few more interfaces (#5063)
This commit is contained in:
18
webclient/src/types/deckList.ts
Normal file
18
webclient/src/types/deckList.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
export interface DeckList {
|
||||
root: DeckStorageFolder;
|
||||
}
|
||||
|
||||
export interface DeckStorageFolder {
|
||||
items: DeckStorageTreeItem[];
|
||||
}
|
||||
|
||||
export interface DeckStorageFile {
|
||||
creationTime: number;
|
||||
}
|
||||
|
||||
export interface DeckStorageTreeItem {
|
||||
id: number;
|
||||
name: string;
|
||||
file: DeckStorageFile;
|
||||
folder: DeckStorageFolder;
|
||||
}
|
||||
35
webclient/src/types/game.ts
Normal file
35
webclient/src/types/game.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
export interface Game {
|
||||
description: string;
|
||||
gameId: number;
|
||||
gameType: string;
|
||||
gameTypes: string[];
|
||||
roomId: number;
|
||||
started: boolean;
|
||||
}
|
||||
|
||||
export enum GameSortField {
|
||||
START_TIME = 'startTime'
|
||||
}
|
||||
|
||||
export interface GameConfig {
|
||||
description: string;
|
||||
password: string;
|
||||
maxPlayer: number;
|
||||
onlyBuddies: boolean;
|
||||
onlyRegistered: boolean;
|
||||
spectatorsAllowed: boolean;
|
||||
spectatorsNeedPassword: boolean;
|
||||
spectatorsCanTalk: boolean;
|
||||
spectatorsSeeEverything: boolean;
|
||||
gameTypeIds: number[];
|
||||
joinAsJudge: boolean;
|
||||
joinAsSpectator: boolean;
|
||||
}
|
||||
|
||||
export interface JoinGameParams {
|
||||
gameId: number;
|
||||
password: string;
|
||||
spectator: boolean;
|
||||
overrideRestrictions: boolean;
|
||||
joinAsJudge: boolean;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
export interface Game {
|
||||
description: string;
|
||||
gameId: number;
|
||||
gameType: string;
|
||||
gameTypes: string[];
|
||||
roomId: number;
|
||||
started: boolean;
|
||||
}
|
||||
|
||||
export enum GameSortField {
|
||||
START_TIME = 'startTime'
|
||||
}
|
||||
@@ -14,3 +14,4 @@ export * from './settings';
|
||||
export * from './languages';
|
||||
export * from './logs';
|
||||
export * from './session';
|
||||
export * from './deckList';
|
||||
|
||||
21
webclient/src/websocket/commands/room/createGame.ts
Normal file
21
webclient/src/websocket/commands/room/createGame.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
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');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
export * from './createGame';
|
||||
export * from './joinGame';
|
||||
export * from './leaveRoom';
|
||||
export * from './roomSay';
|
||||
|
||||
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');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
19
webclient/src/websocket/commands/session/deckDel.ts
Normal file
19
webclient/src/websocket/commands/session/deckDel.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import webClient from '../../WebClient';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
|
||||
export function deckDel(deckId: number): void {
|
||||
const command = webClient.protobuf.controller.Command_DeckDel.create({ deckId });
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({ '.Command_DeckDel.ext': command });
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
const { responseCode } = raw;
|
||||
|
||||
switch (responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
SessionPersistence.deckDelete(deckId);
|
||||
break;
|
||||
default:
|
||||
console.log('Failed to do the thing');
|
||||
}
|
||||
});
|
||||
}
|
||||
19
webclient/src/websocket/commands/session/deckDelDir.ts
Normal file
19
webclient/src/websocket/commands/session/deckDelDir.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import webClient from '../../WebClient';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
|
||||
export function deckDelDir(path: string): void {
|
||||
const command = webClient.protobuf.controller.Command_DeckDelDir.create({ path });
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({ '.Command_DeckDelDir.ext': command });
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
const { responseCode } = raw;
|
||||
|
||||
switch (responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
SessionPersistence.deckDeleteDir(path);
|
||||
break;
|
||||
default:
|
||||
console.log('Failed to do the thing');
|
||||
}
|
||||
});
|
||||
}
|
||||
19
webclient/src/websocket/commands/session/deckDownload.ts
Normal file
19
webclient/src/websocket/commands/session/deckDownload.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import webClient from '../../WebClient';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
|
||||
export function deckDownload(deckId: number): void {
|
||||
const command = webClient.protobuf.controller.Command_DeckDownload.create({ deckId });
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({ '.Command_DeckDownload.ext': command });
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
const { responseCode } = raw;
|
||||
|
||||
switch (responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
SessionPersistence.deckDownload(deckId);
|
||||
break;
|
||||
default:
|
||||
console.log('Failed to do the thing');
|
||||
}
|
||||
});
|
||||
}
|
||||
22
webclient/src/websocket/commands/session/deckList.ts
Normal file
22
webclient/src/websocket/commands/session/deckList.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import webClient from '../../WebClient';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
|
||||
export function deckList(): void {
|
||||
const command = webClient.protobuf.controller.Command_DeckList.create();
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({ '.Command_DeckList.ext': command });
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
const { responseCode } = raw;
|
||||
const response = raw['.Response_DeckList.ext'];
|
||||
|
||||
if (response) {
|
||||
switch (responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
SessionPersistence.deckList(response);
|
||||
break;
|
||||
default:
|
||||
console.log('Failed to do the thing');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
19
webclient/src/websocket/commands/session/deckNewDir.ts
Normal file
19
webclient/src/websocket/commands/session/deckNewDir.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import webClient from '../../WebClient';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
|
||||
export function deckNewDir(path: string, dirName: string): void {
|
||||
const command = webClient.protobuf.controller.Command_DeckNewDir.create({ path, dirName });
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({ '.Command_DeckNewDir.ext': command });
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
const { responseCode } = raw;
|
||||
|
||||
switch (responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
SessionPersistence.deckNewDir(path, dirName);
|
||||
break;
|
||||
default:
|
||||
console.log('Failed to do the thing');
|
||||
}
|
||||
});
|
||||
}
|
||||
23
webclient/src/websocket/commands/session/deckUpload.ts
Normal file
23
webclient/src/websocket/commands/session/deckUpload.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import webClient from '../../WebClient';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
|
||||
export function deckUpload(path: string, deckId: number, deckList: string): void {
|
||||
const command = webClient.protobuf.controller.Command_DeckUpload.create({ path, deckId, deckList });
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({ '.Command_DeckUpload.ext': command });
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
const { responseCode } = raw;
|
||||
const response = raw['.Response_DeckUpload.ext'];
|
||||
|
||||
if (response) {
|
||||
switch (responseCode) {
|
||||
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
|
||||
SessionPersistence.deckUpload(response);
|
||||
break;
|
||||
default:
|
||||
console.log('Failed to do the thing');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
@@ -1,34 +1,33 @@
|
||||
import { ForgotPasswordResetParams } from 'store';
|
||||
import { ForgotPasswordParams } from 'store';
|
||||
import { StatusEnum, WebSocketConnectOptions } from 'types';
|
||||
|
||||
import webClient from '../../WebClient';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
import { hashPassword } from '../../utils';
|
||||
|
||||
import { disconnect, updateStatus } from '.';
|
||||
import { disconnect, updateStatus } from './';
|
||||
|
||||
export function forgotPasswordRequest(options: WebSocketConnectOptions, passwordSalt?: string): void {
|
||||
const { userName, token, newPassword } = options as unknown as ForgotPasswordResetParams;
|
||||
export function forgotPasswordRequest(options: WebSocketConnectOptions): void {
|
||||
const { userName } = options as unknown as ForgotPasswordParams;
|
||||
|
||||
const forgotPasswordResetConfig: any = {
|
||||
const forgotPasswordConfig = {
|
||||
...webClient.clientConfig,
|
||||
userName,
|
||||
token,
|
||||
};
|
||||
|
||||
if (passwordSalt) {
|
||||
forgotPasswordResetConfig.hashedNewPassword = hashPassword(passwordSalt, newPassword);
|
||||
} else {
|
||||
forgotPasswordResetConfig.newPassword = newPassword;
|
||||
}
|
||||
|
||||
const command = webClient.protobuf.controller.Command_ForgotPasswordReset.create(forgotPasswordResetConfig);
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({ '.Command_ForgotPasswordReset.ext': command });
|
||||
const command = webClient.protobuf.controller.Command_ForgotPasswordRequest.create(forgotPasswordConfig);
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({ '.Command_ForgotPasswordRequest.ext': command });
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
if (raw.responseCode === webClient.protobuf.controller.Response.ResponseCode.RespOk) {
|
||||
updateStatus(StatusEnum.DISCONNECTED, null);
|
||||
SessionPersistence.resetPasswordSuccess();
|
||||
const resp = raw['.Response_ForgotPasswordRequest.ext'];
|
||||
|
||||
if (resp.challengeEmail) {
|
||||
updateStatus(StatusEnum.DISCONNECTED, null);
|
||||
SessionPersistence.resetPasswordChallenge();
|
||||
} else {
|
||||
updateStatus(StatusEnum.DISCONNECTED, null);
|
||||
SessionPersistence.resetPassword();
|
||||
}
|
||||
} else {
|
||||
updateStatus(StatusEnum.DISCONNECTED, null);
|
||||
SessionPersistence.resetPasswordFailed();
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
import { ForgotPasswordResetParams } from 'store';
|
||||
import { StatusEnum, WebSocketConnectOptions } from 'types';
|
||||
|
||||
import webClient from '../../WebClient';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
import { hashPassword } from '../../utils';
|
||||
|
||||
import { disconnect, updateStatus } from '.';
|
||||
|
||||
export function forgotPasswordReset(options: WebSocketConnectOptions, passwordSalt?: string): void {
|
||||
const { userName, token, newPassword } = options as unknown as ForgotPasswordResetParams;
|
||||
|
||||
const forgotPasswordResetConfig: any = {
|
||||
...webClient.clientConfig,
|
||||
userName,
|
||||
token,
|
||||
};
|
||||
|
||||
if (passwordSalt) {
|
||||
forgotPasswordResetConfig.hashedNewPassword = hashPassword(passwordSalt, newPassword);
|
||||
} else {
|
||||
forgotPasswordResetConfig.newPassword = newPassword;
|
||||
}
|
||||
|
||||
const command = webClient.protobuf.controller.Command_ForgotPasswordReset.create(forgotPasswordResetConfig);
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({ '.Command_ForgotPasswordReset.ext': command });
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
if (raw.responseCode === webClient.protobuf.controller.Response.ResponseCode.RespOk) {
|
||||
updateStatus(StatusEnum.DISCONNECTED, null);
|
||||
SessionPersistence.resetPasswordSuccess();
|
||||
} else {
|
||||
updateStatus(StatusEnum.DISCONNECTED, null);
|
||||
SessionPersistence.resetPasswordFailed();
|
||||
}
|
||||
|
||||
disconnect();
|
||||
});
|
||||
}
|
||||
@@ -1,22 +1,35 @@
|
||||
export * from './accountEdit';
|
||||
export * from './accountImage';
|
||||
export * from './accountPassword';
|
||||
export * from './activate';
|
||||
export * from './addToList';
|
||||
export * from './connect';
|
||||
export * from './deckDel';
|
||||
export * from './deckDelDir';
|
||||
export * from './deckDownload';
|
||||
export * from './deckList';
|
||||
export * from './deckNewDir';
|
||||
export * from './deckUpload';
|
||||
export * from './disconnect';
|
||||
export * from './forgotPasswordChallenge'
|
||||
export * from './forgotPasswordRequest';
|
||||
export * from './forgotPasswordReset';
|
||||
export * from './getGamesOfUser';
|
||||
export * from './getUserInfo';
|
||||
export * from './joinRoom';
|
||||
export * from './listRooms';
|
||||
export * from './listUsers';
|
||||
export * from './login';
|
||||
export * from './message';
|
||||
export * from './ping';
|
||||
export * from './register';
|
||||
export * from './removeFromList';
|
||||
export * from './requestPasswordSalt';
|
||||
export * from './forgotPasswordRequest';
|
||||
export * from './forgotPasswordChallenge'
|
||||
export * from './resetPasswordRequest';
|
||||
export * from './updateStatus';
|
||||
export * from './accountPassword';
|
||||
export * from './accountEdit';
|
||||
export * from './accountImage';
|
||||
export * from './message';
|
||||
export * from './getUserInfo';
|
||||
export * from './getGamesOfUser';
|
||||
export * from './ping';
|
||||
|
||||
/** TODO
|
||||
* REPLAY_DELETE_MATCH
|
||||
* REPLAY_DOWNLOAD
|
||||
* REPLAY_LIST
|
||||
* REPLAY_MODIFY_MATCH
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
activate,
|
||||
disconnect,
|
||||
login,
|
||||
forgotPasswordRequest,
|
||||
forgotPasswordReset,
|
||||
updateStatus
|
||||
} from './';
|
||||
|
||||
@@ -35,7 +35,7 @@ export function requestPasswordSalt(options: WebSocketConnectOptions): void {
|
||||
}
|
||||
|
||||
case WebSocketConnectReason.PASSWORD_RESET: {
|
||||
forgotPasswordRequest(options, passwordSalt);
|
||||
forgotPasswordReset(options, passwordSalt);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import { ForgotPasswordParams } from 'store';
|
||||
import { StatusEnum, WebSocketConnectOptions } from 'types';
|
||||
|
||||
import webClient from '../../WebClient';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
|
||||
import { disconnect, updateStatus } from './';
|
||||
|
||||
export function resetPasswordRequest(options: WebSocketConnectOptions): void {
|
||||
const { userName } = options as unknown as ForgotPasswordParams;
|
||||
|
||||
const forgotPasswordConfig = {
|
||||
...webClient.clientConfig,
|
||||
userName,
|
||||
};
|
||||
|
||||
const command = webClient.protobuf.controller.Command_ForgotPasswordRequest.create(forgotPasswordConfig);
|
||||
const sc = webClient.protobuf.controller.SessionCommand.create({ '.Command_ForgotPasswordRequest.ext': command });
|
||||
|
||||
webClient.protobuf.sendSessionCommand(sc, raw => {
|
||||
if (raw.responseCode === webClient.protobuf.controller.Response.ResponseCode.RespOk) {
|
||||
const resp = raw['.Response_ForgotPasswordRequest.ext'];
|
||||
|
||||
if (resp.challengeEmail) {
|
||||
updateStatus(StatusEnum.DISCONNECTED, null);
|
||||
SessionPersistence.resetPasswordChallenge();
|
||||
} else {
|
||||
updateStatus(StatusEnum.DISCONNECTED, null);
|
||||
SessionPersistence.resetPassword();
|
||||
}
|
||||
} else {
|
||||
updateStatus(StatusEnum.DISCONNECTED, null);
|
||||
SessionPersistence.resetPasswordFailed();
|
||||
}
|
||||
|
||||
disconnect();
|
||||
});
|
||||
}
|
||||
6
webclient/src/websocket/events/common/index.ts
Normal file
6
webclient/src/websocket/events/common/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { ProtobufEvents } from '../../services/ProtobufService';
|
||||
import { playerPropertiesChanged } from './playerPropertiesChanged';
|
||||
|
||||
export const CommonEvents: ProtobufEvents = {
|
||||
'.Event_PlayerPropertiesChanged.ext': playerPropertiesChanged,
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PlayerGamePropertiesData } from './interfaces';
|
||||
import { PlayerGamePropertiesData } from '../session/interfaces';
|
||||
import { SessionPersistence } from '../../persistence';
|
||||
|
||||
export function playerPropertiesChanges(payload: PlayerGamePropertiesData): void {
|
||||
export function playerPropertiesChanged(payload: PlayerGamePropertiesData): void {
|
||||
SessionPersistence.playerPropertiesChanged(payload);
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './common';
|
||||
export * from './room';
|
||||
export * from './session';
|
||||
|
||||
@@ -3,7 +3,7 @@ import { addToList } from './addToList';
|
||||
import { connectionClosed } from './connectionClosed';
|
||||
import { listRooms } from './listRooms';
|
||||
import { notifyUser } from './notifyUser';
|
||||
import { playerPropertiesChanges } from './playerPropertiesChanges';
|
||||
import { playerPropertiesChanged } from '../common/playerPropertiesChanged';
|
||||
import { removeFromList } from './removeFromList';
|
||||
import { serverIdentification } from './serverIdentification';
|
||||
import { serverMessage } from './serverMessage';
|
||||
@@ -19,9 +19,9 @@ export const SessionEvents: ProtobufEvents = {
|
||||
'.Event_GameJoined.ext': gameJoined,
|
||||
'.Event_ListRooms.ext': listRooms,
|
||||
'.Event_NotifyUser.ext': notifyUser,
|
||||
'.Event_PlayerPropertiesChanges.ext': playerPropertiesChanges,
|
||||
'.Event_RemoveFromList.ext': removeFromList,
|
||||
// '.Event_ReplayAdded.ext': () => {}, // TODO Eventually
|
||||
'.Event_ReplayAdded.ext': () => console.log('Event_ReplayAdded'),
|
||||
'.Event_ServerCompleteList.ext': () => console.log('Event_ServerCompleteList'),
|
||||
'.Event_ServerIdentification.ext': serverIdentification,
|
||||
'.Event_ServerMessage.ext': serverMessage,
|
||||
'.Event_ServerShutdown.ext': serverShutdown,
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
requestPasswordSalt,
|
||||
forgotPasswordChallenge,
|
||||
forgotPasswordRequest,
|
||||
resetPasswordRequest,
|
||||
forgotPasswordReset,
|
||||
updateStatus,
|
||||
} from '../../commands/session';
|
||||
import { generateSalt, passwordSaltSupported } from '../../utils';
|
||||
@@ -48,7 +48,7 @@ export function serverIdentification(info: ServerIdentificationData): void {
|
||||
}
|
||||
break;
|
||||
case WebSocketConnectReason.PASSWORD_RESET_REQUEST:
|
||||
resetPasswordRequest(options);
|
||||
forgotPasswordRequest(options);
|
||||
break;
|
||||
case WebSocketConnectReason.PASSWORD_RESET_CHALLENGE:
|
||||
forgotPasswordChallenge(options);
|
||||
@@ -57,7 +57,7 @@ export function serverIdentification(info: ServerIdentificationData): void {
|
||||
if (getPasswordSalt) {
|
||||
requestPasswordSalt(options);
|
||||
} else {
|
||||
forgotPasswordRequest(options);
|
||||
forgotPasswordReset(options);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -52,4 +52,12 @@ export class RoomPersistence {
|
||||
static removeMessages(roomId: number, name: string, amount: number): void {
|
||||
console.log('removeMessages', roomId, name, amount);
|
||||
};
|
||||
|
||||
static gameCreated(roomId: number) {
|
||||
console.log('gameCreated', roomId);
|
||||
}
|
||||
|
||||
static joinedGame(roomId: number, gameId: number) {
|
||||
console.log('joinedGame', roomId, gameId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ServerDispatch } from 'store';
|
||||
import { StatusEnum, User, WebSocketConnectOptions } from 'types';
|
||||
import { DeckStorageTreeItem, StatusEnum, User, WebSocketConnectOptions } from 'types';
|
||||
|
||||
import { sanitizeHtml } from 'websocket/utils';
|
||||
import {
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
UserMessageData
|
||||
} from '../events/session/interfaces';
|
||||
import NormalizeService from '../utils/NormalizeService';
|
||||
import { DeckList } from '../../types/deckList';
|
||||
|
||||
export class SessionPersistence {
|
||||
static initialized() {
|
||||
@@ -205,4 +206,30 @@ export class SessionPersistence {
|
||||
static removeFromList(list: string, userName: string): void {
|
||||
console.log('removeFromList', list, userName);
|
||||
}
|
||||
|
||||
static deckDelete(deckId: number): void {
|
||||
console.log('deckDelete', deckId);
|
||||
}
|
||||
|
||||
static deckDeleteDir(path: string): void {
|
||||
console.log('deckDeleteDir', path);
|
||||
}
|
||||
|
||||
static deckDownload(deckId: number): void {
|
||||
console.log('deckDownload', deckId);
|
||||
}
|
||||
|
||||
static deckList(deckList: DeckList): void {
|
||||
console.log('deckList', deckList);
|
||||
}
|
||||
|
||||
static deckNewDir(path: string, dirName: string): void {
|
||||
console.log('deckNewDir', path, dirName);
|
||||
}
|
||||
|
||||
static deckUpload(treeItem: DeckStorageTreeItem): void {
|
||||
console.log('deckUpload', treeItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import protobuf from 'protobufjs';
|
||||
|
||||
import { RoomEvents, SessionEvents } from '../events';
|
||||
import { CommonEvents, RoomEvents, SessionEvents } from '../events';
|
||||
import { SessionPersistence } from '../persistence';
|
||||
import { WebClient } from '../WebClient';
|
||||
import { SessionCommands } from 'websocket';
|
||||
@@ -95,7 +95,10 @@ export class ProtobufService {
|
||||
this.processSessionEvent(msg.sessionEvent, msg);
|
||||
break;
|
||||
case this.controller.ServerMessage.MessageType.GAME_EVENT_CONTAINER:
|
||||
// @TODO
|
||||
console.log(msg);
|
||||
break;
|
||||
default:
|
||||
console.log(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -113,6 +116,10 @@ export class ProtobufService {
|
||||
}
|
||||
}
|
||||
|
||||
private processCommonEvent(response: any, raw: any) {
|
||||
this.processEvent(response, CommonEvents, raw);
|
||||
}
|
||||
|
||||
private processRoomEvent(response: any, raw: any) {
|
||||
this.processEvent(response, RoomEvents, raw);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user