diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index f5264ba8..c9342c6e 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -36,7 +36,10 @@ namespace NewHorizons public static AssetBundle ShaderBundle; public static Main Instance { get; private set; } + // Settings public static bool Debug; + private static bool _useCustomTitleScreen; + private static bool _wasConfigured = false; public static Dictionary SystemDict = new Dictionary(); public static Dictionary> BodyDict = new Dictionary>(); @@ -63,7 +66,7 @@ namespace NewHorizons public StarSystemEvent OnChangeStarSystem; public StarSystemEvent OnStarSystemLoaded; - + // For warping to the eye system private GameObject _ship; public override object GetApi() @@ -73,9 +76,23 @@ namespace NewHorizons public override void Configure(IModConfig config) { + Logger.Log("Settings changed"); + Debug = config.GetSettingsValue("Debug"); DebugReload.UpdateReloadButton(); - Logger.UpdateLogLevel(Debug? Logger.LogType.Log : Logger.LogType.Error); + Logger.UpdateLogLevel(Debug ? Logger.LogType.Log : Logger.LogType.Error); + + var wasUsingCustomTitleScreen = _useCustomTitleScreen; + _useCustomTitleScreen = config.GetSettingsValue("Custom title screen"); + // Reload the title screen if this was updated on it + // Don't reload if we haven't configured yet (called on game start) + if (wasUsingCustomTitleScreen != _useCustomTitleScreen && SceneManager.GetActiveScene().name == "TitleScreen" && _wasConfigured) + { + Logger.Log("Reloading"); + SceneManager.LoadScene("TitleScreen", LoadSceneMode.Single); + } + + _wasConfigured = true; } public void Start() @@ -144,7 +161,7 @@ namespace NewHorizons _isChangingStarSystem = false; - if (scene.name == "TitleScreen") + if (scene.name == "TitleScreen" && _useCustomTitleScreen) { TitleSceneHandler.DisplayBodyOnTitleScreen(BodyDict.Values.ToList().SelectMany(x => x).ToList()); } diff --git a/NewHorizons/default-config.json b/NewHorizons/default-config.json index 28384587..75790651 100644 --- a/NewHorizons/default-config.json +++ b/NewHorizons/default-config.json @@ -1,6 +1,7 @@ { "enabled": true, "settings": { - "Debug": false + "Debug": false, + "Custom title screen": true } } \ No newline at end of file