Esempio n. 1
0
 public override void SetValue(string name, object value)
 {
     if (data.GetChild(name) == null)
     {
         data.AddChild(name, StringExtensions.ToInvariantString(value));                 //ncrunch: no coverage
     }
     else
     {
         data.GetChild(name).Value = StringExtensions.ToInvariantString(value);
     }
     wasChanged = true;
 }
 private static Dictionary <TowerType, float> ParseTypeDamageModifier(XmlData boss)
 {
     return
         (boss.GetChild("Modifiers").Attributes.ToDictionary(
              attribute => (TowerType)Enum.Parse(typeof(TowerType), attribute.Name),
              attribute => attribute.Value.Convert <float>()));
 }
Esempio n. 3
0
 public void GetChild()
 {
     var root = new XmlData("root");
     new XmlData("child1", root);
     var child2 = new XmlData("child2", root);
     Assert.AreEqual(child2, root.GetChild("child2"));
 }
Esempio n. 4
0
		private static Dictionary<TowerType, float> ParseTypeDamageModifier(XmlData boss)
		{
			return
				boss.GetChild("Modifiers").Attributes.ToDictionary(
					attribute => (TowerType)Enum.Parse(typeof(TowerType), attribute.Name),
					attribute => attribute.Value.Convert<float>());
		}
Esempio n. 5
0
		private static Dictionary<TowerType, float> ParseTypeDamageModifier(XmlData creep)
		{
			var typeDamageModifier = new Dictionary<TowerType, float>();
			foreach (var attribute in creep.GetChild("Modifiers").Attributes)
				typeDamageModifier.Add((TowerType)Enum.Parse(typeof(TowerType), attribute.Name),
					attribute.Value.Convert<float>());
			return typeDamageModifier;
		}
Esempio n. 6
0
        public void GetChild()
        {
            var root = new XmlData("root");

            root.AddChild(new XmlData("child1"));
            var child2 = new XmlData("child2");

            root.AddChild(child2);
            Assert.AreEqual(child2, root.GetChild("child2"));
        }
        private static Dictionary <TowerType, float> ParseTypeDamageModifier(XmlData creep)
        {
            var typeDamageModifier = new Dictionary <TowerType, float>();

            foreach (var attribute in creep.GetChild("Modifiers").Attributes)
            {
                typeDamageModifier.Add((TowerType)Enum.Parse(typeof(TowerType), attribute.Name),
                                       attribute.Value.Convert <float>());
            }
            return(typeDamageModifier);
        }
Esempio n. 8
0
        public void InitializeData()
        {
            var mapXml = data.GetChild("Map");

            if (mapXml == null || string.IsNullOrEmpty(mapXml.Value))
            {
                throw new InvalidTileMapData();                 //ncrunch: no coverage
            }
            Size      = new Size(data.GetAttributeValue("Size"));
            ModelName = data.GetAttributeValue("ModelName");
            InitializeLists();
            StoreSpawnAndGoalPoints();
            StoreWaves();
            StoreGameTriggers();
            InitializeMapFromXml(mapXml.Value);
            LoadCustomLevelData(data);
            Current = this;
        }