add an event

This commit is contained in:
Noah Pilarski 2025-02-15 03:31:14 -05:00
parent c493db6883
commit cfaa0dc55a
4 changed files with 16 additions and 0 deletions

View File

@ -91,6 +91,15 @@ namespace NewHorizons.Handlers
// default to displaying nh planets if no title screen builders // default to displaying nh planets if no title screen builders
else else
DisplayBodiesOnTitleScreen(); DisplayBodiesOnTitleScreen();
try
{
Main.Instance.OnTitleScreenLoaded?.Invoke();
}
catch (Exception e)
{
NHLogger.LogError($"Error in event handler for OnTitleScreenLoaded: {e}");
}
} }
public static void InitSubtitles() public static void InitSubtitles()

View File

@ -73,6 +73,11 @@ namespace NewHorizons
/// Gives the name of the planet that was just loaded. /// Gives the name of the planet that was just loaded.
/// </summary> /// </summary>
UnityEvent<string> GetBodyLoadedEvent(); UnityEvent<string> GetBodyLoadedEvent();
/// <summary>
/// An event invoked when NH has finished building the title screen.
/// </summary>
UnityEvent GetTitleScreenLoadedEvent();
#endregion #endregion
#region Querying configs #region Querying configs

View File

@ -111,6 +111,7 @@ namespace NewHorizons
public StarSystemEvent OnChangeStarSystem = new(); public StarSystemEvent OnChangeStarSystem = new();
public StarSystemEvent OnStarSystemLoaded = new(); public StarSystemEvent OnStarSystemLoaded = new();
public StarSystemEvent OnPlanetLoaded = new(); public StarSystemEvent OnPlanetLoaded = new();
public UnityEvent OnTitleScreenLoaded = new();
/// <summary> /// <summary>
/// Depending on platform, the AsyncOwnershipStatus might not be ready by the time we go to check it. /// Depending on platform, the AsyncOwnershipStatus might not be ready by the time we go to check it.

View File

@ -90,6 +90,7 @@ namespace NewHorizons
public UnityEvent<string> GetChangeStarSystemEvent() => Main.Instance.OnChangeStarSystem; public UnityEvent<string> GetChangeStarSystemEvent() => Main.Instance.OnChangeStarSystem;
public UnityEvent<string> GetStarSystemLoadedEvent() => Main.Instance.OnStarSystemLoaded; public UnityEvent<string> GetStarSystemLoadedEvent() => Main.Instance.OnStarSystemLoaded;
public UnityEvent<string> GetBodyLoadedEvent() => Main.Instance.OnPlanetLoaded; public UnityEvent<string> GetBodyLoadedEvent() => Main.Instance.OnPlanetLoaded;
public UnityEvent GetTitleScreenLoadedEvent() => Main.Instance.OnTitleScreenLoaded;
public bool SetDefaultSystem(string name) public bool SetDefaultSystem(string name)
{ {