private static void LoadPerSaveOptions() { Logger.LogInformation($"per save options file path: {SkillPrestigeMod.CurrentSaveOptionsPath}"); if (!File.Exists(SkillPrestigeMod.CurrentSaveOptionsPath)) { SetupPerSaveOptionsFile(); } var settings = new JsonSerializerSettings { ContractResolver = new PrivateSetterContractResolver() }; Logger.LogInformation("Deserializing per save options file..."); try { _instance = JsonConvert.DeserializeObject <PerSaveOptions>(File.ReadAllText(SkillPrestigeMod.CurrentSaveOptionsPath), settings); if (Instance.CostOfTierOnePrestige <= 0) { Logger.LogWarning("Tier one prestige cost loaded without value, defaulting to a cost of 1."); Instance.CostOfTierOnePrestige = 1; } if (Instance.CostOfTierTwoPrestige <= 0) { Logger.LogWarning("Tier two prestige cost loaded without value, defaulting to a cost of 2."); Instance.CostOfTierTwoPrestige = 2; } } catch (Exception ex) { Logger.LogError($"Error deserializing per-save options file. {Environment.NewLine}{ex.Message}{Environment.NewLine}{ex.StackTrace}"); Logger.LogInformation(" Attempting to create new per-save options file..."); SetupPerSaveOptionsFile(); } Logger.LogInformation("Per save options loaded."); }
private static void ReturnToTitle(object sender, EventArgs args) { PrestigeSaveData.Instance.Read(); SaveIsLoaded = false; Logger.LogInformation("Return To Title."); PerSaveOptions.ClearLoadedPerSaveOptionsFile(); ExperienceHandler.ResetExperience(); }
public static void ClearLoadedPerSaveOptionsFile() { _instance = null; }
private static void LoadPerSaveOptions() { Logger.LogInformation($"per save options file path: {SkillPrestigeMod.PerSaveOptionsPath}"); _instance = SkillPrestigeMod.ModHelper.ReadJsonFile <PerSaveOptions>(SkillPrestigeMod.PerSaveOptionsPath) ?? SetupPerSaveOptionsFile(); }