IEnumerator Load(string filename) { while (isSaving) { yield return(null); } isBusy = true; BinaryFormatter bf = new BinaryFormatter(); FileStream file = new FileStream(GetPath(filename), FileMode.Open); object dateValue = bf.Deserialize(file); Assert.IsNotNull(dateValue); m_lastModification = Convert.ToDateTime(dateValue); // Read the game data from the buffer. Debug.LogError("This is loading"); dataKlaus.ReadFromBuffer(ref bf, ref file); file.Close(); // Set settings LanguageValueSave.UpdateLanguage(); ColorWorldManager.Instance.LoadWorldColor(); if (onGameLoaded != null) { onGameLoaded(); } isBusy = false; Debug.LogError("This is the loaded resolution " + dataKlaus.reswidth.ToString() + "x" + dataKlaus.resheight.ToString()); Debug.LogError("This is the loaded fullscreen " + dataKlaus.fullscreen); TrophiesManager.Instance.CheckLastTwoTrophies(); }
public void OnLevelWasLoaded(int level) { if (SaveManager.Instance.dataKlaus == null) { currentWorld = 0; return; } if (Application.loadedLevelName.Substring(0, 1) == "W") { SaveManager.Instance.dataKlaus.world = int.Parse(Application.loadedLevelName.Substring(1, 1)); } else { try { SaveManager.Instance.dataKlaus.world = int.Parse(SaveManager.Instance.dataKlaus.GetCurrentLevel().Substring(1, 1)); }catch { Debug.Log(SaveManager.Instance.dataKlaus.GetCurrentLevel() + " " + SaveManager.Instance.dataKlaus.GetCurrentLevel().Substring(1, 1)); } } LoadWorldColor(); LanguageValueSave.UpdateLanguage(); }