예제 #1
0
    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);
    }
예제 #2
0
    //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);
    }
예제 #3
0
    //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);
    }
예제 #4
0
    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);
    }