public void Save() { IsPaused = true; UpdateSnapshot(); SaveUtils.Save(_snapshot); IsPaused = false; }
private async Task DownloadAllAlbumArtsInternal(CancellationToken token) { var dispatcher = Application.Current.Dispatcher; if (dispatcher == null) { throw new ApplicationException("Dispatcher is null"); } this.Status = "Downloading albums..."; // TODO notify current processed document? (processing is in parallel) foreach (var resolvedBandInfo in this.ResolvedBandInfos) { Logger.Debug($"Saving all albums for {resolvedBandInfo}"); dispatcher.Invoke(() => this.CurrentBand = resolvedBandInfo.Name ); var albums = await App.InfoProvider.GetAllAlbums(resolvedBandInfo, token); await SaveUtils.SaveAllAlbumArts(albums); } dispatcher.Invoke(() => { this.Status = "Downloading successfully ended"; this.CurrentAlbum = String.Empty; this.CurrentBand = String.Empty; }); }
public void Save() { string saveDirectory = SaveUtils.GetCurrentSaveDataDir(); DeathRun.saveData.countSave.AboutToSaveGame(); DeathRun.saveData.playerSave.AboutToSaveGame(); try { var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, ReferenceLoopHandling = ReferenceLoopHandling.Ignore, // Keeps our Vector3's etc from generating infinite references //PreserveReferencesHandling = PreserveReferencesHandling.Objects }; var saveDataJson = JsonConvert.SerializeObject(this, Formatting.Indented, settings); if (!Directory.Exists(saveDirectory)) { Directory.CreateDirectory(saveDirectory); } File.WriteAllText(Path.Combine(saveDirectory, DeathRun.SaveFile), saveDataJson); } catch (Exception e) { CattleLogger.GenericError(e); CattleLogger.Message("Failed"); } }
public override void Start() { base.Start(); if (ConfigState.Instance.UseVerboseLogging) { Debug.Log("World Scene Controller Start"); } if (AutoRestore) { MetaState.Instance.IntentsExecutePreload(); Restore(); MetaState.Instance.IntentsExecutePostload(); } if (!string.IsNullOrEmpty(SetMusic)) { AudioPlayer.Instance.SetMusic(SetMusic, MusicSlot.Ambient, 1.0f, true, false); AudioPlayer.Instance.StartMusic(MusicSlot.Ambient); } ScriptingModule.CallHooked(ScriptHook.AfterSceneLoad, this); if (AutosaveOnEnter) { SaveUtils.DoAutoSave(); } }
public void EndGame() { timeTaken = Time.timeSinceLevelLoad - 3f; audioSource.Play(); SaveUtils.SaveTrial(); Invoke("LoadNextLevel", audioSource.clip.length); }
public override void Stream(ref Point point) { byte positionIndex = mBitStream.ReadByte(SaveUtils.GetNumBitsToStoreValue(Game.numRoomColumns * Game.numRoomRows - 1)); point.mRow = positionIndex / Game.numRoomColumns; point.mColumn = positionIndex % Game.numRoomColumns; }
private void Start() { //setup system text if (CoreParams.IsDebug) { SystemText.text = CoreParams.GetShortSystemText(); } else { SystemText.gameObject.SetActive(false); } //setup continue button if (CoreParams.AllowSaveLoad && SaveUtils.GetLastSave() != null) { ContinueButton.interactable = true; EventSystem.current.SetSelectedGameObject(ContinueButton.gameObject); } else { ContinueButton.interactable = false; } //call hooked scripts ScriptingModule.CallHooked(ScriptHook.AfterMainMenuCreate, this); }
public virtual void Start() { if (ConfigState.Instance.UseVerboseLogging) { Debug.Log("Base Scene Controller Start"); } if (!DeferInitialRestoreToSubclass && AutoRestore) { MetaState.Instance.IntentsExecutePreload(); MetaState.Instance.IntentsRemoveInvalid(); Restore(); MetaState.Instance.IntentsExecutePostload(); MetaState.Instance.IntentsRemoveInvalid(); } if (!DeferAfterSceneLoadToSubclass) { ScriptingModule.CallHooked(ScriptHook.AfterSceneLoad, this); } if (!DeferEnterAutosaveToSubclass && AutosaveOnEnter && MetaState.Instance.TransitionType != SceneTransitionType.LoadGame) { SaveUtils.DoAutoSave(); } }
public void Save(ISave saveSystem, string keyPrefix) { saveSystem.SetInt(SaveUtils.GetKey(keyPrefix, SaveUtils.PLAYER_MAX_HEALTH_KEY), MaxHealth); saveSystem.SetInt(SaveUtils.GetKey(keyPrefix, SaveUtils.PLAYER_CURRENT_HEALTH_KEY), CurrentHealth); camController.Save(saveSystem, SaveUtils.CAMERA_PREFIX); }
private IEnumerator CastleInit() { Settings.Instance.Audio.ChangeMusic(AudioContainer.Music.CastleAmbience); if (ObjPoolMan == null) { ObjPoolMan = GetComponent <ObjectPoolManager>(); } /* * if (AIManager == null) * { * AIManager = GetComponent<AIManager>(); * } */ /* * if (PlayerManager == null) * { * PlayerManager = GetComponent<PlayerManager>(); * PlayerManager.Initialize(); * } */ CharController = FindObjectOfType <CharController>(); LevelUIManager = FindObjectOfType <LevelUIManager>(); LevelUIManager.InitializeLevelUIManager(PlayerManager); ObjPoolMan.InitializeCastleObjectPool(); PlayerT = CharController.gameObject.transform; // Wait for one frame before loading some of the values. yield return(null); // Load player pos/rot if (!CastleManager.UseStartPos) { Vector3 playerPos = PlayerT.position; float playerRot = PlayerT.rotation.eulerAngles.y; float posX = SaveSystem.GetFloat(SaveUtils.GetKey(SaveUtils.PLAYER_TRANS_PREFIX, SaveUtils.PLAYER_X_KEY), playerPos.x); float posY = SaveSystem.GetFloat(SaveUtils.GetKey(SaveUtils.PLAYER_TRANS_PREFIX, SaveUtils.PLAYER_Y_KEY), playerPos.y); float posZ = SaveSystem.GetFloat(SaveUtils.GetKey(SaveUtils.PLAYER_TRANS_PREFIX, SaveUtils.PLAYER_Z_KEY), playerPos.z); float rotY = SaveSystem.GetFloat(SaveUtils.GetKey(SaveUtils.PLAYER_TRANS_PREFIX, SaveUtils.PLAYER_ROT_KEY), playerRot); //print(new Vector3(posX, posY + 0.1f, posZ)); PlayerT.position = new Vector3(posX, posY + 0.1f, posZ); PlayerT.rotation = Quaternion.Euler(0f, rotY, 0f); } // Load player health and camera rotation CharController.Load(SaveSystem, SaveUtils.CHAR_CONTROLLER_PREFIX); LevelUIManager.StartFade(FadeType.FadeOut); //AudioSource audioSource = GetComponent<AudioSource>(); //Audio = new AudioManager(audioSource, mixer, audioData); }
public void LoadGame(string saveSlot) { SaveSystem.Load(saveSlot); string scene = SaveSystem.GetString(SaveUtils.GetKey(SaveUtils.GAME_MAN_PREFIX, SaveUtils.GAMEMAN_SCENE_NAME_KEY), GlobalVariables.GRAVEYARD); SceneManager.LoadScene(scene); }
public void OnClickSave() { //Debug.Log("OnClickSave"); //new save if saveName=null //otherwise save over old save if (!GameState.Instance.SaveLocked && !GameState.Instance.ManualSaveLocked) { string saveName = SaveNameField.text; string saveFileName; if (SelectedSaveName != null) { //assume save name is already okay saveName = SelectedSaveName; //we know it already has a prefix saveFileName = saveName + ".json"; string savePath = CoreParams.SavePath + Path.DirectorySeparatorChar + saveName + ".json"; if (File.Exists(savePath)) { File.Delete(savePath); //this "works" but seems to be bugged- race condition? } } else { saveFileName = "m_" + SaveUtils.GetSafeName(saveName) + ".json"; } if (!string.IsNullOrEmpty(saveName)) { try { SharedUtils.SaveGame(saveFileName, true, false); Modal.PushMessageModal(Sub.Replace("SaveSuccessMessage", SubList), Sub.Replace("SaveSuccess", SubList), null, null); } catch (Exception e) { Debug.LogError($"Save failed! ({e.GetType().Name})"); Debug.LogException(e); Modal.PushMessageModal(e.Message, Sub.Replace("SaveFail", SubList), null, null); } SignalPaint(); } else { Modal.PushMessageModal(Sub.Replace("SaveBadFilenameMessage", SubList), Sub.Replace("SaveFail", SubList), null, null); } } else { //can't save! Modal.PushMessageModal(Sub.Replace("SaveNotAllowedMessage", SubList), Sub.Replace("SaveNotAllowed", SubList), null, null); } }
public void Load() { IsPaused = true; var snapshot = SaveUtils.Load(); if (snapshot != null) { _isLoading = true; Gold = snapshot.Gold; Lives = snapshot.Lives; UpdateGold(0); UpdateLives(0); if (IsWaveActive) { var wave = _waves[_currWave % _waves.Length]; wave.OnCreateEnemy -= HandleCreateEnemy; wave.OnWaveCleared -= HandleWaveCleared; wave.IsActive = false; WavePreview.UpdateWave(null, -1); foreach (Transform enemy in EnemiesParent) { Destroy(enemy.gameObject); } } _currWave = snapshot.Wave; ResetWaveStatus(); foreach (var tower in _activeTowers.Keys) { Destroy(tower); } foreach (var tower in snapshot.Towers) { RegisterTower(TowerBase.FromSnapshot(tower)); } Items.Clear(); Inventory.ResetItems(); foreach (var item in snapshot.Items) { AddItem(ItemBase.FromSnapshot(item)); } TowerDetails.UpdateTarget(null, false); EnemyDetails.UpdateTarget(null, false); _snapshot = snapshot; _isLoading = false; } IsPaused = false; }
// Changes the countText and checks for end of game void setCountText() { countText.text = "Score: " + count.ToString(); if (checkEnd()) { end = true; SaveUtils.SaveTrial(); deactivateEnemies(); } }
/// <summary> /// Called when a scene is exiting. Should not actually exit the scene /// </summary> public virtual void ExitScene() { Debug.Log("Exiting scene: "); if (AutoCommit) { Commit(); } if (AutosaveOnExit) { SaveUtils.DoAutoSave(); } }
// this bad boy is called before the timer disables and returns the // player back to the main menu. Adds all the statistice to each list. public void AddHistoryEntry() { difficultyHistory.Add(difficulty); timeLimitHistory.Add(timeLimit); scoreHistory.Add(score); ballNum = CalculateBallNum(); numberOfBallsHistory.Add(ballNum); SaveUtils.SaveTrial(); // when returning to menu the game title displays this oldScore = score; }
IEnumerator BeginGenerativePhase() { makingSongState.Post(gameObject); if (gameMode != GameMode.ViewPreviousReadings && !DEBUG_SaveReadingImmediately) { SaveUtils.SaveReading(new SavedReading( System.DateTime.Now.Ticks, cardsSelectedToDeal.ToArray(), cardMeanings, false )); } generativeUI.SetMeanings(cardMeanings); float t = 0; CanvasGroup readingGroup = spreadCanvas.GetComponent <CanvasGroup>(); if (readingGroup != null) { while (t < 1.0) { t += Time.deltaTime / cardFlipSpeed; readingGroup.alpha = 1 - t; yield return(null); } } foreach (TarotCardData card in selectedCardData) { foreach (ParticleSystem ps in sparks) { float GetColorFromCardOrder(int order) { return(order < 7 ? ((order + 78) * 3) / 255f : (order * 3) / 255f); } Color particleColor = new Color32(); particleColor.r = GetColorFromCardOrder(selectedCardData[0].order); particleColor.g = GetColorFromCardOrder(selectedCardData[1].order); particleColor.b = GetColorFromCardOrder(selectedCardData[2].order); particleColor.a = 255; ParticleSystem.MainModule ma = ps.main; ma.startColor = particleColor; ps.Play(); } } Cursor.SetCursor(waitCursor, Vector2.zero, CursorMode.Auto); yield return(StartCoroutine(generativeUI.FadeIn())); yield return(StartCoroutine(generativeUI.ReadText())); Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); SetGameState(GameState.ShowingGenerativeUITransitionalText); }
private void toolStripSave_Click(object sender, EventArgs e) { var allItems = GetSelecetedLists(); allItems.ContextName = SpContext.ContextName; allItems.ModelFoler = SpContext.ModelFolder; allItems.NamespaceString = SpContext.NamespaceString; if (saveFile.ShowDialog() == System.Windows.Forms.DialogResult.OK) { SaveUtils saveUtil = new SaveUtils(); saveUtil.SaveInfo(allItems, saveFile.FileName); } }
public override IEnumerable <PassDetails> Passes() { SetupPass(); SaveUtils.DoSave = true; SaveUtils.WorldName = "PERF-TEST_SERIALISATION_SUITE"; yield return(EndPass("SerialisationOn")); if (Directory.Exists(SaveUtils.CurrentWorldSaveDirectory)) { SaveUtils.DeleteSave(SaveUtils.WorldName); } SaveUtils.DoSave = false; }
protected void HandleQuicksave() { if (AllowQuicksaveInScene && UnityEngine.Input.GetKeyDown(ConfigState.Instance.QuicksaveKey)) { SaveUtils.DoQuickSave(); return; } if (UnityEngine.Input.GetKeyDown(ConfigState.Instance.QuickloadKey)) { SaveUtils.DoQuickLoad(); return; } }
public void OnClickContinue() { var save = SaveUtils.GetLastSave(); if (save != null) { SharedUtils.LoadGame(save, false); } else { Modal.PushMessageModal(Sub.Replace("ContinueNoSaveMessage", "IGUI_SAVE"), Sub.Replace("ContinueNoSaveHeading", "IGUI_SAVE"), null, null); } }
public void DeleteSavedReading() { if (readingToDelete != null) { savedReadings.Remove(readingToDelete); SaveUtils.SaveReadings(savedReadings); Init(gameRunner); } else { Debug.LogError("tried to delete a saved reading when one wasn't set"); } }
void OnTriggerEnter(Collider other) { Debug.Log("Finish!"); mover.velocity = 0; mover.active = false; SaveUtils.SaveTrial(); if (!hasInstantiated) { Instantiate(endCanvas); hasInstantiated = true; } }
public void AutoSave() { // Save scene SaveSystem.SetString(SaveUtils.GetKey(SaveUtils.GAME_MAN_PREFIX, SaveUtils.GAMEMAN_SCENE_NAME_KEY), SceneManager.GetActiveScene().name); //print("Scene saved"); // Save player pos/rot Vector3 playerPos = PlayerT.position; float playerRot = PlayerT.rotation.eulerAngles.y; SaveSystem.SetFloat(SaveUtils.GetKey(SaveUtils.PLAYER_TRANS_PREFIX, SaveUtils.PLAYER_X_KEY), playerPos.x); SaveSystem.SetFloat(SaveUtils.GetKey(SaveUtils.PLAYER_TRANS_PREFIX, SaveUtils.PLAYER_Y_KEY), playerPos.y); SaveSystem.SetFloat(SaveUtils.GetKey(SaveUtils.PLAYER_TRANS_PREFIX, SaveUtils.PLAYER_Z_KEY), playerPos.z); SaveSystem.SetFloat(SaveUtils.GetKey(SaveUtils.PLAYER_TRANS_PREFIX, SaveUtils.PLAYER_ROT_KEY), playerRot); //print("Player pos/rot saved"); // Save player health and camera rotation CharController.Save(SaveSystem, SaveUtils.CHAR_CONTROLLER_PREFIX); //print("Health and cam rot saved"); // Save player progress PlayerManager.Save(SaveSystem, SaveUtils.PLAYER_MAN_PREFIX); //print("Player progress saved"); // Save AI manager AIManager.Save(SaveSystem, SaveUtils.AI_MAN_PREFIX); //print("AI manager saved"); // TODO: better way to save levelmanagers. // Save GraveyardMan if (GraveyardManager != null) { //print("GraveyardMan not null, saving"); GraveyardManager.Save(SaveSystem, SaveUtils.GRAVEYARD_MAN_PREFIX); //print("GraveyardMan saved"); } // Save CastelMan if (CastleManager != null) { //print("CastleMan not null, saving"); CastleManager.Save(SaveSystem, SaveUtils.CASTLE_MAN_PREFIX); //print("CastleMan saved"); } //print("Calling savesystem to actually save shit"); SaveSystem.Save(SaveUtils.AUTOSAVE_SAVE_SLOT); //print("game saved"); }
public void Save(ISave saveSystem, string keyPrefix) { saveSystem.SetBool(SaveUtils.GetKey(keyPrefix, SaveUtils.GRAVEYARD_SPAWN_SKELETON_BOSS_1_KEY), spawnSkeletonBoss1); for (int i = 0; i < maxHealthIncreases.Length; i++) { saveSystem.SetBool(SaveUtils.GetKey(keyPrefix, string.Format(SaveUtils.GRAVEYARD_SPAWN_MAX_HEALTH_INCREASE_KEY, i)), spawnMaxHealtIncreases[i]); } for (int i = 0; i < gateLockedInfo.Count; i++) { bool isOpen = gateLockedInfo[(GateType)i]; saveSystem.SetBool(SaveUtils.GetKey(keyPrefix, string.Format(SaveUtils.GRAVEYARD_GATE_OPEN_KEY, i)), isOpen); } }
public void HandleSaveButtonClicked() { //technically, it's a quicksave! SaveUtils.DoQuickSave(); //TODO save indicator, probably will use the same as quicksave and autosave //close the menu if (MainPanel.activeSelf) { MainPanel.SetActive(false); DoUnpause(); } }
public void Load(ISave saveSystem, string keyPrefix) { Scene currentScene = SceneManager.GetActiveScene(); if (currentScene.name.Equals(GlobalVariables.CASTLE)) { if (GameMan.Instance.CastleManager.UseStartPos) { return; } } float rotY = saveSystem.GetFloat(SaveUtils.GetKey(keyPrefix, SaveUtils.CAMERA_ROT_Y_KEY), transform.rotation.eulerAngles.y); transform.rotation = Quaternion.Euler(0f, rotY, 0f); }
public void Load(ISave saveSystem, string keyPrefix) { spawnSkeletonBoss1 = saveSystem.GetBool(SaveUtils.GetKey(keyPrefix, SaveUtils.GRAVEYARD_SPAWN_SKELETON_BOSS_1_KEY), true); for (int i = 0; i < maxHealthIncreases.Length; i++) { spawnMaxHealtIncreases[i] = saveSystem.GetBool(SaveUtils.GetKey(keyPrefix, string.Format(SaveUtils.GRAVEYARD_SPAWN_MAX_HEALTH_INCREASE_KEY, i)), true); } gateLockedInfo.Clear(); for (int i = 0; i < Enum.GetNames(typeof(GateType)).Length; i++) { bool isOpen = saveSystem.GetBool(SaveUtils.GetKey(keyPrefix, string.Format(SaveUtils.GRAVEYARD_GATE_OPEN_KEY, i)), true); gateLockedInfo.Add((GateType)i, isOpen); } }
public void Load() { var path = Path.Combine(SaveUtils.GetCurrentSaveDataDir(), DeathRun.SaveFile); if (!File.Exists(path)) { CattleLogger.Message("Death Run data not found - using defaults"); setDefaults(); return; } try { var save = File.ReadAllText(path); var jsonSerializerSettings = new JsonSerializerSettings { MissingMemberHandling = MissingMemberHandling.Ignore, NullValueHandling = NullValueHandling.Ignore, //PreserveReferencesHandling = PreserveReferencesHandling.Objects, }; //var json = JsonConvert.DeserializeObject<DeathRunSaveData>(save, jsonSerializerSettings); //this.exampleString = json.exampleString; //this.exampleData = json.exampleData; // This deserializes the whole saveData object all at once. DeathRun.saveData = JsonConvert.DeserializeObject <DeathRunSaveData>(save, jsonSerializerSettings); DeathRun.saveData.countSave.JustLoadedGame(); DeathRun.saveData.playerSave.JustLoadedGame(); // Special escape-pod re-adjustments EscapePod_FixedUpdate_Patch.JustLoadedGame(); DeathRunUtils.JustLoadedGame(); } catch (Exception e) { CattleLogger.GenericError(e); CattleLogger.Message("Death Run data not found - using defaults"); CattleLogger.Message(e.StackTrace); setDefaults(); } }
public void HandleReloadButtonClicked() { string saveName = SaveUtils.GetLastSave(); if (string.IsNullOrEmpty(saveName)) { Modal.PushConfirmModal("There is no previous save to load", "Save Not Found", "Main Menu", "Close", null, (status, tag, result) => { if (result) { SharedUtils.EndGame(); } }); } else { SharedUtils.LoadGame(saveName, false); } }