Exemplo n.º 1
0
    public static IEnumerator LoadConfig(XmlNode encountersXml, MissionConfig missionConfig)
    {
        bool untilEndTime    = Misc.xmlBool(encountersXml.Attributes.GetNamedItem("untilEndTime"), false);
        bool untilQueueEmpty = Misc.xmlBool(encountersXml.Attributes.GetNamedItem("untilQueueEmpty"), true);

        XmlNodeList peopleNodes             = encountersXml.SelectNodes("person");
        List <PersonInMissionConfig> people = new List <PersonInMissionConfig>();

        foreach (XmlNode personNode in peopleNodes)
        {
            yield return(PersonInMissionConfig.LoadConfig(personNode, people));
        }

        EncountersConfig encountersConfig = new EncountersConfig(untilEndTime, untilQueueEmpty, people);

        missionConfig.encountersConfig = encountersConfig;

        yield return(null);
    }
Exemplo n.º 2
0
    public static IEnumerator LoadConfig(XmlNode missionXml)
    {
        XmlAttributeCollection missionAttributes = missionXml.Attributes;
        String id          = Misc.xmlString(missionAttributes.GetNamedItem("id"));
        String name        = Misc.xmlString(missionAttributes.GetNamedItem("name"));
        String description = Misc.xmlString(missionAttributes.GetNamedItem("description"));
        String location    = Misc.xmlString(missionAttributes.GetNamedItem("location"));
        String icon        = Misc.xmlString(missionAttributes.GetNamedItem("icon"));

        String startTime     = Misc.xmlString(missionAttributes.GetNamedItem("startTime"));
        String endTime       = Misc.xmlString(missionAttributes.GetNamedItem("endTime"));
        String overtime      = Misc.xmlString(missionAttributes.GetNamedItem("overtime"));
        int    timeSpeed     = Misc.xmlInt(missionAttributes.GetNamedItem("timeSpeed"), 1);
        String clockType     = Misc.xmlString(missionAttributes.GetNamedItem("clockType"));
        int    clockPosition = Misc.xmlInt(missionAttributes.GetNamedItem("clockPosition"), 0);

        String difficulty = Misc.xmlString(missionAttributes.GetNamedItem("difficulty"));
        String stars3     = Misc.xmlString(missionAttributes.GetNamedItem("stars3"));
        String stars2     = Misc.xmlString(missionAttributes.GetNamedItem("stars2"));
        String stars1     = Misc.xmlString(missionAttributes.GetNamedItem("stars1"));

        String failCondition = Misc.xmlString(missionAttributes.GetNamedItem("failCondition"));

        MissionConfig missionConfig = new MissionConfig(id, name, description, location,
                                                        icon, startTime, endTime, overtime, timeSpeed,
                                                        clockType, clockPosition, difficulty, stars3,
                                                        stars2, stars1, failCondition);

        XmlNode seeds = missionXml.SelectSingleNode("seeds");

        yield return(SeedsConfig.LoadConfig(seeds, missionConfig));

        XmlNode encounters = missionXml.SelectSingleNode("encounters");

        yield return(EncountersConfig.LoadConfig(encounters, missionConfig));

        Debug.Log("Mission loaded:");
        Debug.Log("Location: " + missionConfig.location + " " + missionConfig.startTime + " (" + missionConfig.clockType + ", " + missionConfig.clockPosition + ")");
        Debug.Log("Seeds: " + missionConfig.seedsConfig.bags.Count + " " + missionConfig.seedsConfig.people.Count);
        Debug.Log("Encounters: " + missionConfig.encountersConfig.people.Count);

        Instance = missionConfig;
    }