Esempio n. 1
0
 protected virtual void HandleOperation(IOperation op)
 {
     if (op.Key == $"{KEY_PLAYER_PREFIX}{_playerId}" || op.Key == $"{KEY_PLAYER_PREFIX}{_gameState.PlayerId}")
     {
         var self = JsonConvert.DeserializeObject <TPlayer>(op.Value);
         OnSelfUpdate?.Invoke(this, new Revision <TPlayer>(_gameState.Self, self));
         _gameState.Self = self;
     }
     else if (op.Key == KEY_ROOM)
     {
         var room = JsonConvert.DeserializeObject <TRoom>(op.Value);
         OnRoomUpdate?.Invoke(this, new Revision <TRoom>(_gameState.Room, room));
         _gameState.Room = room;
     }
 }
Esempio n. 2
0
 public override void OnRoomListUpdate(List <RoomInfo> roomList)
 {
     base.OnRoomListUpdate(roomList);
     UpdateCachedRoomList(roomList);
     OnRoomUpdate?.Invoke(roomList);
 }