Exemple #1
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);
        }
Exemple #2
0
 public void UpdateLandlord(HomeType homeType)
 {
     _dbContext.Entry(homeType).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
 }
Exemple #3
0
 public void CreateLandlord(HomeType homeType)
 {
     _dbContext.HomeTypes.Add(homeType);
 }
Exemple #4
0
        public void DeleteLandlord(int homeTypeId)
        {
            HomeType types = _dbContext.HomeTypes.Find(homeTypeId);

            _dbContext.HomeTypes.Remove(types);
        }
Exemple #5
0
 public void CreateHomeType(HomeType model)
 {
     AddEntityImage(model);
     _context.HomeTypes.Add(model);
 }