mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using NewHorizons.Handlers;
|
|
using OWML.Common;
|
|
using OWML.Common.Menus;
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
namespace NewHorizons.Utility.DebugUtilities
|
|
{
|
|
public static class DebugReload
|
|
{
|
|
|
|
private static IModButton _reloadButton;
|
|
|
|
public static void InitializePauseMenu()
|
|
{
|
|
_reloadButton = Main.Instance.ModHelper.Menus.PauseMenu.OptionsButton.Duplicate(TranslationHandler.GetTranslation("Reload Configs", TranslationHandler.TextType.UI).ToUpper());
|
|
_reloadButton.OnClick += ReloadConfigs;
|
|
UpdateReloadButton();
|
|
}
|
|
|
|
public static void UpdateReloadButton()
|
|
{
|
|
if (_reloadButton != null)
|
|
{
|
|
if (Main.Debug) _reloadButton.Show();
|
|
else _reloadButton.Hide();
|
|
}
|
|
}
|
|
|
|
private static void ReloadConfigs()
|
|
{
|
|
Logger.Log("Begin reload of config files...");
|
|
|
|
Main.Instance.ResetConfigs();
|
|
|
|
try
|
|
{
|
|
foreach (IModBehaviour mountedAddon in Main.MountedAddons)
|
|
{
|
|
Main.Instance.LoadConfigs(mountedAddon);
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
Logger.LogWarning("Error While Reloading");
|
|
}
|
|
|
|
SearchUtilities.Find("/PauseMenu/PauseMenuManagers").GetComponent<PauseMenuManager>().OnSkipToNextTimeLoop();
|
|
|
|
Main.Instance.ChangeCurrentStarSystem(Main.Instance.CurrentStarSystem);
|
|
|
|
Main.SecondsElapsedInLoop = -1f;
|
|
}
|
|
}
|
|
} |