mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-19 15:51:54 +00:00
Fix ambiguous patch exception
This commit is contained in:
1 parent
f55036efbc
commit
bbdbd5bec8
1 file changed
+8
-1
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
@@ -8,9 +10,14 @@ namespace Reactor.Patches.Fixes;
|
||||
/// <summary>
|
||||
/// "Fixes" an issue where empty TextBoxes have wrong cursor positions.
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(TextMeshProExtensions), nameof(TextMeshProExtensions.CursorPos))]
|
||||
[HarmonyPatch]
|
||||
internal static class CursorPosPatch
|
||||
{
|
||||
public static IEnumerable<MethodBase> TargetMethods()
|
||||
{
|
||||
return AccessTools.GetDeclaredMethods(typeof(TextMeshProExtensions)).Where(m => m.Name == nameof(TextMeshProExtensions.CursorPos));
|
||||
}
|
||||
|
||||
public static bool Prefix(TextMeshPro self, ref Vector2 __result)
|
||||
{
|
||||
if (self.textInfo == null || self.textInfo.lineCount == 0 || self.textInfo.lineInfo[0].characterCount <= 0)
|
||||
|
||||
Reference in new issue
Block a user