Decompiled source of Pinnacle v1.12.0
Pinnacle.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; 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.Configuration; using BepInEx.Logging; using ComfyLib; using HarmonyLib; using Microsoft.CodeAnalysis; using Splatform; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Pinnacle")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Pinnacle")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8d534f00-8286-4b0e-b2bc-a7669730bbca")] [assembly: AssemblyFileVersion("1.12.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.12.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Pinnacle { public static class PluginConfig { [HarmonyPatch(typeof(FejdStartup))] private static class FejdStartupPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void AwakePostfix() { while (_lateBindConfigQueue.Count > 0) { _lateBindConfigQueue.Dequeue()?.Invoke(CurrentConfig); } } } private static readonly Queue<Action<ConfigFile>> _lateBindConfigQueue = new Queue<Action<ConfigFile>>(); public static ConfigFile CurrentConfig { get; private set; } public static ConfigEntry<bool> IsModEnabled { get; private set; } public static ConfigEntry<float> CenterMapLerpDuration { get; private set; } public static ConfigEntry<KeyboardShortcut> PinListPanelToggleShortcut { get; private set; } public static ConfigEntry<bool> PinListPanelShowPinPosition { get; private set; } public static ConfigEntry<Vector2> PinListPanelPosition { get; private set; } public static ConfigEntry<Vector2> PinListPanelSizeDelta { get; private set; } public static ConfigEntry<Color> PinListPanelBackgroundColor { get; private set; } public static ConfigEntry<MovementType> PinListPanelScrollRectMovementType { get; private set; } public static ConfigEntry<bool> PinListPanelEditPinOnRowClick { get; private set; } public static ConfigEntry<float> PinEditPanelToggleLerpDuration { get; private set; } public static ConfigEntry<Vector2> PinFilterPanelPosition { get; private set; } public static ConfigEntry<float> PinFilterPanelGridIconSize { get; private set; } public static ConfigEntry<string> PinFont { get; private set; } public static ConfigEntry<int> PinFontSize { get; private set; } public static ConfigEntry<KeyboardShortcut> AddPinAtMouseShortcut { get; private set; } public static void BindConfig(ConfigFile config) { CurrentConfig = config; IsModEnabled = config.BindInOrder("_Global", "isModEnabled", defaultValue: true, "Globally enable or disable this mod."); IsModEnabled.OnSettingChanged<bool>(Pinnacle.TogglePinnacle); IsModEnabled.OnSettingChanged<bool>(ComfyCommandUtils.ToggleCommands); CenterMapLerpDuration = config.BindInOrder("CenterMap", "lerpDuration", 1f, "Duration (in seconds) for the CenterMap lerp.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f)); BindPinListPanelConfig(config); BindPinEditPanelConfig(config); BindPinFilterPanelConfig(config); _lateBindConfigQueue.Clear(); _lateBindConfigQueue.Enqueue(BindMinimapConfig); } public static void BindPinListPanelConfig(ConfigFile config) { //IL_0012: 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_00b6: 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) PinListPanelToggleShortcut = config.BindInOrder<KeyboardShortcut>("PinListPanel", "pinListPanelToggleShortcut", new KeyboardShortcut((KeyCode)9, Array.Empty<KeyCode>()), "Keyboard shortcut to toggle the PinListPanel on/off."); PinListPanelShowPinPosition = config.BindInOrder("PinListPanel.Columns", "pinListPanelShowPinPosition", defaultValue: true, "Show the Pin.Position columns in the PinListPanel."); PinListPanelPosition = config.BindInOrder<Vector2>("PinListPanel.Panel", "pinListPanelPosition", new Vector2(25f, 0f), "The value for the PinListPanel.Panel position (relative to pivot/anchors)."); PinListPanelPosition.OnSettingChanged((Action<Vector2>)PinListPanelController.SetPanelPosition); PinListPanelSizeDelta = config.BindInOrder<Vector2>("PinListPanel.Panel", "pinListPanelSizeDelta", new Vector2(400f, 400f), "The value for the PinListPanel.Panel sizeDelta (width/height in pixels)."); PinListPanelSizeDelta.OnSettingChanged((Action<Vector2>)PinListPanelController.SetPanelSize); PinListPanelBackgroundColor = config.BindInOrder<Color>("PinListPanel.Panel", "pinListPanelBackgroundColor", new Color(0f, 0f, 0f, 0.9f), "The value for the PinListPanel.Panel background color."); PinListPanelBackgroundColor.OnSettingChanged((Action<Color>)PinListPanelController.SetBackgroundColor); PinListPanelScrollRectMovementType = config.BindInOrder<MovementType>("PinListPanel.ScrollRect", "movementType", (MovementType)2, "Determines how the PinListPanel scrolling should behave.", (AcceptableValueBase)(object)new AcceptableValueEnumList<MovementType>((MovementType)2, (MovementType)1)); PinListPanelScrollRectMovementType.OnSettingChanged((Action<MovementType>)PinListPanelController.SetScrollRectMovementType); PinListPanelEditPinOnRowClick = config.BindInOrder("PinListPanel.Behaviour", "pinListPanelEditPinOnRowClick", defaultValue: true, "If set, will show the PinEditPanel when a row is selected in the PinListPanel."); } public static void BindPinEditPanelConfig(ConfigFile config) { PinEditPanelToggleLerpDuration = config.BindInOrder("PinEditPanel.Toggle", "pinEditPanelToggleLerpDuration", 0.25f, "Duration (in seconds) for the PinEdiPanl.Toggle on/off lerp.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f)); } public static void BindPinFilterPanelConfig(ConfigFile config) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) PinFilterPanelPosition = config.BindInOrder<Vector2>("PinFilterPanel.Panel", "pinFilterPanelPanelPosition", new Vector2(-25f, 0f), "The value for the PinFilterPanel.Panel position (relative to pivot/anchors)."); PinFilterPanelGridIconSize = config.BindInOrder("PinFilterPanel.Grid", "pinFilterPanelGridIconSize", 30f, "The size of the PinFilterPanel.Grid icons.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 100f)); } public static void BindMinimapConfig(ConfigFile config) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) PinFont = config.BindInOrder("Minimap", "Pin.Font", UIResources.ValheimNorseFont, "The font for the Pin text on the Minimap.", (AcceptableValueBase)(object)new AcceptableValueList<string>((from f in Resources.FindObjectsOfTypeAll<TMP_FontAsset>() select ((Object)f).name into f orderby f select f).ToArray())); PinFontSize = config.BindInOrder("Minimap", "Pin.FontSize", 18, "The font size for the Pin text on the Minimap.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 26)); PinFont.OnSettingChanged<string>(PinMarkerUtils.SetPinNameFont); PinFontSize.OnSettingChanged<int>(PinMarkerUtils.SetPinNameFontSize); AddPinAtMouseShortcut = config.BindInOrder<KeyboardShortcut>("Minimap.Actions", "addPinAtMouseShortcut", KeyboardShortcut.Empty, "Keyboard shortcut to add a Minimap.Pin at the mouse position."); } } public static class CenterMapHelper { [CompilerGenerated] private sealed class <CenterMapCoroutine>d__2 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float lerpDuration; public Vector3 targetPosition; private float <timeElapsed>5__2; private Vector3 <startPosition>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CenterMapCoroutine>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002b: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_00b5: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <timeElapsed>5__2 = 0f; <startPosition>5__3 = Minimap.m_instance.m_mapOffset; break; case 1: <>1__state = -1; break; } if (<timeElapsed>5__2 < lerpDuration) { float num = <timeElapsed>5__2 / lerpDuration; num = num * num * (3f - 2f * num); Minimap.m_instance.m_mapOffset = Vector3.Lerp(<startPosition>5__3, targetPosition, num); <timeElapsed>5__2 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } Minimap.m_instance.m_mapOffset = targetPosition; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static Coroutine _centerMapCoroutine; public static void CenterMapOnPosition(Vector3 targetPosition) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Minimap.m_instance) && Object.op_Implicit((Object)(object)Player.m_localPlayer)) { if (_centerMapCoroutine != null) { ((MonoBehaviour)Minimap.m_instance).StopCoroutine(_centerMapCoroutine); } _centerMapCoroutine = ((MonoBehaviour)Minimap.m_instance).StartCoroutine(CenterMapCoroutine(targetPosition - ((Component)Player.m_localPlayer).transform.position, PluginConfig.CenterMapLerpDuration.Value)); } } [IteratorStateMachine(typeof(<CenterMapCoroutine>d__2))] private static IEnumerator CenterMapCoroutine(Vector3 targetPosition, float lerpDuration) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CenterMapCoroutine>d__2(0) { targetPosition = targetPosition, lerpDuration = lerpDuration }; } } public static class ExportPinsCommand { [CompilerGenerated] private static class <>O { public static ConsoleEventFailable <0>__ExportPinsToBinaryFile; public static ConsoleEventFailable <1>__ExportPinsToTextFile; } [ComfyCommand] public static IEnumerable<ConsoleCommand> Register() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown ConsoleCommand[] array = new ConsoleCommand[2]; object obj = <>O.<0>__ExportPinsToBinaryFile; if (obj == null) { ConsoleEventFailable val = ExportPinsToBinaryFile; <>O.<0>__ExportPinsToBinaryFile = val; obj = (object)val; } array[0] = new ConsoleCommand("pinnacle-exportpins-binary", "<filename> [name-filter-regex] -- export pins to a file in binary format.", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj2 = <>O.<1>__ExportPinsToTextFile; if (obj2 == null) { ConsoleEventFailable val2 = ExportPinsToTextFile; <>O.<1>__ExportPinsToTextFile = val2; obj2 = (object)val2; } array[1] = new ConsoleCommand("pinnacle-exportpins-text", "<filename> [name-filter-regex] -- export pins to a file in plain text format.", (ConsoleEventFailable)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); return new <>z__ReadOnlyArray<ConsoleCommand>((ConsoleCommand[])(object)array); } public static object ExportPinsToBinaryFile(ConsoleEventArgs args) { PinImportExport.ExportPinsToFile(args, PinImportExport.PinFileFormat.Binary); return true; } public static object ExportPinsToTextFile(ConsoleEventArgs args) { PinImportExport.ExportPinsToFile(args, PinImportExport.PinFileFormat.PlainText); return true; } } public static class ImportPinsCommand { [CompilerGenerated] private static class <>O { public static ConsoleEvent <0>__ImportPinsFromBinaryFile; } [ComfyCommand] public static ConsoleCommand Register() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown object obj = <>O.<0>__ImportPinsFromBinaryFile; if (obj == null) { ConsoleEvent val = PinImportExport.ImportPinsFromBinaryFile; <>O.<0>__ImportPinsFromBinaryFile = val; obj = (object)val; } return new ConsoleCommand("pinnacle-importpins-binary", "<filename> [name-filter-regex] -- import pins in binary format from file.", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } public static class RemoveAllPinsCommand { [CompilerGenerated] private static class <>O { public static ConsoleEventFailable <0>__Run; } [ComfyCommand] public static ConsoleCommand Register() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown object obj = <>O.<0>__Run; if (obj == null) { ConsoleEventFailable val = Run; <>O.<0>__Run = val; obj = (object)val; } return new ConsoleCommand("pinnacle-remove-all-pins", "(Pinnacle) Removes ALL pins.", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } public static object Run(ConsoleEventArgs args) { if (Object.op_Implicit((Object)(object)Minimap.m_instance)) { return false; } int num = Minimap.m_instance.m_pins.RemoveAll((PinData pin) => pin.m_save); args.Context.AddString($"Removed {num} pins."); return true; } } public static class PinImportExport { public enum PinFileFormat { Binary, PlainText } public static void ExportPinsToFile(ConsoleEventArgs args, PinFileFormat exportFormat) { if (Object.op_Implicit((Object)(object)Minimap.m_instance)) { object arg = ((args.Length >= 2) ? args[1] : DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString()); object arg2 = Minimap.MAPVERSION; string text = string.Format("Pinnacle/{0}.v{1}.{2}", arg, arg2, exportFormat switch { PinFileFormat.Binary => "pins", PinFileFormat.PlainText => "pins.txt", _ => string.Empty, }); Directory.CreateDirectory(Path.GetDirectoryName(text)); IReadOnlyCollection<PinData> readOnlyCollection = FilterPins(Minimap.m_instance.m_pins, (args.Length >= 3) ? args[2] : string.Empty); Pinnacle.LogInfo($"Exporting {readOnlyCollection.Count} pins to file: {text}"); Pinnacle.LogInfo($"Exported {exportFormat switch { PinFileFormat.Binary => ExportPinsToBinaryFile(readOnlyCollection, text), PinFileFormat.PlainText => ExportPinsToTextFile(readOnlyCollection, text), _ => 0, }} pins to file: {text} "); } } private static int ExportPinsToBinaryFile(IReadOnlyCollection<PinData> pins, string filename) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected I4, but got Unknown using FileStream output = new FileStream(filename, FileMode.CreateNew); using BinaryWriter binaryWriter = new BinaryWriter(output); int num = 0; binaryWriter.Write(pins.Count); foreach (PinData pin in pins) { if (pin.m_save) { binaryWriter.Write(pin.m_name); binaryWriter.Write(pin.m_pos.x); binaryWriter.Write(pin.m_pos.y); binaryWriter.Write(pin.m_pos.z); binaryWriter.Write((int)pin.m_type); binaryWriter.Write(pin.m_checked); binaryWriter.Write(pin.m_ownerID); binaryWriter.Write(((object)(PlatformUserID)(ref pin.m_author)).ToString()); num++; } } return num; } private static int ExportPinsToTextFile(IReadOnlyCollection<PinData> pins, string filename) { //IL_0091: 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) using StreamWriter streamWriter = File.CreateText(filename); int num = 0; foreach (PinData pin in pins) { if (pin.m_save) { streamWriter.Write("\"" + pin.m_name + "\","); streamWriter.Write($"{pin.m_pos.x},{pin.m_pos.y},{pin.m_pos.z},"); streamWriter.Write($"{pin.m_type},{pin.m_checked},{pin.m_ownerID},{pin.m_author}"); streamWriter.WriteLine(); num++; } } return num; } public static void ImportPinsFromBinaryFile(ConsoleEventArgs args) { //IL_00d4: 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_00e5: 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_0115: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Minimap.m_instance) || args.Length < 2) { return; } string text = "Pinnacle/" + args[1]; if (!File.Exists(text)) { args.Context.AddString("Could not find file: " + text); return; } Dictionary<PinType, Sprite> dictionary = Minimap.m_instance.m_icons.ToDictionary((SpriteData data) => data.m_name, (SpriteData data) => data.m_icon); using FileStream input = new FileStream(text, FileMode.Open); using BinaryReader binaryReader = new BinaryReader(input); int num = binaryReader.ReadInt32(); List<PinData> list = new List<PinData>(num); Pinnacle.LogInfo($"Reading {num} pins from file: {text}"); for (int i = 0; i < num; i++) { PinData val = new PinData { m_name = binaryReader.ReadString(), m_pos = new Vector3 { x = binaryReader.ReadSingle(), y = binaryReader.ReadSingle(), z = binaryReader.ReadSingle() }, m_type = (PinType)binaryReader.ReadInt32(), m_checked = binaryReader.ReadBoolean(), m_ownerID = binaryReader.ReadInt64(), m_author = new PlatformUserID(binaryReader.ReadString()), m_save = true }; dictionary.TryGetValue(val.m_type, out val.m_icon); list.Add(val); } if (args.Length >= 3) { list = FilterPins(list, args[2]); } Pinnacle.LogInfo($"Imported {list.Count} pins from file: {text}"); Minimap.m_instance.m_pins.AddRange(list); } private static List<PinData> FilterPins(IReadOnlyCollection<PinData> pins, string nameRegexPattern) { if (nameRegexPattern.Length > 0) { Pinnacle.LogInfo($"Filtering {pins.Count} pins by pin.name with regex: {nameRegexPattern}"); Regex regex = new Regex(nameRegexPattern, RegexOptions.CultureInvariant, TimeSpan.FromSeconds(1.0)); return pins.Where((PinData pin) => pin.m_save && regex.Match(pin.m_name).Success).ToList(); } return pins.Where((PinData pin) => pin.m_save).ToList(); } } public static class PinListPanelController { public static PinListPanel PinListPanel { get; private set; } public static void TogglePanel() { PinListPanel pinListPanel = PinListPanel; bool? obj; if (pinListPanel == null) { obj = null; } else { GameObject obj2 = pinListPanel.Panel.Ref<GameObject>(); obj = ((obj2 != null) ? new bool?(!obj2.activeSelf) : null); } bool? flag = obj; TogglePanel(flag.GetValueOrDefault()); } public static void TogglePanel(bool toggleOn) { //IL_0048: 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_0070: 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) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)PinListPanel?.Panel)) { PinListPanel = new PinListPanel(Minimap.m_instance.m_largeRoot.transform); PinListPanel.PanelRectTransform.SetAnchorMin(new Vector2(0f, 0.5f)).SetAnchorMax(new Vector2(0f, 0.5f)).SetPivot(new Vector2(0f, 0.5f)) .SetPosition(PluginConfig.PinListPanelPosition.Value) .SetSizeDelta(PluginConfig.PinListPanelSizeDelta.Value); PinListPanel.PanelDragger.OnPanelEndDrag += OnPanelDragEnd; PinListPanel.PanelResizer.OnPanelEndResize += OnPanelResizeEnd; } if (toggleOn) { PinListPanel.Panel.SetActive(true); PinListPanel.SetTargetPins(); } else { PinListPanel.PinNameFilter.InputField.DeactivateInputField(false); PinListPanel.Panel.SetActive(false); } } public static bool IsPanelValid() { return Object.op_Implicit((Object)(object)PinListPanel?.Panel); } public static void SetBackgroundColor(Color color) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (IsPanelValid()) { ((Graphic)PinListPanel.PanelBackground).color = color; } } public static void SetPanelPosition(Vector2 position) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (IsPanelValid()) { PinListPanel.PanelRectTransform.anchoredPosition = position; } } public static void SetPanelSize(Vector2 sizeDelta) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (IsPanelValid()) { PinListPanel.PanelRectTransform.sizeDelta = sizeDelta; PinListPanel.SetTargetPins(); } } public static void SetScrollRectMovementType(MovementType movementType) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (IsPanelValid()) { PinListPanel.ScrollRect.movementType = movementType; } } private static void OnPanelDragEnd(object sender, Vector3 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) PluginConfig.PinListPanelPosition.Value = Vector2.op_Implicit(position); } private static void OnPanelResizeEnd(object sender, Vector2 sizeDelta) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) PluginConfig.PinListPanelSizeDelta.Value = sizeDelta; } } public static class PinMarkerUtils { [CompilerGenerated] private sealed class <GetPinNameLabels>d__3 : IEnumerable<TMP_Text>, IEnumerable, IEnumerator<TMP_Text>, IDisposable, IEnumerator { private int <>1__state; private TMP_Text <>2__current; private int <>l__initialThreadId; private Minimap minimap; public Minimap <>3__minimap; private TMP_Text[] <>7__wrap1; private int <>7__wrap2; TMP_Text IEnumerator<TMP_Text>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetPinNameLabels>d__3(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>7__wrap1 = minimap.m_pinNamePrefab.GetComponentsInChildren<TMP_Text>(true); <>7__wrap2 = 0; goto IL_0075; case 1: <>1__state = -1; <>7__wrap2++; goto IL_0075; case 2: { <>1__state = -1; <>7__wrap2++; break; } IL_0075: if (<>7__wrap2 < <>7__wrap1.Length) { TMP_Text val = <>7__wrap1[<>7__wrap2]; <>2__current = val; <>1__state = 1; return true; } <>7__wrap1 = null; <>7__wrap1 = ((Component)minimap.m_pinNameRootLarge).GetComponentsInChildren<TMP_Text>(true); <>7__wrap2 = 0; break; } if (<>7__wrap2 < <>7__wrap1.Length) { TMP_Text val2 = <>7__wrap1[<>7__wrap2]; <>2__current = val2; <>1__state = 2; return true; } <>7__wrap1 = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<TMP_Text> IEnumerable<TMP_Text>.GetEnumerator() { <GetPinNameLabels>d__3 <GetPinNameLabels>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetPinNameLabels>d__ = this; } else { <GetPinNameLabels>d__ = new <GetPinNameLabels>d__3(0); } <GetPinNameLabels>d__.minimap = <>3__minimap; return <GetPinNameLabels>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<TMP_Text>)this).GetEnumerator(); } } public static void SetupPinNamePrefab(Minimap minimap) { TMP_Text componentInChildren = minimap.m_pinNamePrefab.GetComponentInChildren<TMP_Text>(); componentInChildren.enableAutoSizing = false; componentInChildren.richText = true; SetPinNameFont(); SetPinNameFontSize(); } public static void SetPinNameFont() { if (!Object.op_Implicit((Object)(object)Minimap.m_instance)) { return; } TMP_FontAsset fontAssetByName = UIResources.GetFontAssetByName(PluginConfig.PinFont.Value); foreach (TMP_Text pinNameLabel in GetPinNameLabels(Minimap.m_instance)) { pinNameLabel.font = fontAssetByName; } } public static void SetPinNameFontSize() { if (!Object.op_Implicit((Object)(object)Minimap.m_instance)) { return; } float fontSize = PluginConfig.PinFontSize.Value; foreach (TMP_Text pinNameLabel in GetPinNameLabels(Minimap.m_instance)) { pinNameLabel.fontSize = fontSize; } } [IteratorStateMachine(typeof(<GetPinNameLabels>d__3))] private static IEnumerable<TMP_Text> GetPinNameLabels(Minimap minimap) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GetPinNameLabels>d__3(-2) { <>3__minimap = minimap }; } } public static class PinnacleUtils { public static void CenterMapOnOrTeleportTo(PinData targetPin) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (PluginConfig.IsModEnabled.Value && ((Terminal)Console.m_instance).IsCheatsEnabled() && Object.op_Implicit((Object)(object)Player.m_localPlayer) && ZInput.GetKey((KeyCode)304, true)) { TeleportTo(targetPin); return; } Pinnacle.TogglePinEditPanel(PluginConfig.PinListPanelEditPinOnRowClick.Value ? targetPin : null); CenterMapHelper.CenterMapOnPosition(targetPin.m_pos); } public static void TeleportTo(PinData targetPin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) Vector3 targetPosition = targetPin.m_pos; if ((int)targetPin.m_type == 10 && !targetPin.m_save && !targetPin.m_checked) { targetPosition = GetPlayerInfoPosition(targetPin); } TeleportTo(targetPosition); } public static Vector3 GetPlayerInfoPosition(PinData targetPin) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) string name = targetPin.m_name; foreach (PlayerInfo player in ZNet.m_instance.m_players) { if (player.m_name == name && player.m_publicPosition) { Pinnacle.LogInfo($"Found PlayerInfo for {player.m_name}: {targetPin.m_pos:F0} -> {player.m_position:F0}"); return player.m_position; } } return targetPin.m_pos; } public static void TeleportTo(Vector3 targetPosition) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { Pinnacle.LogWarning("No local Player found."); return; } if (Mathf.Approximately(targetPosition.y, 0f)) { targetPosition.y = GetHeight(targetPosition); } Pinnacle.LogInfo($"Teleporting player from {((Component)localPlayer).transform.position:F0} to {targetPosition:F0}."); ((Character)localPlayer).TeleportTo(targetPosition, ((Component)localPlayer).transform.rotation, true); Minimap.m_instance.SetMapMode((MapMode)1); } public static float GetHeight(Vector3 targetPosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) float num = default(float); if (!Heightmap.GetHeight(targetPosition, ref num)) { num = GetHeightmapData(targetPosition).m_baseHeights[0]; } return Mathf.Max(0f, num); } public static HMBuildData GetHeightmapData(Vector3 targetPosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown HMBuildData val = new HMBuildData(targetPosition, 1, 1f, false, WorldGenerator.m_instance); HeightmapBuilder.m_instance.Build(val); return val; } public static PinData AddNewPin(Minimap minimap, Vector3 targetPosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Approximately(targetPosition.y, 0f)) { targetPosition.y = GetHeight(targetPosition); } return minimap.AddPin(targetPosition, minimap.m_selectedType, string.Empty, true, false, 0L, default(PlatformUserID)); } } public sealed class LabelButton { public GameObject Container { get; private set; } public RectTransform RectTransform { get; private set; } public TMP_Text Label { get; private set; } public Button Button { get; private set; } public LabelButton(Transform parentTransform) { Container = CreateContainer(parentTransform); RectTransform = Container.GetComponent<RectTransform>(); Label = CreateLabel(Container.transform); Button = CreateButton(Container); } private static GameObject CreateContainer(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0050: 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_0074: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown GameObject val = new GameObject("Button", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parentTransform, false); val.AddComponent<Image>().SetType((Type)1).SetSprite(UIResources.GetSprite("button")) .SetColor(Color.white); val.GetComponent<RectTransform>().SetAnchorMin(new Vector2(0.5f, 0.5f)).SetAnchorMax(new Vector2(0.5f, 0.5f)) .SetPivot(new Vector2(0.5f, 0.5f)) .SetPosition(Vector2.zero) .SetSizeDelta(new Vector2(120f, 45f)); return val; } private static TMP_Text CreateLabel(Transform parentTransform) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform); ((TMP_Text)(object)obj).SetFontSize<TMP_Text>(16f).SetAlignment<TMP_Text>((TextAlignmentOptions)514).SetText("Button"); ((TMP_Text)obj).rectTransform.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one).SetPivot(new Vector2(0.5f, 0.5f)) .SetPosition(Vector2.zero) .SetSizeDelta(Vector2.zero); return (TMP_Text)(object)obj; } private static Button CreateButton(GameObject container) { //IL_000f: 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) Button obj = container.AddComponent<Button>(); Button selectable = obj.SetTransition<Button>((Transition)2); SpriteState spriteState = default(SpriteState); ((SpriteState)(ref spriteState)).disabledSprite = UIResources.GetSprite("button_disabled"); ((SpriteState)(ref spriteState)).highlightedSprite = UIResources.GetSprite("button_highlight"); ((SpriteState)(ref spriteState)).pressedSprite = UIResources.GetSprite("button_pressed"); ((SpriteState)(ref spriteState)).selectedSprite = UIResources.GetSprite("button_highlight"); selectable.SetSpriteState<Button>(spriteState); return obj; } } public sealed class LabelCell { public GameObject Cell { get; private set; } public Image Background { get; private set; } public TMP_Text Label { get; private set; } public LabelCell(Transform parentTransform) { Cell = CreateChildCell(parentTransform); Background = Cell.Image(); Label = CreateChildLabel(Cell.transform); } private GameObject CreateChildCell(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown GameObject val = new GameObject("Cell", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.AddComponent<HorizontalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false) .SetPadding(4, 4, 4, 4) .SetSpacing(4f) .SetChildAlignment((TextAnchor)4); val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateRoundedCornerSprite(64, 64, 8, (FilterMode)1)) .SetColor(new Color(0.2f, 0.2f, 0.2f, 0.5f)); val.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)0).SetVerticalFit((FitMode)2); val.AddComponent<LayoutElement>().SetPreferred(150f, null).SetFlexible(1f); return val; } private TMP_Text CreateChildLabel(Transform parentTransform) { TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform); ((TMP_Text)(object)obj).SetName<TMP_Text>("Label"); ((TMP_Text)obj).alignment = (TextAlignmentOptions)513; ((TMP_Text)obj).text = "Label"; ((Component)obj).gameObject.AddComponent<LayoutElement>().SetFlexible(1f); return (TMP_Text)(object)obj; } } public sealed class LabelRow { public GameObject Row { get; private set; } public TMP_Text Label { get; private set; } public LabelRow(Transform parentTransform) { Row = CreateChildRow(parentTransform); Label = CreateChildLabel(Row.transform); } private GameObject CreateChildRow(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown GameObject val = new GameObject("Row", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.AddComponent<HorizontalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false) .SetPadding(8, 8, 2, 2) .SetSpacing(12f) .SetChildAlignment((TextAnchor)4); return val; } private TMP_Text CreateChildLabel(Transform parentTransform) { TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform); ((TMP_Text)(object)obj).SetName<TMP_Text>("Label"); ((TMP_Text)obj).alignment = (TextAlignmentOptions)513; ((TMP_Text)obj).text = "Label"; ((Component)obj).gameObject.AddComponent<LayoutElement>(); return (TMP_Text)(object)obj; } } public sealed class LabelValueRow { public GameObject Row { get; private set; } public TMP_Text Label { get; private set; } public ValueCell Value { get; private set; } public LabelValueRow(Transform parentTransform) { Row = CreateChildRow(parentTransform); Label = CreateChildLabel(Row.transform); Value = new ValueCell(Row.transform); } private GameObject CreateChildRow(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown GameObject val = new GameObject("Row", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.AddComponent<HorizontalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false) .SetPadding(8, 8, 2, 2) .SetSpacing(12f) .SetChildAlignment((TextAnchor)4); return val; } private TMP_Text CreateChildLabel(Transform parentTransform) { TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform); ((TMP_Text)(object)obj).SetName<TMP_Text>("Label"); ((TMP_Text)obj).alignment = (TextAlignmentOptions)513; ((TMP_Text)obj).text = "Name"; ((Component)obj).gameObject.AddComponent<LayoutElement>().SetPreferred(75f, null); return (TMP_Text)(object)obj; } } public sealed class ToggleCell { private static readonly Lazy<ColorBlock> ToggleColorBlock = new Lazy<ColorBlock>((Func<ColorBlock>)delegate { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0074: 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_00b1: Unknown result type (might be due to invalid IL or missing references) ColorBlock result = default(ColorBlock); ((ColorBlock)(ref result)).normalColor = new Color(1f, 1f, 1f, 0.9f); ((ColorBlock)(ref result)).highlightedColor = new Color(0.565f, 0.792f, 0.976f); ((ColorBlock)(ref result)).disabledColor = new Color(0.2f, 0.2f, 0.2f, 0.8f); ((ColorBlock)(ref result)).pressedColor = new Color(0.647f, 0.839f, 0.655f); ((ColorBlock)(ref result)).selectedColor = new Color(1f, 0.878f, 0.51f); ((ColorBlock)(ref result)).colorMultiplier = 1f; ((ColorBlock)(ref result)).fadeDuration = 0.25f; return result; }); public GameObject Cell { get; private set; } public TMP_Text Label { get; private set; } public Image Checkbox { get; private set; } public Image Checkmark { get; private set; } public Toggle Toggle { get; private set; } public ToggleCell(Transform parentTransform) { //IL_0095: 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) Cell = CreateChildCell(parentTransform); Label = CreateChildLabel(Cell.transform); Checkbox = CreateChildCheckbox(Cell.transform).Image(); Checkmark = CreateChildCheckmark(((Component)Checkbox).transform).Image(); Toggle = Cell.AddComponent<Toggle>(); Toggle.SetTransition<Toggle>((Transition)1).SetNavigationMode<Toggle>((Mode)0).SetTargetGraphic<Toggle>((Graphic)(object)Checkbox) .SetColors<Toggle>(ToggleColorBlock.Value); Toggle.graphic = (Graphic)(object)Checkmark; Toggle.toggleTransition = (ToggleTransition)1; } private GameObject CreateChildCell(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00e6: Expected O, but got Unknown GameObject val = new GameObject("Cell", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.AddComponent<HorizontalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false) .SetPadding(8, 8, 4, 4) .SetSpacing(8f) .SetChildAlignment((TextAnchor)4); val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateRoundedCornerSprite(64, 64, 8, (FilterMode)1)) .SetColor(new Color(0.5f, 0.5f, 0.5f, 0.5f)); val.AddComponent<Shadow>().SetEffectDistance(new Vector2(2f, -2f)); val.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)2).SetVerticalFit((FitMode)2); return val; } private GameObject CreateChildCheckbox(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0093: 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_00f4: Expected O, but got Unknown GameObject val = new GameObject("Toggle.Checkbox", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.AddComponent<Image>().SetType((Type)3).SetSprite(UIBuilder.CreateRoundedCornerSprite(64, 64, 10, (FilterMode)1)) .SetColor(new Color(0.5f, 0.5f, 0.5f, 0.9f)) .SetPreserveAspect(preserveAspect: true); val.AddComponent<Shadow>().SetEffectDistance(new Vector2(1f, -1f)); val.AddComponent<GridLayoutGroup>().SetCellSize(new Vector2(12f, 12f)).SetPadding(4, 4, 4, 4) .SetConstraint((Constraint)1) .SetConstraintCount(1) .SetStartAxis((Axis)0) .SetStartCorner((Corner)0); val.AddComponent<LayoutElement>().SetPreferred(16f, 16f); return val; } private GameObject CreateChildCheckmark(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: 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_0067: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown GameObject val = new GameObject("Toggle.Checkmark", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.AddComponent<Image>().SetType((Type)3).SetSprite(UIBuilder.CreateRoundedCornerSprite(64, 64, 6, (FilterMode)1)) .SetColor(new Color(0.565f, 0.792f, 0.976f, 0.9f)) .SetPreserveAspect(preserveAspect: true); val.AddComponent<Shadow>().SetEffectDistance(new Vector2(1f, -1f)); val.AddComponent<LayoutElement>().SetFlexible(1f, 1f); return val; } private TMP_Text CreateChildLabel(Transform parentTransform) { TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform); ((TMP_Text)(object)obj).SetName<TMP_Text>("Toggle.Label"); ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).text = "Toggle"; return (TMP_Text)(object)obj; } } public sealed class ValueCell { private static readonly Lazy<ColorBlock> InputFieldColorBlock = new Lazy<ColorBlock>((Func<ColorBlock>)delegate { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0074: 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_00b1: Unknown result type (might be due to invalid IL or missing references) ColorBlock result = default(ColorBlock); ((ColorBlock)(ref result)).normalColor = new Color(1f, 1f, 1f, 0.9f); ((ColorBlock)(ref result)).highlightedColor = new Color(0.565f, 0.792f, 0.976f); ((ColorBlock)(ref result)).disabledColor = new Color(0.2f, 0.2f, 0.2f, 0.8f); ((ColorBlock)(ref result)).pressedColor = new Color(0.647f, 0.839f, 0.655f); ((ColorBlock)(ref result)).selectedColor = new Color(1f, 0.878f, 0.51f); ((ColorBlock)(ref result)).colorMultiplier = 1f; ((ColorBlock)(ref result)).fadeDuration = 0.25f; return result; }); public GameObject Cell { get; private set; } public Image Background { get; private set; } public TMP_InputField InputField { get; private set; } public ValueCell(Transform parentTransform) { Cell = CreateChildCell(parentTransform); Background = Cell.Image(); InputField = CreateChildInputField(Cell.transform); InputField.SetTargetGraphic<TMP_InputField>((Graphic)(object)Background); } private GameObject CreateChildCell(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown GameObject val = new GameObject("Cell", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateRoundedCornerSprite(64, 64, 8, (FilterMode)1)) .SetColor(new Color(0.5f, 0.5f, 0.5f, 0.5f)); val.AddComponent<RectMask2D>(); val.AddComponent<LayoutElement>(); return val; } private TMP_InputField CreateChildInputField(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_002d: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("InputField", new Type[1] { typeof(RectTransform) }); val.SetParent(parentTransform); val.RectTransform().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one) .SetSizeDelta(Vector2.zero) .SetPosition(Vector2.zero); TMP_Text val2 = (TMP_Text)(object)UIBuilder.CreateTMPLabel(val.transform); val2.SetName<TMP_Text>("InputField.Text"); val2.richText = false; val2.alignment = (TextAlignmentOptions)513; val2.text = "InputField.Text"; TMP_InputField obj = ((Component)parentTransform).gameObject.AddComponent<TMP_InputField>(); obj.textComponent = val2; obj.textViewport = val.GetComponent<RectTransform>(); ((Selectable)obj).transition = (Transition)1; ((Selectable)obj).colors = InputFieldColorBlock.Value; obj.onFocusSelectAll = false; obj.SetNavigationMode<TMP_InputField>((Mode)0); return obj; } } public sealed class VectorCell { public GameObject Cell { get; private set; } public TMP_Text XLabel { get; private set; } public ValueCell XValue { get; private set; } public TMP_Text YLabel { get; private set; } public ValueCell YValue { get; private set; } public TMP_Text ZLabel { get; private set; } public ValueCell ZValue { get; private set; } public VectorCell(Transform parentTransform) { //IL_00c1: 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) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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_025b: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) Cell = CreateChildCell(parentTransform); XValue = new ValueCell(Cell.transform); XLabel = (TMP_Text)(object)UIBuilder.CreateTMPLabel(XValue.Cell.transform); XLabel.transform.SetAsFirstSibling(); XLabel.alignment = (TextAlignmentOptions)513; XLabel.SetText("X"); XValue.InputField.textComponent.alignment = (TextAlignmentOptions)516; XValue.Cell.GetComponent<LayoutElement>().SetFlexible(1f).SetPreferred(XLabel.GetPreferredValues("-99999") + new Vector2(0f, 8f)); YValue = new ValueCell(Cell.transform); YLabel = (TMP_Text)(object)UIBuilder.CreateTMPLabel(YValue.Cell.transform); YLabel.transform.SetAsFirstSibling(); YLabel.alignment = (TextAlignmentOptions)513; YLabel.SetText("Y"); YValue.InputField.textComponent.alignment = (TextAlignmentOptions)516; YValue.Cell.GetComponent<LayoutElement>().SetFlexible(1f).SetPreferred(YLabel.GetPreferredValues("-99999") + new Vector2(0f, 8f)); ZValue = new ValueCell(Cell.transform); ZLabel = (TMP_Text)(object)UIBuilder.CreateTMPLabel(ZValue.Cell.transform); ZLabel.transform.SetAsFirstSibling(); ZLabel.alignment = (TextAlignmentOptions)513; ZLabel.SetText("Z"); ZValue.InputField.textComponent.alignment = (TextAlignmentOptions)516; ZValue.Cell.GetComponent<LayoutElement>().SetFlexible(1f).SetPreferred(ZLabel.GetPreferredValues("-99999") + new Vector2(0f, 8f)); } private GameObject CreateChildCell(Transform parentTransform) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown GameObject val = new GameObject("Cell", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.AddComponent<HorizontalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false) .SetSpacing(8f) .SetChildAlignment((TextAnchor)4); return val; } } public sealed class DisableHighlightOnSelect : MonoBehaviour, ISelectHandler, IEventSystemHandler { [CompilerGenerated] private sealed class <DisableHighlight>d__3 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public DisableHighlightOnSelect <>4__this; private Color <original>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DisableHighlight>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; DisableHighlightOnSelect disableHighlightOnSelect = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <original>5__2 = disableHighlightOnSelect._inputField.selectionColor; disableHighlightOnSelect._inputField.selectionColor = Color.clear; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; disableHighlightOnSelect._inputField.MoveTextEnd(false); disableHighlightOnSelect._inputField.selectionColor = <original>5__2; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private InputField _inputField; private void Start() { _inputField = ((Component)this).GetComponent<InputField>(); } public void OnSelect(BaseEventData eventData) { ((MonoBehaviour)this).StartCoroutine(DisableHighlight()); } [IteratorStateMachine(typeof(<DisableHighlight>d__3))] private IEnumerator DisableHighlight() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DisableHighlight>d__3(0) { <>4__this = this }; } } public sealed class PanelDragger : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler { private Vector2 _lastMousePosition; public RectTransform TargetRectTransform; public event EventHandler<Vector3> OnPanelEndDrag; public void OnBeginDrag(PointerEventData eventData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) _lastMousePosition = eventData.position; } public void OnDrag(PointerEventData eventData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) Vector2 val = eventData.position - _lastMousePosition; if (Object.op_Implicit((Object)(object)TargetRectTransform)) { RectTransform targetRectTransform = TargetRectTransform; ((Transform)targetRectTransform).position = ((Transform)targetRectTransform).position + new Vector3(val.x, val.y, ((Transform)TargetRectTransform).position.z); } _lastMousePosition = eventData.position; } public void OnEndDrag(PointerEventData eventData) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)TargetRectTransform)) { this.OnPanelEndDrag?.Invoke(this, Vector2.op_Implicit(TargetRectTransform.anchoredPosition)); } } } public sealed class PanelResizer : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IBeginDragHandler, IDragHandler, IEndDragHandler { [CompilerGenerated] private sealed class <LerpCanvasGroupAlpha>d__10 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PanelResizer <>4__this; public float lerpDuration; public float targetAlpha; private float <timeElapsed>5__2; private float <sourceAlpha>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LerpCanvasGroupAlpha>d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; PanelResizer panelResizer = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <timeElapsed>5__2 = 0f; <sourceAlpha>5__3 = panelResizer._canvasGroup.alpha; break; case 1: <>1__state = -1; break; } if (<timeElapsed>5__2 < lerpDuration) { float num2 = <timeElapsed>5__2 / lerpDuration; num2 = num2 * num2 * (3f - 2f * num2); panelResizer._canvasGroup.SetAlpha(Mathf.Lerp(<sourceAlpha>5__3, targetAlpha, num2)); <timeElapsed>5__2 += Time.deltaTime; <>2__current = null; <>1__state = 1; return true; } panelResizer._canvasGroup.SetAlpha(targetAlpha); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private CanvasGroup _canvasGroup; private float _targetAlpha; private Vector2 _lastMousePosition; private Coroutine _lerpAlphaCoroutine; public RectTransform TargetRectTransform; public event EventHandler<Vector2> OnPanelEndResize; private void Awake() { _canvasGroup = ((Component)this).GetComponent<CanvasGroup>(); } private void SetCanvasGroupAlpha(float alpha) { if (_lerpAlphaCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_lerpAlphaCoroutine); _lerpAlphaCoroutine = null; } if (_canvasGroup.alpha != alpha) { _lerpAlphaCoroutine = ((MonoBehaviour)this).StartCoroutine(LerpCanvasGroupAlpha(alpha, 0.25f)); } } [IteratorStateMachine(typeof(<LerpCanvasGroupAlpha>d__10))] private IEnumerator LerpCanvasGroupAlpha(float targetAlpha, float lerpDuration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LerpCanvasGroupAlpha>d__10(0) { <>4__this = this, targetAlpha = targetAlpha, lerpDuration = lerpDuration }; } public void OnPointerEnter(PointerEventData eventData) { _targetAlpha = 1f; SetCanvasGroupAlpha(_targetAlpha); } public void OnPointerExit(PointerEventData eventData) { _targetAlpha = 0f; if (!eventData.dragging) { SetCanvasGroupAlpha(_targetAlpha); } } public void OnBeginDrag(PointerEventData eventData) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) SetCanvasGroupAlpha(1f); _lastMousePosition = eventData.position; } public void OnDrag(PointerEventData eventData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //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_0085: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Vector2 val = _lastMousePosition - eventData.position; if (Object.op_Implicit((Object)(object)TargetRectTransform)) { RectTransform targetRectTransform = TargetRectTransform; targetRectTransform.anchoredPosition += new Vector2(0f, -0.5f * val.y); RectTransform targetRectTransform2 = TargetRectTransform; targetRectTransform2.sizeDelta += new Vector2(-1f * val.x, val.y); } SetCanvasGroupAlpha(1f); _lastMousePosition = eventData.position; } public void OnEndDrag(PointerEventData eventData) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) SetCanvasGroupAlpha(_targetAlpha); this.OnPanelEndResize?.Invoke(this, TargetRectTransform.sizeDelta); } } public sealed class ParentSizeFitter : MonoBehaviour { private RectTransform _parentRectTransform; private RectTransform _rectTransform; private void Awake() { _parentRectTransform = ((Component)((Component)this).transform.parent).GetComponent<RectTransform>(); _rectTransform = ((Component)this).GetComponent<RectTransform>(); } private void OnRectTransformDimensionsChange() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_parentRectTransform)) { _parentRectTransform = ((Component)((Component)this).transform.parent).GetComponent<RectTransform>(); } if (!Object.op_Implicit((Object)(object)_rectTransform)) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); } if (Object.op_Implicit((Object)(object)_rectTransform) && Object.op_Implicit((Object)(object)_parentRectTransform)) { _rectTransform.SetSizeWithCurrentAnchors((Axis)0, _parentRectTransform.sizeDelta.x); } } } public sealed class PointerState : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { public bool IsPointerHovered { get; private set; } public void OnPointerEnter(PointerEventData eventData) { IsPointerHovered = true; } public void OnPointerExit(PointerEventData eventData) { IsPointerHovered = false; } } public static class UIBuilder { private static readonly Lazy<TextGenerator> CachedTextGenerator = new Lazy<TextGenerator>(); private static readonly Dictionary<string, Sprite> _spriteCache = new Dictionary<string, Sprite>(); private static readonly Color32 ColorWhite = Color32.op_Implicit(Color.white); private static readonly Color32 ColorClear = Color32.op_Implicit(Color.clear); public static TextMeshProUGUI CreateTMPLabel(Transform parentTransform) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = Object.Instantiate<TextMeshProUGUI>(UnifiedPopup.instance.bodyText, parentTransform, false); ((Object)obj).name = "Label"; ((TMP_Text)obj).text = string.Empty; ((TMP_Text)obj).fontSize = 16f; ((Graphic)obj).color = Color.white; ((TMP_Text)obj).richText = true; ((TMP_Text)obj).enableAutoSizing = false; return obj; } public static GameObject CreateRowSpacer(Transform parentTransform) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown GameObject val = new GameObject(((Object)parentTransform).name + ".Spacer", new Type[1] { typeof(RectTransform) }); GameObjectExtensions.SetParent(val, parentTransform); val.AddComponent<LayoutElement>().SetFlexible(1f); return val; } public static float GetPreferredWidth(this Text text) { return GetPreferredWidth(text, text.text); } public static float GetPreferredWidth(Text text, string content) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) TextGenerator value = CachedTextGenerator.Value; Rect rect = ((Graphic)text).rectTransform.rect; return value.GetPreferredWidth(content, text.GetGenerationSettings(((Rect)(ref rect)).size)); } public static Sprite CreateRoundedCornerSprite(int width, int height, int radius, FilterMode filterMode = 1) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_012f: Unknown result type (might be due to invalid IL or missing references) string text = $"RoundedCorner-{width}w-{height}h-{radius}r"; if (_spriteCache.TryGetValue(text, out var value)) { return value; } Texture2D val = Texture2DExtensions.SetName(new Texture2D(width, height), text).SetWrapMode((TextureWrapMode)1).SetFilterMode(filterMode); Color32[] array = (Color32[])(object)new Color32[width * height]; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { array[i * width + j] = (IsCornerPixel(j, i, width, height, radius) ? ColorClear : ColorWhite); } } val.SetPixels32(array); val.Apply(); int k; for (k = 0; k < width && !(Color32.op_Implicit(array[k]) == Color.white); k++) { } int l; for (l = 0; l < height && !(Color32.op_Implicit(array[l * width]) == Color.white); l++) { } value = Sprite.Create(val, new Rect(0f, 0f, (float)width, (float)height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)k, (float)l, (float)k, (float)l)).SetName(text); _spriteCache[text] = value; return value; } private static bool IsCornerPixel(int x, int y, int w, int h, int rad) { if (rad == 0) { return false; } int num = Math.Min(x, w - x); int num2 = Math.Min(y, h - y); if (num == 0 && num2 == 0) { return true; } if (num > rad || num2 > rad) { return false; } num = rad - num; num2 = rad - num2; return Math.Round(Math.Sqrt(num * num + num2 * num2)) > (double)rad; } public static Sprite CreateSuperellipse(int width, int height, float exponent) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0129: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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) //IL_01c3: 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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) string text = $"Superellipse-{width}w-{height}h-{exponent}e"; if (_spriteCache.TryGetValue(text, out var value)) { return value; } Texture2D val = Texture2DExtensions.SetName(new Texture2D(width, height), text).SetWrapMode((TextureWrapMode)1).SetFilterMode((FilterMode)2); Color32[] array = (Color32[])(object)new Color32[width * height]; int num = width / 2; int num2 = height / 2; float num3 = 1f * ((float)width / 2f); float num4 = 1f * ((float)height / 2f); for (int i = 0; i < num; i++) { for (int j = 0; j < num2; j++) { Color32 val2 = Color32.op_Implicit((Mathf.Pow(Mathf.Abs((float)i / num3), exponent) + Mathf.Pow(Mathf.Abs((float)j / num4), exponent) > 1f) ? Color.clear : Color.white); int x2 = i + num; int x3 = -i + num - 1; int y2 = -j + num2 - 1; int y3 = j + num2; array[XYToIndex(x2, y3)] = val2; array[XYToIndex(x2, y2)] = val2; array[XYToIndex(x3, y2)] = val2; array[XYToIndex(x3, y3)] = val2; } } val.SetPixels32(array); val.Apply(); int k; for (k = 0; k < width && !(Color32.op_Implicit(array[k]) == Color.white); k++) { } int l; for (l = 0; l < height && !(Color32.op_Implicit(array[l * width]) == Color.white); l++) { } value = Sprite.Create(val, new Rect(0f, 0f, (float)width, (float)height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)k, (float)l, (float)k, (float)l)).SetName(text); _spriteCache[text] = value; return value; int XYToIndex(int x, int y) { return x + y * width; } } } public static class CanvasGroupExtensions { public static CanvasGroup SetAlpha(this CanvasGroup canvasGroup, float alpha) { canvasGroup.alpha = alpha; return canvasGroup; } public static CanvasGroup SetBlocksRaycasts(this CanvasGroup canvasGroup, bool blocksRaycasts) { canvasGroup.blocksRaycasts = blocksRaycasts; return canvasGroup; } } public static class ColorExtensions { public static Color SetAlpha(this Color color, float alpha) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) color.a = alpha; return color; } } public static class ContentSizeFitterExtensions { public static ContentSizeFitter SetHorizontalFit(this ContentSizeFitter fitter, FitMode fitMode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) fitter.horizontalFit = fitMode; return fitter; } public static ContentSizeFitter SetVerticalFit(this ContentSizeFitter fitter, FitMode fitMode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) fitter.verticalFit = fitMode; return fitter; } } public static class GameObjectExtensions { public static GameObject SetName(this GameObject gameObject, string name) { ((Object)gameObject).name = name; return gameObject; } public static T SetName<T>(this T component, string name) where T : Component { ((Object)((Component)component).gameObject).name = name; return component; } public static GameObject SetParent(this GameObject gameObject, Transform transform, bool worldPositionStays = false) { gameObject.transform.SetParent(transform, worldPositionStays); return gameObject; } public static IEnumerable<GameObject> Children(this GameObject gameObject) { if (!Object.op_Implicit((Object)(object)gameObject)) { return Array.Empty<GameObject>(); } return from Transform t in (IEnumerable)gameObject.transform select ((Component)t).gameObject; } public static Button Button(this GameObject gameObject) { if (!Object.op_Implicit((Object)(object)gameObject)) { return null; } return gameObject.GetComponent<Button>(); } public static Image Image(this GameObject gameObject) { if (!Object.op_Implicit((Object)(object)gameObject)) { return null; } return gameObject.GetComponent<Image>(); } public static LayoutElement LayoutElement(this GameObject gameObject) { if (!Object.op_Implicit((Object)(object)gameObject)) { return null; } return gameObject.GetComponent<LayoutElement>(); } public static RectTransform RectTransform(this GameObject gameObject) { if (!Object.op_Implicit((Object)(object)gameObject)) { return null; } return gameObject.GetComponent<RectTransform>(); } public static Text Text(this GameObject gameObject) { if (!Object.op_Implicit((Object)(object)gameObject)) { return null; } return gameObject.GetComponent<Text>(); } } public static class GridLayoutGroupExtensions { public static GridLayoutGroup SetCellSize(this GridLayoutGroup layoutGroup, Vector2 cellSize) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) layoutGroup.cellSize = cellSize; return layoutGroup; } public static GridLayoutGroup SetConstraint(this GridLayoutGroup layoutGroup, Constraint constraint) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) layoutGroup.constraint = constraint; return layoutGroup; } public static GridLayoutGroup SetConstraintCount(this GridLayoutGroup layoutGroup, int constraintCount) { layoutGroup.constraintCount = constraintCount; return layoutGroup; } public static GridLayoutGroup SetStartAxis(this GridLayoutGroup layoutGroup, Axis startAxis) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) layoutGroup.startAxis = startAxis; return layoutGroup; } public static GridLayoutGroup SetStartCorner(this GridLayoutGroup layoutGroup, Corner startCorner) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) layoutGroup.startCorner = startCorner; return layoutGroup; } public static GridLayoutGroup SetPadding(this GridLayoutGroup layoutGroup, int? left = null, int? right = null, int? top = null, int? bottom = null) { if (!left.HasValue && !right.HasValue && !top.HasValue && !bottom.HasValue) { throw new ArgumentException("Value for left, right, top or bottom must be provided."); } if (left.HasValue) { ((LayoutGroup)layoutGroup).padding.left = left.Value; } if (right.HasValue) { ((LayoutGroup)layoutGroup).padding.right = right.Value; } if (top.HasValue) { ((LayoutGroup)layoutGroup).padding.top = top.Value; } if (bottom.HasValue) { ((LayoutGroup)layoutGroup).padding.bottom = bottom.Value; } return layoutGroup; } public static GridLayoutGroup SetSpacing(this GridLayoutGroup layoutGroup, Vector2 spacing) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) layoutGroup.spacing = spacing; return layoutGroup; } } public static class HorizontalLayoutGroupExtensions { public static HorizontalLayoutGroup SetChildControl(this HorizontalLayoutGroup layoutGroup, bool? width = null, bool? height = null) { if (!width.HasValue && !height.HasValue) { throw new ArgumentException("Value for width or height must be provided."); } if (width.HasValue) { ((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlWidth = width.Value; } if (height.HasValue) { ((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlHeight = height.Value; } return layoutGroup; } public static HorizontalLayoutGroup SetChildForceExpand(this HorizontalLayoutGroup layoutGroup, bool? width = null, bool? height = null) { if (!width.HasValue && !height.HasValue) { throw new ArgumentException("Value for width or height must be provided."); } if (width.HasValue) { ((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandWidth = width.Value; } if (height.HasValue) { ((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandHeight = height.Value; } return layoutGroup; } public static HorizontalLayoutGroup SetChildAlignment(this HorizontalLayoutGroup layoutGroup, TextAnchor alignment) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((LayoutGroup)layoutGroup).childAlignment = alignment; return layoutGroup; } public static HorizontalLayoutGroup SetPadding(this HorizontalLayoutGroup layoutGroup, int? left = null, int? right = null, int? top = null, int? bottom = null) { if (!left.HasValue && !right.HasValue && !top.HasValue && !bottom.HasValue) { throw new ArgumentException("Value for left, right, top or bottom must be provided."); } if (left.HasValue) { ((LayoutGroup)layoutGroup).padding.left = left.Value; } if (right.HasValue) { ((LayoutGroup)layoutGroup).padding.right = right.Value; } if (top.HasValue) { ((LayoutGroup)layoutGroup).padding.top = top.Value; } if (bottom.HasValue) { ((LayoutGroup)layoutGroup).padding.bottom = bottom.Value; } return layoutGroup; } public static HorizontalLayoutGroup SetSpacing(this HorizontalLayoutGroup layoutGroup, float spacing) { ((HorizontalOrVerticalLayoutGroup)layoutGroup).spacing = spacing; return layoutGroup; } } public static class ImageExtensions { public static Image SetColor(this Image image, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((Graphic)image).color = color; return image; } public static Image SetFillAmount(this Image image, float amount) { image.fillAmount = amount; return image; } public static Image SetFillCenter(this Image image, bool fillCenter) { image.fillCenter = fillCenter; return image; } public static Image SetFillMethod(this Image image, FillMethod fillMethod) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) image.fillMethod = fillMethod; return image; } public static Image SetFillOrigin(this Image image, OriginHorizontal origin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown image.fillOrigin = (int)origin; return image; } public static Image SetFillOrigin(this Image image, OriginVertical origin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected I4, but got Unknown image.fillOrigin = (int)origin; return image; } public static Image SetMaskable(this Image image, bool maskable) { ((MaskableGraphic)image).maskable = maskable; return image; } public static Image SetPreserveAspect(this Image image, bool preserveAspect) { image.preserveAspect = preserveAspect; return image; } public static Image SetRaycastTarget(this Image image, bool raycastTarget) { ((Graphic)image).raycastTarget = raycastTarget; return image; } public static Image SetSprite(this Image image, Sprite sprite) { image.sprite = sprite; return image; } public static Image SetType(this Image image, Type type) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) image.type = type; return image; } } public static class InputFieldExtensions { public static InputField SetTextComponent(this InputField inputField, Text textComponent) { inputField.textComponent = textComponent; return inputField; } } public static class LayoutElementExtensions { public static LayoutElement SetPreferred(this LayoutElement layoutElement, float? width = null, float? height = null) { if (!width.HasValue && !height.HasValue) { throw new ArgumentException("Value for width or height must be provided."); } if (width.HasValue) { layoutElement.preferredWidth = width.Value; } if (height.HasValue) { layoutElement.preferredHeight = height.Value; } return layoutElement; } public static LayoutElement SetPreferred(this LayoutElement layoutElement, Vector2 sizeDelta) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) layoutElement.preferredWidth = sizeDelta.x; layoutElement.preferredHeight = sizeDelta.y; return layoutElement; } public static LayoutElement SetFlexible(this LayoutElement layoutElement, float? width = null, float? height = null) { if (!width.HasValue && !height.HasValue) { throw new ArgumentException("Value for width or height must be provided."); } if (width.HasValue) { layoutElement.flexibleWidth = width.Value; } if (height.HasValue) { layoutElement.flexibleHeight = height.Value; } return layoutElement; } public static LayoutElement SetMinimum(this LayoutElement layoutElement, float? width = null, float? height = null) { if (!width.HasValue && !height.HasValue) { throw new ArgumentException("Value for width or height must be provided."); } if (width.HasValue) { layoutElement.minWidth = width.Value; } if (height.HasValue) { layoutElement.minHeight = height.Value; } return layoutElement; } public static LayoutElement SetIgnoreLayout(this LayoutElement layoutElement, bool ignoreLayout) { layoutElement.ignoreLayout = ignoreLayout; return layoutElement; } } public static class MaskExtensions { public static Mask SetShowMaskGraphic(this Mask mask, bool showMaskGraphic) { mask.showMaskGraphic = showMaskGraphic; return mask; } } public static class OutlineExtensions { public static Outline SetEffectColor(this Outline outline, Color effectColor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((Shadow)outline).effectColor = effectColor; return outline; } public static Outline SetEffectDistance(this Outline outline, Vector2 effectDistance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((Shadow)outline).effectDistance = effectDistance; return outline; } public static Outline SetUseGraphicAlpha(this Outline outline, bool useGraphicAlpha) { ((Shadow)outline).useGraphicAlpha = useGraphicAlpha; return outline; } } public static class RectTransformExtensions { public static RectTransform SetAnchorMin(this RectTransform rectTransform, Vector2 anchorMin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.anchorMin = anchorMin; return rectTransform; } public static RectTransform SetAnchorMax(this RectTransform rectTransform, Vector2 anchorMax) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.anchorMax = anchorMax; return rectTransform; } public static RectTransform SetPivot(this RectTransform rectTransform, Vector2 pivot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.pivot = pivot; return rectTransform; } public static RectTransform SetPosition(this RectTransform rectTransform, Vector2 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.anchoredPosition = position; return rectTransform; } public static RectTransform SetSizeDelta(this RectTransform rectTransform, Vector2 sizeDelta) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) rectTransform.sizeDelta = sizeDelta; return rectTransform; } } public static class SelectableExtensions { public static T SetColors<T>(this T selectable, ColorBlock colors) where T : Selectable { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Selectable)selectable).colors = colors; return selectable; } public static T SetImage<T>(this T selectable, Image image) where T : Selectable { ((Selectable)selectable).image = image; return selectable; } public static T SetInteractable<T>(this T selectable, bool interactable) where T : Selectable { ((Selectable)selectable).interactable = interactable; return selectable; } public static T SetSpriteState<T>(this T selectable, SpriteState spriteState) where T : Selectable { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Selectable)selectable).spriteState = spriteState; return selectable; } public static T SetTargetGraphic<T>(this T selectable, Graphic graphic) where T : Selectable { ((Selectable)selectable).targetGraphic = graphic; return selectable; } public static T SetTransition<T>(this T selectable, Transition transition) where T : Selectable { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Selectable)selectable).transition = transition; return selectable; } public static T SetNavigationMode<T>(this T selectable, Mode mode) where T : Selectable { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Navigation navigation = ((Selectable)selectable).navigation; ((Navigation)(ref navigation)).mode = mode; ((Selectable)selectable).navigation = navigation; return selectable; } } public static class ShadowExtensions { public static Shadow SetEffectColor(this Shadow shadow, Color effectColor) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) shadow.effectColor = effectColor; return shadow; } public static Shadow SetEffectDistance(this Shadow shadow, Vector2 effectDistance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) shadow.effectDistance = effectDistance; return shadow; } } public static class ScrollRectExtensions { public static ScrollRect SetMovementType(this ScrollRect scrollRect, MovementType movementType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) scrollRect.movementType = movementType; return scrollRect; } public static ScrollRect SetScrollSensitivity(this ScrollRect scrollRect, float sensitivity) { scrollRect.scrollSensitivity = sensitivity; return scrollRect; } public static ScrollRect SetVerticalScrollPosition(this ScrollRect scrollRect, float position) { scrollRect.verticalNormalizedPosition = position; return scrollRect; } public static ScrollRect SetViewport(this ScrollRect scrollRect, RectTransform viewport) { scrollRect.viewport = viewport; return scrollRect; } public static ScrollRect SetContent(this ScrollRect scrollRect, RectTransform content) { scrollRect.content = content; return scrollRect; } public static ScrollRect SetHorizontal(this ScrollRect scrollRect, bool horizontal) { scrollRect.horizontal = horizontal; return scrollRect; } public static ScrollRect SetVertical(this ScrollRect scrollRect, bool vertical) { scrollRect.vertical = vertical; return scrollRect; } } public static class SpriteExtensions { public static Sprite SetName(this Sprite sprite, string name) { ((Object)sprite).name = name; return sprite; } } public static class TextMeshProExtensions { public static T SetAlignment<T>(this T tmpText, TextAlignmentOptions alignment) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).alignment = alignment; return tmpText; } public static T SetColor<T>(this T tmpText, Color color) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((Graphic)(object)tmpText).color = color; return tmpText; } public static T SetEnableAutoSizing<T>(this T tmpText, bool enableAutoSizing) where T : TMP_Text { ((TMP_Text)tmpText).enableAutoSizing = enableAutoSizing; return tmpText; } public static T SetFont<T>(this T tmpText, TMP_FontAsset font) where T : TMP_Text { ((TMP_Text)tmpText).font = font; return tmpText; } public static T SetFontSize<T>(this T tmpText, float fontSize) where T : TMP_Text { ((TMP_Text)tmpText).fontSize = fontSize; return tmpText; } public static T SetFontMaterial<T>(this T tmpText, Material fontMaterial) where T : TMP_Text { ((TMP_Text)tmpText).fontMaterial = fontMaterial; return tmpText; } public static T SetMargin<T>(this T tmpText, Vector4 margin) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).margin = margin; return tmpText; } public static T SetOverflowMode<T>(this T tmpText, TextOverflowModes overflowMode) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).overflowMode = overflowMode; return tmpText; } public static T SetRichText<T>(this T tmpText, bool richText) where T : TMP_Text { ((TMP_Text)tmpText).richText = richText; return tmpText; } public static T SetTextWrappingMode<T>(this T tmpText, TextWrappingModes textWrappingMode) where T : TMP_Text { //IL_0006: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmpText).textWrappingMode = textWrappingMode; return tmpText; } } public static class Texture2DExtensions { public static Texture2D SetName(this Texture2D texture, string name) { ((Object)texture).name = name; return texture; } public static Texture2D SetWrapMode(this Texture2D texture, TextureWrapMode wrapMode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((Texture)texture).wrapMode = wrapMode; return texture; } public static Texture2D SetFilterMode(this Texture2D texture, FilterMode filterMode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ((Texture)texture).filterMode = filterMode; return texture; } } public static class VerticalLayoutGroupExtensions { public static VerticalLayoutGroup SetChildControl(this VerticalLayoutGroup layoutGroup, bool? width = null, bool? height = null) { if (!width.HasValue && !height.HasValue) { throw new ArgumentException("Value for width or height must be provided."); } if (width.HasValue) { ((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlWidth = width.Value; } if (height.HasValue) { ((HorizontalOrVerticalLayoutGroup)layoutGroup).childContro