mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Support Game Events (#5087)
This commit is contained in:
parent
bbe125beee
commit
248ea82573
9 changed files with 77 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import protobuf from 'protobufjs';
|
||||
|
||||
import { CommonEvents, RoomEvents, SessionEvents } from '../events';
|
||||
import { CommonEvents, GameEvents, RoomEvents, SessionEvents } from '../events';
|
||||
import { SessionPersistence } from '../persistence';
|
||||
import { WebClient } from '../WebClient';
|
||||
import { SessionCommands } from 'websocket';
|
||||
|
|
@ -95,7 +95,7 @@ export class ProtobufService {
|
|||
this.processSessionEvent(msg.sessionEvent, msg);
|
||||
break;
|
||||
case this.controller.ServerMessage.MessageType.GAME_EVENT_CONTAINER:
|
||||
console.log(msg);
|
||||
this.processGameEvent(msg.gameEvent, msg);
|
||||
break;
|
||||
default:
|
||||
console.log(msg);
|
||||
|
|
@ -128,6 +128,10 @@ export class ProtobufService {
|
|||
this.processEvent(response, SessionEvents, raw);
|
||||
}
|
||||
|
||||
private processGameEvent(response: any, raw: any): void {
|
||||
this.processEvent(response, GameEvents, raw);
|
||||
}
|
||||
|
||||
private processEvent(response: any, events: ProtobufEvents, raw: any) {
|
||||
for (const event in events) {
|
||||
const payload = response[event];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue