Esempio n. 1
0
File: MyXml.cs Progetto: VicBoss/KR
        public static Conversation load(String fileName)
        {
            Conversation conv = new Conversation("");
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(fileName);
            XmlNodeList xmlNL = xmlDoc.GetElementsByTagName("npcName");
            XmlElement xmlEl;
            xmlEl = (XmlElement)xmlNL[0];
            conv.npcName = xmlEl.GetAttribute("npcName");
            xmlNL = xmlDoc.GetElementsByTagName("resetConversation");
            xmlEl = (XmlElement)xmlNL[0];
            bool resetConv=bool.Parse(xmlEl.GetAttribute("resetConversation"));
            conv.resetConversationOnEnd = resetConv;

            xmlNL = xmlDoc.SelectNodes("/conversation/dialog/dialogNode");
            for (int i = 0; i < xmlNL.Count; i++)
            {
                xmlEl = (XmlElement)xmlNL[i];
                DialogNode node = loadNode(xmlEl, ref conv);
                conv.addRootNode(node);
            }

            return conv;
        }