using ADOFAIRenderer.Core;
using HarmonyLib;
namespace ADOFAIRenderer.Patch.Game;
///
/// Hides the detailed results panel (per-judgement hit counts) that the game shows on the clear screen.
///
/// Patched member: DetailedResults.Show(). The game calls it from scrController.OnLandOnPortal when a level is won
/// (and detailed results are enabled); it builds the result text per player, enables the component and activates
/// scrController.detailedResults.
///
///
/// Active while (stage >= OnScene), so the panel does not appear in the rendered video
/// during the delay after the level end.
///
///
[HarmonyPatch(typeof(DetailedResults))]
// ReSharper disable once InconsistentNaming
public static class DetailedResultsPatch
{
///
/// Prefix of DetailedResults.Show. While rendering, disables the component and deactivates its GameObject.
///
/// The DetailedResults component being shown.
/// True to run the original method (not rendering); false to skip it (rendering).
[HarmonyPrefix]
[HarmonyPatch("Show")]
// ReSharper disable once InconsistentNaming
public static bool PreventShow(DetailedResults __instance)
{
if (!RenderManager.IsActive) return true;
if (__instance)
{
__instance.enabled = false;
if (__instance.gameObject) __instance.gameObject.SetActive(false);
}
return false;
}
}