Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MenuLibExtras v1.1.0
MenuLibExtras.dll
Decompiled a month agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using MenuLib.MonoBehaviors; using MenuLibExtras.API; using MenuLibExtras.MonoBehaviors; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MenuLibExtras")] [assembly: AssemblyDescription("Mod to expand the capabilities of MenuLib! Developed by Jettcodey.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Jettcodey")] [assembly: AssemblyProduct("MenuLibExtras")] [assembly: AssemblyCopyright("Copyright © Jettcodey 2026")] [assembly: ComVisible(false)] [assembly: Guid("eb0c4019-0285-435a-9ca6-c0221cfe49bd")] [assembly: AssemblyFileVersion("1.1.0")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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 MenuLibExtras { public static class ConfigTooltipRegistry { public static Dictionary<string, string> GlobalDescriptions = new Dictionary<string, string>(); public static void Initialize() { foreach (PluginInfo value2 in Chainloader.PluginInfos.Values) { if ((Object)(object)value2.Instance == (Object)null || value2.Instance.Config == null) { continue; } foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item in value2.Instance.Config) { ConfigEntryBase value = item.Value; if (((value != null) ? value.Description : null) != null && !string.IsNullOrWhiteSpace(value.Description.Description)) { string key = FixNaming(value.Definition.Key); GlobalDescriptions[key] = value.Description.Description.Replace("\n", " ").Trim(); } } } } public static string FixNaming(string input) { if (string.IsNullOrEmpty(input)) { return input; } input = Regex.Replace(input, "([a-z])([A-Z])", "$1 $2"); input = Regex.Replace(input, "([A-Z])([A-Z][a-z])", "$1 $2"); input = Regex.Replace(input, "\\s+", " "); input = Regex.Replace(input, "([A-Z]\\.)\\s([A-Z]\\.)", "$1$2"); return input.Trim(); } } [BepInPlugin("Jettcodey.MenuLibExtras", "MenuLibExtras", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private Harmony _harmony; public static Plugin Instance { get; private set; } internal static ManualLogSource? Logger { get; private set; } private void Awake() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); Logger = ((BaseUnityPlugin)this).Logger; ConfigTooltipRegistry.Initialize(); _harmony = new Harmony("Jettcodey.MenuLibExtras"); _harmony.PatchAll(); Logger.LogInfo((object)"Plugin MenuLibExtras v1.1.0 loaded successfully."); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Jettcodey.MenuLibExtras"; public const string PLUGIN_NAME = "MenuLibExtras"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace MenuLibExtras.Patches { [HarmonyPatch] internal static class REPOConfigResetButtonPatch { private static MethodInfo _fixNamingMethod; public static MethodBase TargetMethod() { Type type = Type.GetType("REPOConfig.ConfigMenu, REPOConfig"); if (type == null) { return null; } return AccessTools.Method(type, "CreateModEntries", (Type[])null, (Type[])null); } [HarmonyPostfix] private static void Postfix(REPOPopupPage modPage, ConfigEntryBase[] configEntryBases) { if ((Object)(object)modPage == (Object)null || configEntryBases == null) { return; } if (_fixNamingMethod == null) { Type type = Type.GetType("REPOConfig.ConfigMenu, REPOConfig"); if (type != null) { _fixNamingMethod = AccessTools.Method(type, "FixNaming", (Type[])null, (Type[])null); } } if (_fixNamingMethod == null) { return; } REPOElement[] componentsInChildren = ((Component)modPage).GetComponentsInChildren<REPOElement>(true); foreach (ConfigEntryBase val in configEntryBases) { if (val.DefaultValue == null) { continue; } string expectedName = (string)_fixNamingMethod.Invoke(null, new object[1] { val.Definition.Key }); REPOElement val2 = ((IEnumerable<REPOElement>)componentsInChildren).FirstOrDefault((Func<REPOElement, bool>)delegate(REPOElement e) { REPOToggle val3 = (REPOToggle)(object)((e is REPOToggle) ? e : null); if (val3 != null) { return (Object)(object)val3.labelTMP != (Object)null && ((TMP_Text)val3.labelTMP).text == expectedName; } REPOSlider val4 = (REPOSlider)(object)((e is REPOSlider) ? e : null); if (val4 != null) { return (Object)(object)val4.labelTMP != (Object)null && ((TMP_Text)val4.labelTMP).text == expectedName; } REPOInputField val5 = (REPOInputField)(object)((e is REPOInputField) ? e : null); return val5 != null && (Object)(object)val5.labelTMP != (Object)null && ((TMP_Text)val5.labelTMP).text == expectedName; }); if ((Object)(object)val2 != (Object)null) { AttachResetButton(val2, val); } } } private static void AttachResetButton(REPOElement element, ConfigEntryBase entry) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = null; REPOToggle val2 = (REPOToggle)(object)((element is REPOToggle) ? element : null); if (val2 != null) { val = val2.labelTMP; } else { REPOSlider val3 = (REPOSlider)(object)((element is REPOSlider) ? element : null); if (val3 != null) { val = val3.labelTMP; } else { REPOInputField val4 = (REPOInputField)(object)((element is REPOInputField) ? element : null); if (val4 != null) { val = val4.labelTMP; } } } if (!((Object)(object)val == (Object)null)) { float num = -22f; float num2 = 22f; float num3 = 22f; float num4 = 6f; float num5 = num + num2 + num4; if (num5 < 0f) { num5 = 0f; } ((TMP_Text)val).margin = new Vector4(num5, ((TMP_Text)val).margin.y, ((TMP_Text)val).margin.z, ((TMP_Text)val).margin.w); GameObject val5 = new GameObject("ResetButton", new Type[1] { typeof(RectTransform) }); val5.transform.SetParent(((TMP_Text)val).transform, false); RectTransform component = val5.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0.5f); component.anchorMax = new Vector2(0f, 0.5f); component.pivot = new Vector2(0f, 0.5f); component.anchoredPosition = new Vector2(num, 0f); component.sizeDelta = new Vector2(num2, num3); ConfigResetButton configResetButton = val5.AddComponent<ConfigResetButton>(); configResetButton.Initialize(entry, element); } } } [HarmonyPatch] internal static class REPOConfigTooltipPatch { private static MethodInfo _fixNamingMethod; public static MethodBase TargetMethod() { Type type = Type.GetType("REPOConfig.ConfigMenu, REPOConfig"); if (type == null) { return null; } return AccessTools.Method(type, "CreateModEntries", (Type[])null, (Type[])null); } [HarmonyPostfix] private static void Postfix(REPOPopupPage modPage, ConfigEntryBase[] configEntryBases) { if ((Object)(object)modPage == (Object)null || configEntryBases == null) { return; } if (_fixNamingMethod == null) { Type type = Type.GetType("REPOConfig.ConfigMenu, REPOConfig"); if (type != null) { _fixNamingMethod = AccessTools.Method(type, "FixNaming", (Type[])null, (Type[])null); } } if (_fixNamingMethod == null) { return; } REPOElement[] componentsInChildren = ((Component)modPage).GetComponentsInChildren<REPOElement>(true); foreach (ConfigEntryBase val in configEntryBases) { object value; if (val == null) { value = null; } else { ConfigDescription description = val.Description; value = ((description != null) ? description.Description : null); } if (string.IsNullOrWhiteSpace((string?)value)) { continue; } string expectedName = (string)_fixNamingMethod.Invoke(null, new object[1] { val.Definition.Key }); REPOElement val2 = ((IEnumerable<REPOElement>)componentsInChildren).FirstOrDefault((Func<REPOElement, bool>)delegate(REPOElement e) { REPOToggle val3 = (REPOToggle)(object)((e is REPOToggle) ? e : null); if (val3 != null) { return (Object)(object)val3.labelTMP != (Object)null && ((TMP_Text)val3.labelTMP).text == expectedName; } REPOSlider val4 = (REPOSlider)(object)((e is REPOSlider) ? e : null); if (val4 != null) { return (Object)(object)val4.labelTMP != (Object)null && ((TMP_Text)val4.labelTMP).text == expectedName; } REPOInputField val5 = (REPOInputField)(object)((e is REPOInputField) ? e : null); return val5 != null && (Object)(object)val5.labelTMP != (Object)null && ((TMP_Text)val5.labelTMP).text == expectedName; }); if ((Object)(object)val2 != (Object)null) { string text = val.Description.Description.Replace("\n", " ").Trim(); MenuLibExtrasAPI.AddTooltip(((Component)val2).gameObject, text); } } } } [HarmonyPatch(typeof(REPOInputStringSystem))] internal static class REPOInputStringSystemPatches { private static readonly PropertyInfo CurrentValueProp = AccessTools.Property(typeof(REPOInputStringSystem), "currentValue"); [HarmonyPatch("HandleInput")] [HarmonyPrefix] private static void HandleInput_Prefix(REPOInputStringSystem __instance) { if (__instance.currentValue == null) { CurrentValueProp.SetValue(__instance, string.Empty); } } } [HarmonyPatch(typeof(REPOLabel))] internal static class REPOLabelPatches { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake_Postfix(REPOLabel __instance) { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.labelTMP == (Object)null)) { ((TMP_Text)__instance.labelTMP).enableAutoSizing = true; ((TMP_Text)__instance.labelTMP).fontSizeMin = 20f; ((TMP_Text)__instance.labelTMP).fontSizeMax = 30f; ((TMP_Text)__instance.labelTMP).characterWidthAdjustment = 50f; } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start_Postfix(REPOLabel __instance) { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance.labelTMP == (Object)null)) { ((TMP_Text)__instance.labelTMP).ForceMeshUpdate(false, false); AdjustFontSizeIfNeeded(__instance); } } private static void AdjustFontSizeIfNeeded(REPOLabel label) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)label.labelTMP == (Object)null)) { Bounds textBounds = ((TMP_Text)label.labelTMP).textBounds; Rect rect = ((TMP_Text)label.labelTMP).rectTransform.rect; float width = ((Rect)(ref rect)).width; if (((Bounds)(ref textBounds)).size.x > width * 1.15f) { float num = width / ((Bounds)(ref textBounds)).size.x; float num2 = Mathf.Lerp(((TMP_Text)label.labelTMP).fontSizeMin, ((TMP_Text)label.labelTMP).fontSize, num * 0.9f); ((TMP_Text)label.labelTMP).fontSize = Mathf.Max(((TMP_Text)label.labelTMP).fontSizeMin, num2); ((TMP_Text)label.labelTMP).ForceMeshUpdate(false, false); } } } } [HarmonyPatch(typeof(REPOSlider))] internal static class REPOSliderPatches { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake_Postfix(REPOSlider __instance) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) Transform obj = ((Component)__instance).transform.Find("Bar Text"); TextMeshProUGUI val = ((obj != null) ? ((Component)obj).GetComponent<TextMeshProUGUI>() : null); if (!((Object)(object)val == (Object)null)) { Transform val2 = ((Component)__instance).transform.Find("MaskedText"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(false); } GameObject val3 = new GameObject("InputWrapper", new Type[3] { typeof(RectTransform), typeof(Image), typeof(RectMask2D) }); int siblingIndex = ((TMP_Text)val).transform.GetSiblingIndex(); val3.transform.SetParent(((TMP_Text)val).transform.parent, false); val3.transform.SetSiblingIndex(siblingIndex); RectTransform component = val3.GetComponent<RectTransform>(); RectTransform rectTransform = ((TMP_Text)val).rectTransform; component.anchorMin = rectTransform.anchorMin; component.anchorMax = rectTransform.anchorMax; component.pivot = rectTransform.pivot; component.anchoredPosition = rectTransform.anchoredPosition + new Vector2(0f, -10f); ((Transform)component).localRotation = ((Transform)rectTransform).localRotation; ((Transform)component).localScale = ((Transform)rectTransform).localScale; component.sizeDelta = new Vector2(50f, 20f); Image component2 = val3.GetComponent<Image>(); ((Graphic)component2).color = Color.clear; ((Graphic)component2).raycastTarget = true; ((TMP_Text)val).transform.SetParent(val3.transform, true); ((Graphic)val).raycastTarget = false; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.sizeDelta = Vector2.zero; rectTransform.anchoredPosition = Vector2.zero; ((TMP_Text)val).alignment = (TextAlignmentOptions)514; ((TMP_Text)val).fontSize = 14f; ((TMP_Text)val).enableAutoSizing = false; ((TMP_Text)val).margin = Vector4.zero; ((TMP_Text)val).enableWordWrapping = false; SliderInputHandler sliderInputHandler = ((Component)__instance).gameObject.AddComponent<SliderInputHandler>(); sliderInputHandler.Initialize(__instance, val, component, component2); } } [HarmonyPatch("UpdateBarText")] [HarmonyPrefix] private static bool UpdateBarText_Prefix(REPOSlider __instance) { SliderInputHandler component = ((Component)__instance).GetComponent<SliderInputHandler>(); if ((Object)(object)component != (Object)null) { component.SyncFromSlider(__instance.value); } return false; } [HarmonyPatch("HandleHovering")] [HarmonyPrefix] private static bool HandleHovering_Prefix(REPOSlider __instance) { SliderInputHandler component = ((Component)__instance).GetComponent<SliderInputHandler>(); return (Object)(object)component == (Object)null || !component.IsInteracting(); } } [HarmonyPatch] internal static class UniversalElementPatches { [HarmonyPatch(typeof(REPOToggle), "Awake")] [HarmonyPostfix] private static void Toggle_Awake(REPOToggle __instance) { if ((Object)(object)__instance.labelTMP != (Object)null) { ((Graphic)__instance.labelTMP).raycastTarget = false; } HoverTooltip hoverTooltip = default(HoverTooltip); if (!((Component)__instance).TryGetComponent<HoverTooltip>(ref hoverTooltip)) { ((Component)__instance).gameObject.AddComponent<HoverTooltip>(); } } [HarmonyPatch(typeof(REPOSlider), "Awake")] [HarmonyPostfix] private static void Slider_Awake(REPOSlider __instance) { if ((Object)(object)__instance.labelTMP != (Object)null) { ((Graphic)__instance.labelTMP).raycastTarget = false; } Transform val = ((Component)__instance).transform.Find("SliderBG"); if ((Object)(object)val != (Object)null) { Transform val2 = val.Find("Option Box"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.AddComponent<HoverTooltip>(); } } Transform val3 = ((Component)__instance).transform.Find("BarSize"); if ((Object)(object)val3 != (Object)null) { ((Component)val3).gameObject.AddComponent<HoverTooltip>(); } } [HarmonyPatch(typeof(REPOInputField), "Awake")] [HarmonyPostfix] private static void InputField_Awake(REPOInputField __instance) { if ((Object)(object)__instance.labelTMP != (Object)null) { ((Graphic)__instance.labelTMP).raycastTarget = false; } Transform val = ((Component)__instance).transform.Find("SliderBG"); if ((Object)(object)val != (Object)null) { Transform val2 = val.Find("Option Box"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.AddComponent<HoverTooltip>(); } } } } } namespace MenuLibExtras.MonoBehaviors { public class ConfigResetButton : MonoBehaviour { private ConfigEntryBase _entry; private REPOElement _element; private RectTransform _rect; private Canvas _canvas; private TextMeshProUGUI _textTMP; private Image _bgImage; private Image[] _borders = (Image[])(object)new Image[4]; private HoverTooltip _parentTooltip; private readonly Color _bgColor = new Color(0.02f, 0.02f, 0.02f, 1f); private readonly Color _bgHoverColor = new Color(0.1f, 0.1f, 0.1f, 1f); private readonly Color _borderColor = new Color(0.15f, 0.4f, 0.8f, 0.8f); private readonly Color _borderHoverColor = new Color(0.3f, 0.6f, 1f, 1f); private readonly Color _textColor = new Color(1f, 0.55f, 0f, 1f); public void Initialize(ConfigEntryBase entry, REPOElement element) { _entry = entry; _element = element; } private void Start() { //IL_0042: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_01bf: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: 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) _rect = ((Component)this).GetComponent<RectTransform>(); _canvas = ((Component)this).GetComponentInParent<Canvas>(); _parentTooltip = ((Component)_element).GetComponentInChildren<HoverTooltip>(); _bgImage = ((Component)this).gameObject.AddComponent<Image>(); ((Graphic)_bgImage).color = _bgColor; _borders[0] = CreateBorderLine("Top", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 1f), _borderColor); _borders[1] = CreateBorderLine("Bottom", new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 1f), _borderColor); _borders[2] = CreateBorderLine("Left", new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(1f, 0f), _borderColor); _borders[3] = CreateBorderLine("Right", new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(1f, 0.5f), new Vector2(1f, 0f), _borderColor); GameObject val = new GameObject("Text", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Component)this).transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; _textTMP = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)_textTMP).text = "R"; ((TMP_Text)_textTMP).fontSize = 14f; ((TMP_Text)_textTMP).alignment = (TextAlignmentOptions)514; ((Graphic)_textTMP).color = _textColor; ((TMP_Text)_textTMP).enableWordWrapping = false; ((Graphic)_textTMP).raycastTarget = false; TextMeshProUGUI componentInChildren = ((Component)_element).GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)_textTMP).font = ((TMP_Text)componentInChildren).font; } } private Image CreateBorderLine(string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 sizeDelta, Color color) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0040: 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) //IL_0050: 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_0062: 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) GameObject val = new GameObject("Border_" + name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Component)this).transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = anchorMin; component.anchorMax = anchorMax; component.pivot = pivot; component.sizeDelta = sizeDelta; component.anchoredPosition = Vector2.zero; Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = color; ((Graphic)val2).raycastTarget = false; return val2; } private void Update() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) //IL_008e: 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_00cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_canvas == (Object)null || (Object)(object)_rect == (Object)null) { return; } Vector2 val = (((Object)(object)MenuCursor.instance != (Object)null) ? Vector2.op_Implicit(((Component)MenuCursor.instance).transform.position) : ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue()); Camera val2 = (((int)_canvas.renderMode == 0) ? null : _canvas.worldCamera); bool flag = RectTransformUtility.RectangleContainsScreenPoint(_rect, val, val2); ((Graphic)_bgImage).color = (flag ? _bgHoverColor : _bgColor); Image[] borders = _borders; foreach (Image val3 in borders) { if ((Object)(object)val3 != (Object)null) { ((Graphic)val3).color = (flag ? _borderHoverColor : _borderColor); } } if ((Object)(object)_parentTooltip != (Object)null) { ((Behaviour)_parentTooltip).enabled = !flag; } if (flag) { if ((Object)(object)TooltipManager.Instance == (Object)null) { TooltipManager.Create(_canvas); } TooltipManager.Instance.RegisterHover($"Reset to Default: {_entry.DefaultValue}"); if (Mouse.current != null && Mouse.current.leftButton.wasPressedThisFrame) { ResetToDefault(); } } } private void ResetToDefault() { Type type = Type.GetType("REPOConfig.ConfigMenu, REPOConfig"); IDictionary dictionary = ((type != null) ? AccessTools.Field(type, "changedEntryValues") : null)?.GetValue(null) as IDictionary; object obj = ((dictionary != null && dictionary.Contains(_entry)) ? dictionary[_entry] : _entry.BoxedValue); if (obj != null && obj.Equals(_entry.DefaultValue)) { return; } _entry.BoxedValue = _entry.DefaultValue; if (!(type != null)) { return; } FieldInfo fieldInfo = AccessTools.Field(type, "lastClickedModButton"); if (fieldInfo != null && dictionary != null) { dictionary.Clear(); object? value = fieldInfo.GetValue(null); REPOButton val = (REPOButton)((value is REPOButton) ? value : null); if ((Object)(object)val != (Object)null && val.onClick != null) { fieldInfo.SetValue(null, null); val.onClick(); } } } } public class HoverTooltip : MonoBehaviour { public string text = string.Empty; private Canvas _canvas; private List<Graphic> _graphics = new List<Graphic>(); private bool _initialized; private bool _isToggle; private RectTransform _rectTransform; private void Start() { _canvas = ((Component)this).GetComponentInParent<Canvas>(); _isToggle = (Object)(object)((Component)this).GetComponent<REPOToggle>() != (Object)null; _rectTransform = ((Component)this).GetComponent<RectTransform>(); } private void Update() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: 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_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_canvas == (Object)null) { return; } if (!_initialized) { if (_isToggle) { _graphics.AddRange(((Component)this).GetComponentsInChildren<Graphic>(true)); } if (string.IsNullOrEmpty(text)) { InitializeText(); } _initialized = true; } if ((_graphics.Count == 0 && (Object)(object)_rectTransform == (Object)null) || string.IsNullOrEmpty(text)) { return; } Vector2 val = (((Object)(object)MenuCursor.instance != (Object)null) ? Vector2.op_Implicit(((Component)MenuCursor.instance).transform.position) : ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue()); Camera val2 = (((int)_canvas.renderMode == 0) ? null : _canvas.worldCamera); bool flag = false; if (_isToggle) { Vector2 val4 = default(Vector2); foreach (Graphic graphic in _graphics) { if ((Object)(object)graphic == (Object)null || !((Component)graphic).gameObject.activeInHierarchy || !RectTransformUtility.RectangleContainsScreenPoint(graphic.rectTransform, val, val2)) { continue; } TextMeshProUGUI val3 = (TextMeshProUGUI)(object)((graphic is TextMeshProUGUI) ? graphic : null); if (val3 != null) { RectTransformUtility.ScreenPointToLocalPointInRectangle(((TMP_Text)val3).rectTransform, val, val2, ref val4); Bounds textBounds = ((TMP_Text)val3).textBounds; if (((Bounds)(ref textBounds)).Contains(Vector2.op_Implicit(val4))) { flag = true; break; } } else if (graphic.color.a > 0.01f) { flag = true; break; } } } else if ((Object)(object)_rectTransform != (Object)null && RectTransformUtility.RectangleContainsScreenPoint(_rectTransform, val, val2)) { flag = true; } if (flag) { if ((Object)(object)TooltipManager.Instance == (Object)null) { TooltipManager.Create(_canvas); } TooltipManager.Instance?.RegisterHover(text); } } private void InitializeText() { REPOElement val = ((Component)this).GetComponent<REPOElement>() ?? ((Component)this).GetComponentInParent<REPOElement>(); if ((Object)(object)val == (Object)null) { return; } string text = ""; REPOToggle val2 = (REPOToggle)(object)((val is REPOToggle) ? val : null); if (val2 != null && (Object)(object)val2.labelTMP != (Object)null) { text = ((TMP_Text)val2.labelTMP).text; } else { REPOSlider val3 = (REPOSlider)(object)((val is REPOSlider) ? val : null); if (val3 != null && (Object)(object)val3.labelTMP != (Object)null) { text = ((TMP_Text)val3.labelTMP).text; } else { REPOInputField val4 = (REPOInputField)(object)((val is REPOInputField) ? val : null); if (val4 != null && (Object)(object)val4.labelTMP != (Object)null) { text = ((TMP_Text)val4.labelTMP).text; } } } if (!string.IsNullOrEmpty(text)) { text = text.Trim(); if (ConfigTooltipRegistry.GlobalDescriptions.TryGetValue(text, out string value)) { this.text = value; return; } } REPOSlider val5 = (REPOSlider)(object)((val is REPOSlider) ? val : null); if (val5 != null && (Object)(object)val5.descriptionTMP != (Object)null && !string.IsNullOrEmpty(((TMP_Text)val5.descriptionTMP).text)) { this.text = ((TMP_Text)val5.descriptionTMP).text; ((TMP_Text)val5.descriptionTMP).text = string.Empty; } } } public class SliderInputHandler : MonoBehaviour { private REPOSlider _slider; private REPOInputStringSystem _inputSystem; private RectTransform _wrapperRect; private Image _bgImage; private MenuPage _menuPage; private MenuSelectableElement _selectable; private Canvas _canvas; private readonly Color _colNormal = Color.clear; private readonly Color _colHover = new Color(0.1f, 0.1f, 0.1f, 0.5f); private readonly Color _colEdit = new Color(0.05f, 0.05f, 0.05f, 0.9f); private bool _isHovering = false; private bool _wasFocused = false; private float _lastClickTime; private const float DoubleClickThreshold = 0.3f; private bool _isListeningForKey = false; private string _tooltipText; public void Initialize(REPOSlider slider, TextMeshProUGUI text, RectTransform wrapper, Image bgImage) { //IL_0042: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) _slider = slider; _wrapperRect = wrapper; _bgImage = bgImage; _menuPage = ((Component)slider).GetComponentInParent<MenuPage>(); _selectable = ((Component)slider).GetComponent<MenuSelectableElement>(); _canvas = ((Component)slider).GetComponentInParent<Canvas>(); ((Graphic)_bgImage).color = _colNormal; _inputSystem = ((Component)this).gameObject.AddComponent<REPOInputStringSystem>(); _inputSystem.inputTMP = (TMP_Text)(object)text; _inputSystem.maskRectTransform = wrapper; _inputSystem.onlyNotifyOnSubmit = true; REPOInputStringSystem inputSystem = _inputSystem; Colors colors = default(Colors); ((Colors)(ref colors))..ctor(); colors.focusedColor = Color.white; colors.hoverColor = new Color(0.8f, 1f, 0.8f); colors.unfocusedColor = ((Graphic)text).color; colors.placeholderColor = Color.gray; inputSystem.colors = colors; if ((Object)(object)_slider.descriptionTMP != (Object)null && !string.IsNullOrEmpty(((TMP_Text)_slider.descriptionTMP).text)) { _tooltipText = ((TMP_Text)_slider.descriptionTMP).text; ((TMP_Text)_slider.descriptionTMP).text = string.Empty; } SyncFromSlider(_slider.value); _inputSystem.onValueChanged = OnInputSubmitted; } public bool IsInteracting() { return ((Object)(object)_inputSystem != (Object)null && _inputSystem.isFocused) || _isListeningForKey; } private bool IsKeyCodeSlider() { if (_slider.stringOptions == null) { return false; } if (_slider.stringOptions.Length > 100) { return true; } string[] stringOptions = _slider.stringOptions; foreach (string text in stringOptions) { if (text.IndexOf("Backspace", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Space", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } public void SyncFromSlider(float val) { if (!((Object)(object)_inputSystem != (Object)null) || !_inputSystem.isFocused) { string text; if (_slider.stringOptions != null && _slider.stringOptions.Length != 0) { int num = Mathf.Clamp(Mathf.RoundToInt(val), 0, _slider.stringOptions.Length - 1); text = _slider.stringOptions[num]; } else { string text2 = ((_slider.precision == 0) ? "F0" : $"F{_slider.precision}"); text = val.ToString(text2, CultureInfo.CurrentCulture); } if ((Object)(object)_inputSystem != (Object)null) { _inputSystem.SetValue(text, false); UpdateWrapperSize(); } } } private void OnInputSubmitted(string rawValue) { string rawValue2 = rawValue; float num = _slider.value; bool flag = false; float result; if (_slider.stringOptions != null && _slider.stringOptions.Length != 0) { int num2 = Array.FindIndex(_slider.stringOptions, (string s) => s.Equals(rawValue2, StringComparison.OrdinalIgnoreCase)); if (num2 != -1) { num = num2; flag = true; } } else if (float.TryParse(rawValue2, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) { float num3 = Mathf.Clamp(result, _slider.min, _slider.max); num = ((_slider.precision == 0) ? Mathf.Round(num3) : num3); flag = true; } if (flag) { _slider.SetValue(num, true); } SyncFromSlider(_slider.value); } private void Update() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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) if (Object.op_Implicit((Object)(object)_slider) && Object.op_Implicit((Object)(object)_inputSystem)) { UpdateWrapperSize(); Vector2 val = (((Object)(object)MenuCursor.instance != (Object)null) ? Vector2.op_Implicit(((Component)MenuCursor.instance).transform.position) : ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue()); object obj; if (!((Object)(object)_canvas != (Object)null) || (int)_canvas.renderMode != 0) { Canvas canvas = _canvas; obj = ((canvas != null) ? canvas.worldCamera : null); } else { obj = null; } Camera val2 = (Camera)obj; RectTransform component = ((Component)_slider).GetComponent<RectTransform>(); _isHovering = RectTransformUtility.RectangleContainsScreenPoint(component, val, val2); _inputSystem.SetHovering(_isHovering); HandleInput(); if (IsInteracting()) { ((Graphic)_bgImage).color = _colEdit; } else if (_isHovering) { ((Graphic)_bgImage).color = _colHover; } else { ((Graphic)_bgImage).color = _colNormal; } } } private void HandleInput() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) if (_isListeningForKey) { ((Graphic)_bgImage).color = _colEdit; Mouse current = Mouse.current; if (current != null) { ButtonControl leftButton = current.leftButton; if (((leftButton != null) ? new bool?(leftButton.wasPressedThisFrame) : null).GetValueOrDefault()) { CancelListening(); return; } } Mouse current2 = Mouse.current; if (current2 != null) { ButtonControl rightButton = current2.rightButton; if (((rightButton != null) ? new bool?(rightButton.wasPressedThisFrame) : null).GetValueOrDefault()) { FinishListening("Mouse1"); return; } } Mouse current3 = Mouse.current; if (current3 != null) { ButtonControl middleButton = current3.middleButton; if (((middleButton != null) ? new bool?(middleButton.wasPressedThisFrame) : null).GetValueOrDefault()) { FinishListening("Mouse2"); return; } } Mouse current4 = Mouse.current; if (current4 != null) { ButtonControl backButton = current4.backButton; if (((backButton != null) ? new bool?(backButton.wasPressedThisFrame) : null).GetValueOrDefault()) { FinishListening("Mouse3"); return; } } Mouse current5 = Mouse.current; if (current5 != null) { ButtonControl forwardButton = current5.forwardButton; if (((forwardButton != null) ? new bool?(forwardButton.wasPressedThisFrame) : null).GetValueOrDefault()) { FinishListening("Mouse4"); return; } } if (Keyboard.current == null) { return; } Enumerator<KeyControl> enumerator = Keyboard.current.allKeys.GetEnumerator(); try { while (enumerator.MoveNext()) { KeyControl current6 = enumerator.Current; if (current6 != null && ((ButtonControl)current6).wasPressedThisFrame) { if (Keyboard.current.escapeKey != null && current6 == Keyboard.current.escapeKey) { CancelListening(); } else { FinishListening(MapKeyName(((InputControl)current6).name)); } break; } } return; } finally { ((IDisposable)enumerator).Dispose(); } } if (_inputSystem.isFocused) { Keyboard current7 = Keyboard.current; if (current7 != null) { KeyControl escapeKey = current7.escapeKey; if (((escapeKey != null) ? new bool?(((ButtonControl)escapeKey).wasPressedThisFrame) : null).GetValueOrDefault()) { _inputSystem.isFocused = false; SyncFromSlider(_slider.value); return; } } } Mouse current8 = Mouse.current; if (current8 != null) { ButtonControl leftButton2 = current8.leftButton; if (((leftButton2 != null) ? new bool?(leftButton2.wasPressedThisFrame) : null).GetValueOrDefault()) { if (_isHovering) { if (!IsInteracting()) { if (Time.unscaledTime - _lastClickTime <= 0.3f) { if (IsKeyCodeSlider()) { _isListeningForKey = true; _inputSystem.SetValue("Press Any Key...", false); } else { _inputSystem.SetValue(string.Empty, false); _inputSystem.isFocused = true; } } _lastClickTime = Time.unscaledTime; } } else if (_inputSystem.isFocused) { _inputSystem.isFocused = false; } } } if (_wasFocused && !_inputSystem.isFocused) { OnInputSubmitted(_inputSystem.currentValue); } _wasFocused = _inputSystem.isFocused; } private void UpdateWrapperSize() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_inputSystem.inputTMP == (Object)null)) { Vector2 preferredValues = _inputSystem.inputTMP.GetPreferredValues(_inputSystem.inputTMP.text); float num = Mathf.Max(55f, preferredValues.x + 18f); if (Mathf.Abs(_wrapperRect.sizeDelta.x - num) > 0.1f) { _wrapperRect.sizeDelta = new Vector2(num, 22f); } } } private void FinishListening(string mappedKey) { OnInputSubmitted(mappedKey); _isListeningForKey = false; } private void CancelListening() { _isListeningForKey = false; SyncFromSlider(_slider.value); } private string MapKeyName(string inputName) { string text = inputName.ToLower(); switch (text) { case "enter": return "Return"; case "leftctrl": return "LeftControl"; case "rightctrl": return "RightControl"; case "leftalt": return "LeftAlt"; case "rightalt": return "RightAlt"; case "leftshift": return "LeftShift"; case "rightshift": return "RightShift"; default: { if (inputName.Length == 1 && char.IsDigit(inputName[0])) { return "Alpha" + inputName; } if (text.StartsWith("digit")) { return "Alpha" + inputName.Substring(5); } if (text.StartsWith("numpad")) { return "Keypad" + inputName.Substring(6); } if (Enum.TryParse<KeyCode>(inputName, ignoreCase: true, out KeyCode result)) { return ((object)(KeyCode)(ref result)).ToString(); } return (inputName.Length == 1) ? inputName.ToUpper() : inputName; } } } } public class TooltipManager : MonoBehaviour { public static TooltipManager Instance; private RectTransform _rect; private TextMeshProUGUI _textTMP; private CanvasGroup _canvasGroup; private Canvas _parentCanvas; private LayoutElement _layoutElement; private string _targetText; private float _hoverTimer; private bool _isHoveredThisFrame; private const float HoverDelay = 0.4f; private float _graceTimer; private const float GracePeriod = 0.15f; public static void Create(Canvas canvas) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { if (!((Object)(object)Instance._parentCanvas == (Object)null)) { return; } Object.Destroy((Object)(object)((Component)Instance).gameObject); } GameObject val = new GameObject("MenuLibExtras_Tooltip", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Component)canvas).transform, false); Instance = val.AddComponent<TooltipManager>(); Instance._parentCanvas = canvas; TextMeshProUGUI componentInChildren = ((Component)canvas).GetComponentInChildren<TextMeshProUGUI>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)((TMP_Text)componentInChildren).font != (Object)null) { Instance.SetFont(((TMP_Text)componentInChildren).font); } } private void Awake() { //IL_0019: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_028b: Unknown result type (might be due to invalid IL or missing references) Instance = this; _rect = ((Component)this).GetComponent<RectTransform>(); ((Transform)_rect).localScale = Vector3.one; _canvasGroup = ((Component)this).gameObject.AddComponent<CanvasGroup>(); _canvasGroup.blocksRaycasts = false; _canvasGroup.interactable = false; Image val = ((Component)this).gameObject.AddComponent<Image>(); ((Graphic)val).color = new Color(0.02f, 0.02f, 0.02f, 1f); HorizontalLayoutGroup val2 = ((Component)this).gameObject.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)val2).padding = new RectOffset(6, 6, 4, 4); ((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true; ContentSizeFitter val3 = ((Component)this).gameObject.AddComponent<ContentSizeFitter>(); val3.horizontalFit = (FitMode)2; val3.verticalFit = (FitMode)2; Color color = default(Color); ((Color)(ref color))..ctor(0.15f, 0.4f, 0.8f, 0.8f); CreateBorderLine("Top", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 1f), color); CreateBorderLine("Bottom", new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 1f), color); CreateBorderLine("Left", new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f, 0.5f), new Vector2(1f, 0f), color); CreateBorderLine("Right", new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(1f, 0.5f), new Vector2(1f, 0f), color); GameObject val4 = new GameObject("Text", new Type[1] { typeof(RectTransform) }); val4.transform.SetParent(((Component)this).transform, false); _layoutElement = val4.AddComponent<LayoutElement>(); _textTMP = val4.AddComponent<TextMeshProUGUI>(); ((TMP_Text)_textTMP).fontSize = 13f; ((TMP_Text)_textTMP).alignment = (TextAlignmentOptions)513; ((Graphic)_textTMP).color = new Color(1f, 0.55f, 0f, 1f); ((TMP_Text)_textTMP).enableWordWrapping = true; } public void SetFont(TMP_FontAsset font) { if ((Object)(object)_textTMP != (Object)null && (Object)(object)font != (Object)null) { ((TMP_Text)_textTMP).font = font; } } private void CreateBorderLine(string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 sizeDelta, Color color) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0040: 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) //IL_0050: 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_0062: 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) GameObject val = new GameObject("Border_" + name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Component)this).transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = anchorMin; component.anchorMax = anchorMax; component.pivot = pivot; component.sizeDelta = sizeDelta; component.anchoredPosition = Vector2.zero; Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = color; LayoutElement val3 = val.AddComponent<LayoutElement>(); val3.ignoreLayout = true; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } public void RegisterHover(string text) { if (!string.IsNullOrWhiteSpace(text)) { _isHoveredThisFrame = true; if (_targetText != text) { _targetText = text; _hoverTimer = 0f; Hide(); } } } private void LateUpdate() { if (_isHoveredThisFrame) { _graceTimer = 0.15f; _hoverTimer += Time.unscaledDeltaTime; if (_hoverTimer >= 0.4f) { ShowInternal(_targetText); } } else if (_graceTimer > 0f) { _graceTimer -= Time.unscaledDeltaTime; } else { _hoverTimer = 0f; _targetText = null; Hide(); } _isHoveredThisFrame = false; if (_canvasGroup.alpha > 0f) { UpdatePosition(); } } private void ShowInternal(string text) { if (_canvasGroup.alpha == 0f) { ((Transform)_rect).SetAsLastSibling(); _canvasGroup.alpha = 1f; } if (((TMP_Text)_textTMP).text != text) { ((TMP_Text)_textTMP).text = text; _layoutElement.preferredWidth = ((((TMP_Text)_textTMP).preferredWidth > 220f) ? 220f : (-1f)); } } public void Hide() { if ((Object)(object)_canvasGroup != (Object)null) { _canvasGroup.alpha = 0f; } } private void UpdatePosition() { //IL_001e: 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_0080: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_parentCanvas == (Object)null)) { ((Transform)_rect).localScale = Vector3.one; ((Transform)_rect).localRotation = Quaternion.identity; if ((Object)(object)MenuCursor.instance != (Object)null) { ((Transform)_rect).position = ((Component)MenuCursor.instance).transform.position; } else { Vector2 val = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle(((Component)_parentCanvas).GetComponent<RectTransform>(), ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue(), ((int)_parentCanvas.renderMode == 0) ? null : _parentCanvas.worldCamera, ref val); ((Transform)_rect).localPosition = Vector2.op_Implicit(val); } RectTransform component = ((Component)_parentCanvas).GetComponent<RectTransform>(); float x = ((Transform)_rect).localPosition.x; Rect rect = _rect.rect; float num = x + ((Rect)(ref rect)).width + 20f; rect = component.rect; float num2 = ((num > ((Rect)(ref rect)).xMax) ? 1f : 0f); float y = ((Transform)_rect).localPosition.y; rect = _rect.rect; float num3 = y + ((Rect)(ref rect)).height + 20f; rect = component.rect; float num4 = ((num3 > ((Rect)(ref rect)).yMax) ? 1f : 0f); _rect.pivot = new Vector2(num2, num4); float num5 = ((num2 == 1f) ? (-8f) : 8f); float num6 = ((num4 == 1f) ? (-8f) : 8f); RectTransform rect2 = _rect; ((Transform)rect2).localPosition = ((Transform)rect2).localPosition + new Vector3(num5, num6, 0f); } } } public class TooltipTrigger : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public string tooltipText; private bool _isHovering; public void OnPointerEnter(PointerEventData eventData) { _isHovering = true; } public void OnPointerExit(PointerEventData eventData) { _isHovering = false; } private void Update() { if (!_isHovering || string.IsNullOrEmpty(tooltipText)) { return; } if ((Object)(object)TooltipManager.Instance == (Object)null) { Canvas componentInParent = ((Component)this).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent != (Object)null) { TooltipManager.Create(componentInParent); } } TooltipManager.Instance?.RegisterHover(tooltipText); } private void OnDisable() { _isHovering = false; } } } namespace MenuLibExtras.API { public static class MenuLibExtrasAPI { public static void AddTooltip(GameObject targetElement, string text) { HoverTooltip hoverTooltip = targetElement.GetComponent<HoverTooltip>(); if ((Object)(object)hoverTooltip == (Object)null) { hoverTooltip = targetElement.AddComponent<HoverTooltip>(); } hoverTooltip.text = text; } public static void AddTooltip(Component targetComponent, string text) { AddTooltip(targetComponent.gameObject, text); } } }