Beispiel #1
0
        private static void saveNode(DialogNode node, ref XmlElement xmlEl,
            ref XmlDocument xmlDoc)
        {
            XmlElement xmlChildEl = xmlDoc.CreateElement("dialogNode");
            xmlChildEl.SetAttribute("id", node.id);
            xmlChildEl.SetAttribute("npcPhrase", node.npcDialog);
            xmlChildEl.SetAttribute("voiceFile", node.npcVoiceFile);

            DialogResponse[] responses = node.getResponses();
            for (int j = 0; j < responses.Length; j++)
            {
                DialogResponse response = responses[j];
                XmlElement responseXE = xmlDoc.CreateElement("response");
                responseXE.SetAttribute("pcPhrase", response.response);
                responseXE.SetAttribute("link", response.link);
                responseXE.SetAttribute("linkType", 
                    response.linkType.ToString());
                responseXE.SetAttribute("switchConversation",
                    response.switchConversation);
                responseXE.SetAttribute("onlyAllowOnce", 
                    response.onlyAllowOnce.ToString());
                xmlChildEl.AppendChild(responseXE);
                if (response.childNode != null)
                    saveNode(response.childNode, ref responseXE, ref xmlDoc);
            }
            xmlEl.AppendChild(xmlChildEl);
        }
Beispiel #2
0
Datei: GUI.cs Projekt: VicBoss/KR
        private List<DialogResponse> getResponses(DialogNode node)
        {
            List<DialogResponse> responses = new List<DialogResponse>();

            foreach (DialogResponse r in node.getResponses())
            {
                responses.Add(r);
                if (r.childNode != null)
                    responses.AddRange(getResponses(r.childNode));
            }

            return responses;
        }