using ADOFAIRenderer.Core; using HarmonyLib; namespace ADOFAIRenderer.Patch.Game; /// /// Hides the "press any key to begin" text of the first level start of a render. /// /// Patched member: scrPressToStart.ShowText(), which sets the press/tap-to-begin text and shows the difficulty /// selector (scrUIController.ShowDifficultyContainer). scrController calls it before waiting for the start input. /// /// /// Active once per render: RenderManager.skipPressToStart is set when the render loads scnGame and cleared by /// the first ShowText call (or when the render stops). Later ShowText calls run the original. /// /// [HarmonyPatch(typeof(scrPressToStart))] // ReSharper disable once InconsistentNaming public class scrPressToStartPatch { /// /// Prefix of scrPressToStart.ShowText. When skipPressToStart is set, clears it, hides the difficulty /// selector and skips the original. /// /// True to run the original method; false to skip it (first ShowText of a render). [HarmonyPrefix] [HarmonyPatch("ShowText")] private static bool PreventShowText() { if (!RenderManager.Instance || !RenderManager.Instance.skipPressToStart) return true; RenderManager.Instance.skipPressToStart = false; // scrPressToStart.ShowText ends with ShowDifficultyContainer(mode). Skipping ShowText skips that call too, // which leaves the difficulty selector active and clickable. DontShow deactivates difficultyContainer // and makes the keyboard difficulty shortcuts (difficultyUIMode != DontShow checks) do nothing. if (scrUIController.instance) scrUIController.instance.ShowDifficultyContainer(DifficultyUIMode.DontShow); return false; } }