public static void LoadFile(PlayStationVita.SaveData data) { version = data.version; Money = data.Money; Hearts = data.Hearts; Armor = data.Armor; Healing = data.Healing; StartOnWave = data.StartOnWave; GunOwned = data.GunOwned; GunPower = data.GunPower; GunEquipped = data.GunEquipped; Choom.MusicVolume = data.MusicVolume; Choom.EffectVolume = data.EffectVolume; IgnoreSignIn = data.IgnoreSignIn; Objectives.activeTasks = data.ObjectivesActive; AmountOfObjectivesComplete = data.AmountOfObjectivesComplete; int[] scores = data.BestHardcoreScores; BestHardcoreScores.Clear(); for (int i = 0; i < scores.Length / 2; i++) { if (scores[i * 2] > 0) { BestHardcoreScores.Add(new Tuple <int, int>(scores[i * 2], scores[i * 2 + 1])); } } BlocksLoaded = data.BlocksLoaded; AmmoLoaded = data.AmmoLoaded; MatchStreak = data.MatchStreak; ShotsFired = data.ShotsFired; TimesDefeated = data.TimesDefeated; DisconcertingObjectivesSeen = data.DisconcertingObjectivesSeen; }
public static void LoadRemote() { Reset(); Money = WebGLJump.LoadData(SaveKeys.Money, 0); Hearts = WebGLJump.LoadData(SaveKeys.Hearts, 2); Armor = WebGLJump.LoadData(SaveKeys.Armor, 0); Healing = WebGLJump.LoadData(SaveKeys.Healing, 1); StartOnWave = WebGLJump.LoadData(SaveKeys.StartOnWave, 0); for (int i = 0; i < GunOwned.Length; ++i) { GunOwned[i] = WebGLJump.LoadData(SaveKeys.GunOwned + i.ToString(), i < maxEquip); } for (int i = 0; i < GunPower.Length; ++i) { GunPower[i] = WebGLJump.LoadData(SaveKeys.GunPower + i.ToString(), 1); } for (int i = 0; i < GunEquipped.Length; ++i) { GunEquipped[i] = WebGLJump.LoadData(SaveKeys.GunEquipped + i.ToString(), i < maxEquip); } Choom.MusicVolume = ((float)WebGLJump.LoadData(SaveKeys.MusicVolume, 75) / (float)100); Choom.EffectVolume = ((float)WebGLJump.LoadData(SaveKeys.EffectVolume, 75) / (float)100); for (int i = 0; i < Objectives.activeTasks.Length; ++i) { Objectives.activeTasks[i] = WebGLJump.LoadData(SaveKeys.ObjectivesActive + i.ToString(), 0); } AmountOfObjectivesComplete = WebGLJump.LoadData(SaveKeys.ObjectivesComplete, 0); int[] scores = new int[5]; for (int i = 0; i < scores.Length; ++i) { scores[i] = WebGLJump.LoadData(SaveKeys.BestHardcoreScores + i.ToString(), 0); } BestHardcoreScores.Clear(); for (int i = 0; i < scores.Length / 2; i++) { if (scores[i * 2] > 0) { BestHardcoreScores.Add(new Tuple <int, int>(scores[i * 2], scores[i * 2 + 1])); } } for (int i = 0; i < BlocksLoaded.Length; ++i) { BlocksLoaded[i] = WebGLJump.LoadData(SaveKeys.BlocksLoaded + i.ToString(), 0); } for (int i = 0; i < AmmoLoaded.Length; ++i) { AmmoLoaded[i] = WebGLJump.LoadData(SaveKeys.AmmoLoaded + i.ToString(), 0); } MatchStreak = WebGLJump.LoadData(SaveKeys.MatchStreak, 0); ShotsFired = WebGLJump.LoadData(SaveKeys.ShotsFired, 0); TimesDefeated = WebGLJump.LoadData(SaveKeys.TimesDefeated, 0); DisconcertingObjectivesSeen = WebGLJump.LoadData(SaveKeys.DisconcertingObjectivesSeen, 0); }
public static void LoadFile() { Reset(); string serializedSaveData = ""; SaveData savedData; if (SaveDataHandler.Load(ref serializedSaveData, "GunhouseSave")) { savedData = JsonUtility.FromJson <SaveData>(serializedSaveData); } else { serializedSaveData = SaveFile(); savedData = JsonUtility.FromJson <SaveData>(serializedSaveData); } version = savedData.version != 0 ? savedData.version : 1; Money = savedData.Money; Hearts = savedData.Hearts != 0 ? savedData.Hearts : 2; Armor = savedData.Armor; Healing = savedData.Healing != 0 ? savedData.Healing : 1; StartOnWave = savedData.StartOnWave; GunOwned = savedData.GunOwned != null ? savedData.GunOwned : new bool[NumberOfGuns]; GunPower = savedData.GunPower != null ? savedData.GunPower : new int[NumberOfGuns]; GunEquipped = savedData.GunEquipped != null ? savedData.GunEquipped : new bool[NumberOfGuns]; Choom.MusicVolume = savedData.MusicVolume != 0 ? savedData.MusicVolume : 0.75f; Choom.EffectVolume = savedData.EffectVolume != 0 ? savedData.EffectVolume : 0.75f; IgnoreSignIn = savedData.IgnoreSignIn; Objectives.activeTasks = savedData.ObjectivesActive != null ? savedData.ObjectivesActive : new int[3]; AmountOfObjectivesComplete = savedData.AmountOfObjectivesComplete; int[] scores = savedData.BestHardcoreScores != null ? savedData.BestHardcoreScores : new int[0]; BestHardcoreScores.Clear(); for (int i = 0; i < scores.Length / 2; i++) { if (scores[i * 2] > 0) { BestHardcoreScores.Add(new Tuple <int, int>(scores[i * 2], scores[i * 2 + 1])); } } BlocksLoaded = savedData.BlocksLoaded != null ? savedData.BlocksLoaded : new int[10]; AmmoLoaded = savedData.AmmoLoaded != null ? savedData.AmmoLoaded : new int[10]; MatchStreak = savedData.MatchStreak; ShotsFired = savedData.ShotsFired; TimesDefeated = savedData.TimesDefeated; DisconcertingObjectivesSeen = savedData.DisconcertingObjectivesSeen; }
public static void ResetValues() { GunOwned = new bool[NumberOfGuns]; GunPower = new int[NumberOfGuns]; GunEquipped = new bool[NumberOfGuns]; for (int i = 0; i < maxEquip; ++i) { GunEquipped[i] = true; } for (int i = 0; i < NumberOfGuns; ++i) { GunOwned[i] = i < maxEquip; GunPower[i] = 1; } version = 1; Money = 0; Hearts = 2; Armor = 0; Healing = 1; StartOnWave = 0; Choom.MusicVolume = 0.75f; Choom.EffectVolume = 0.75f; IgnoreSignIn = false; Objectives.activeTasks = new int[3]; AmountOfObjectivesComplete = 0; int[] scores = new int[0]; BestHardcoreScores.Clear(); for (int i = 0; i < scores.Length / 2; i++) { if (scores[i * 2] > 0) { BestHardcoreScores.Add(new Tuple <int, int>(scores[i * 2], scores[i * 2 + 1])); } } BlocksLoaded = new int[10]; AmmoLoaded = new int[10]; MatchStreak = 0; ShotsFired = 0; TimesDefeated = 0; DisconcertingObjectivesSeen = 0; }