/// <summary> /// Synchronizes with the server, then calls run(). /// </summary> /// <returns> /// Return true to end turn, false to resynchronize with the /// server and run again. /// </returns> public bool startTurn() { int count = 0; iteration++; count = Client.getPlayerCount(connection); players = new Player[count]; for(int i = 0; i < count; i++) players[i] = new Player(Client.getPlayer(connection, i)); count = Client.getMappableCount(connection); mappables = new Mappable[count]; for(int i = 0; i < count; i++) mappables[i] = new Mappable(Client.getMappable(connection, i)); count = Client.getTileCount(connection); tiles = new Tile[count]; for(int i = 0; i < count; i++) tiles[i] = new Tile(Client.getTile(connection, i)); count = Client.getTrapCount(connection); traps = new Trap[count]; for(int i = 0; i < count; i++) traps[i] = new Trap(Client.getTrap(connection, i)); count = Client.getThiefCount(connection); thiefs = new Thief[count]; for(int i = 0; i < count; i++) thiefs[i] = new Thief(Client.getThief(connection, i)); count = Client.getThiefTypeCount(connection); thiefTypes = new ThiefType[count]; for(int i = 0; i < count; i++) thiefTypes[i] = new ThiefType(Client.getThiefType(connection, i)); count = Client.getTrapTypeCount(connection); trapTypes = new TrapType[count]; for(int i = 0; i < count; i++) trapTypes[i] = new TrapType(Client.getTrapType(connection, i)); if(!initialized) { initialized = true; init(); } return run(); }
/// <summary> /// Synchronizes with the server, then calls run(). /// </summary> /// <returns> /// Return true to end turn, false to resynchronize with the /// server and run again. /// </returns> public bool startTurn() { int count = 0; iteration++; count = Client.getPlayerCount(connection); players = new Player[count]; for (int i = 0; i < count; i++) { players[i] = new Player(Client.getPlayer(connection, i)); } count = Client.getMappableCount(connection); mappables = new Mappable[count]; for (int i = 0; i < count; i++) { mappables[i] = new Mappable(Client.getMappable(connection, i)); } count = Client.getTileCount(connection); tiles = new Tile[count]; for (int i = 0; i < count; i++) { tiles[i] = new Tile(Client.getTile(connection, i)); } count = Client.getTrapCount(connection); traps = new Trap[count]; for (int i = 0; i < count; i++) { traps[i] = new Trap(Client.getTrap(connection, i)); } count = Client.getThiefCount(connection); thieves = new Thief[count]; for (int i = 0; i < count; i++) { thieves[i] = new Thief(Client.getThief(connection, i)); } count = Client.getThiefTypeCount(connection); thiefTypes = new ThiefType[count]; for (int i = 0; i < count; i++) { thiefTypes[i] = new ThiefType(Client.getThiefType(connection, i)); } count = Client.getTrapTypeCount(connection); trapTypes = new TrapType[count]; for (int i = 0; i < count; i++) { trapTypes[i] = new TrapType(Client.getTrapType(connection, i)); } if (!initialized) { initialized = true; init(); } return(run()); }