Пример #1
0
        public Items()
        {
            I = new Dictionary <string, DescribedProfile>();

            XmlDocument File = new XmlDocument();

            File.Load("Media\\Profiles\\Items.xml");

            XmlElement  root  = File.DocumentElement;
            XmlNodeList Items = root.SelectNodes("//items/item");

            foreach (XmlNode item in Items)
            {
                if (item["type"].InnerText == "DescribedProfile")
                {
                    DescribedProfile Kriper = new DescribedProfile();
                    Kriper.DisplayName = item["name"].InnerText;
                    Kriper.Description = item["description"].InnerText;
                    Kriper.MeshName    = item["mesh"].InnerText;
                    Kriper.InventoryPictureMaterial = item["inventory_material"].InnerText;
                    Kriper.Mass                = int.Parse(item["mass"].InnerText);
                    Kriper.IsPickable          = bool.Parse(item["ispickable"].InnerText);
                    Kriper.DisplayNameOffset   = Vector3.ZERO;
                    Kriper.DisplayNameOffset.x = float.Parse(item["nameoffsetx"].InnerText);
                    Kriper.DisplayNameOffset.y = float.Parse(item["nameoffsety"].InnerText);
                    Kriper.DisplayNameOffset.z = float.Parse(item["nameoffsetz"].InnerText);
                    Kriper.ProfileName         = item["idstring"].InnerText;

                    I.Add(item["idstring"].InnerText, Kriper);
                }
                else if (item["type"].InnerText == "ItemSword")
                {
                    ItemSword Kriper = new ItemSword();
                    Kriper.DisplayName = item["name"].InnerText;
                    Kriper.Description = item["description"].InnerText;
                    Kriper.MeshName    = item["mesh"].InnerText;
                    Kriper.InventoryPictureMaterial = item["inventory_material"].InnerText;
                    Kriper.Mass                = int.Parse(item["mass"].InnerText);
                    Kriper.IsPickable          = bool.Parse(item["ispickable"].InnerText);
                    Kriper.DisplayNameOffset   = Vector3.ZERO;
                    Kriper.DisplayNameOffset.x = float.Parse(item["nameoffsetx"].InnerText);
                    Kriper.DisplayNameOffset.y = float.Parse(item["nameoffsety"].InnerText);
                    Kriper.DisplayNameOffset.z = float.Parse(item["nameoffsetz"].InnerText);
                    Kriper.ProfileName         = item["idstring"].InnerText;

                    I.Add(item["idstring"].InnerText, Kriper);
                }
            }
        }
Пример #2
0
        public Items()
        {
            I = new Dictionary<string, DescribedProfile>();

            XmlDocument File = new XmlDocument();
            File.Load("Media\\Profiles\\Items.xml");

            XmlElement root = File.DocumentElement;
            XmlNodeList Items = root.SelectNodes("//items/item");

            foreach (XmlNode item in Items)
            {
                if (item["type"].InnerText == "DescribedProfile")
                {
                    DescribedProfile Kriper = new DescribedProfile();
                    Kriper.DisplayName = item["name"].InnerText;
                    Kriper.Description = item["description"].InnerText;
                    Kriper.MeshName = item["mesh"].InnerText;
                    Kriper.InventoryPictureMaterial = item["inventory_material"].InnerText;
                    Kriper.Mass = int.Parse(item["mass"].InnerText);
                    Kriper.IsPickable = bool.Parse(item["ispickable"].InnerText);
                    Kriper.DisplayNameOffset = Vector3.ZERO;
                    Kriper.DisplayNameOffset.x = float.Parse(item["nameoffsetx"].InnerText);
                    Kriper.DisplayNameOffset.y = float.Parse(item["nameoffsety"].InnerText);
                    Kriper.DisplayNameOffset.z = float.Parse(item["nameoffsetz"].InnerText);
                    Kriper.ProfileName = item["idstring"].InnerText;

                    I.Add(item["idstring"].InnerText, Kriper);
                }
                else if (item["type"].InnerText == "ItemSword")
                {
                    ItemSword Kriper = new ItemSword();
                    Kriper.DisplayName = item["name"].InnerText;
                    Kriper.Description = item["description"].InnerText;
                    Kriper.MeshName = item["mesh"].InnerText;
                    Kriper.InventoryPictureMaterial = item["inventory_material"].InnerText;
                    Kriper.Mass = int.Parse(item["mass"].InnerText);
                    Kriper.IsPickable = bool.Parse(item["ispickable"].InnerText);
                    Kriper.DisplayNameOffset = Vector3.ZERO;
                    Kriper.DisplayNameOffset.x = float.Parse(item["nameoffsetx"].InnerText);
                    Kriper.DisplayNameOffset.y = float.Parse(item["nameoffsety"].InnerText);
                    Kriper.DisplayNameOffset.z = float.Parse(item["nameoffsetz"].InnerText);
                    Kriper.ProfileName = item["idstring"].InnerText;

                    I.Add(item["idstring"].InnerText, Kriper);
                }
            }
        }