public static void Postfix(MainMenu __instance) { string currentSave = __instance.Button_ResumeGame.GetComponentsInChildren <LocText>()[1].text; const int not_Auto_Save = -1; if (!string.IsNullOrEmpty(currentSave)) { string latestSaveFile = SaveLoader.GetLatestSaveFile(); string auto_save_path = Path.GetDirectoryName(SaveLoader.GetAutosaveFilePath()); if (latestSaveFile.IndexOf(auto_save_path) == not_Auto_Save && latestSaveFile.IndexOf("auto_save") == not_Auto_Save) { //Debug.Log("================== MANUAL SAVE DETECTED =================== \n" + latestSaveFile); __instance.Button_ResumeGame.GetComponentsInChildren <LocText>()[1].text = "Manual Save - " + currentSave; } else { __instance.Button_ResumeGame.GetComponentsInChildren <LocText>()[1].text = "Auto Save - " + currentSave; //Debug.Log("================== AUTO SAVE DETECTED =================== \n" + latestSaveFile); }; } }
private void RefreshResumeButton() { string latestSaveFile = SaveLoader.GetLatestSaveFile(); bool flag = !string.IsNullOrEmpty(latestSaveFile) && File.Exists(latestSaveFile); if (flag) { try { if (GenericGameSettings.instance.demoMode) { flag = false; } System.DateTime lastWriteTime = File.GetLastWriteTime(latestSaveFile); SaveFileEntry value = default(SaveFileEntry); SaveGame.Header header = default(SaveGame.Header); SaveGame.GameInfo gameInfo = default(SaveGame.GameInfo); if (!saveFileEntries.TryGetValue(latestSaveFile, out value) || value.timeStamp != lastWriteTime) { gameInfo = SaveLoader.LoadHeader(latestSaveFile, out header); SaveFileEntry saveFileEntry = default(SaveFileEntry); saveFileEntry.timeStamp = lastWriteTime; saveFileEntry.header = header; saveFileEntry.headerData = gameInfo; value = saveFileEntry; saveFileEntries[latestSaveFile] = value; } else { header = value.header; gameInfo = value.headerData; } if (header.buildVersion > 365655 || gameInfo.saveMajorVersion < 7) { flag = false; } string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(latestSaveFile); if (!string.IsNullOrEmpty(gameInfo.baseName)) { Button_ResumeGame.GetComponentsInChildren <LocText>()[1].text = string.Format(UI.FRONTEND.MAINMENU.RESUMEBUTTON_BASENAME, gameInfo.baseName, gameInfo.numberOfCycles + 1); } else { Button_ResumeGame.GetComponentsInChildren <LocText>()[1].text = fileNameWithoutExtension; } } catch (Exception obj) { Debug.LogWarning(obj); flag = false; } } if ((UnityEngine.Object)Button_ResumeGame != (UnityEngine.Object)null && (UnityEngine.Object)Button_ResumeGame.gameObject != (UnityEngine.Object)null) { Button_ResumeGame.gameObject.SetActive(flag); } else { Debug.LogWarning("Why is the resume game button null?"); } }
private void ResumeGame() { string text = (!string.IsNullOrEmpty(GenericGameSettings.instance.performanceCapture.saveGame)) ? GenericGameSettings.instance.performanceCapture.saveGame : SaveLoader.GetLatestSaveFile(); if (!string.IsNullOrEmpty(text)) { KCrashReporter.MOST_RECENT_SAVEFILE = text; SaveLoader.SetActiveSaveFilePath(text); LoadingOverlay.Load(delegate { App.LoadScene("backend"); }); } }