public static AbilityActionData GetAbilityActionData() { AbilityActionData result = new AbilityActionData(); string abilityDataPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/data"), "abilitydata.xml"); IEDebug.Log($"Looking for file {abilityDataPath}"); if (File.Exists(abilityDataPath)) { IEDebug.Log("Found abilitydata.xml"); try { XmlSerializer serializer = new XmlSerializer(typeof(Serialization.AbilityActionData)); Serialization.AbilityActionData serializedData; using (var openRead = File.OpenRead(abilityDataPath)) { serializedData = (Serialization.AbilityActionData)serializer.Deserialize(openRead); } result = new AbilityActionData(serializedData); } catch (Exception ex) { IEDebug.Log($"Couldn't process ability data: {ex.ToString()}"); } } return(result); }
public static AbilityActionData GetAbilityActionData() { AbilityActionData result = new AbilityActionData(); string abilityDataPath = Path.Combine(Path.Combine(Application.dataPath, "Managed/iemod/data"), "abilitydata.xml"); IEDebug.Log($"Looking for file {abilityDataPath}"); if (File.Exists(abilityDataPath)) { IEDebug.Log("Found abilitydata.xml"); try { XmlSerializer serializer = new XmlSerializer(typeof(Serialization.AbilityActionData)); Serialization.AbilityActionData serializedData; using (var openRead = File.OpenRead(abilityDataPath)) { serializedData = (Serialization.AbilityActionData)serializer.Deserialize(openRead); } result = new AbilityActionData(serializedData); //List<AbilityChange> temp = new List<AbilityChange>(result.AbilityChanges["Blizzard"]); //temp.Add(new AbilityChange() //{ // Type = AbilityChange.ChangeType.StatusEffect, // Value = new AbilityChange.StatusEffectChange() // { // Index = 0, // Magnitude = .7f, // Duration = 15f // } //}); //result.AbilityChanges["Blizzard"] = temp; //value = new Serialization.AbilityActionData(); //value.AbilityExports = new List<Serialization.AbilityExport>(); //value.AbilityExports.Add(new Serialization.AbilityExport { Name = "Test1" }); //value.AbilityExports.Add(new Serialization.AbilityExport { Name = "Test2" }); //value.AbilityChanges = new List<Serialization.AbilityChange>(); //value.AbilityChanges.Add(new Serialization.AbilityChange() //{ // Name = "Test3", // MinDamage = "3", // MaxDamage = "5.5", // Accuracy = "12", // BlastRadius = "3.2", // BlastAngle = "120", // DTBypass = "******", // Range = "10", // ExtraAOE = new Serialization.AbilityChange() // { // Name="Doesn't Matter", // MinDamage = "6", // MaxDamage = "9.2", // Accuracy = "12" // } //}); //System.Text.StringBuilder sb = new System.Text.StringBuilder(); //using (var writer = new StringWriter(sb)) { // serializer.Serialize(writer, value); // IEDebug.Log($"Serialization example: {sb.ToString()}"); //} } catch (Exception ex) { IEDebug.Log($"Couldn't process ability data: {ex.ToString()}"); } } return(result); }