예제 #1
0
        /// <summary>
        /// 递归来获取整棵技能树
        /// </summary>
        /// <param name="skillNode"></param>
        /// <param name="xmlNode"></param>
        private void TraverseToGetSkillTree(SkillNode skillNode, XmlNode xmlNode)
        {
            if (xmlNode.HasChildNodes)
            {
                foreach (XmlNode childNode in xmlNode.ChildNodes)
                {
                    if (childNode.Name.Equals("Condition")) //条件节点
                    {
                        SkillCondition skillCondition = new SkillCondition("Condition");
                        skillNode.AddChildNode(skillCondition);
                        TraverseToGetSkillTree(skillCondition, childNode);
                    }

                    if (childNode.Name.Equals("SkillBase")) //具体技能
                    {
                        SkillLeaf skillBase = GetSkillBase(childNode.Attributes["Id"].Value);
                        skillNode.AddChildNode(skillBase);
                        TraverseToGetSkillTree(skillBase, childNode);
                    }
                }
            }
        }