diff --git a/NewHorizons/External/Configs/StarSystemConfig.cs b/NewHorizons/External/Configs/StarSystemConfig.cs index 22201a15..9e6b902c 100644 --- a/NewHorizons/External/Configs/StarSystemConfig.cs +++ b/NewHorizons/External/Configs/StarSystemConfig.cs @@ -4,7 +4,7 @@ namespace NewHorizons.External.Configs { public class StarSystemConfig { - public string subtitleFilepath; + public string subtitle; [DefaultValue(true)] public bool canEnterViaWarpDrive = true; [DefaultValue(true)] public bool enableTimeLoop = true; diff --git a/NewHorizons/Handlers/SubtitlesHandler.cs b/NewHorizons/Handlers/SubtitlesHandler.cs index a74e753d..4bae3112 100644 --- a/NewHorizons/Handlers/SubtitlesHandler.cs +++ b/NewHorizons/Handlers/SubtitlesHandler.cs @@ -1,16 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using UnityEngine; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; -using UnityEngine.InputSystem; using UnityEngine.UI; using NewHorizons.Utility; using OWML.Common; @@ -44,6 +33,7 @@ namespace NewHorizons.Handlers if (!eoteSubtitleHasBeenInserted) { + // TODO: only insert if hasDLC possibleSubtitles.Insert(0, image.sprite); // ensure that the Echoes of the Eye subtitle always appears first eoteSubtitleHasBeenInserted = true; } @@ -103,8 +93,9 @@ namespace NewHorizons.Handlers // note, this makes the code more confusing, but Random.Next(min, max) generates a random number on the range [min, max) // that is, the below code will generate numbers up to and including Count-1, not Count. - var newIndexOffset = randomizer.Next(1, possibleSubtitles.Count); - subtitleIndex = (subtitleIndex % newIndexOffset) % possibleSubtitles.Count; + var newIndexOffset = randomizer.Next(1, possibleSubtitles.Count); + subtitleIndex = (subtitleIndex + newIndexOffset) % possibleSubtitles.Count; + NewHorizons.Utility.Logger.Log("NEW SPRITE INDEX OFFSET " + newIndexOffset + " NEW SPRITE INDEX " + subtitleIndex); image.sprite = possibleSubtitles[subtitleIndex]; } diff --git a/NewHorizons/Handlers/TitleSceneHandler.cs b/NewHorizons/Handlers/TitleSceneHandler.cs index 2b8d0740..0f3149a9 100644 --- a/NewHorizons/Handlers/TitleSceneHandler.cs +++ b/NewHorizons/Handlers/TitleSceneHandler.cs @@ -15,6 +15,8 @@ namespace NewHorizons.Handlers { GameObject subtitleContainer = GameObject.Find("TitleMenu/TitleCanvas/TitleLayoutGroup/Logo_EchoesOfTheEye"); subtitleContainer.AddComponent(); + + // TODO: if no subtitleContainer found, make one } public static void DisplayBodyOnTitleScreen(List bodies) diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 860117e8..9a45ac13 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -314,9 +314,9 @@ namespace NewHorizons if (name != "SolarSystem") SetDefaultSystem(name); } - if (starSystemConfig.subtitleFilepath != null) + if (starSystemConfig.subtitle != null) { - SubtitlesHandler.AddSubtitle(mod, starSystemConfig.subtitleFilepath); + SubtitlesHandler.AddSubtitle(mod, starSystemConfig.subtitle); } var system = new NewHorizonsSystem(name, starSystemConfig, mod);