mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Add comments and start on handlers
This commit is contained in:
parent
a980eef1d3
commit
09ffa4b2bc
@ -19,6 +19,8 @@ namespace NewHorizons.Handlers
|
||||
{
|
||||
public static class TitleSceneHandler
|
||||
{
|
||||
internal static Dictionary<IModBehaviour, TitleScreenBuilder> TitleScreenBuilders = new();
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
var planetRoot = SearchUtilities.Find("Scene/Background/PlanetPivot/PlanetRoot");
|
||||
@ -41,6 +43,7 @@ namespace NewHorizons.Handlers
|
||||
profileManager.currentProfileInputJSON);
|
||||
|
||||
|
||||
// TODO: Implement handlers as well
|
||||
// TODO: Select one title screen and if it has shareTitleScreen set to true do all the other ones that have it true too.
|
||||
var (mod, config) = Main.TitleScreenConfigs.FirstOrDefault(kvp => kvp.Value.KnowsFact() && kvp.Value.HasCondition());
|
||||
if (config != null)
|
||||
@ -369,5 +372,30 @@ namespace NewHorizons.Handlers
|
||||
|
||||
return meshRenderer;
|
||||
}
|
||||
|
||||
public static void RegisterBuilder(IModBehaviour mod, Action<GameObject> builder, bool disableNHPlanets, bool shareTitleScreen, string conditionRequired, string factRequired)
|
||||
{
|
||||
TitleScreenBuilders.SafeAdd(mod, new TitleScreenBuilder(mod, builder, disableNHPlanets, shareTitleScreen, conditionRequired, factRequired));
|
||||
}
|
||||
|
||||
internal class TitleScreenBuilder
|
||||
{
|
||||
public IModBehaviour mod;
|
||||
public Action<GameObject> builder;
|
||||
public bool disableNHPlanets;
|
||||
public bool shareTitleScreen;
|
||||
public string conditionRequired;
|
||||
public string factRequired;
|
||||
|
||||
public TitleScreenBuilder(IModBehaviour mod, Action<GameObject> builder, bool disableNHPlanets, bool shareTitleScreen, string conditionRequired, string factRequired)
|
||||
{
|
||||
this.mod = mod;
|
||||
this.builder = builder;
|
||||
this.disableNHPlanets = disableNHPlanets;
|
||||
this.shareTitleScreen = shareTitleScreen;
|
||||
this.conditionRequired = conditionRequired;
|
||||
this.factRequired = factRequired;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,7 +233,16 @@ namespace NewHorizons
|
||||
/// <param name="id"></param>
|
||||
void SetNextSpawnID(string id);
|
||||
|
||||
|
||||
void RegisterTitleScreenHandler(Action<GameObject> builder, bool deleteNHPlanets = true, bool shareTitleScreen = false, string conditionRequired = null, string factRequired = null);
|
||||
/// <summary>
|
||||
/// Registers a builder for the main menu.
|
||||
/// Call this once before the main menu finishes loading
|
||||
/// </summary>
|
||||
/// <param name="mod"></param>
|
||||
/// <param name="builder">Builder to run when this title screen is selected.</param>
|
||||
/// <param name="disableNHPlanets">If set to true, NH generated planets will not show on the title screen. If false, this title screen has the same chance as other NH planet title screens to show.</param>
|
||||
/// <param name="shareTitleScreen">If set to true, this custom title screen will merge with all other custom title screens with shareTitleScreen set to true. If false, NH will randomly select between this and other valid title screens that are loaded.</param>
|
||||
/// <param name="conditionRequired">Persistent condition required for this title screen to appear.</param>
|
||||
/// <param name="factRequired">Ship log fact required for this title screen to appear.</param>
|
||||
void RegisterTitleScreenBuilder(IModBehaviour mod, Action<GameObject> builder, bool disableNHPlanets = true, bool shareTitleScreen = false, string conditionRequired = null, string factRequired = null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,10 +363,7 @@ namespace NewHorizons
|
||||
|
||||
public void SetNextSpawnID(string id) => PlayerSpawnHandler.TargetSpawnID = id;
|
||||
|
||||
// TODO: Implement
|
||||
public void RegisterTitleScreenHandler(Action<GameObject> builder, bool deleteNHPlanets = true, bool shareTitleScreen = false, string conditionRequired = null, string factRequired = null)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public void RegisterTitleScreenBuilder(IModBehaviour mod, Action<GameObject> builder, bool disableNHPlanets = true, bool shareTitleScreen = false, string conditionRequired = null, string factRequired = null)
|
||||
=> TitleSceneHandler.RegisterBuilder(mod, builder, disableNHPlanets, shareTitleScreen, conditionRequired, factRequired);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user