diff --git a/NewHorizons/Handlers/TitleSceneHandler.cs b/NewHorizons/Handlers/TitleSceneHandler.cs index 4be176c8..65d3ba30 100644 --- a/NewHorizons/Handlers/TitleSceneHandler.cs +++ b/NewHorizons/Handlers/TitleSceneHandler.cs @@ -91,15 +91,6 @@ namespace NewHorizons.Handlers // default to displaying nh planets if no title screen builders else DisplayBodiesOnTitleScreen(); - - try - { - Main.Instance.OnTitleScreenLoaded?.Invoke(); - } - catch (Exception e) - { - NHLogger.LogError($"Error in event handler for OnTitleScreenLoaded: {e}"); - } } public static void InitSubtitles() @@ -465,6 +456,15 @@ namespace NewHorizons.Handlers { NHLogger.LogError(e); } + + try + { + Main.Instance.OnTitleScreenLoaded?.Invoke(mod.ModHelper.Manifest.UniqueName); + } + catch (Exception e) + { + NHLogger.LogError($"Error in event handler for OnTitleScreenLoaded on title screen {mod.ModHelper.Manifest.UniqueName}: {e}"); + } } public IModBehaviour Mod => mod; @@ -500,6 +500,15 @@ namespace NewHorizons.Handlers { NHLogger.LogError(e); } + + try + { + Main.Instance.OnTitleScreenLoaded?.Invoke(mod.ModHelper.Manifest.UniqueName); + } + catch (Exception e) + { + NHLogger.LogError($"Error in event handler for OnTitleScreenLoaded on title screen {mod.ModHelper.Manifest.UniqueName}: {e}"); + } } public IModBehaviour Mod => mod; diff --git a/NewHorizons/INewHorizons.cs b/NewHorizons/INewHorizons.cs index 82f7509c..5031fb0f 100644 --- a/NewHorizons/INewHorizons.cs +++ b/NewHorizons/INewHorizons.cs @@ -75,9 +75,10 @@ namespace NewHorizons UnityEvent GetBodyLoadedEvent(); /// - /// An event invoked when NH has finished building the title screen. + /// An event invoked when NH has finished building a title screen. + /// Gives the unique name of the mod the title screen builder was from. /// - UnityEvent GetTitleScreenLoadedEvent(); + UnityEvent GetTitleScreenLoadedEvent(); #endregion #region Querying configs diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 25e2303d..3f25eb1d 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -107,11 +107,11 @@ namespace NewHorizons public ShipWarpController ShipWarpController { get; private set; } // API events - public class StarSystemEvent : UnityEvent { } - public StarSystemEvent OnChangeStarSystem = new(); - public StarSystemEvent OnStarSystemLoaded = new(); - public StarSystemEvent OnPlanetLoaded = new(); - public UnityEvent OnTitleScreenLoaded = new(); + public class StringEvent : UnityEvent { } + public StringEvent OnChangeStarSystem = new(); + public StringEvent OnStarSystemLoaded = new(); + public StringEvent OnPlanetLoaded = new(); + public StringEvent OnTitleScreenLoaded = new(); /// /// Depending on platform, the AsyncOwnershipStatus might not be ready by the time we go to check it. diff --git a/NewHorizons/NewHorizonsApi.cs b/NewHorizons/NewHorizonsApi.cs index ee3da69f..5293c883 100644 --- a/NewHorizons/NewHorizonsApi.cs +++ b/NewHorizons/NewHorizonsApi.cs @@ -90,7 +90,7 @@ namespace NewHorizons public UnityEvent GetChangeStarSystemEvent() => Main.Instance.OnChangeStarSystem; public UnityEvent GetStarSystemLoadedEvent() => Main.Instance.OnStarSystemLoaded; public UnityEvent GetBodyLoadedEvent() => Main.Instance.OnPlanetLoaded; - public UnityEvent GetTitleScreenLoadedEvent() => Main.Instance.OnTitleScreenLoaded; + public UnityEvent GetTitleScreenLoadedEvent() => Main.Instance.OnTitleScreenLoaded; public bool SetDefaultSystem(string name) {