Make a config

This commit is contained in:
xen-42 2025-01-15 16:32:58 -05:00
parent ffe41747fb
commit 3ea4a3ab2d
4 changed files with 40 additions and 0 deletions

View File

@ -44,5 +44,10 @@ namespace NewHorizons.External.Configs
/// The dimensions of the Echoes of the Eye subtitle is 669 x 67, so aim for that size /// The dimensions of the Echoes of the Eye subtitle is 669 x 67, so aim for that size
/// </summary> /// </summary>
public string subtitlePath = "subtitle.png"; public string subtitlePath = "subtitle.png";
/// <summary>
///
/// </summary>
public MainMenuConfig mainMenuConfig;
} }
} }

View File

@ -0,0 +1,19 @@
using NewHorizons.External.SerializableData;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewHorizons.External.Configs
{
[JsonObject]
public class MainMenuConfig
{
/// <summary>
/// Colour of the text on the main menu
/// </summary>
public MColor menuTextTint;
}
}

View File

@ -1,11 +1,13 @@
using NewHorizons.Builder.Body; using NewHorizons.Builder.Body;
using NewHorizons.External; using NewHorizons.External;
using NewHorizons.External.Configs;
using NewHorizons.External.Modules; using NewHorizons.External.Modules;
using NewHorizons.Utility; using NewHorizons.Utility;
using NewHorizons.Utility.OWML; using NewHorizons.Utility.OWML;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
namespace NewHorizons.Handlers namespace NewHorizons.Handlers
{ {
@ -25,6 +27,18 @@ namespace NewHorizons.Handlers
subtitleContainer.AddComponent<SubtitlesHandler>(); subtitleContainer.AddComponent<SubtitlesHandler>();
} }
public static void SetUp(MainMenuConfig config)
{
if (config.menuTextTint != null)
{
var buttons = GameObject.FindObjectOfType<TitleScreenManager>()._mainMenu.GetComponentsInChildren<Text>();
foreach (var button in buttons)
{
button.color = config.menuTextTint.ToColor();
}
}
}
public static void DisplayBodyOnTitleScreen(List<NewHorizonsBody> bodies) public static void DisplayBodyOnTitleScreen(List<NewHorizonsBody> bodies)
{ {
// Try loading one planet why not // Try loading one planet why not

View File

@ -430,6 +430,8 @@ namespace NewHorizons
NHLogger.LogError($"Failed to make title screen bodies: {e}"); NHLogger.LogError($"Failed to make title screen bodies: {e}");
} }
TitleSceneHandler.InitSubtitles(); TitleSceneHandler.InitSubtitles();
TitleSceneHandler.SetUp(new MainMenuConfig() { menuTextTint = new External.SerializableData.MColor(128, 128, 255) });
} }
// EOTU fixes // EOTU fixes