private bool DetermineIsUnlocked() { if (this.GameRoom == GameRooms.Level1) { return(true); } var previous_level_game_room = this.GameRoom - 1; int required_score = Settings.LevelScoreRequirements[(int)previous_level_game_room]; int highest_score = 0; var speeds = new [] { GameplaySpeeds.Slow, GameplaySpeeds.Medium, GameplaySpeeds.Fast }; foreach (var speed in speeds) { string save_file_path = Settings.GetSaveFilePath(previous_level_game_room, speed); string data = SaveDataHandler.LoadData(save_file_path); int score = 0; bool success = (data != null && int.TryParse(data, out score)); if (success && score > highest_score) { highest_score = score; } } return(highest_score >= required_score); }
public void Initialize(SaveDataHandler handler) { this.gameData = handler.GameDataFile; if (this.Enabled = (this.gameData != null)) { inventoryItemAdapters = new ItemAdapter[gameData.InventoryItems.Length]; for (int i = 0; i < inventoryItemAdapters.Length; i++) { inventoryItemAdapters[i] = new ItemAdapter(gameData.InventoryItems[i], null); } keyItemsItemAdapters = new ItemAdapter[gameData.KeyItems.Length]; for (int i = 0; i < keyItemsItemAdapters.Length; i++) { keyItemsItemAdapters[i] = new ItemAdapter(gameData.KeyItems[i], null); } storageItemAdapters = new ItemAdapter[gameData.StorageItems.Length]; for (int i = 0; i < storageItemAdapters.Length; i++) { storageItemAdapters[i] = new ItemAdapter(gameData.StorageItems[i], gameData.StorageItemAmounts[i]); } InitializeDataGrid(dgvInventory, inventoryItemAdapters); InitializeDataGrid(dgvKeyItems, keyItemsItemAdapters); InitializeDataGrid(dgvStorage, storageItemAdapters); } }
public void Initialize(SaveDataHandler handler) { this.gameData = handler.GameDataFile; if (this.Enabled = (this.gameData != null)) { charaEquipmentComboBoxes = new ComboBox[] { cmbCharacterWeapon, cmbCharacterEquipment, cmbCharacterArmor1, cmbCharacterArmor2 }; cmbCharacterClass.DisplayMember = "Value"; cmbCharacterClass.ValueMember = "Key"; cmbCharacterClass.DataSource = new BindingSource(XmlHelper.ClassNames[SaveDataHandler.SaveLanguage], null); cmbCharacterSubclass.DisplayMember = "Value"; cmbCharacterSubclass.ValueMember = "Key"; cmbCharacterSubclass.DataSource = new BindingSource(XmlHelper.ClassNames[SaveDataHandler.SaveLanguage], null); foreach (ComboBox comboBox in charaEquipmentComboBoxes) { comboBox.DisplayMember = "Value"; comboBox.ValueMember = "Key"; comboBox.DataSource = new BindingSource(XmlHelper.EquipmentNames[SaveDataHandler.SaveLanguage], null); } lbCharacters.DataSource = this.gameData.Characters; } }
public static void PostStats(bool force_post = false) { #if XBOX_LIVE if (StatTracker.FoodEaten > 0) { XboxLiveStatsManager.SetStatInteger(XboxLiveStats.FoodEaten, StatTracker.FoodEaten); } var game_rooms = Enum.GetValues(typeof(GameRooms)); var game_speeds = Enum.GetValues(typeof(GameplaySpeeds)); foreach (GameRooms game_room in game_rooms) { foreach (GameplaySpeeds gameplay_speed in game_speeds) { const string prefix = "LongestSnake"; string stat_string = prefix + game_room + gameplay_speed; bool success = Enum.TryParse(typeof(XboxLiveStats), stat_string, out var stat); if (success && stat is XboxLiveStats) { string data = SaveDataHandler.LoadData(Settings.GetSaveFilePath(game_room, gameplay_speed)); int.TryParse(data, out int score); if (score > 0) { XboxLiveStatsManager.SetStatInteger((XboxLiveStats)stat, score); } } } } XboxLiveStatsManager.CheckAndFlush(force_post); #else #endif }
public void ChangeSingleItemCategory(ItemViewModel _item, CategoryViewModel _changeTo, out ItemViewModel x) { FindCategoryUsingId(_item.Category).RemoveItem(_item); SaveDataHandler.SwapItemTable(_item, _changeTo.Id); _item.Category = _changeTo.Id; Categories[Categories.IndexOf(_changeTo)].AddItem(_item); x = _item; }
void Start() { if (scores.scoreList == null) { scores.scoreList = SaveDataHandler.GetScores(); } paddleRenderer = GetComponent <SpriteRenderer>(); Display(0); }
public void LoadButtonClicked() { PlayerAchivedDataModel data = GetStoredData(); data.collectedCoinNumber = GetInputValue(); SaveDataHandler.SaveData(data, GetFilePath()); ShowStoredData(); }
void Update() { if (Input.GetKeyDown(KeyCode.Return) && nameField.text.Length > 0) { SaveDataHandler.AddNewScore(score.Value, nameField.text.ToUpper()); SceneManager.LoadScene("HighScores"); } nameField.ActivateInputField(); }
public static void LoadFile() { string serializedObjectivesSaveData = ""; ObjectivesSaveFile savedObjectivesData; if (SaveDataHandler.Load(ref serializedObjectivesSaveData, "GunhouseObjectivesSave")) { savedObjectivesData = JsonUtility.FromJson <ObjectivesSaveFile>(serializedObjectivesSaveData); } else { savedObjectivesData = JsonUtility.FromJson <ObjectivesSaveFile>(SaveFile()); } defeatWithGun = (Gun.Ammo)(savedObjectivesData.defeatWithGun != 0 ? savedObjectivesData.defeatWithGun : Random.Range((int)Gun.Ammo.DRAGON, (int)Gun.Ammo.SIN)); previousDefeatWithGun = (Gun.Ammo)(savedObjectivesData.previousDefeatWithGun != 0 ? savedObjectivesData.previousDefeatWithGun : (int)defeatWithGun); amountToDefeat = savedObjectivesData.amountToDefeat != 0 ? savedObjectivesData.amountToDefeat : Random.Range(5, 10); ammoToUpgrade = (Gun.Ammo)(savedObjectivesData.ammoToUpgrade != 0 ? savedObjectivesData.ammoToUpgrade : Random.Range((int)Gun.Ammo.DRAGON, (int)Gun.Ammo.SIN)); previousAmmoToUpgrade = (Gun.Ammo)(savedObjectivesData.previousAmmoToUpgrade != 0 ? savedObjectivesData.previousAmmoToUpgrade : (int)ammoToUpgrade); leveToUpgrade = savedObjectivesData.leveToUpgrade != 0 ? savedObjectivesData.leveToUpgrade : (DataStorage.GunPower[(int)ammoToUpgrade] + 2); levelToHealing = savedObjectivesData.levelToHealing != 0 ? savedObjectivesData.levelToHealing : (DataStorage.Healing + 2); levelToHeart = savedObjectivesData.levelToHeart != 0 ? savedObjectivesData.levelToHeart : Mathf.Clamp(DataStorage.Hearts + 1, 0, 6); isLevelingHeart = (savedObjectivesData.isLevelingHeart != 0 ? savedObjectivesData.isLevelingHeart : 1) == 1 ? true : false; amountofBlocksToMake = savedObjectivesData.amountofBlocksToMake != 0 ? savedObjectivesData.amountofBlocksToMake : Random.Range(3, 10); makeXSize = savedObjectivesData.makeXSize != 0 ? savedObjectivesData.makeXSize : Random.Range(2, 4); makeYSize = savedObjectivesData.makeYSize != 0 ? savedObjectivesData.makeYSize : Random.Range(2, 4); amountOfSizedBlocksToLoadToGun = savedObjectivesData.amountOfSizedBlocksToLoadToGun != 0 ? savedObjectivesData.amountOfSizedBlocksToLoadToGun : Random.Range(3, 10); loadGunXSize = savedObjectivesData.loadGunXSize != 0 ? savedObjectivesData.loadGunXSize : Random.Range(2, 4); loadGunYSize = savedObjectivesData.loadGunYSize != 0 ? savedObjectivesData.loadGunYSize : Random.Range(2, 4); amountOfSizedBlocksToLoadToSpecial = savedObjectivesData.amountOfSizedBlocksToLoadToSpecial != 0 ? savedObjectivesData.amountOfSizedBlocksToLoadToSpecial : Random.Range(3, 10); loadSpecialXSize = savedObjectivesData.loadSpecialXSize != 0 ? savedObjectivesData.loadSpecialXSize : Random.Range(2, 4); loadSpecialYSize = savedObjectivesData.loadSpecialYSize != 0 ? savedObjectivesData.loadSpecialYSize : Random.Range(2, 4); currentFreeTask = savedObjectivesData.currentFreeTask; int difference = 0; if (DataStorage.Money > 10000) { int targetAmount = (DataStorage.Money + 10000); int whole = (int)Mathf.Pow(10, Mathf.FloorToInt(Mathf.Log10(targetAmount)) - 2); int remainder = targetAmount % whole; difference = whole - remainder; } amountToHaveInBank = savedObjectivesData.amountToHaveInBank != 0 ? savedObjectivesData.amountToHaveInBank : (DataStorage.Money + 10000 + difference); ammoGunToSend = (Gun.Ammo)(savedObjectivesData.ammoGunToSend != 0 ? savedObjectivesData.ammoGunToSend : Random.Range((int)Gun.Ammo.DRAGON, (int)Gun.Ammo.GATLING)); ammoSpecialToSend = (Gun.Ammo)(savedObjectivesData.ammoSpecialToSend != 0 ? savedObjectivesData.ammoSpecialToSend : Random.Range((int)Gun.Ammo.DRAGON, (int)Gun.Ammo.GATLING)); amountOfElementsMatching = savedObjectivesData.amountOfElementsMatching != 0 ? savedObjectivesData.amountOfElementsMatching : Random.Range(2, 5); amountOfBossesToDefeat = savedObjectivesData.amountOfBossesToDefeat != 0 ? savedObjectivesData.amountOfBossesToDefeat : Random.Range(2, 5); currentBossesDefeated = savedObjectivesData.currentBossesDefeated; int currentDay = (DataStorage.StartOnWave / 3 + 1); daysToReach = savedObjectivesData.daysToReach != 0 ? savedObjectivesData.daysToReach : Mathf.Clamp(currentDay, currentDay + 1, currentDay + 4); }
public static void Load() { StatTracker.Reset(); string data_string = SaveDataHandler.LoadData(Settings.StatTrackerSavePath); if (data_string != null) { StatTracker.FoodEaten = int.Parse(data_string); } }
public void Initialize(SaveDataHandler handler) { this.mapData = handler.MapDatafile; if (this.Enabled = (this.mapData != null)) { handler.SaveSucceededEvent += ((s, e) => { pgMapPlaceable.Refresh(); }); chkZoomedMap.Checked = Properties.Settings.Default.ZoomedMap; if (Properties.Settings.Default.LastMapExportPath != string.Empty) { sfdExport.InitialDirectory = System.IO.Path.GetDirectoryName(Properties.Settings.Default.LastMapExportPath); sfdExport.FileName = System.IO.Path.GetFileName(Properties.Settings.Default.LastMapExportPath); } mapNameDict = new Dictionary <MapLayer, string>(); mapNameDict.Add(this.mapData.MazeMaps[0], "Maze: Lush Woodlands B1F"); mapNameDict.Add(this.mapData.MazeMaps[1], "Maze: Lush Woodlands B2F"); mapNameDict.Add(this.mapData.MazeMaps[2], "Maze: Lush Woodlands B3F"); mapNameDict.Add(this.mapData.MazeMaps[3], "Maze: Misty Ravine B1F"); mapNameDict.Add(this.mapData.MazeMaps[4], "Maze: Misty Ravine B2F"); mapNameDict.Add(this.mapData.MazeMaps[5], "Maze: Misty Ravine B3F"); mapNameDict.Add(this.mapData.MazeMaps[6], "Maze: Golden Lair B1F"); mapNameDict.Add(this.mapData.MazeMaps[7], "Maze: Golden Lair B2F"); mapNameDict.Add(this.mapData.MazeMaps[8], "Maze: Golden Lair B3F"); mapNameDict.Add(this.mapData.MazeMaps[9], "Maze: Echoing Library B1F"); mapNameDict.Add(this.mapData.MazeMaps[10], "Maze: Echoing Library B2F"); mapNameDict.Add(this.mapData.MazeMaps[11], "Maze: Echoing Library B3F"); mapNameDict.Add(this.mapData.MazeMaps[12], "Maze: Forgotten Capital B1F"); mapNameDict.Add(this.mapData.MazeMaps[13], "Maze: Hall of Darkness B1F"); mapNameDict.Add(this.mapData.MazeMaps[14], "Maze: Hall of Darkness B2F"); mapNameDict.Add(this.mapData.MazeMaps[15], "Maze: Hall of Darkness B3F"); mapNameDict.Add(this.mapData.CaveMaps[0], "Cave: Old Forest Mine"); mapNameDict.Add(this.mapData.CaveMaps[1], "Cave: Small Orchard"); mapNameDict.Add(this.mapData.CaveMaps[2], "Cave: Valley Spring"); mapNameDict.Add(this.mapData.CaveMaps[3], "Cave: Dense Bushland"); mapNameDict.Add(this.mapData.CaveMaps[5], "Cave: Miasma Forest"); // v-- swapped mapNameDict.Add(this.mapData.CaveMaps[4], "Cave: Moth's Garden"); // ^-- in-game mapNameDict.Add(this.mapData.CaveMaps[6], "Cave: Noisy Marsh"); mapNameDict.Add(this.mapData.CaveMaps[7], "Cave: Cramped Nest"); mapNameDict.Add(this.mapData.CaveMaps[8], "Cave: Toxic Cave"); mapNameDict.Add(this.mapData.CaveMaps[9], "Cave: Underground Lake"); mapNameDict.Add(this.mapData.CaveMaps[10], "Cave: South Sanctuary"); mapNameDict.Add(this.mapData.CaveMaps[11], "Cave: Windy Archive"); mapNameDict.Add(this.mapData.CaveMaps[12], "Cave: Golden Deer Keep"); cmbMaps.DataSource = new BindingSource(mapNameDict, null); cmbMaps.DisplayMember = "Value"; cmbMaps.ValueMember = "Key"; currentMap = this.mapData.MazeMaps[0]; } }
public void ChangeGameAudioStatus() { GameAudioSavedData data = GetSavedSoundSettingData(); data.isGameAudioOn = !data.isGameAudioOn; SaveDataHandler.SaveData(data, GetFilePath()); if (onAudioStateChange != null) { onAudioStateChange(data.isGameAudioOn); } }
public static SaveDataHandler GetInstance() { if (instance != null) { return(instance); } GameObject newGameObject = new GameObject(); instance = newGameObject.AddComponent <SaveDataHandler>(); instance.initialize(); return(instance); }
public override void Call() { if (SaveDataHandler.IsNewRecord(score.Value)) { Sounds.PlayAudio(newHSClip); SceneManager.LoadScene("EnterNewScore"); } else { Sounds.PlayAudio(backClip); SceneManager.LoadScene("Start"); } }
void Start() { if (highScores.scoreList == null) { highScores.scoreList = SaveDataHandler.GetScores(); } for (int i = 0; i < highScores.scoreList.Count; i++) { GameObject number = scoreLines.transform.GetChild(i).gameObject; Vector3 position = number.transform.position; GameObject line = Instantiate(scoreLinePrefab, new Vector3(position.x - .2f, position.y + .25f, 0), Quaternion.identity); line.GetComponent <ScoreLine>().Format(highScores.scoreList[i].name, highScores.scoreList[i].score); } }
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 Scoreboard() { this.Depth = -100; this.Position = new Vector2(Engine.Game.CanvasWidth / 2 - Scoreboard.Width / 2, 30 + 30 + 20); this.BackgroundRegion = new Region(ContentHolder.Get(Settings.CurrentBackground), (int)this.Position.X, (int)this.Position.Y, Scoreboard.Width, Scoreboard.Height, 0, 0); this.SnakeRegion = new Region(ContentHolder.Get(Settings.CurrentSnake)); string data = SaveDataHandler.LoadData(Settings.CurrentSaveFilePath); bool success = (data != null && int.TryParse(data, out this.HighScore)); if (!success) { this.SaveHighscore(); } }
public void Initialize(SaveDataHandler handler) { this.gameOptions = handler.OptionDataFile; if (this.Enabled = (this.gameOptions != null)) { SetComboBoxBinding(cmbBGMVolume, "BGMVolume", Mori4Option.VolumeLevels); SetComboBoxBinding(cmbSEVolume, "SEVolume", Mori4Option.VolumeLevels); SetComboBoxBinding(cmbMessageSpeed, "MessageSpeed", Mori4Option.MessageSpeeds); SetComboBoxBinding(cmbBattleSpeed, "BattleSpeed", Mori4Option.BattleSpeeds); chkUnlockBGMTest.SetBinding("Checked", gameOptions, "BGMTestUnlocked"); SetComboBoxBinding(cmbCameraLR, "CameraLeftRight", Mori4Option.CameraSettings); SetComboBoxBinding(cmbCameraUD, "CameraUpDown", Mori4Option.CameraSettings); chkAutoMapEnable.SetBinding("Checked", gameOptions, "AutoMapEnable"); SetComboBoxBinding(cmbDifficulty, "Difficulty", Mori4Option.DifficultyLevels); } }
public void Awake() { if (_instance != null && _instance != this) { // if obj is a duplicate, destroy it Destroy(gameObject); return; } else { _instance = this; DontDestroyOnLoad(gameObject); } lockerName += gameObject.GetInstanceID(); Initialize(); }
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 void Initialize(SaveDataHandler handler) { this.guildCardData = handler.GuildCardDataFile; if (this.Enabled = (this.guildCardData != null)) { nameTextBoxes = new TextBox[] { txtCharaListName1, txtCharaListName2, txtCharaListName3, txtCharaListName4, txtCharaListName5 }; levelNumericUpDowns = new NumericUpDown[] { nudCharaListLevel1, nudCharaListLevel2, nudCharaListLevel3, nudCharaListLevel4, nudCharaListLevel5 }; classComboBoxes = new ComboBox[] { cmbCharaListClass1, cmbCharaListClass2, cmbCharaListClass3, cmbCharaListClass4, cmbCharaListClass5 }; portraitComboBoxes = new ImageComboBox[] { icmbCharaListPortrait1, icmbCharaListPortrait2, icmbCharaListPortrait3, icmbCharaListPortrait4, icmbCharaListPortrait5 }; regCharaEquipmentComboBoxes = new ComboBox[] { cmbRegCharacterWeapon, cmbRegCharacterEquipment, cmbRegCharacterArmor1, cmbRegCharacterArmor2 }; foreach (ComboBox comboBox in classComboBoxes) { comboBox.DisplayMember = "Value"; comboBox.ValueMember = "Key"; comboBox.DataSource = new BindingSource(XmlHelper.ClassNames[SaveDataHandler.SaveLanguage], null); } cmbGuildTreasureMap.DisplayMember = "Value"; cmbGuildTreasureMap.ValueMember = "Key"; cmbGuildTreasureMap.DataSource = new BindingSource(XmlHelper.TreasureMapNames[SaveDataHandler.SaveLanguage], null); cmbRegCharacterClass.DisplayMember = "Value"; cmbRegCharacterClass.ValueMember = "Key"; cmbRegCharacterClass.DataSource = new BindingSource(XmlHelper.ClassNames[SaveDataHandler.SaveLanguage], null); cmbRegCharacterSubclass.DisplayMember = "Value"; cmbRegCharacterSubclass.ValueMember = "Key"; cmbRegCharacterSubclass.DataSource = new BindingSource(XmlHelper.ClassNames[SaveDataHandler.SaveLanguage], null); foreach (ComboBox comboBox in regCharaEquipmentComboBoxes) { comboBox.DisplayMember = "Value"; comboBox.ValueMember = "Key"; comboBox.DataSource = new BindingSource(XmlHelper.EquipmentNames[SaveDataHandler.SaveLanguage], null); } lbGuildCards.DataSource = new BindingSource(this.guildCardData.GuildCards, null); } }
public void Initialize(SaveDataHandler handler) { this.gameData = handler.GameDataFile; if (this.Enabled = (this.gameData != null)) { txtGuildName.SetBinding("Text", gameData, "GuildName"); txtSkyshipName.SetBinding("Text", gameData, "SkyshipName"); txtCurrentEn.SetBinding("Text", gameData, "CurrentEn"); nudBurstValue.SetBinding("Value", gameData, "BurstValue"); lblBurstPointDisplay.SetBinding("Text", gameData, "BurstPoints"); spbBurstGauge.SetBinding("Value", gameData, "BurstGauge"); nudTimeYear.SetBinding("Value", gameData, "CurrentYear"); cmbTimeMonth.DataSource = Mori4Game.MonthNames; cmbTimeMonth.SetBinding("SelectedIndex", gameData, "CurrentMonth"); nudTimeDay.SetBinding("Value", gameData, "CurrentDay"); } }
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); }
public static void Save() { string data_string = StatTracker.FoodEaten.ToString(); SaveDataHandler.SaveData(data_string, Settings.StatTrackerSavePath); }
private void SaveHighscore() { SaveDataHandler.SaveData(this.HighScore.ToString(), Settings.CurrentSaveFilePath); }
public override void onSwitchTo(Room previous_room, Dictionary <string, object> args) { Engine.SpawnInstance <LoadingSplash>(); var timer = new GameTimeSpan(); Action initialize = () => { #if ADS #if ANDROID #if AMAZON Engine.SpawnInstance <AmazonUpgrade>(); #endif #endif #endif #if XBOX_LIVE // Wait for Xbox Live login to complete if attempting const int xbox_live_timeout = 5000; while (XboxLiveObject.CurrentlyAttemptingSignIn && timer.TotalMilliseconds <= xbox_live_timeout) { System.Threading.Thread.Sleep(10); } #endif // Load all game data to initialize the SaveDataHandler cache Debug.WriteLine("########### Loading Save Files In To Cache ##########"); foreach (GameRooms game_room in Enum.GetValues(typeof(GameRooms))) { foreach (GameplaySpeeds gameplay_speed in Enum.GetValues(typeof(GameplaySpeeds))) { string data = SaveDataHandler.LoadData(Settings.GetSaveFilePath(game_room, gameplay_speed)); Debug.WriteLine(game_room + " - " + gameplay_speed + ": " + data); } } Debug.WriteLine("########### Loading Save Files In To Cache ##########"); // Wait until initial data loading occurs to spawn persistent stat tracker entity Engine.SpawnInstance <StatTracker>(); // Preload in game assemblies for (int i = 0; i < this.AssembliesToPreload.Length; i++) { try { System.Reflection.Assembly.Load(this.AssembliesToPreload[i]); } catch { Debug.WriteLine("Unable to preload: " + this.AssembliesToPreload[i]); } } // If time remains after doing these operations set the time to allow splash screen to remain int remaining_time_to_wait = RoomInit.MinimumSplashDuration - (int)timer.TotalMilliseconds; if (remaining_time_to_wait < 0) { remaining_time_to_wait = 0; } // Setup switching to RoomMain after timeout Engine.SpawnInstance(new TimedExecution(remaining_time_to_wait, () => Engine.ChangeRoom <RoomMain>())); }; Engine.SpawnInstance(new TimedExecution(500, initialize)); }
PlayerAchivedDataModel GetStoredData() { return(SaveDataHandler.GetData <PlayerAchivedDataModel>(GetFilePath(), GetDefaultPlayerAchivedDataModel())); }
private GameAudioSavedData GetSavedSoundSettingData() { return(SaveDataHandler.GetData <GameAudioSavedData>(GetFilePath(), new GameAudioSavedData())); }