feat: handling for when the player does not have the dlc

This commit is contained in:
FreezeDriedMangoes 2022-05-22 11:19:57 -04:00
parent a42ef6f46a
commit 3ec36b7b18
2 changed files with 17 additions and 5 deletions

View File

@ -31,20 +31,24 @@ namespace NewHorizons.Handlers
{
randomizer = new System.Random();
GetComponent<CanvasGroup>().alpha = 1;
graphic = GetComponent<Graphic>();
image = GetComponent<UnityEngine.UI.Image>();
graphic.enabled = true;
image.enabled = true;
if (!Main.HasDLC) image.sprite = null; // Just in case. I don't know how not having the dlc changes the subtitle game object
if (!eoteSubtitleHasBeenInserted)
{
// TODO: only insert if hasDLC
possibleSubtitles.Insert(0, image.sprite); // ensure that the Echoes of the Eye subtitle always appears first
if (image.sprite != null) possibleSubtitles.Insert(0, image.sprite); // ensure that the Echoes of the Eye subtitle always appears first
eoteSubtitleHasBeenInserted = true;
}
}
public static void AddSubtitle(IModBehaviour mod, string filepath)
{
var tex = ImageUtilities.GetTexture(mod, filepath);
if (tex == null) return;
@ -60,6 +64,8 @@ namespace NewHorizons.Handlers
public void Update()
{
if (image.sprite == null) image.sprite = possibleSubtitles[0];
// don't fade transition subtitles if there's only one subtitle
if (possibleSubtitles.Count <= 1) return;

View File

@ -14,9 +14,15 @@ namespace NewHorizons.Handlers
public static void InitSubtitles()
{
GameObject subtitleContainer = GameObject.Find("TitleMenu/TitleCanvas/TitleLayoutGroup/Logo_EchoesOfTheEye");
subtitleContainer.AddComponent<SubtitlesHandler>();
if (subtitleContainer == null)
{
Logger.LogError("No subtitle container found! Failed to load subtitles.");
return;
}
// TODO: if no subtitleContainer found, make one
subtitleContainer.SetActive(true);
subtitleContainer.AddComponent<SubtitlesHandler>();
}
public static void DisplayBodyOnTitleScreen(List<NewHorizonsBody> bodies)