SHA256
41 lines
1.8 KiB
C#
41 lines
1.8 KiB
C#
using ADOFAIRenderer.Core;
|
|
using HarmonyLib;
|
|
|
|
namespace ADOFAIRenderer.Patch.Game;
|
|
|
|
/// <summary>
|
|
/// Hides the "press any key to begin" text of the first level start of a render.
|
|
/// <para>
|
|
/// Patched member: <c>scrPressToStart.ShowText()</c>, which sets the press/tap-to-begin text and shows the difficulty
|
|
/// selector (<c>scrUIController.ShowDifficultyContainer</c>). <c>scrController</c> calls it before waiting for the start input.
|
|
/// </para>
|
|
/// <para>
|
|
/// Active once per render: <c>RenderManager.skipPressToStart</c> is set when the render loads <c>scnGame</c> and cleared by
|
|
/// the first ShowText call (or when the render stops). Later ShowText calls run the original.
|
|
/// </para>
|
|
/// </summary>
|
|
[HarmonyPatch(typeof(scrPressToStart))]
|
|
// ReSharper disable once InconsistentNaming
|
|
public class scrPressToStartPatch
|
|
{
|
|
/// <summary>
|
|
/// Prefix of <c>scrPressToStart.ShowText</c>. When <c>skipPressToStart</c> is set, clears it, hides the difficulty
|
|
/// selector and skips the original.
|
|
/// </summary>
|
|
/// <returns>True to run the original method; false to skip it (first ShowText of a render).</returns>
|
|
[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;
|
|
}
|
|
} |