public static Pilots loadPilotsForEachShip(Ships ships) { Pilots pilots = new Pilots(); foreach (Ship ship in ships.Ship) { if (pilots == null || pilots.Pilot == null || pilots.Pilot.Capacity == 0) { pilots = XMLLoader.getPilots(ship.ShipId.ToString() + "_pilots.xml"); } else { pilots.Pilot.AddRange(XMLLoader.getPilots(ship.ShipId.ToString() + "_pilots.xml").Pilot); } } return(pilots); }
public void mockPlayerSquadrons() { Ships ships = XMLLoader.getShips("rebel_ships.xml"); Pilots pilots = XMLLoader.getPilots("t65xw_pilots.xml"); LoadedShip ship1 = new LoadedShip(); ship1.setShip(ships.Ship[0]); ship1.setPilot(pilots.Pilot[0]); //Adding event actions to be registered for event handling. //TODO Is the input parameter correct/enough?????? ship1.addEventAction(new EventActionWedgeAntilles(ship1)); LoadedShip ship2 = new LoadedShip(); ship2.setShip(ships.Ship[0]); ship2.setPilot(pilots.Pilot[1]); ship2.getPilot().Level = ship1.getPilot().Level; //List<LoadedShip> squadron1 = new List<LoadedShip>(); /*foreach (LoadedShip ship in LocalDataWrapper.getPlayer().getSquadron()) * { * squadron1.Add(ship); * * //Registering event actions... * foreach (CustomEventBase eventAction in ship.getEventActions()) * { * EventActionRegister.registerEventAction(eventAction); * } * }*/ LocalDataWrapper.getPlayer().setChosenSide("Rebels"); LocalDataWrapper.getPlayer().setPLayerID(1); LocalDataWrapper.getPlayer().setAI(false); if (LocalDataWrapper.getPlayer().getSquadron() == null || LocalDataWrapper.getPlayer().getSquadron().Count == 0) { LocalDataWrapper.getPlayer().setSelectedEmptyShip(ship1.getShip()); LocalDataWrapper.getPlayer().addPilotToSquadron(ship1.getPilot()); LocalDataWrapper.getPlayer().setSelectedEmptyShip(ship2.getShip()); LocalDataWrapper.getPlayer().addPilotToSquadron(ship2.getPilot()); //LocalDataWrapper.getPlayer().setSquadron(squadron1); } //AI PLAYER!! Player player2 = new Player(); player2.setChosenSide("Empire"); player2.setPlayerName("AI Player"); player2.setPLayerID(2); Ships ships2 = XMLLoader.getShips("imperial_ships.xml"); Pilots pilots2 = XMLLoader.getPilots("tief_pilots.xml"); LoadedShip ship3 = new LoadedShip(); ship3.setShip(ships2.Ship[0]); ship3.setPilot(pilots2.Pilot[0]); player2.setSelectedEmptyShip(ship3.getShip()); player2.addPilotToSquadron(ship3.getPilot()); LoadedShip ship4 = new LoadedShip(); ship4.setShip(ships2.Ship[0]); ship4.setPilot(pilots2.Pilot[1]); player2.setSelectedEmptyShip(ship4.getShip()); player2.addPilotToSquadron(ship4.getPilot()); LoadedShip ship5 = new LoadedShip(); ship5.setShip(ships2.Ship[0]); ship5.setPilot(pilots2.Pilot[2]); player2.setSelectedEmptyShip(ship5.getShip()); player2.addPilotToSquadron(ship5.getPilot()); LoadedShip ship6 = new LoadedShip(); ship6.setShip(ships2.Ship[0]); ship6.setPilot(pilots2.Pilot[0]); player2.setSelectedEmptyShip(ship6.getShip()); player2.addPilotToSquadron(ship6.getPilot()); LoadedShip ship7 = new LoadedShip(); ship7.setShip(ships2.Ship[0]); ship7.setPilot(pilots2.Pilot[0]); player2.setSelectedEmptyShip(ship7.getShip()); player2.addPilotToSquadron(ship7.getPilot()); LoadedShip ship8 = new LoadedShip(); ship8.setShip(ships2.Ship[0]); ship8.setPilot(pilots2.Pilot[0]); player2.setSelectedEmptyShip(ship8.getShip()); player2.addPilotToSquadron(ship8.getPilot()); player2.setAI(true); MatchDatas.addPlayer(LocalDataWrapper.getPlayer()); MatchDatas.addPlayer(player2); }