Change config to a list of infos

This commit is contained in:
Noah Pilarski 2025-02-17 15:28:09 -05:00
parent d9441f5140
commit d827d6956d
3 changed files with 17 additions and 4 deletions

View File

@ -8,6 +8,15 @@ namespace NewHorizons.External.Configs
{
[JsonObject]
public class TitleScreenConfig
{
/// <summary>
/// Create title screens
/// </summary>
public TitleScreenInfo[] titleScreens;
}
[JsonObject]
public class TitleScreenInfo
{
/// <summary>
/// Colour of the text on the main menu

View File

@ -119,7 +119,7 @@ namespace NewHorizons.Handlers
subtitleContainer.AddComponent<SubtitlesHandler>();
}
public static void BuildConfig(IModBehaviour mod, TitleScreenConfig config)
public static void BuildConfig(IModBehaviour mod, TitleScreenInfo config)
{
if (config.menuTextTint != null)
{
@ -436,7 +436,7 @@ namespace NewHorizons.Handlers
TitleScreenBuilders[mod].Add(builder);
}
public static void RegisterBuilder(IModBehaviour mod, TitleScreenConfig config)
public static void RegisterBuilder(IModBehaviour mod, TitleScreenInfo config)
=> RegisterBuilder(mod,
new TitleScreenConfigBuilder(mod, config));
@ -522,9 +522,9 @@ namespace NewHorizons.Handlers
internal class TitleScreenConfigBuilder : ITitleScreenBuilder
{
public IModBehaviour mod;
public TitleScreenConfig config;
public TitleScreenInfo config;
public TitleScreenConfigBuilder(IModBehaviour mod, TitleScreenConfig config)
public TitleScreenConfigBuilder(IModBehaviour mod, TitleScreenInfo config)
{
this.mod = mod;
this.config = config;

View File

@ -860,6 +860,10 @@ namespace NewHorizons
}
TitleScreenConfigs[mod] = titleScreenConfig;
foreach (var info in titleScreenConfig.titleScreens)
{
TitleSceneHandler.RegisterBuilder(mod, info);
}
}
private void LoadTranslations(string folder, IModBehaviour mod)