mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
30 lines
1005 B
C#
30 lines
1005 B
C#
using HarmonyLib;
|
|
|
|
namespace NewHorizons.Patches.CreditsScenePatches
|
|
{
|
|
[HarmonyPatch(typeof(CreditsEntry))]
|
|
public static class CreditsEntryPatches
|
|
{
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(nameof(CreditsEntry.SetContents))]
|
|
public static bool CreditsEntry_SetContents(CreditsEntry __instance, string[] columnTexts)
|
|
{
|
|
for (int i = 0; i < __instance._columns.Length; i++)
|
|
{
|
|
// Base method throws out of bounds exception sometimes (_columns length doesn't match columnTexts length)
|
|
// Trim also NREs sometimes because of the TrimHelper class Mobius has idk
|
|
try
|
|
{
|
|
__instance._columns[i].text = columnTexts[i].Trim();
|
|
}
|
|
catch
|
|
{
|
|
// Error occurs when column 2 is empty
|
|
__instance._columns[i].text = " ";
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|