Exemplo n.º 1
0
        public bool Parse(XmlNode node)
        {
            if (node.Attributes != null && node.Attributes["upgrade_cost"] != null)
            {
                var s = node.Attributes["upgrade_cost"].Value;
                upgrade_cost = GenericStringParser.GetObjectList <CostItem>(s);
            }
            if (node.Attributes != null && node.Attributes["add_furniture"] != null)
            {
                var s = node.Attributes["add_furniture"].Value;
                add_furniture = GenericStringParser.GetObjectList <ObjectLayout>(s);
            }
            if (node.Attributes != null && node.Attributes["level"] != null)
            {
                level = int.Parse(node.Attributes["level"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("level");
                if (child != null)
                {
                    level = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["size"] != null)
            {
                size = int.Parse(node.Attributes["size"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("size");
                if (child != null)
                {
                    size = int.Parse(child.InnerText);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        public List <SceneLevel> SceneLevelList = new List <SceneLevel>(); //默认从下级节点解析

        public bool Parse(XmlNode node)
        {
            {
                var mid_node = node.SelectSingleNode("SceneLevelList");
                if (mid_node == null)
                {
                    mid_node = node;
                }
                var child_node = mid_node.SelectNodes("SceneLevel");
                if (child_node == null)
                {
                    child_node = mid_node.ChildNodes;
                }
                foreach (XmlNode n in child_node)
                {
                    SceneLevel value = new SceneLevel();
                    if (!value.Parse(n))
                    {
                        return(false);
                    }
                    SceneLevelList.Add(value);
                }
            }
            if (node.Attributes != null && node.Attributes["def_layout"] != null)
            {
                var s = node.Attributes["def_layout"].Value;
                def_layout = GenericStringParser.GetObjectList <ObjectLayout>(s);
            }
            if (node.Attributes != null && node.Attributes["open_cost"] != null)
            {
                var s = node.Attributes["open_cost"].Value;
                open_cost = GenericStringParser.GetObjectList <CostItem>(s);
            }
            if (node.Attributes != null && node.Attributes["name"] != null)
            {
                name = node.Attributes["name"].Value;
            }
            else
            {
                var child = node.SelectSingleNode("name");
                if (child != null)
                {
                    name = child.InnerText;
                }
            }
            if (node.Attributes != null && node.Attributes["type"] != null)
            {
                type = (HomeType)int.Parse(node.Attributes["type"].Value);
            }
            if (node.Attributes != null && node.Attributes["id"] != null)
            {
                id = int.Parse(node.Attributes["id"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("id");
                if (child != null)
                {
                    id = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["open_level"] != null)
            {
                open_level = int.Parse(node.Attributes["open_level"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("open_level");
                if (child != null)
                {
                    open_level = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["def_ground"] != null)
            {
                def_ground = int.Parse(node.Attributes["def_ground"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("def_ground");
                if (child != null)
                {
                    def_ground = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["def_terrain"] != null)
            {
                def_terrain = int.Parse(node.Attributes["def_terrain"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("def_terrain");
                if (child != null)
                {
                    def_terrain = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["def_bg"] != null)
            {
                def_bg = int.Parse(node.Attributes["def_bg"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("def_bg");
                if (child != null)
                {
                    def_bg = int.Parse(child.InnerText);
                }
            }

            return(true);
        }
Exemplo n.º 3
0
        public bool Parse(XmlNode node)
        {
            if (node.Attributes != null && node.Attributes["recover_time_reduce_map"] != null)
            {
                var s = node.Attributes["recover_time_reduce_map"].Value;
                recover_time_reduce_map = GenericStringParser.GetObjectList <ReduceMap>(s);
            }
            if (node.Attributes != null && node.Attributes["health_phase_img"] != null)
            {
                health_phase_img = node.Attributes["health_phase_img"].Value;
            }
            else
            {
                var child = node.SelectSingleNode("health_phase_img");
                if (child != null)
                {
                    health_phase_img = child.InnerText;
                }
            }
            if (node.Attributes != null && node.Attributes["normal_phase_img"] != null)
            {
                normal_phase_img = node.Attributes["normal_phase_img"].Value;
            }
            else
            {
                var child = node.SelectSingleNode("normal_phase_img");
                if (child != null)
                {
                    normal_phase_img = child.InnerText;
                }
            }
            if (node.Attributes != null && node.Attributes["tired_phase_img"] != null)
            {
                tired_phase_img = node.Attributes["tired_phase_img"].Value;
            }
            else
            {
                var child = node.SelectSingleNode("tired_phase_img");
                if (child != null)
                {
                    tired_phase_img = child.InnerText;
                }
            }
            if (node.Attributes != null && node.Attributes["out_heart_time"] != null)
            {
                out_heart_time = int.Parse(node.Attributes["out_heart_time"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("out_heart_time");
                if (child != null)
                {
                    out_heart_time = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["storage_max_count"] != null)
            {
                storage_max_count = int.Parse(node.Attributes["storage_max_count"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("storage_max_count");
                if (child != null)
                {
                    storage_max_count = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["recover_health_time"] != null)
            {
                recover_health_time = int.Parse(node.Attributes["recover_health_time"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("recover_health_time");
                if (child != null)
                {
                    recover_health_time = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["health_out_rate"] != null)
            {
                health_out_rate = int.Parse(node.Attributes["health_out_rate"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("health_out_rate");
                if (child != null)
                {
                    health_out_rate = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["normal_out_rate"] != null)
            {
                normal_out_rate = int.Parse(node.Attributes["normal_out_rate"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("normal_out_rate");
                if (child != null)
                {
                    normal_out_rate = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["tired_out_rate"] != null)
            {
                tired_out_rate = int.Parse(node.Attributes["tired_out_rate"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("tired_out_rate");
                if (child != null)
                {
                    tired_out_rate = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["recover_heart_time"] != null)
            {
                recover_heart_time = int.Parse(node.Attributes["recover_heart_time"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("recover_heart_time");
                if (child != null)
                {
                    recover_heart_time = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["min_work_time"] != null)
            {
                min_work_time = int.Parse(node.Attributes["min_work_time"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("min_work_time");
                if (child != null)
                {
                    min_work_time = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["max_work_time"] != null)
            {
                max_work_time = int.Parse(node.Attributes["max_work_time"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("max_work_time");
                if (child != null)
                {
                    max_work_time = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["health_phase_rate"] != null)
            {
                health_phase_rate = int.Parse(node.Attributes["health_phase_rate"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("health_phase_rate");
                if (child != null)
                {
                    health_phase_rate = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["normal_phase_rate"] != null)
            {
                normal_phase_rate = int.Parse(node.Attributes["normal_phase_rate"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("normal_phase_rate");
                if (child != null)
                {
                    normal_phase_rate = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["tired_phase_rate"] != null)
            {
                tired_phase_rate = int.Parse(node.Attributes["tired_phase_rate"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("tired_phase_rate");
                if (child != null)
                {
                    tired_phase_rate = int.Parse(child.InnerText);
                }
            }

            return(true);
        }
Exemplo n.º 4
0
        public bool Parse(XmlNode node)
        {
            if (node.Attributes != null && node.Attributes["cost"] != null)
            {
                var s = node.Attributes["cost"].Value;
                cost = GenericStringParser.GetObjectList <CostItem>(s);
            }
            if (node.Attributes != null && node.Attributes["level"] != null)
            {
                level = int.Parse(node.Attributes["level"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("level");
                if (child != null)
                {
                    level = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["player_level"] != null)
            {
                player_level = int.Parse(node.Attributes["player_level"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("player_level");
                if (child != null)
                {
                    player_level = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["pos_count"] != null)
            {
                pos_count = int.Parse(node.Attributes["pos_count"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("pos_count");
                if (child != null)
                {
                    pos_count = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["out_interval"] != null)
            {
                out_interval = int.Parse(node.Attributes["out_interval"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("out_interval");
                if (child != null)
                {
                    out_interval = int.Parse(child.InnerText);
                }
            }
            if (node.Attributes != null && node.Attributes["out_level_rate"] != null)
            {
                out_level_rate = float.Parse(node.Attributes["out_level_rate"].Value);
            }
            else
            {
                var child = node.SelectSingleNode("out_level_rate");
                if (child != null)
                {
                    out_level_rate = float.Parse(child.InnerText);
                }
            }

            return(true);
        }