feat: renamed subtitleFilepath to subtitle, fixed a modulus that was supposed to be a plus, added a todo

This commit is contained in:
FreezeDriedMangoes 2022-05-22 10:21:52 -04:00
parent 4ae8d71f2c
commit e636e2a844
4 changed files with 10 additions and 17 deletions

View File

@ -4,7 +4,7 @@ namespace NewHorizons.External.Configs
{ {
public class StarSystemConfig public class StarSystemConfig
{ {
public string subtitleFilepath; public string subtitle;
[DefaultValue(true)] public bool canEnterViaWarpDrive = true; [DefaultValue(true)] public bool canEnterViaWarpDrive = true;
[DefaultValue(true)] public bool enableTimeLoop = true; [DefaultValue(true)] public bool enableTimeLoop = true;

View File

@ -1,16 +1,5 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine; 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 UnityEngine.UI;
using NewHorizons.Utility; using NewHorizons.Utility;
using OWML.Common; using OWML.Common;
@ -44,6 +33,7 @@ namespace NewHorizons.Handlers
if (!eoteSubtitleHasBeenInserted) if (!eoteSubtitleHasBeenInserted)
{ {
// TODO: only insert if hasDLC
possibleSubtitles.Insert(0, image.sprite); // ensure that the Echoes of the Eye subtitle always appears first possibleSubtitles.Insert(0, image.sprite); // ensure that the Echoes of the Eye subtitle always appears first
eoteSubtitleHasBeenInserted = true; 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) // 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. // that is, the below code will generate numbers up to and including Count-1, not Count.
var newIndexOffset = randomizer.Next(1, possibleSubtitles.Count); var newIndexOffset = randomizer.Next(1, possibleSubtitles.Count);
subtitleIndex = (subtitleIndex % newIndexOffset) % possibleSubtitles.Count; subtitleIndex = (subtitleIndex + newIndexOffset) % possibleSubtitles.Count;
NewHorizons.Utility.Logger.Log("NEW SPRITE INDEX OFFSET " + newIndexOffset + " NEW SPRITE INDEX " + subtitleIndex);
image.sprite = possibleSubtitles[subtitleIndex]; image.sprite = possibleSubtitles[subtitleIndex];
} }

View File

@ -15,6 +15,8 @@ namespace NewHorizons.Handlers
{ {
GameObject subtitleContainer = GameObject.Find("TitleMenu/TitleCanvas/TitleLayoutGroup/Logo_EchoesOfTheEye"); GameObject subtitleContainer = GameObject.Find("TitleMenu/TitleCanvas/TitleLayoutGroup/Logo_EchoesOfTheEye");
subtitleContainer.AddComponent<SubtitlesHandler>(); subtitleContainer.AddComponent<SubtitlesHandler>();
// TODO: if no subtitleContainer found, make one
} }
public static void DisplayBodyOnTitleScreen(List<NewHorizonsBody> bodies) public static void DisplayBodyOnTitleScreen(List<NewHorizonsBody> bodies)

View File

@ -314,9 +314,9 @@ namespace NewHorizons
if (name != "SolarSystem") SetDefaultSystem(name); 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); var system = new NewHorizonsSystem(name, starSystemConfig, mod);