示例#1
0
        public static Item fromXML(XmlElement element)
        {
            ItemType  type = (ItemType)Enum.Parse(typeof(ItemType), element.GetAttribute("type"));
            ItemClass itemClass = (ItemClass)Enum.Parse(typeof(ItemClass), element.GetAttribute("class"));
            String    name = element.GetAttribute("name"), textureName = element.GetAttribute("textureName");
            StatSet   stats = StatSet.fromXML((XmlElement)element.GetElementsByTagName("stats").Item(0));

            return(new Item(name, stats, type, textureName, itemClass));
        }
示例#2
0
        protected void copyValues(XmlElement element)
        {
            StatSet stats = StatSet.fromXML((XmlElement)element.GetElementsByTagName("stats").Item(0));

            xp            = int.Parse(element.GetAttribute("xp"));
            level         = int.Parse(element.GetAttribute("level"));
            unusedAttr    = int.Parse(element.GetAttribute("unusedAttr"));
            xpOfNextLevel = int.Parse(element.GetAttribute("xpOfNextLevel"));
            guid          = new Guid(element.GetAttribute("guid"));
            unlocked      = UnlockedManager.fromXML((XmlElement)element.GetElementsByTagName("levelsUnlocked").Item(0));
            foreach (Stat stat in stats.statsTable.Values)
            {
                this.stats.setStatValue(stat.getType(), stat.getValue());
            }
            itemManager = InventoryManager.fromXML((XmlElement)element.GetElementsByTagName("inventory").Item(0));
        }