using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.InteropTypes;
using Microsoft.CodeAnalysis;
using Rewired;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
[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("SoDQuickMenu")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("SoDQuickMenu")]
[assembly: AssemblyTitle("SoDQuickMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 SoDQuickMenu
{
[BepInPlugin("sm3gm.sod.quickmenu", "Quick Menu", "1.0.2")]
public sealed class Plugin : BasePlugin
{
public const string VER = "1.0.2";
internal static ManualLogSource L;
internal static ConfigEntry<KeyCode> OpenKey;
internal static ConfigEntry<bool> UsePad;
internal static ConfigEntry<string> Style;
public override void Load()
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
L = ((BasePlugin)this).Log;
OpenKey = ((BasePlugin)this).Config.Bind<KeyCode>("Controls", "OpenKey", (KeyCode)103, "Opens and closes the quick menu.");
UsePad = ((BasePlugin)this).Config.Bind<bool>("Controls", "DPadDown", true, "D-pad Down on a controller opens and closes the quick menu.");
Style = ((BasePlugin)this).Config.Bind<string>("Look", "Style", "Red", "Red: deep red with a pink edge. Game: the navy and maroon colours of the game's case board tabs. Both use the game's menu font.");
((BasePlugin)this).AddComponent<Menu>();
ManualLogSource l = L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Quick Menu ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.2");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded");
}
l.LogInfo(val);
}
}
internal sealed class Entry
{
public string Id = "";
public Func<string?> Label = () => (string?)null;
public Action Run = delegate
{
};
}
public class Menu : MonoBehaviour
{
private static readonly List<Entry> all = new List<Entry>();
private static bool scanned;
private readonly List<Entry> shown = new List<Entry>();
private readonly List<(Image bg, TextMeshProUGUI text, Outline edge)> slots = new List<(Image, TextMeshProUGUI, Outline)>();
private GameObject? root;
private TextMeshProUGUI? hint;
private TextMeshProUGUI? title;
private bool open;
private bool savedInput;
private bool savedVisible;
private bool froze;
private bool restoring;
private CursorLockMode savedLock;
private int pick = -1;
private int padDown = -1;
private float openedAt;
private Vector2 mouseAtOpen;
private EventSystem? heldEvents;
private bool savedNav;
private static Color Panel = new Color(0.08f, 0.06f, 0.1f, 0.92f);
private static Color Lit = new Color(0.78f, 0.16f, 0.3f, 0.97f);
private static Color Edge = new Color(1f, 0.55f, 0.65f, 1f);
private static Color EdgeDim = new Color(0.85f, 0.25f, 0.4f, 0.55f);
private static Color Ink = Color.white;
private static Color InkLit = Color.white;
private static bool themed;
private float watchUntil;
private int lastSeen = -1;
private static Sprite? shape;
private static int shapeTries;
private static TMP_FontAsset? font;
public Menu(IntPtr ptr)
: base(ptr)
{
}
private void Update()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)Player.Instance == (Object)null || !Playing())
{
if (open)
{
Close();
}
return;
}
if (restoring && !AnyHeld())
{
Restore();
}
Watch();
bool flag = Keys.Down(Plugin.OpenKey.Value) && !Typing() && (Desktop() || !Busy(pad: false));
if (Plugin.UsePad.Value && PadDown())
{
flag |= open || PadFree();
}
if (flag)
{
if (open)
{
Close();
}
else
{
Open();
}
}
else if (open)
{
Steer();
}
}
catch (Exception ex)
{
Plugin.L.LogWarning((object)("[QUICK] " + ex.Message));
if (open)
{
Close();
}
}
}
private static bool Playing()
{
try
{
SessionData instance = SessionData.Instance;
if ((Object)(object)instance == (Object)null || !instance.startedGame || instance.isCityEdit || instance.isFloorEdit)
{
return false;
}
MainMenuController instance2 = MainMenuController.Instance;
return (Object)(object)instance2 == (Object)null || !instance2.mainMenuActive;
}
catch
{
return false;
}
}
private static bool Desktop()
{
InterfaceController instance = InterfaceController.Instance;
if ((Object)(object)instance != (Object)null)
{
return instance.desktopMode;
}
return false;
}
private static bool Busy(bool pad)
{
Player instance = Player.Instance;
if ((Object)(object)instance == (Object)null)
{
return true;
}
try
{
if (instance.computerInteractable != null || instance.isCrunchingDatabase)
{
return true;
}
if (!pad)
{
return false;
}
if (instance.searchInteractable != null || instance.phoneInteractable != null || instance.isLockpicking || instance.transitionActive || instance.genericActionInteractable != null)
{
return true;
}
InteractionController instance2 = InteractionController.Instance;
object obj;
if (instance2 == null)
{
obj = null;
}
else
{
InteractableController currentLookingAtInteractable = instance2.currentLookingAtInteractable;
obj = ((currentLookingAtInteractable != null) ? currentLookingAtInteractable.interactable : null);
}
Evidence val = ((obj != null) ? ((Interactable)obj).evidence : null);
if (val != null && ((Il2CppObjectBase)val).TryCast<EvidenceMultiPage>() != null)
{
return true;
}
return false;
}
catch
{
return false;
}
}
private static bool PadFree()
{
if (Desktop() || Busy(pad: true))
{
return false;
}
try
{
if ((Object)(object)BioScreenController.Instance != (Object)null && BioScreenController.Instance.isOpen)
{
return false;
}
}
catch
{
}
try
{
if ((Object)(object)InteractionController.Instance != (Object)null && InteractionController.Instance.dialogMode)
{
return false;
}
}
catch
{
}
EventSystem current = EventSystem.current;
return (Object)(object)((current != null) ? current.currentSelectedGameObject : null) == (Object)null;
}
private static bool AnyHeld()
{
Joystick val = Pad();
if (val != null && (((Controller)val).GetButton(0) || ((Controller)val).GetButton(1)))
{
return true;
}
if (!Input.GetMouseButton(0) && !Input.GetMouseButton(1))
{
return Keys.Held((KeyCode)13);
}
return true;
}
private static bool Typing()
{
EventSystem current = EventSystem.current;
GameObject val = ((current != null) ? current.currentSelectedGameObject : null);
if ((Object)(object)val != (Object)null)
{
if (!((Object)(object)val.GetComponent<TMP_InputField>() != (Object)null))
{
return (Object)(object)val.GetComponent<InputField>() != (Object)null;
}
return true;
}
return false;
}
private static void Scan()
{
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Expected O, but got Unknown
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Expected O, but got Unknown
if (scanned)
{
return;
}
scanned = true;
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
bool flag = default(bool);
foreach (Assembly assembly in assemblies)
{
Type[] types;
try
{
types = assembly.GetTypes();
}
catch
{
continue;
}
Type[] array = types;
foreach (Type type in array)
{
if (type.Name != "QuickMenuHook")
{
continue;
}
try
{
if (!(type.GetMethod("Entries", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(null, null) is IEnumerable<(string, Func<string>, Action)> enumerable))
{
continue;
}
int num = 0;
foreach (var (id, label, run) in enumerable)
{
all.Add(new Entry
{
Id = id,
Label = label,
Run = run
});
num++;
}
ManualLogSource l = Plugin.L;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[QUICK] ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" entries from ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(assembly.GetName().Name);
}
l.LogInfo(val);
}
catch (Exception ex)
{
ManualLogSource l2 = Plugin.L;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(10, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[QUICK] ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(assembly.GetName().Name);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
l2.LogWarning(val2);
}
}
}
}
private void Open()
{
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Expected O, but got Unknown
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
Scan();
shown.Clear();
foreach (Entry item in all)
{
string value = null;
try
{
value = item.Label();
}
catch
{
}
if (!string.IsNullOrEmpty(value))
{
shown.Add(item);
}
}
Build();
open = true;
openedAt = Time.unscaledTime;
pick = -1;
EventSystem current2 = EventSystem.current;
if ((Object)(object)current2 != (Object)null)
{
heldEvents = current2;
savedNav = current2.sendNavigationEvents;
current2.sendNavigationEvents = false;
current2.SetSelectedGameObject((GameObject)null);
}
Vector3 mousePosition = Input.mousePosition;
mouseAtOpen = new Vector2(mousePosition.x, mousePosition.y);
root.SetActive(true);
InputController instance = InputController.Instance;
if ((Object)(object)instance != (Object)null)
{
if (!restoring)
{
savedInput = instance.enableInput;
}
instance.enableInput = false;
}
restoring = false;
froze = !Desktop();
if (froze)
{
Player.Instance.EnablePlayerMovement(false, true);
Player.Instance.EnablePlayerMouseLook(false, false);
savedVisible = Cursor.visible;
savedLock = Cursor.lockState;
Cursor.visible = true;
Cursor.lockState = (CursorLockMode)0;
}
ManualLogSource l = Plugin.L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(28, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[QUICK] opened with ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(shown.Count);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" entries");
}
l.LogInfo(val);
}
private void Close()
{
open = false;
if ((Object)(object)root != (Object)null)
{
root.SetActive(false);
}
try
{
restoring = true;
}
catch
{
}
}
private void Restore()
{
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Expected O, but got Unknown
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
restoring = false;
if ((Object)(object)heldEvents != (Object)null)
{
try
{
heldEvents.sendNavigationEvents = savedNav;
}
catch
{
}
heldEvents = null;
}
InputController instance = InputController.Instance;
bool flag = (Object)(object)instance != (Object)null && instance.enableInput;
if (froze)
{
savedInput = true;
}
if ((Object)(object)instance != (Object)null)
{
instance.enableInput = savedInput;
}
if (froze && (Object)(object)Player.Instance != (Object)null)
{
Player.Instance.EnablePlayerMovement(true, true);
Player.Instance.EnablePlayerMouseLook(true, false);
Cursor.visible = savedVisible;
Cursor.lockState = savedLock;
}
froze = false;
ManualLogSource l = Plugin.L;
bool flag2 = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(33, 2, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[QUICK] controls back: input ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(flag);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(savedInput);
}
l.LogInfo(val);
watchUntil = Time.unscaledTime + 10f;
lastSeen = -1;
}
private void Watch()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
if (Time.unscaledTime > watchUntil)
{
return;
}
InputController instance = InputController.Instance;
int num = (((Object)(object)instance == (Object)null) ? (-1) : (instance.enableInput ? 1 : 0));
if (num == lastSeen)
{
return;
}
if (lastSeen != -1)
{
ManualLogSource l = Plugin.L;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[QUICK] input is now ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((num == 1) ? "on" : "off");
}
l.LogInfo(val);
}
lastSeen = num;
}
private void Steer()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0316: Expected O, but got Unknown
//IL_0070: 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)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: 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)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Expected O, but got Unknown
int count = shown.Count;
Vector2 val = Vector2.zero;
Joystick val2 = Pad();
if (val2 != null)
{
Vector2 val3 = default(Vector2);
((Vector2)(ref val3))..ctor(((ControllerWithAxes)val2).GetAxisRaw(0), ((ControllerWithAxes)val2).GetAxisRaw(1));
Vector2 val4 = default(Vector2);
((Vector2)(ref val4))..ctor(((ControllerWithAxes)val2).GetAxisRaw(2), ((ControllerWithAxes)val2).GetAxisRaw(3));
val = ((((Vector2)(ref val4)).sqrMagnitude > ((Vector2)(ref val3)).sqrMagnitude) ? val4 : val3);
if (((Vector2)(ref val)).sqrMagnitude < 0.25f)
{
val = Vector2.zero;
}
}
Vector3 mousePosition = Input.mousePosition;
if (val == Vector2.zero)
{
Vector2 val5 = new Vector2(mousePosition.x, mousePosition.y) - mouseAtOpen;
if (((Vector2)(ref val5)).magnitude > 12f)
{
Vector2 val6 = default(Vector2);
((Vector2)(ref val6))..ctor(mousePosition.x - (float)Screen.width * 0.5f, mousePosition.y - (float)Screen.height * 0.5f);
if (((Vector2)(ref val6)).magnitude > (float)Screen.height * 0.08f)
{
val = val6;
}
}
}
if (count > 0 && val != Vector2.zero)
{
float num = Mathf.Atan2(val.x, val.y) * 57.29578f;
if (num < 0f)
{
num += 360f;
}
pick = Mathf.RoundToInt(num / (360f / (float)count)) % count;
}
for (int i = 0; i < slots.Count; i++)
{
bool flag = i == pick;
((Graphic)slots[i].bg).color = (flag ? Lit : Panel);
((Shadow)slots[i].edge).effectColor = (flag ? Edge : EdgeDim);
((Graphic)slots[i].text).color = (flag ? InkLit : Ink);
((Transform)((Graphic)slots[i].bg).rectTransform).localScale = Vector3.one * (flag ? 1.08f : 1f);
}
if (Time.unscaledTime - openedAt < 0.15f)
{
return;
}
bool flag2 = (val2 != null && ((Controller)val2).GetButtonDown(0)) || Input.GetMouseButtonDown(0) || Keys.Down((KeyCode)13);
if ((val2 != null && ((Controller)val2).GetButtonDown(1)) || Keys.Down((KeyCode)27) || Input.GetMouseButtonDown(1))
{
Close();
}
else
{
if (!flag2 || pick < 0 || pick >= count)
{
return;
}
Entry entry = shown[pick];
Close();
bool flag3 = default(bool);
try
{
entry.Run();
ManualLogSource l = Plugin.L;
BepInExInfoLogInterpolatedStringHandler val7 = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag3);
if (flag3)
{
((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("[QUICK] ran '");
((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<string>(entry.Id);
((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("'");
}
l.LogInfo(val7);
}
catch (Exception ex)
{
ManualLogSource l2 = Plugin.L;
BepInExWarningLogInterpolatedStringHandler val8 = new BepInExWarningLogInterpolatedStringHandler(19, 2, ref flag3);
if (flag3)
{
((BepInExLogInterpolatedStringHandler)val8).AppendLiteral("[QUICK] '");
((BepInExLogInterpolatedStringHandler)val8).AppendFormatted<string>(entry.Id);
((BepInExLogInterpolatedStringHandler)val8).AppendLiteral("' failed: ");
((BepInExLogInterpolatedStringHandler)val8).AppendFormatted<string>(ex.Message);
}
l2.LogWarning(val8);
}
}
}
private static Joystick? Pad()
{
try
{
ControllerHelper controllers = ReInput.controllers;
int num = 0;
while (controllers != null && num < 8)
{
Joystick joystick = controllers.GetJoystick(num);
if (joystick != null)
{
return joystick;
}
num++;
}
}
catch
{
}
return null;
}
private bool PadDown()
{
Joystick val = Pad();
if (val == null)
{
return false;
}
if (padDown < 0)
{
for (int i = 0; i < ((Controller)val).buttonCount; i++)
{
string text = "";
try
{
text = ((Element)((Controller)val).Buttons[i]).elementIdentifier.name;
}
catch
{
}
if (text.Replace(" ", "").Equals("D-PadDown", StringComparison.OrdinalIgnoreCase))
{
padDown = i;
break;
}
}
}
if (padDown >= 0)
{
return ((Controller)val).GetButtonDown(padDown);
}
return false;
}
private void Build()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_0364: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)root == (Object)null)
{
Theme();
root = new GameObject("SoDQuickMenu");
Object.DontDestroyOnLoad((Object)(object)root);
Canvas obj = root.AddComponent<Canvas>();
obj.renderMode = (RenderMode)0;
obj.sortingOrder = 5000;
CanvasScaler obj2 = root.AddComponent<CanvasScaler>();
obj2.uiScaleMode = (ScaleMode)1;
obj2.referenceResolution = new Vector2(1920f, 1080f);
obj2.matchWidthOrHeight = 1f;
root.AddComponent<GraphicRaycaster>();
RectTransform obj3 = Box(root.transform, "Shade", Vector2.zero, Vector2.zero, new Color(0f, 0f, 0f, 0.45f));
obj3.anchorMin = Vector2.zero;
obj3.anchorMax = Vector2.one;
hint = Text(root.transform, "Hint", Vector2.zero, new Vector2(520f, 120f), 26f);
title = Text(root.transform, "Title", Vector2.zero, new Vector2(600f, 70f), 44f);
((TMP_Text)title).text = "QUICK MENU";
((Graphic)title).color = Edge;
((Graphic)hint).color = Ink;
}
foreach (var slot in slots)
{
if ((Object)(object)slot.bg != (Object)null)
{
Object.Destroy((Object)(object)((Component)slot.bg).gameObject);
}
}
slots.Clear();
int count = shown.Count;
float num = ((count <= 2) ? 200f : 300f);
for (int i = 0; i < count; i++)
{
float num2 = (float)i * (360f / (float)count) * (MathF.PI / 180f);
Vector2 pos = new Vector2(Mathf.Sin(num2), Mathf.Cos(num2)) * num;
RectTransform obj4 = Box(root.transform, "Entry" + i, pos, new Vector2(340f, 84f), Panel);
Image component = ((Component)obj4).GetComponent<Image>();
Sprite val = Shape();
if ((Object)(object)val != (Object)null)
{
component.sprite = val;
component.type = (Type)1;
}
Outline val2 = ((Component)obj4).gameObject.AddComponent<Outline>();
((Shadow)val2).effectColor = EdgeDim;
((Shadow)val2).effectDistance = new Vector2(3f, -3f);
TextMeshProUGUI val3 = Text((Transform)(object)obj4, "Label", Vector2.zero, new Vector2(320f, 76f), 30f);
string text = "";
try
{
text = shown[i].Label() ?? "";
}
catch
{
}
((TMP_Text)val3).text = text;
slots.Add((component, val3, val2));
}
((TMP_Text)title).rectTransform.anchoredPosition = new Vector2(0f, num + 120f);
((TMP_Text)hint).rectTransform.anchoredPosition = new Vector2(0f, 0f - num - 120f);
((TMP_Text)hint).text = ((count == 0) ? "Nothing to do here right now" : "Point with a stick or the mouse\nA or click to use, B to close");
}
private static void Theme()
{
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: 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_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Expected O, but got Unknown
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Expected O, but got Unknown
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Invalid comparison between Unknown and I4
if (themed)
{
return;
}
themed = true;
bool flag = string.Equals(Plugin.Style.Value, "Game", StringComparison.OrdinalIgnoreCase);
try
{
ButtonController val = null;
int num = -1;
string text = "";
foreach (ButtonController item in Resources.FindObjectsOfTypeAll<ButtonController>())
{
if (!((Object)(object)item == (Object)null) && !((Object)(object)item.background == (Object)null) && !((Object)(object)item.background.sprite == (Object)null) && !((Object)(object)item.text == (Object)null) && !((Object)(object)((TMP_Text)item.text).font == (Object)null))
{
string text2 = Path(((Component)item).transform);
string text3 = text2.ToLowerInvariant();
int num2 = 0;
if (text3.Contains("menu"))
{
num2 += 4;
}
if (text3.Contains("mainmenu") || text3.Contains("pause"))
{
num2 += 4;
}
if ((int)item.background.type == 1)
{
num2 += 2;
}
if (text3.Contains("evidence") || text3.Contains("case") || text3.Contains("window"))
{
num2 -= 3;
}
if (num2 > num)
{
val = item;
num = num2;
text = text2;
}
}
}
if ((Object)(object)val == (Object)null)
{
Plugin.L.LogInfo((object)"[QUICK] no game menu button found, keeping the red look");
return;
}
font = ((TMP_Text)val.text).font;
bool flag2 = default(bool);
BepInExInfoLogInterpolatedStringHandler val2;
if (!flag)
{
ManualLogSource l = Plugin.L;
val2 = new BepInExInfoLogInterpolatedStringHandler(46, 2, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[QUICK] red look with the game font '");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)font).name);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' from '");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'");
}
l.LogInfo(val2);
return;
}
Color color = ((Graphic)val.background).color;
Panel = new Color(0.1f, 0.07f, 0.22f, 0.94f);
Lit = new Color(0.4f, 0.08f, 0.2f, 0.97f);
Ink = (InkLit = Color.white);
Edge = new Color(1f, 0.42f, 0.58f, 1f);
EdgeDim = new Color(0.6f, 0.16f, 0.24f, 0.8f);
Color color2 = ((Graphic)val.text).color;
shape = val.background.sprite;
font = ((TMP_Text)val.text).font;
ManualLogSource l2 = Plugin.L;
val2 = new BepInExInfoLogInterpolatedStringHandler(73, 7, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[QUICK] game look from '");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' score ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": panel ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Color>(color);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", text ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Color>(color2);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", lit ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Color>(Lit);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", sprite '");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)shape).name);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("', font '");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)font).name);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("'");
}
l2.LogInfo(val2);
}
catch (Exception ex)
{
Plugin.L.LogWarning((object)("[QUICK] game look failed, keeping the red look: " + ex.Message));
}
}
private static string Path(Transform t)
{
string text = ((Object)t).name;
for (int i = 0; i < 6; i++)
{
if (!((Object)(object)t.parent != (Object)null))
{
break;
}
t = t.parent;
text = ((Object)t).name + "/" + text;
}
return text;
}
private static Sprite? Shape()
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Invalid comparison between Unknown and I4
//IL_006b: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
if ((Object)(object)shape != (Object)null || shapeTries++ > 20)
{
return shape;
}
try
{
bool flag = default(bool);
foreach (Image item in Object.FindObjectsOfType<Image>())
{
if ((Object)(object)item == (Object)null || (Object)(object)item.sprite == (Object)null || (int)item.type != 1)
{
continue;
}
Vector4 border = item.sprite.border;
if (!(((Vector4)(ref border)).sqrMagnitude < 1f) && !((Object)(object)((Component)item).GetComponentInParent<Button>() == (Object)null))
{
shape = item.sprite;
ManualLogSource l = Plugin.L;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(31, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[QUICK] button shape '");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)shape).name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' from '");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)item).gameObject).name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'");
}
l.LogInfo(val);
break;
}
}
}
catch
{
}
return shape;
}
private static RectTransform Box(Transform parent, string name, Vector2 pos, Vector2 size, Color c)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0029: 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_0030: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name);
RectTransform obj = val.AddComponent<RectTransform>();
((Transform)obj).SetParent(parent, false);
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(0.5f, 0.5f);
obj.pivot = val2;
Vector2 anchorMin = (obj.anchorMax = val2);
obj.anchorMin = anchorMin;
obj.anchoredPosition = pos;
obj.sizeDelta = size;
((Graphic)val.AddComponent<Image>()).color = c;
return obj;
}
private static TextMeshProUGUI Text(Transform parent, string name, Vector2 pos, Vector2 size, float fontSize)
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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_008a: 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_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)font == (Object)null)
{
foreach (TextMeshProUGUI item in Object.FindObjectsOfType<TextMeshProUGUI>())
{
if ((Object)(object)item != (Object)null && (Object)(object)((TMP_Text)item).font != (Object)null)
{
font = ((TMP_Text)item).font;
break;
}
}
}
GameObject val = new GameObject(name);
RectTransform obj = val.AddComponent<RectTransform>();
((Transform)obj).SetParent(parent, false);
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor(0.5f, 0.5f);
obj.pivot = val2;
Vector2 anchorMin = (obj.anchorMax = val2);
obj.anchorMin = anchorMin;
obj.anchoredPosition = pos;
obj.sizeDelta = size;
TextMeshProUGUI val4 = val.AddComponent<TextMeshProUGUI>();
if ((Object)(object)font != (Object)null)
{
((TMP_Text)val4).font = font;
}
((TMP_Text)val4).fontSize = fontSize;
((TMP_Text)val4).enableAutoSizing = true;
((TMP_Text)val4).fontSizeMin = 12f;
((TMP_Text)val4).fontSizeMax = fontSize;
((TMP_Text)val4).alignment = (TextAlignmentOptions)514;
((Graphic)val4).color = Color.white;
((Graphic)val4).raycastTarget = false;
return val4;
}
}
internal static class Keys
{
private static MethodInfo? down;
private static MethodInfo? held;
private static bool looked;
internal static bool Down(KeyCode k)
{
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
if (!looked)
{
looked = true;
Type type = Type.GetType("UnityEngine.Input, UnityEngine.InputLegacyModule");
down = type?.GetMethod("GetKeyDown", new Type[1] { typeof(KeyCode) });
held = type?.GetMethod("GetKey", new Type[1] { typeof(KeyCode) });
if (down == null)
{
Plugin.L.LogWarning((object)"[QUICK] keyboard not found, only the controller opens the menu");
}
}
if (down != null)
{
return (bool)down.Invoke(null, new object[1] { k });
}
return false;
}
internal static bool Held(KeyCode k)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
Down((KeyCode)0);
if (held != null)
{
return (bool)held.Invoke(null, new object[1] { k });
}
return false;
}
}
}