public static void SaveHeroes() { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/heroes.nt"; FileStream stream = new FileStream(path, FileMode.Create); HeroesData data = new HeroesData(); formatter.Serialize(stream, data); stream.Close(); }
private void InitCachedData() { CachedUserLocalData = new UserLocalData(); CachedCardsLibraryData = new CardsLibraryData(); CachedHeroesData = new HeroesData(); CachedCollectionData = new CollectionData(); CachedDecksData = new DecksData(); CachedOpponentDecksData = new OpponentDecksData(); CachedCreditsData = new CreditsData(); CachedBuffsTooltipData = new TooltipContentData(); }
public static HeroesData LoadHeroes() { string path = Application.persistentDataPath + "/heroes.nt"; if (File.Exists(path)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); HeroesData data = formatter.Deserialize(stream) as HeroesData; stream.Close(); return(data); } else { Debug.LogError("Save file not found in " + path); return(null); } }
void LoadHeroes() { HeroesData data = SaveSystem.LoadHeroes(); //all heroes for (int i = 0; i < AllHeros.heroes.Length; i++) { AllHeros.heroes[i].maxHP = (int)data.allMaxHp[i]; AllHeros.heroes[i].attackDamage = (int)data.allAttackDamage[i]; AllHeros.heroes[i].critChance = (int)data.allCritChance[i]; } //heroes for (int i = 0; i < data.count; i++) { Fighter f = new Fighter(AllHeros.GetFighter(data.id[i])); f.setID(data.id[i]); f.currentHP = (int)data.currentHP[i]; Heroes.AddHero(f); } }
public ViewResult AvailableHeroes() { List <Models.Hero> allHeroes = HeroesData.getAllAvailableHeroes(); return(View(allHeroes)); }