Exemple #1
0
    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();
    }
Exemple #2
0
 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();
 }
Exemple #3
0
    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);
        }
    }
Exemple #4
0
    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);
        }
    }
Exemple #5
0
        public ViewResult AvailableHeroes()
        {
            List <Models.Hero> allHeroes = HeroesData.getAllAvailableHeroes();

            return(View(allHeroes));
        }