public void SetOnlineGame(string viewerId, BGA.TableData table, JSONObject bgaData) { Logger.Instance.Log("LOG", "NWInterface: SetOnlineGame()"); try { Clear(); BGA.BoardData board = new BGA.BoardData(viewerId, table); string bgaDataDebugString = JSONTools.FormatJsonDisplay(bgaData); foreach (string chunk in splitInLineChunks(bgaDataDebugString, 500)) { Logger.Instance.Log("DETAIL", chunk); } GameStateReader gameStateReader = new GameStateReader(bgaData, board); if (!gameStateReader.IsValid) { Logger.Instance.Log("ERROR", "invalid gamestate received from server"); } gamestate = gameStateReader.convertToGameState(); gameData.SetOnlineGame(board, gameStateReader.initMoveId, gameStateReader.initPacketId); } catch (System.Exception e) { Logger.Instance.Log("ERROR", e.ToString()); BGA.BoardData board = new BGA.BoardData(viewerId, table); gamestate = null; gameData.SetOnlineGame(board, 0, 0); } }
public PacketData(JSONObject json) { ParseData(json); debugPrintString = JSONTools.FormatJsonDisplay(json); }