public static string SaveFile() { Debug.Log("Saving"); int[] scores = new int[SCORES_TO_KEEP * 2]; for (int i = 0; i < SCORES_TO_KEEP; i++) { if (i >= BestHardcoreScores.Count) { break; } scores[i * 2] = BestHardcoreScores[i].Item1; scores[i * 2 + 1] = BestHardcoreScores[i].Item2; } SaveData saveFile = new SaveData(); saveFile.version = version; saveFile.Money = Money; saveFile.Hearts = Hearts; saveFile.Armor = Armor; saveFile.Healing = Healing; saveFile.StartOnWave = StartOnWave; saveFile.GunOwned = GunOwned; saveFile.GunPower = GunPower; saveFile.GunEquipped = GunEquipped; saveFile.MusicVolume = Choom.MusicVolume; saveFile.EffectVolume = Choom.EffectVolume; saveFile.IgnoreSignIn = IgnoreSignIn; saveFile.ObjectivesActive = Objectives.activeTasks; saveFile.AmountOfObjectivesComplete = AmountOfObjectivesComplete; saveFile.BestHardcoreScores = scores; saveFile.BlocksLoaded = BlocksLoaded; saveFile.AmmoLoaded = AmmoLoaded; saveFile.ShotsFired = ShotsFired; saveFile.TimesDefeated = TimesDefeated; saveFile.MatchStreak = MatchStreak; saveFile.DisconcertingObjectivesSeen = DisconcertingObjectivesSeen; string saveFileSerialized = JsonUtility.ToJson(saveFile); SaveDataHandler.Save(saveFileSerialized, "GunhouseSave"); return(saveFileSerialized); }
public static string SaveFile() { ObjectivesSaveFile objectivesSaveFile = new ObjectivesSaveFile(); objectivesSaveFile.defeatWithGun = (int)defeatWithGun; objectivesSaveFile.previousDefeatWithGun = (int)previousDefeatWithGun; objectivesSaveFile.amountToDefeat = amountToDefeat; objectivesSaveFile.ammoToUpgrade = (int)ammoToUpgrade; objectivesSaveFile.previousAmmoToUpgrade = (int)previousAmmoToUpgrade; objectivesSaveFile.leveToUpgrade = leveToUpgrade; objectivesSaveFile.levelToHealing = levelToHealing; objectivesSaveFile.levelToHeart = levelToHeart; objectivesSaveFile.isLevelingHeart = isLevelingHeart ? 1 : 0; objectivesSaveFile.amountofBlocksToMake = amountofBlocksToMake; objectivesSaveFile.makeXSize = makeXSize; objectivesSaveFile.makeYSize = makeYSize; objectivesSaveFile.amountOfSizedBlocksToLoadToGun = amountOfSizedBlocksToLoadToGun; objectivesSaveFile.loadGunXSize = loadGunXSize; objectivesSaveFile.loadGunYSize = loadGunYSize; objectivesSaveFile.amountOfSizedBlocksToLoadToSpecial = amountOfSizedBlocksToLoadToSpecial; objectivesSaveFile.loadSpecialXSize = loadSpecialXSize; objectivesSaveFile.loadSpecialYSize = loadSpecialYSize; objectivesSaveFile.amountToHaveInBank = amountToHaveInBank; objectivesSaveFile.ammoGunToSend = (int)ammoGunToSend; objectivesSaveFile.ammoSpecialToSend = (int)ammoSpecialToSend; objectivesSaveFile.amountOfElementsMatching = amountOfElementsMatching; objectivesSaveFile.amountOfBossesToDefeat = amountOfBossesToDefeat; objectivesSaveFile.currentBossesDefeated = currentBossesDefeated; objectivesSaveFile.daysToReach = daysToReach; objectivesSaveFile.currentFreeTask = currentFreeTask; string objectivesSaveFileSerialized = JsonUtility.ToJson(objectivesSaveFile); SaveDataHandler.Save(objectivesSaveFileSerialized, "GunhouseObjectivesSave"); return(objectivesSaveFileSerialized); }