public static MissionHistory getLoadedMissionHistory(string selectedMission, Objective[] loadedObjectives) { MissionHistory mh = new MissionHistory(); mh.name = selectedMission; mh.status = Active; mh.objectives = new List <ObjectiveHistory> (); for (int i = 0; i < loadedObjectives.Length; i++) { ObjectiveHistory oh = ObjectiveHistory.getLoadedObjectiveHistory(i, loadedObjectives [i]); mh.objectives.Add(oh); } return(mh); }
//phase d'initialisation //initialiser MissionHistory a partir du fichier json public static List <ObjectiveHistory> getObjectiveHistoryFromJSON(JSONNode x) { List <ObjectiveHistory> loh = new List <ObjectiveHistory>(); foreach (JSONNode y in x["objectif"].AsArray) { ObjectiveHistory oh = new ObjectiveHistory(); oh.id = y["id"].AsInt; oh.label = y["label"]; oh.status = y["status"]; oh.tasks = TaskHistory.getTaskHistoryFromJSON(y); loh.Add(oh); } return(loh); }
//phase d'initialisation //initialiser MissionHistory pour la premiere foi (pa d'historique) avec les tache charger par le moteur de scénario public static ObjectiveHistory getLoadedObjectiveHistory(int iD, Objective obj) { ObjectiveHistory oh = new ObjectiveHistory(); oh.id = iD; oh.label = obj.getLabel(); oh.status = obj.getStatut(); oh.tasks = new List <TaskHistory>(); for (int i = 0; i < obj.getTasks().Count; i++) { TaskHistory th = TaskHistory.getLoadedTaskHistory(i, obj.getTasks()[i]); oh.tasks.Add(th); } return(oh); }
public static MissionHistory getMissionHistoryFromJSON(string selectedMission, string filePath) { LAJsonReader laJsonReader = new LAJsonReader(filePath); laJsonReader.setExternal(true); JSONNode node = laJsonReader.parsing(); MissionHistory mh = new MissionHistory(); //mh.name = selectedMission; mh.name = node ["historique"] ["mission"]; mh.status = node ["historique"] ["status"]; mh.objectives = ObjectiveHistory.getObjectiveHistoryFromJSON(node ["historique"]); return(mh); }