public RuneInfo LoadRuneInfo(string heroName) { RuneInfo runeInfo = new RuneInfo(); string priP = ""; string secP = ""; string keyStone = ""; List <string> runeStones = new List <string>(); string path_pri; string path_sec; #if UNITY_EDITOR || UNITY_STANDALONE_WIN path_pri = Application.streamingAssetsPath + "/SavedRunePages/" + heroName + "/PrimaryPath0.json"; if (File.Exists(path_pri)) { string dataAsJson; dataAsJson = File.ReadAllText(path_pri); RunePathData runePathData = new RunePathData(); runePathData = JsonUtility.FromJson <RunePathData>(dataAsJson); Debug.Log("Found Saved RunePage at " + path_pri); GameDebugUtility.AddDebugMsg("Found Saved RunePage at " + path_pri); priP = runePathData.pathName; keyStone = runePathData.keyStone.stoneChoiced; foreach (RuneStone rs in runePathData.runeStones) { runeStones.Add(rs.stoneChoiced); } } else { Debug.LogError("No saved RunePage"); } path_sec = Application.streamingAssetsPath + "/SavedRunePages/" + heroName + "/SecondaryPath0.json"; if (File.Exists(path_sec)) { string dataAsJson; dataAsJson = File.ReadAllText(path_sec); RunePathData runePathData = new RunePathData(); runePathData = JsonUtility.FromJson <RunePathData>(dataAsJson); Debug.Log("Found Saved RunePage at " + path_sec); GameDebugUtility.AddDebugMsg("Found Saved RunePage at " + path_sec); secP = runePathData.pathName; foreach (RuneStone rs in runePathData.runeStones) { runeStones.Add(rs.stoneChoiced); } } else { Debug.LogError("No saved RunePage"); } #endif #if UNITY_ANDROID if (Application.platform == RuntimePlatform.Android)//Unknown bug in reading the files { string dataAsJson; path_pri = Path.Combine(Application.streamingAssetsPath + "/", heroName + "/PrimaryPath0.json"); Debug.Assert(File.Exists(path_pri)); WWW reader = new WWW(path_pri); while (!reader.isDone) { } dataAsJson = reader.text; RunePathData runePathData = new RunePathData(); runePathData = JsonUtility.FromJson <RunePathData>(dataAsJson); Debug.Log("Found Saved RunePage at " + path_pri); priP = runePathData.pathName; keyStone = runePathData.keyStone.stoneChoiced; foreach (RuneStone rs in runePathData.runeStones) { runeStones.Add(rs.stoneChoiced); } path_sec = Path.Combine(Application.streamingAssetsPath + "/", heroName + "/SecondaryPath0.json"); reader = new WWW(path_sec); while (!reader.isDone) { } dataAsJson = reader.text; runePathData = new RunePathData(); runePathData = JsonUtility.FromJson <RunePathData>(dataAsJson); Debug.Log("Found Saved RunePage at " + path_sec); secP = runePathData.pathName; foreach (RuneStone rs in runePathData.runeStones) { runeStones.Add(rs.stoneChoiced); } } #endif runeInfo.Initialize(priP, secP); runeInfo.AddRuneStone(keyStone); foreach (string s in runeStones) { runeInfo.AddRuneStone(s); } return(runeInfo); }
public void Calculate(Dictionary <int, SpellListItem> spellCastsSequence) { Debug.Log("Calculating using advanced technologies... "); GameDebugUtility.AddDebugMsg("--------------Calculating using advanced technologies...--------- "); intTime = 0; for (int i = 0; i < totalTime * 10; i++) { if (spellCastsSequence.ContainsKey(intTime)) { if (spellCastsSequence[intTime].caster.heroName.Equals("Annie")) { List <SpellCast> spellCasts = new List <SpellCast>(); SpellCast spellCast; switch (spellCastsSequence[intTime].strSpell) { case "A": spellCast = annie.CastSpell(BaseSpell.A); break; case "HextechProtobelt_01": spellCast = annie.CastSpell(BaseSpell.HextechProtobelt_01); break; case "HextechGunblade": spellCast = annie.CastSpell(BaseSpell.HextechGunblade); break; case "Spellbinder": spellCast = annie.CastSpell(BaseSpell.Spellbinder); break; case "Flash": spellCast = annie.CastSpell(BaseSpell.Flash); break; case "Ignite": spellCast = annie.CastSpell(BaseSpell.Ignite); break; default: Debug.Log("Current casting: " + spellCastsSequence[intTime]); spellCast = annie.CastSpell(spellCastsSequence[intTime].strSpell); break; } spellCasts.Add(spellCast); foreach (string addInfo in spellCast.strAdditionalInfo) { if (addInfo.Equals("Electrocute")) { spellCasts.Add(annie.CastSpell(BaseSpell.Electrocute)); } if (addInfo.Equals("ArcaneComet")) { spellCasts.Add(annie.CastSpell(BaseSpell.ArcaneComet)); } if (addInfo.Equals("Echo")) { spellCasts.Add(annie.CastSpell(BaseSpell.Echo)); } if (addInfo.Equals("HextechRevolver")) { spellCasts.Add(annie.CastSpell(BaseSpell.HextechRevolver)); } if (addInfo.Equals("SpellBlade_LichBane")) { spellCasts.Add(annie.CastSpell(BaseSpell.SpellBlade_LichBane)); } if (addInfo.EndsWith("Scorch")) { spellCasts.Add(annie.CastSpell(BaseSpell.Scorch)); } } enemy.Update(spellCasts); } else if (spellCastsSequence[intTime].caster.heroName.Equals("Enemy")) { List <SpellCast> spellCasts = new List <SpellCast>(); SpellCast spellCast; switch (spellCastsSequence[intTime].strSpell) { case "A": spellCast = enemy.CastSpell(BaseSpell.A); break; case "HextechProtobelt_01": spellCast = enemy.CastSpell(BaseSpell.HextechProtobelt_01); break; case "HextechGunblade": spellCast = enemy.CastSpell(BaseSpell.HextechGunblade); break; case "Spellbinder": spellCast = enemy.CastSpell(BaseSpell.Spellbinder); break; case "Flash": spellCast = enemy.CastSpell(BaseSpell.Flash); break; case "Ignite": spellCast = enemy.CastSpell(BaseSpell.Ignite); break; default: Debug.Log("Current casting: " + spellCastsSequence[intTime]); spellCast = enemy.CastSpell(spellCastsSequence[intTime].strSpell); break; } spellCasts.Add(spellCast); foreach (string addInfo in spellCast.strAdditionalInfo) { if (addInfo.Equals("Electrocute")) { spellCasts.Add(enemy.CastSpell(BaseSpell.Electrocute)); } if (addInfo.Equals("ArcaneComet")) { spellCasts.Add(enemy.CastSpell(BaseSpell.ArcaneComet)); } if (addInfo.Equals("Echo")) { spellCasts.Add(enemy.CastSpell(BaseSpell.Echo)); } if (addInfo.Equals("HextechRevolver")) { spellCasts.Add(enemy.CastSpell(BaseSpell.HextechRevolver)); } if (addInfo.Equals("SpellBlade_LichBane")) { spellCasts.Add(enemy.CastSpell(BaseSpell.SpellBlade_LichBane)); } if (addInfo.EndsWith("Scorch")) { spellCasts.Add(enemy.CastSpell(BaseSpell.Scorch)); } } annie.Update(spellCasts); } } else { enemy.Update(); } annie.Update(); intTime += intUpdateInterval; } logText.text = GameDebugUtility.ShowAllDebugMsg(); }