using ADOFAIRenderer.Core;
using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game;
///
/// Hides the end-screen lanterns again right after the game shows them.
///
/// Patched member: scrUIController.ShowEndscreenLanterns(), which calls EndscreenLanterns.Show for each player's
/// lantern set (and fades the end-screen flash in co-op). scrController.OnLandOnPortal calls it on a win.
///
///
/// Active while (stage >= OnScene). Works together with ,
/// which already skips EndscreenLanterns.Show during a render.
///
///
[HarmonyPatch(typeof(scrUIController))]
// ReSharper disable once InconsistentNaming
public class scrUIControllerPatch
{
///
/// Postfix of scrUIController.ShowEndscreenLanterns: calls HideEndscreenLanterns(), which runs
/// EndscreenLanterns.Hide on every lantern set.
///
/// The UI controller.
[HarmonyPostfix]
[HarmonyPatch("ShowEndscreenLanterns")]
// ReSharper disable once InconsistentNaming
public static void PreventEndscreenLanternsPostfix(scrUIController __instance)
{
if (RenderManager.IsActive && __instance != null)
{
__instance.HideEndscreenLanterns();
}
}
}