/// <summary>
 /// Parse the XML nodes
 /// </summary>
 /// <param name="xmlNode">The <Tree></Tree> nodes</param>
 public void fromXML(XmlNode xmlNode)
 {
     setNodeId(xmlNode.Attributes[XmlAttributes.TREENODEID].Value);
     foreach (XmlNode talkTreeNode in xmlNode.ChildNodes)
     {
         if (talkTreeNode.Name.Equals(XmlTag.TEXT))
         {
             setNpcText(talkTreeNode.FirstChild.Value);
         }
         else if (talkTreeNode.Name.Equals(XmlTag.BRANCH))
         {
             TalkTree.Branch branch = new TalkTree.Branch();
             branch.gotoNode = talkTreeNode.Attributes[XmlAttributes.TREENODEID].Value;
             branch.text     = talkTreeNode.FirstChild.Value;
             addPcReply(branch);
         }
         else if (talkTreeNode.Name.Equals(XmlAttributes.FLAGS))
         {
             TalkTree.Flag flag = new TalkTree.Flag();
             foreach (XmlAttribute attribute in talkTreeNode.Attributes)
             {
                 if (attribute.Name.Equals(XmlAttributes.DATA))
                 {
                     flag.data = attribute.Value;
                 }
             }
             flag.value = (CommonTools.TalkTreeFlag)Enum.Parse(typeof(CommonTools.TalkTreeFlag), talkTreeNode.FirstChild.Value);
             setFlag(flag);
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Parse the XML nodes
 /// </summary>
 /// <param name="xmlNode">The <Tree></Tree> nodes</param>
 public void fromXML(XmlNode xmlNode)
 {
     setNodeId(xmlNode.Attributes[XmlAttributes.TREENODEID].Value);
     foreach (XmlNode talkTreeNode in xmlNode.ChildNodes)
     {
         if (talkTreeNode.Name.Equals(XmlTag.TEXT))
         {
             setNpcText(talkTreeNode.FirstChild.Value);
         }
         else if (talkTreeNode.Name.Equals(XmlTag.BRANCH))
         {
             TalkTree.Branch branch = new TalkTree.Branch();
             branch.gotoNode = talkTreeNode.Attributes[XmlAttributes.TREENODEID].Value;
             branch.text = talkTreeNode.FirstChild.Value;
             addPcReply(branch);
         }
         else if (talkTreeNode.Name.Equals(XmlAttributes.FLAGS))
         {
             TalkTree.Flag flag = new TalkTree.Flag();
             foreach (XmlAttribute attribute in talkTreeNode.Attributes)
             {
                 if (attribute.Name.Equals(XmlAttributes.DATA))
                 {
                     flag.data = attribute.Value;
                 }
             }
             flag.value = (CommonTools.TalkTreeFlag)Enum.Parse(typeof(CommonTools.TalkTreeFlag), talkTreeNode.FirstChild.Value);
             setFlag(flag);
         }
     }
 }