using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Cleverous.Prodigy.Input;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Tableflip;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MikhailKillsZombies")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright (c) 2026 MikhailKillsZombies")]
[assembly: AssemblyFileVersion("0.3.1.0")]
[assembly: AssemblyInformationalVersion("0.3.1")]
[assembly: AssemblyProduct("mikhailkillszombies.FateQuickSpell")]
[assembly: AssemblyTitle("mikhailkillszombies.FateQuickSpell")]
[assembly: AssemblyVersion("0.3.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace MikhailKillsZombies.FateQuickSpell
{
[BepInPlugin("mikhailkillszombies.fate.quickspell", "FATE Quick Spell", "0.3.1")]
public sealed class QuickSpellPlugin : BaseUnityPlugin
{
private sealed class Driver : MonoBehaviour
{
private bool failed;
private void Start()
{
Log("driver running.");
}
private void Update()
{
QuickSpellPlugin active = QuickSpellPlugin.active;
if (active == null)
{
Log("driver has no plugin instance.");
((Behaviour)this).enabled = false;
return;
}
try
{
active.Tick();
}
catch (Exception ex)
{
if (!failed)
{
failed = true;
Warn("driver tick failed: " + ex);
}
}
}
private void LateUpdate()
{
active?.Guard();
}
private void OnApplicationFocus(bool focused)
{
active?.Focus(focused);
}
private void OnDestroy()
{
active?.Shutdown();
}
}
public const string Guid = "mikhailkillszombies.fate.quickspell";
private const float Hysteresis = 0.12f;
private const float TravelDecay = 0.02f;
private const float PanelGrace = 0.35f;
private static QuickSpellPlugin active;
private static ManualLogSource log;
private static Driver driver;
private Harmony harmony;
private ConfigEntry<bool> modEnabled;
private ConfigEntry<float> flick;
private ConfigEntry<bool> debug;
private bool stopped;
private float nextStepLog;
private static bool aimingJoined;
private static bool cursorGuarded;
private bool open;
private Vector2 travel;
private Vector2 lastPointer;
private bool pointerKnown;
private int selected = -1;
private SpellbookRadialUI panel;
private float holdingSince = -1f;
private bool wasHolding;
private int lastFrame = -1;
private bool cursorSaved;
private bool arrowWasActive;
private bool cursorVisible;
private CursorLockMode cursorLock;
private Vector2 pointerHome;
private static CursorManager cursorManager;
private static PropertyInfo virtualCursor;
private static readonly FieldRef<SpellbookRadialUI, SpellSlot[]> Slots = AccessTools.FieldRefAccess<SpellbookRadialUI, SpellSlot[]>("spellSlots");
private static FieldRef<PlayerUI, SpellbookRadialUI> wheelField;
private void Awake()
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
active = this;
log = ((BaseUnityPlugin)this).Logger;
modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Pick spells by the direction of the mouse. Off leaves the game's own click-to-select wheel alone.");
flick = ((BaseUnityPlugin)this).Config.Bind<float>("Wheel", "FlickPixels", 28f, "How far the mouse must travel, in pixels, before a direction is chosen. Lower picks a spell sooner; higher needs a more deliberate flick.");
debug = ((BaseUnityPlugin)this).Config.Bind<bool>("Wheel", "Diagnostics", true, "Log each wheel hold and the spell it picks. Turn off once it works.");
harmony = new Harmony("mikhailkillszombies.fate.quickspell");
Patch("OnTweenOutBegin", "Closing");
JoinAiming();
EnsureDriver();
SceneManager.sceneLoaded += delegate
{
EnsureDriver();
};
((BaseUnityPlugin)this).Logger.LogInfo((object)"FATE Quick Spell 0.3.1 ready; hold the spell wheel key, flick the mouse, release.");
}
private void Patch(string method, string prefix = null, string postfix = null)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
try
{
MethodInfo methodInfo = AccessTools.Method(typeof(SpellbookRadialUI), method, Type.EmptyTypes, (Type[])null);
if (methodInfo == null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("SpellbookRadialUI." + method + " is missing; that part of the wheel is off."));
return;
}
harmony.Patch((MethodBase)methodInfo, (prefix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(typeof(QuickSpellPlugin), prefix, (Type[])null)
{
priority = 600
}, (postfix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(typeof(QuickSpellPlugin), postfix, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not patch SpellbookRadialUI." + method + ": " + ex.Message));
}
}
private void JoinAiming()
{
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
try
{
Type type = AccessTools.TypeByName("MikhailKillsZombies.FateAiming.AimingPlugin+Driver");
if (type == null)
{
Log("FATE Aiming is not installed; the wheel hides the cursor on its own.");
return;
}
string[] obj = new string[4] { "RestoreGameCursor", "PlaceCursorRect", "PinCursorRect", "ForceCursorVisible" };
int num = 0;
string[] array = obj;
foreach (string text in array)
{
MethodInfo methodInfo = AccessTools.Method(type, text, (Type[])null, (Type[])null);
if (!(methodInfo == null))
{
harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(QuickSpellPlugin), "AimingCursor", (Type[])null)
{
priority = 600
}, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
num++;
}
}
aimingJoined = num > 0;
if (aimingJoined)
{
Log("FATE Aiming found: its cursor handling stands down while the wheel is held (" + num + " hooks).");
}
else
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"FATE Aiming is loaded but its cursor methods moved; the wheel hides the cursor on its own.");
}
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not join FATE Aiming's cursor handling: " + ex.Message));
}
}
private static bool AimingCursor()
{
return !cursorGuarded;
}
private static void EnsureDriver()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
if (!((Object)(object)driver != (Object)null))
{
GameObject val = new GameObject("FATE.QuickSpellDriver");
Object.DontDestroyOnLoad((Object)val);
driver = val.AddComponent<Driver>();
Log("driver attached.");
}
}
internal static void Log(string message)
{
ManualLogSource obj = log;
if (obj != null)
{
obj.LogInfo((object)message);
}
}
internal static void Warn(string message)
{
ManualLogSource obj = log;
if (obj != null)
{
obj.LogWarning((object)message);
}
}
private static void Closing(SpellbookRadialUI __instance)
{
QuickSpellPlugin quickSpellPlugin = active;
if (quickSpellPlugin != null)
{
InputBroker instance = SingletonBehaviour<InputBroker>.Instance;
quickSpellPlugin.Finish((Object)(object)instance == (Object)null || !instance.HoldingSpellWheel);
}
}
private static bool MouseMode()
{
if (Gamepad.current == null)
{
return Joystick.current == null;
}
return false;
}
private void Tick()
{
InputBroker instance = SingletonBehaviour<InputBroker>.Instance;
bool flag = (Object)(object)instance != (Object)null && instance.HoldingSpellWheel;
if (flag != wasHolding)
{
wasHolding = flag;
if (debug.Value)
{
Log("wheel key " + (flag ? "down" : "up") + ".");
}
}
if (!flag)
{
holdingSince = -1f;
if (open)
{
Finish(commit: true);
}
return;
}
if (!open)
{
Begin();
}
if (open)
{
StepFrame();
}
}
private SpellbookRadialUI Panel()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
Scene scene;
if ((Object)(object)panel != (Object)null && (Object)(object)((Component)panel).gameObject != (Object)null)
{
scene = ((Component)panel).gameObject.scene;
if (((Scene)(ref scene)).IsValid())
{
return panel;
}
}
panel = null;
try
{
PlayerUI instance = SimpleSingletonBehaviour<PlayerUI>.Instance;
if ((Object)(object)instance != (Object)null)
{
wheelField = wheelField ?? AccessTools.FieldRefAccess<PlayerUI, SpellbookRadialUI>("spellWheelUI");
panel = wheelField.Invoke(instance);
}
}
catch
{
}
if ((Object)(object)panel == (Object)null)
{
Object[] array = Resources.FindObjectsOfTypeAll(typeof(SpellbookRadialUI));
foreach (Object obj2 in array)
{
SpellbookRadialUI val = (SpellbookRadialUI)(object)((obj2 is SpellbookRadialUI) ? obj2 : null);
if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null)
{
continue;
}
scene = ((Component)val).gameObject.scene;
if (((Scene)(ref scene)).IsValid())
{
panel = val;
if (((Behaviour)val).isActiveAndEnabled)
{
break;
}
}
}
}
return panel;
}
private void Begin()
{
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
if (!modEnabled.Value)
{
if (debug.Value)
{
Log("wheel key held with the mod switched off.");
}
return;
}
if (!MouseMode())
{
if (debug.Value)
{
Log("a controller is connected; the mod stays out of the wheel.");
}
return;
}
SpellbookRadialUI val = Panel();
if ((Object)(object)val == (Object)null)
{
if (holdingSince < 0f)
{
holdingSince = Time.unscaledTime;
}
if (!(Time.unscaledTime - holdingSince < 0.35f))
{
Warn("wheel key held but no spell wheel panel was found; the mod stays out of it.");
}
return;
}
SpellSlot[] array = Slots.Invoke(val);
if (array == null || array.Length == 0)
{
Warn("wheel opened with no slots; nothing to pick.");
return;
}
open = true;
travel = Vector2.zero;
selected = -1;
HidePointer();
List<SpellData> list = Wheel();
if (debug.Value)
{
Log("hold started: spells=" + (list?.Count ?? 0) + ", slots=" + array.Length + ", panel " + (((Behaviour)val).isActiveAndEnabled ? "up" : "not up") + ".");
}
Player playerChar = Player.PlayerChar;
SpellData val2 = (((Object)(object)playerChar == (Object)null) ? null : ((Character)playerChar).GetActiveSpell);
if ((Object)(object)val2 == (Object)null)
{
return;
}
List<SpellData> activeSpellWheel = playerChar.ActiveSpellWheel;
for (int i = 0; i < array.Length; i++)
{
if (!((Object)(object)array[i] == (Object)null) && ((Component)array[i]).gameObject.activeSelf && array[i].ActiveSpell == val2 && (activeSpellWheel == null || (i < activeSpellWheel.Count && !((Object)(object)activeSpellWheel[i] == (Object)null))))
{
Highlight(array[i], i);
break;
}
}
}
private void StepFrame()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Unknown result type (might be due to invalid IL or missing references)
if (lastFrame == Time.frameCount)
{
return;
}
lastFrame = Time.frameCount;
SpellbookRadialUI val = panel;
if ((Object)(object)val == (Object)null)
{
return;
}
Mouse current = Mouse.current;
if (current == null)
{
return;
}
Vector2 val2 = ((InputControl<Vector2>)(object)((Pointer)current).position).ReadValue();
if (!pointerKnown)
{
lastPointer = val2;
pointerKnown = true;
}
Vector2 val3 = val2 - lastPointer;
lastPointer = val2;
float num = (float)Screen.width * 0.2f;
if (((Vector2)(ref val3)).sqrMagnitude > num * num)
{
val3 = Vector2.zero;
}
travel = travel * Mathf.Pow(0.02f, Time.unscaledDeltaTime) + val3;
PinPointer();
SpellSlot[] array = Slots.Invoke(val);
if (array == null || array.Length == 0)
{
return;
}
if (debug.Value && Time.unscaledTime >= nextStepLog)
{
nextStepLog = Time.unscaledTime + 0.5f;
List<SpellData> list = Wheel();
Log("wheel: travel=" + ((Vector2)(ref travel)).magnitude.ToString("0.0") + "px needs " + flick.Value.ToString("0.0") + ", slots=" + array.Length + ", spells=" + (list?.Count ?? 0));
}
if (((Vector2)(ref travel)).magnitude < flick.Value)
{
return;
}
Vector2 normalized = ((Vector2)(ref travel)).normalized;
Vector2 val4 = Centre(array);
List<SpellData> list2 = Wheel();
int num2 = -1;
float num3 = -1f;
for (int i = 0; i < array.Length; i++)
{
SpellSlot val5 = array[i];
if ((Object)(object)val5 == (Object)null || (Object)(object)val5.ActiveSpell == (Object)null || !((Component)val5).gameObject.activeSelf || (list2 != null && (i >= list2.Count || (Object)(object)list2[i] == (Object)null)))
{
continue;
}
Vector2 val6 = new Vector2(((Component)val5).transform.position.x, ((Component)val5).transform.position.y) - val4;
if (!(((Vector2)(ref val6)).sqrMagnitude < 1f))
{
float num4 = Vector2.Dot(((Vector2)(ref val6)).normalized, normalized);
if (!(num4 <= num3))
{
num3 = num4;
num2 = i;
}
}
}
if (num2 < 0 || num2 == selected)
{
return;
}
if (selected >= 0 && selected < array.Length && (Object)(object)array[selected] != (Object)null)
{
Vector2 val7 = new Vector2(((Component)array[selected]).transform.position.x, ((Component)array[selected]).transform.position.y) - val4;
if (((Vector2)(ref val7)).sqrMagnitude >= 1f && Vector2.Dot(((Vector2)(ref val7)).normalized, normalized) >= num3 - 0.12f)
{
return;
}
}
Highlight(array[num2], num2);
}
private static List<SpellData> Wheel()
{
Player playerChar = Player.PlayerChar;
if (!((Object)(object)playerChar == (Object)null))
{
return playerChar.ActiveSpellWheel;
}
return null;
}
private static Vector2 Centre(SpellSlot[] slots)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = Vector2.zero;
int num = 0;
for (int i = 0; i < slots.Length; i++)
{
if (!((Object)(object)slots[i] == (Object)null) && ((Component)slots[i]).gameObject.activeSelf)
{
val += new Vector2(((Component)slots[i]).transform.position.x, ((Component)slots[i]).transform.position.y);
num++;
}
}
if (num != 0)
{
return val / (float)num;
}
return val;
}
private void Highlight(SpellSlot slot, int index)
{
selected = index;
try
{
UtilityTG.SetSelected(((Component)slot).gameObject);
}
catch
{
}
if (debug.Value)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("Spell wheel: slot " + index + " (" + (((Object)(object)slot.ActiveSpell == (Object)null) ? "empty" : slot.ActiveSpell.spellName) + ")."));
}
}
private void Finish(bool commit)
{
if (!open)
{
return;
}
open = false;
pointerKnown = false;
int num = selected;
selected = -1;
RestorePointer();
if (!commit || num < 0)
{
return;
}
Player playerChar = Player.PlayerChar;
List<SpellData> list = (((Object)(object)playerChar == (Object)null) ? null : playerChar.ActiveSpellWheel);
if ((Object)(object)playerChar == (Object)null || list == null || num >= list.Count)
{
return;
}
SpellData val = list[num];
if ((Object)(object)val == (Object)null)
{
return;
}
try
{
if (((Character)playerChar).SetActiveSpell(val))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("Spell wheel picked " + val.spellName + "."));
}
else
{
((BaseUnityPlugin)this).Logger.LogInfo((object)("Could not switch to " + val.spellName + "; the active spell is unchanged."));
}
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)("Spell switch failed: " + ex.Message));
}
}
internal void Guard()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Invalid comparison between Unknown and I4
if (!open)
{
return;
}
try
{
if (Cursor.visible)
{
Cursor.visible = false;
}
RectTransform val = CursorRect();
if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf)
{
((Component)val).gameObject.SetActive(false);
}
if ((int)Cursor.lockState == 1)
{
Cursor.lockState = (CursorLockMode)2;
}
}
catch
{
}
}
private void Focus(bool focused)
{
if (!focused && open)
{
Finish(commit: false);
}
}
private void Shutdown()
{
if (!stopped)
{
stopped = true;
if (open)
{
Finish(commit: false);
}
Harmony obj = harmony;
if (obj != null)
{
obj.UnpatchSelf();
}
}
}
private void HidePointer()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if (cursorSaved)
{
return;
}
cursorSaved = true;
cursorGuarded = true;
Mouse current = Mouse.current;
pointerHome = ((current == null) ? Vector2.zero : ((InputControl<Vector2>)(object)((Pointer)current).position).ReadValue());
cursorVisible = Cursor.visible;
cursorLock = Cursor.lockState;
Cursor.visible = false;
Cursor.lockState = (CursorLockMode)2;
arrowWasActive = false;
RectTransform val = CursorRect();
if ((Object)(object)val != (Object)null)
{
arrowWasActive = ((Component)val).gameObject.activeSelf;
if (arrowWasActive)
{
((Component)val).gameObject.SetActive(false);
}
}
pointerKnown = false;
PinPointer();
}
private void PinPointer()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Invalid comparison between Unknown and I4
Mouse current = Mouse.current;
if (current != null)
{
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(Mathf.Round((float)Screen.width * 0.5f), Mathf.Round((float)Screen.height * 0.5f));
current.WarpCursorPosition(val);
lastPointer = val;
pointerKnown = true;
Cursor.visible = false;
if ((int)Cursor.lockState == 1)
{
Cursor.lockState = (CursorLockMode)2;
}
}
}
private void RestorePointer()
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Invalid comparison between Unknown and I4
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
if (cursorSaved)
{
cursorSaved = false;
RectTransform val = CursorRect();
if ((Object)(object)val != (Object)null && arrowWasActive)
{
((Component)val).gameObject.SetActive(true);
((Transform)val).position = new Vector3(pointerHome.x, pointerHome.y, 0f);
}
arrowWasActive = false;
Mouse current = Mouse.current;
if (current != null)
{
current.WarpCursorPosition(pointerHome);
Cursor.visible = false;
Cursor.lockState = (CursorLockMode)2;
}
Cursor.visible = cursorVisible;
Cursor.lockState = (CursorLockMode)(((int)cursorLock == 1) ? 2 : ((int)cursorLock));
cursorGuarded = false;
}
}
private static RectTransform CursorRect()
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
try
{
virtualCursor = virtualCursor ?? typeof(CursorManager).GetProperty("VirtualCursor", BindingFlags.Instance | BindingFlags.Public);
if (virtualCursor == null)
{
return null;
}
Scene scene;
if (!((Object)(object)cursorManager == (Object)null) && !((Object)(object)((Component)cursorManager).gameObject == (Object)null))
{
scene = ((Component)cursorManager).gameObject.scene;
if (((Scene)(ref scene)).IsValid())
{
goto IL_00fb;
}
}
cursorManager = null;
Object[] array = Resources.FindObjectsOfTypeAll(typeof(CursorManager));
foreach (Object obj in array)
{
CursorManager val = (CursorManager)(object)((obj is CursorManager) ? obj : null);
if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null)
{
continue;
}
scene = ((Component)val).gameObject.scene;
if (((Scene)(ref scene)).IsValid())
{
if ((Object)(object)cursorManager == (Object)null)
{
cursorManager = val;
}
if (((Component)val).gameObject.activeInHierarchy)
{
cursorManager = val;
break;
}
}
}
goto IL_00fb;
IL_00fb:
return (RectTransform)(((Object)(object)cursorManager == (Object)null) ? null : /*isinst with value type is only supported in some contexts*/);
}
catch
{
return null;
}
}
}
}