Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Aerolt v4.3.1
Aerolt.dll
Decompiled 2 days 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.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net.Http; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using Aerolt.API; using Aerolt.Classes; using Aerolt.Enums; using Aerolt.Helpers; using Aerolt.Managers; using Aerolt.Messages; using Aerolt.Overrides; using Aerolt.UI; using Aerolt.UI.Sections; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HG; using HarmonyLib; using JetBrains.Annotations; using KinematicCharacterController; using Microsoft.CodeAnalysis; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Networking; using RoR2.UI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.UI; using UniverseLib; using UniverseLib.Config; using UniverseLib.UI; using UniverseLib.UI.Models; using UniverseLib.UI.Panels; using UniverseLib.UI.Widgets; using Zio; using ZioConfigFile; using ZioRiskOfOptions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Aerolt")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+b3c8b36df6bd7cbefe1c215436cce101dca73e58")] [assembly: AssemblyProduct("Aerolt")] [assembly: AssemblyTitle("Aerolt")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace Aerolt { [BepInPlugin("com.Lodington.Aerolt", "Aerolt", "4.3.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Load : BaseUnityPlugin { public const string Name = "Aerolt"; public const string Guid = "com.Lodington.Aerolt"; public const string Version = "4.3.1"; public static ManualLogSource Log = null; public static AssetBundle Assets = null; public static Load Instance = null; public static Dictionary<ButtonNames, ZioConfigEntry<KeyboardShortcut>> KeyBinds = new Dictionary<ButtonNames, ZioConfigEntry<KeyboardShortcut>>(); public static ZioConfigFile ConfigFile = null; public static string Path = null; public void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; Path = System.IO.Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); Assets = AssetBundle.LoadFromFile(System.IO.Path.Combine(Path, "aeroltbundle")); Tools.Log(LogLevel.Information, "Loaded AssetBundle"); Tools.SendCount(); NetworkManager.Initialize(); } public void Start() { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(GameLoad)); } public void OnGUI() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 if (AeroltUniverseUI.IsReady) { AeroltIcon.Draw(); } if (Esp.AnyEnabled && (int)Event.current.type == 7) { Esp.Draw(); } } public void Update() { SettingsSection.TickRebind(); if (!SettingsSection.IsRebinding && AeroltUniverseUI.IsReady && KeyBinds.TryGetValue(ButtonNames.OpenMenu, out ZioConfigEntry<KeyboardShortcut> value) && GetKeyPressed(value)) { AeroltUniverseUI.Toggle(); } AeroltUniverseUI.TickCursor(); } public static bool GetKeyPressed(ZioConfigEntry<KeyboardShortcut> entry) { //IL_0003: 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_0019: 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_001f: 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) //IL_004f: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = entry.Value; foreach (KeyCode modifier in ((KeyboardShortcut)(ref value)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } value = entry.Value; return Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey); } private void GameLoad() { //IL_000b: 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) //IL_001c: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) ConfigFile = new ZioConfigFile(RoR2Application.cloudStorage, UPath.op_Implicit("/Aerolt/Settings.cfg"), true, (BepInPlugin)null); CreateKeyBindSettings(); Colors.InitColors(); IconCache.Warm((MonoBehaviour)(object)this); Esp.Init(); AeroltIcon.Init(); PlayerSelection.Init(); Run.onRunStartGlobal += OnRunStart; Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); new PatchClassProcessor(val, typeof(Hooks)).Patch(); } private static void OnRunStart(Run run) { if (!AeroltUniverseUI.IsReady) { AeroltUniverseUI.Bootstrap(); } } private void CreateKeyBindSettings() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) KeyBinds.Add(ButtonNames.OpenMenu, ConfigFile.Bind<KeyboardShortcut>("Keybinds", "OpenMenu", new KeyboardShortcut((KeyCode)282, Array.Empty<KeyCode>()), (ConfigDescription)null)); if (Chainloader.PluginInfos.ContainsKey("bubbet.zioriskofoptions")) { MakeRiskOfOptions(); } } private void MakeRiskOfOptions() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown foreach (ZioConfigEntry<KeyboardShortcut> value in KeyBinds.Values) { ModSettingsManager.AddOption((BaseOption)new ZioKeyBindOption(value)); } ModSettingsManager.SetModIcon(Assets.LoadAsset<Sprite>("NewLogo")); } } } namespace Aerolt.UI { public class AeroltDockWindow : PanelBase, ISectionHost { private static readonly Color RowIdle = new Color(0.25f, 0.25f, 0.25f); private static readonly Color RowOpen = new Color(0.2f, 0.4f, 0.28f); private readonly List<IAeroltSection> _sections = new List<IAeroltSection>(); private readonly Dictionary<IAeroltSection, ButtonRef> _rows = new Dictionary<IAeroltSection, ButtonRef>(); private readonly Dictionary<IAeroltSection, AeroltSatelliteWindow> _windows = new Dictionary<IAeroltSection, AeroltSatelliteWindow>(); private readonly Dictionary<NetworkUser, ButtonRef> _playerButtons = new Dictionary<NetworkUser, ButtonRef>(); private GameObject _playerBar = null; private GameObject _list = null; private int _openCount; private float _nextPlayerRefresh; public override string Name => "AEROLT"; public override int MinWidth => 300; public override int MinHeight => 420; public override Vector2 DefaultAnchorMin => new Vector2(0.04f, 0.18f); public override Vector2 DefaultAnchorMax => new Vector2(0.22f, 0.82f); public override Vector2 DefaultPosition => new Vector2(-760f, 300f); public AeroltDockWindow(UIBase owner) : base(owner) { } protected override void OnClosePanelClicked() { AeroltUniverseUI.SetVisible(visible: false); } protected override void ConstructPanelContent() { //IL_0014: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) Text val = UIFactory.CreateLabel(((PanelBase)this).ContentRoot, "TargetLabel", "Target:", (TextAnchor)3, default(Color), true, 14); GameObject gameObject = ((Component)val).gameObject; int? num = 18; int? num2 = 9999; UIFactory.SetLayoutElement(gameObject, (int?)null, num, num2, (int?)null, (int?)null, (int?)null, (bool?)null); _playerBar = UIFactory.CreateUIObject("PlayerBar", ((PanelBase)this).ContentRoot, default(Vector2)); GridLayoutGroup val2 = _playerBar.AddComponent<GridLayoutGroup>(); val2.cellSize = new Vector2(120f, 24f); val2.spacing = new Vector2(4f, 4f); val2.constraint = (Constraint)0; ContentSizeFitter val3 = _playerBar.AddComponent<ContentSizeFitter>(); val3.verticalFit = (FitMode)2; GameObject playerBar = _playerBar; num2 = 24; num = 9999; UIFactory.SetLayoutElement(playerBar, (int?)null, num2, num, (int?)null, (int?)null, (int?)null, (bool?)null); RefreshPlayerButtons(); Text val4 = UIFactory.CreateLabel(((PanelBase)this).ContentRoot, "Header", "Applications", (TextAnchor)3, default(Color), true, 14); GameObject gameObject2 = ((Component)val4).gameObject; num = 22; num2 = 9999; UIFactory.SetLayoutElement(gameObject2, (int?)null, num, num2, (int?)null, (int?)null, (int?)null, (bool?)null); val4.fontStyle = (FontStyle)1; GameObject val6 = default(GameObject); AutoSliderScrollbar val7 = default(AutoSliderScrollbar); GameObject val5 = UIFactory.CreateScrollView(((PanelBase)this).ContentRoot, "ListScroll", ref val6, ref val7, new Color(0.1f, 0.1f, 0.1f)); num2 = 9999; num = 9999; UIFactory.SetLayoutElement(val5, (int?)null, (int?)null, num2, num, (int?)null, (int?)null, (bool?)null); UIFactory.SetLayoutGroup<VerticalLayoutGroup>(val6, (bool?)false, (bool?)false, (bool?)true, (bool?)true, (int?)2, (int?)4, (int?)4, (int?)4, (int?)4, (TextAnchor?)null); _list = val6; RegisterBuiltInSections(); AeroltAPI.FlushPendingSections(this); } private void RegisterBuiltInSections() { RegisterSection(new PlayerSection()); RegisterSection(new BodyStatsSection()); RegisterSection(new ItemsSection()); RegisterSection(new EquipmentSection()); RegisterSection(new BuffsSection()); RegisterSection(new BodySection()); RegisterSection(new MonsterSection()); RegisterSection(new InteractableSection()); RegisterSection(new TeleporterSection()); RegisterSection(new WorldSection()); RegisterSection(new EspSection()); RegisterSection(new SettingsSection()); } public void RegisterSection(IAeroltSection section) { if (section != null && !_sections.Contains(section)) { _sections.Add(section); int count = _sections.Count; string text = $"{count:00} - {section.Title}"; ButtonRef val = UIFactory.CreateButton(_list, "Row_" + section.Title, text, (Color?)null); GameObject gameObject = ((Component)val.Component).gameObject; int? num = 28; int? num2 = 9999; UIFactory.SetLayoutElement(gameObject, (int?)null, num, num2, (int?)null, (int?)null, (int?)null, (bool?)null); val.ButtonText.alignment = (TextAnchor)3; val.ButtonText.fontSize = 13; val.OnClick = (Action)Delegate.Combine(val.OnClick, (Action)delegate { Toggle(section); }); _rows[section] = val; Highlight(); } } private void Toggle(IAeroltSection section) { //IL_0044: 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_0051: Unknown result type (might be due to invalid IL or missing references) if (_windows.TryGetValue(section, out AeroltSatelliteWindow value) && value != null) { if (((UIModel)value).Enabled) { ((UIModel)value).SetActive(false); } else { value.Open(); } Highlight(); return; } Vector2 defaultPos = NextWindowPosition(); AeroltSatelliteWindow aeroltSatelliteWindow = AeroltSatelliteWindow.Create(((PanelBase)this).Owner, section, defaultPos); aeroltSatelliteWindow.Closed += delegate { Highlight(); }; _windows[section] = aeroltSatelliteWindow; aeroltSatelliteWindow.Open(); Highlight(); } private Vector2 NextWindowPosition() { //IL_0034: 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_003c: Unknown result type (might be due to invalid IL or missing references) int num = _openCount % 8; _openCount++; return new Vector2(-200f + (float)num * 34f, 280f - (float)num * 30f); } public void CloseAllWindows() { foreach (KeyValuePair<IAeroltSection, AeroltSatelliteWindow> window in _windows) { if (window.Value != null && ((UIModel)window.Value).Enabled) { ((UIModel)window.Value).SetActive(false); } } Highlight(); } private void Highlight() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair<IAeroltSection, ButtonRef> row in _rows) { ButtonRef value = row.Value; if (!((Object)(object)((value != null) ? value.Component : null) == (Object)null)) { AeroltSatelliteWindow value2; bool flag = _windows.TryGetValue(row.Key, out value2) && value2 != null && ((UIModel)value2).Enabled; RuntimeHelper.SetColorBlock((Selectable)(object)row.Value.Component, (Color?)(flag ? RowOpen : RowIdle), (Color?)null, (Color?)null, (Color?)null); } } } public override void Update() { ((UIBehaviourModel)this).Update(); if (!(Time.unscaledTime < _nextPlayerRefresh)) { _nextPlayerRefresh = Time.unscaledTime + 1f; RefreshPlayerButtons(); } } private void RefreshPlayerButtons() { //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_playerBar == (Object)null) { return; } IReadOnlyList<NetworkUser> players = PlayerSelection.GetPlayers(); List<NetworkUser> list = new List<NetworkUser>(); foreach (KeyValuePair<NetworkUser, ButtonRef> playerButton in _playerButtons) { if (!Object.op_Implicit((Object)(object)playerButton.Key) || !players.Contains(playerButton.Key)) { list.Add(playerButton.Key); } } foreach (NetworkUser item in list) { ButtonRef obj = _playerButtons[item]; if (Object.op_Implicit((Object)(object)((obj != null) ? obj.Component : null))) { Object.Destroy((Object)(object)((Component)_playerButtons[item].Component).gameObject); } _playerButtons.Remove(item); } foreach (NetworkUser item2 in players) { if (Object.op_Implicit((Object)(object)item2) && !_playerButtons.ContainsKey(item2)) { NetworkUser captured = item2; ButtonRef val = UIFactory.CreateButton(_playerBar, $"Player_{item2.id}", GetPlayerName(item2), (Color?)null); val.ButtonText.fontSize = 11; val.OnClick = (Action)Delegate.Combine(val.OnClick, (Action)delegate { PlayerSelection.Select(captured); }); _playerButtons[item2] = val; } } foreach (KeyValuePair<NetworkUser, ButtonRef> playerButton2 in _playerButtons) { if (Object.op_Implicit((Object)(object)playerButton2.Key)) { ButtonRef value = playerButton2.Value; if (!((Object)(object)((value != null) ? value.Component : null) == (Object)null)) { playerButton2.Value.ButtonText.text = GetPlayerName(playerButton2.Key); bool flag = (Object)(object)playerButton2.Key == (Object)(object)PlayerSelection.Selected; RuntimeHelper.SetColorBlock((Selectable)(object)playerButton2.Value.Component, (Color?)(flag ? RowOpen : RowIdle), (Color?)null, (Color?)null, (Color?)null); } } } } private static string GetPlayerName(NetworkUser user) { return (Object.op_Implicit((Object)(object)user) && !string.IsNullOrEmpty(user.userName)) ? user.userName : "Player"; } } public static class AeroltIcon { private const int Size = 48; private const int Margin = 8; private static Texture? _logo; private static bool _loaded; public static ZioConfigEntry<bool> ShowIcon; public static void Init() { if (ShowIcon == null) { ShowIcon = Load.ConfigFile.Bind<bool>("General", "Show Menu Icon", true, "Show the clickable Aerolt logo in the top-left corner. The menu can still be opened with its keybind."); } } public static void Draw() { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (ShowIcon != null && !ShowIcon.Value) { return; } if (!_loaded) { _loaded = true; Sprite val = (Object.op_Implicit((Object)(object)Load.Assets) ? Load.Assets.LoadAsset<Sprite>("NewLogo") : null); if (Object.op_Implicit((Object)(object)val)) { _logo = (Texture?)(object)val.texture; } } Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(8f, 8f, 48f, 48f); if (Object.op_Implicit((Object)(object)_logo) ? GUI.Button(val2, _logo, GUIStyle.none) : GUI.Button(val2, "Aerolt")) { AeroltUniverseUI.Toggle(); } } } public class AeroltSatelliteWindow : PanelBase { private static IAeroltSection _pendingSection; private static Vector2 _pendingDefaultPos; private readonly IAeroltSection _section; public IAeroltSection Section => _section; public override string Name => _section?.Title ?? _pendingSection?.Title ?? "Aerolt"; public override int MinWidth => 620; public override int MinHeight => 420; public override Vector2 DefaultAnchorMin => new Vector2(0.5f, 0.5f); public override Vector2 DefaultAnchorMax => new Vector2(0.5f, 0.5f); public override Vector2 DefaultPosition => _pendingDefaultPos; public event Action<AeroltSatelliteWindow>? Closed; public static AeroltSatelliteWindow Create(UIBase owner, IAeroltSection section, Vector2 defaultPos) { //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) _pendingSection = section; _pendingDefaultPos = defaultPos; return new AeroltSatelliteWindow(owner); } private AeroltSatelliteWindow(UIBase owner) : base(owner) { _section = _pendingSection; } protected override void ConstructPanelContent() { //IL_002b: 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_00db: Unknown result type (might be due to invalid IL or missing references) IAeroltSection pendingSection = _pendingSection; GameObject val = UIFactory.CreateVerticalGroup(((PanelBase)this).ContentRoot, "SatelliteHost", false, false, true, true, 2, new Vector4(2f, 2f, 2f, 2f), new Color(0.13f, 0.13f, 0.14f), (TextAnchor?)null); int? num = 9999; int? num2 = 9999; UIFactory.SetLayoutElement(val, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); if (pendingSection.ScrollableContent) { GameObject contentParent = default(GameObject); AutoSliderScrollbar val3 = default(AutoSliderScrollbar); GameObject val2 = UIFactory.CreateScrollView(val, "Scroll_" + pendingSection.Title, ref contentParent, ref val3, new Color(0.14f, 0.14f, 0.14f)); num2 = 9999; num = 9999; UIFactory.SetLayoutElement(val2, (int?)null, (int?)null, num2, num, (int?)null, (int?)null, (bool?)null); pendingSection.Build(contentParent); } else { pendingSection.Build(val); } } protected override void OnClosePanelClicked() { ((UIModel)this).SetActive(false); this.Closed?.Invoke(this); } public override void SetActive(bool active) { bool enabled = ((UIModel)this).Enabled; ((PanelBase)this).SetActive(active); if (enabled && !active) { _section?.OnHidden(); } } public void Open() { ((UIModel)this).SetActive(true); if (Object.op_Implicit((Object)(object)((PanelBase)this).Rect)) { ((Transform)((PanelBase)this).Rect).SetAsLastSibling(); } _section.OnShown(); } } public static class AeroltUniverseUI { private const string UiId = "com.Lodington.Aerolt.UniverseUI"; private static UIBase? _uiBase; private static AeroltDockWindow? _dock; private static ItemEditorWindow? _itemEditor; public static ZioConfigEntry<float> WindowOpacity; private static MPEventSystem? _cursorOpenerTarget; private static bool _wasOpen; public static bool IsReady => _uiBase != null && _dock != null; public static UIBase? UiBase => _uiBase; public static AeroltDockWindow? Dock => _dock; public static float Opacity => (WindowOpacity != null) ? Mathf.Clamp(WindowOpacity.Value, 0.3f, 1f) : 1f; public static bool IsOpen => _uiBase != null && _uiBase.Enabled && UniversalUI.AnyUIShowing; public static void OpenItemEditor(IItemEditTarget? target = null) { if (_uiBase != null) { if (_itemEditor == null) { _itemEditor = new ItemEditorWindow(_uiBase); } _uiBase.Enabled = true; ((UIModel)_itemEditor).SetActive(true); _itemEditor.SetTarget(target ?? new PlayerInventoryTarget()); } } public static void CloseItemEditor() { if (_itemEditor != null && ((UIModel)_itemEditor).Enabled) { ((UIModel)_itemEditor).SetActive(false); } } public static void Bootstrap() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0035: Unknown result type (might be due to invalid IL or missing references) UniverseLibConfig val = new UniverseLibConfig { Force_Unlock_Mouse = false }; Universe.Init(1f, (Action)OnReady, (Action<string, LogType>)LogHandler, val); } private static void OnReady() { try { _uiBase = UniversalUI.RegisterUI("com.Lodington.Aerolt.UniverseUI", (Action)OnUpdate); _dock = new AeroltDockWindow(_uiBase); Tools.Log(LogLevel.Information, "Aerolt UniverseLib UI ready."); WindowOpacity = Load.ConfigFile.Bind<float>("General", "Window Opacity", 1f, "Opacity of the Aerolt windows (0.3 - 1). Lower values let you see the game behind the menu."); ApplyOpacity(); SetVisible(visible: false); AeroltAPI.NotifyReady(_dock); } catch (Exception arg) { Tools.Log(LogLevel.Error, $"[Aerolt] UI init failed: {arg}"); } } public static void SetOpacity(float value) { if (WindowOpacity != null) { WindowOpacity.Value = Mathf.Clamp(value, 0.3f, 1f); } ApplyOpacity(); } private static void ApplyOpacity() { if (_uiBase != null && Object.op_Implicit((Object)(object)_uiBase.RootObject)) { CanvasGroup val = _uiBase.RootObject.GetComponent<CanvasGroup>(); if (!Object.op_Implicit((Object)(object)val)) { val = _uiBase.RootObject.AddComponent<CanvasGroup>(); } val.alpha = Opacity; } } private static void OnUpdate() { } public static void TickCursor() { if (_uiBase == null) { return; } bool isOpen = IsOpen; MPEventSystem val = (isOpen ? GetLocalEventSystem() : null); if ((Object)(object)_cursorOpenerTarget != (Object)(object)val) { if (Object.op_Implicit((Object)(object)_cursorOpenerTarget)) { _cursorOpenerTarget.cursorOpenerCount = Mathf.Max(0, _cursorOpenerTarget.cursorOpenerCount - 1); } if (Object.op_Implicit((Object)(object)val)) { val.cursorOpenerCount += 1; } _cursorOpenerTarget = val; } if (isOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else if (_wasOpen) { Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } _wasOpen = isOpen; } private static MPEventSystem? GetLocalEventSystem() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); return (firstLocalUser != null) ? firstLocalUser.eventSystem : null; } public static void Toggle() { if (IsOpen) { HideAll(); } else { ShowDock(); } } public static void SetVisible(bool visible) { if (visible) { ShowDock(); } else { HideAll(); } } private static void ShowDock() { if (_uiBase != null && _dock != null) { if (!((UIModel)_dock).Enabled) { ((UIModel)_dock).SetActive(true); } _uiBase.Enabled = true; } } private static void HideAll() { if (_uiBase != null) { _uiBase.Enabled = false; } } private static void LogHandler(string message, LogType type) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Tools.Log(((int)type != 0) ? LogLevel.Information : LogLevel.Error, "[UniverseLib] " + message); } } public interface IAeroltSection { string Title { get; } GameObject Root { get; } bool ScrollableContent => true; void Build(GameObject contentParent); void OnShown(); void OnHidden() { } } public interface ISectionHost { void RegisterSection(IAeroltSection section); } public class IconGrid<T> where T : class { private class Cell { public T Value = null; public GameObject Root = null; public Image Icon = null; public Text CountText = null; public int Generation; public int Count; } private const int IconSize = 48; private const int NamePlateHeight = 16; private const int CellWidth = 64; private const int CellHeight = 64; private readonly List<Cell> _cells = new List<Cell>(); private readonly Func<T, string> _nameOf; private readonly Action<T, Image, Func<bool>> _applyIcon; private readonly Action<T, int>? _onClick; private readonly Func<T, int>? _getCount; private readonly Func<T, Color>? _tint; private readonly bool _onlyOwned; private GameObject _grid = null; private AutoSliderScrollbar _scrollbar = null; private string _filter = ""; public IconGrid(Func<T, string> nameOf, Action<T, Image, Func<bool>> applyIcon, Action<T, int>? onClick = null, Func<T, int>? getCount = null, bool onlyOwned = false, Func<T, Color>? tint = null) { _nameOf = nameOf; _applyIcon = applyIcon; _onClick = onClick; _getCount = getCount; _onlyOwned = onlyOwned; _tint = tint; } public GameObject Build(GameObject parent, IEnumerable<T> items) { //IL_000e: 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) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown GameObject val = UIFactory.CreateVerticalGroup(parent, "IconGrid", false, false, true, true, 4, default(Vector4), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); int? num = 9999; int? num2 = 9999; UIFactory.SetLayoutElement(val, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); InputFieldRef val2 = UIFactory.CreateInputField(val, "Search", "Search..."); GameObject gameObject = ((Component)val2.Component).gameObject; num2 = 28; num = 9999; UIFactory.SetLayoutElement(gameObject, (int?)null, num2, num, (int?)null, (int?)null, (int?)null, (bool?)null); val2.OnValueChanged += OnFilterChanged; GameObject grid = default(GameObject); UIFactory.CreateScrollView(val, "GridScroll", ref grid, ref _scrollbar, new Color(0.1f, 0.1f, 0.1f)); _grid = grid; VerticalLayoutGroup component = _grid.GetComponent<VerticalLayoutGroup>(); if (Object.op_Implicit((Object)(object)component)) { Object.DestroyImmediate((Object)(object)component); } GridLayoutGroup val3 = _grid.AddComponent<GridLayoutGroup>(); val3.cellSize = new Vector2(64f, 64f); val3.spacing = new Vector2(4f, 4f); ((LayoutGroup)val3).padding = new RectOffset(4, 4, 4, 4); val3.startCorner = (Corner)0; val3.startAxis = (Axis)0; ((LayoutGroup)val3).childAlignment = (TextAnchor)0; val3.constraint = (Constraint)0; foreach (T item in items) { if (item != null) { CreateCell(item); } } Refresh(); return val; } private void CreateCell(T value) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) Cell cell = new Cell { Value = value }; GameObject val2; if (_onClick != null) { ButtonRef val = UIFactory.CreateButton(_grid, "Cell", "", (Color?)null); val2 = ((Component)val.Component).gameObject; val.OnClick = (Action)Delegate.Combine(val.OnClick, (Action)delegate { _onClick(cell.Value, (!Shift()) ? 1 : 5); }); AddRightClick(val2, delegate { _onClick(cell.Value, Shift() ? (-5) : (-1)); }); } else { val2 = UIFactory.CreateUIObject("Cell", _grid, default(Vector2)); } cell.Root = val2; GameObject val3 = UIFactory.CreateUIObject("Icon", val2, default(Vector2)); RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(1f, 1f); component.offsetMin = new Vector2(0f, 16f); component.offsetMax = Vector2.zero; Image val4 = val3.AddComponent<Image>(); val4.preserveAspect = true; ((Graphic)val4).color = ((_tint != null) ? _tint(value) : Color.white); ((Graphic)val4).raycastTarget = false; cell.Icon = val4; int generation = ++cell.Generation; _applyIcon(value, val4, () => cell.Generation == generation); Text val5 = UIFactory.CreateLabel(val3, "Count", "", (TextAnchor)8, default(Color), true, 14); RectTransform component2 = ((Component)val5).gameObject.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = new Vector2(0f, 0f); component2.offsetMax = new Vector2(-2f, 0f); val5.fontStyle = (FontStyle)1; val5.resizeTextForBestFit = false; val5.fontSize = 16; ((Graphic)val5).raycastTarget = false; cell.CountText = val5; GameObject val6 = UIFactory.CreateUIObject("NamePlate", val2, default(Vector2)); RectTransform component3 = val6.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(0f, 0f); component3.anchorMax = new Vector2(1f, 0f); component3.pivot = new Vector2(0.5f, 0f); component3.offsetMin = Vector2.zero; component3.offsetMax = new Vector2(0f, 16f); Image val7 = val6.AddComponent<Image>(); ((Graphic)val7).color = new Color(0f, 0f, 0f, 0.6f); ((Graphic)val7).raycastTarget = false; Text val8 = UIFactory.CreateLabel(val6, "Name", _nameOf(value), (TextAnchor)4, default(Color), true, 14); RectTransform component4 = ((Component)val8).gameObject.GetComponent<RectTransform>(); component4.anchorMin = Vector2.zero; component4.anchorMax = Vector2.one; component4.offsetMin = new Vector2(1f, 0f); component4.offsetMax = new Vector2(-1f, 0f); val8.fontSize = 10; val8.resizeTextForBestFit = true; val8.resizeTextMinSize = 6; val8.resizeTextMaxSize = 11; val8.horizontalOverflow = (HorizontalWrapMode)0; val8.verticalOverflow = (VerticalWrapMode)0; ((Graphic)val8).raycastTarget = false; _cells.Add(cell); } private static void AddRightClick(GameObject target, Action onRightClick) { RightClickHandler rightClickHandler = target.AddComponent<RightClickHandler>(); rightClickHandler.OnRightClick = onRightClick; } private static bool Shift() { return Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303); } public void Refresh() { foreach (Cell cell in _cells) { if (_getCount != null) { cell.Count = _getCount(cell.Value); cell.CountText.text = ((cell.Count > 0) ? cell.Count.ToString() : ""); } ApplyVisibility(cell); } UpdateScrollbar(); } private void UpdateScrollbar() { if (!((Object)(object)_grid == (Object)null) && _scrollbar != null) { RectTransform component = _grid.GetComponent<RectTransform>(); if (Object.op_Implicit((Object)(object)component)) { LayoutRebuilder.ForceRebuildLayoutImmediate(component); } _scrollbar.UpdateSliderHandle(); } } private void OnFilterChanged(string text) { _filter = text?.ToLowerInvariant() ?? ""; foreach (Cell cell in _cells) { ApplyVisibility(cell); } UpdateScrollbar(); } private void ApplyVisibility(Cell cell) { bool flag = string.IsNullOrEmpty(_filter) || _nameOf(cell.Value).ToLowerInvariant().Contains(_filter); bool flag2 = !_onlyOwned || cell.Count > 0; cell.Root.SetActive(flag && flag2); } } public class RightClickHandler : MonoBehaviour, IPointerClickHandler, IEventSystemHandler { public Action? OnRightClick; public void OnPointerClick(PointerEventData eventData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)eventData.button == 1) { OnRightClick?.Invoke(); } } } public interface IItemEditTarget { string RightLabel { get; } int GetCount(ItemDef def); void Adjust(ItemDef def, int amount); } public class PlayerInventoryTarget : IItemEditTarget { public string RightLabel => "Player Inventory"; public int GetCount(ItemDef def) { Inventory val = Inv(); return Object.op_Implicit((Object)(object)val) ? val.GetItemCountEffective(def) : 0; } public void Adjust(ItemDef def, int amount) { Inventory val = Inv(); if (Object.op_Implicit((Object)(object)val) && amount != 0) { int itemCountEffective = val.GetItemCountEffective(def); int num = Mathf.Max(0, itemCountEffective + amount); if (num != itemCountEffective) { new SetItemCountMessage(val, new Dictionary<ItemDef, int> { { def, num } }).SendToServer(); } } } private static Inventory? Inv() { NetworkUser selected = PlayerSelection.Selected; if (!Object.op_Implicit((Object)(object)selected) || !Object.op_Implicit((Object)(object)selected.master)) { return null; } return Object.op_Implicit((Object)(object)selected.master.inventory) ? selected.master.inventory : null; } } public class DictionaryItemTarget : IItemEditTarget { private readonly Dictionary<ItemDef, int> _items; public string RightLabel { get; } public DictionaryItemTarget(Dictionary<ItemDef, int> items, string rightLabel) { _items = items; RightLabel = rightLabel; } public int GetCount(ItemDef def) { int value; return _items.TryGetValue(def, out value) ? value : 0; } public void Adjust(ItemDef def, int amount) { if (amount != 0) { int num = Mathf.Max(0, GetCount(def) + amount); if (num == 0) { _items.Remove(def); } else { _items[def] = num; } } } } public class ItemEditorWindow : PanelBase { private IconGrid<ItemDef> _catalogGrid = null; private IconGrid<ItemDef> _inventoryGrid = null; private Text _rightLabel = null; private IItemEditTarget _target = new PlayerInventoryTarget(); public override string Name => "Aerolt - Edit Items"; public override int MinWidth => 760; public override int MinHeight => 500; public override Vector2 DefaultAnchorMin => new Vector2(0.2f, 0.2f); public override Vector2 DefaultAnchorMax => new Vector2(0.8f, 0.8f); public override Vector2 DefaultPosition => new Vector2(-380f, 250f); public ItemEditorWindow(UIBase owner) : base(owner) { } protected override void OnClosePanelClicked() { ((UIModel)this).SetActive(false); } public void SetTarget(IItemEditTarget target) { _target = target; if (Object.op_Implicit((Object)(object)_rightLabel)) { _rightLabel.text = target.RightLabel; } RefreshGrids(); } protected override void ConstructPanelContent() { //IL_0014: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) Text val = UIFactory.CreateLabel(((PanelBase)this).ContentRoot, "Hint", "Left grid: click to add (Shift +5, right-click to remove). Right grid: current items, click to remove (Shift -5, right-click to add).", (TextAnchor)3, default(Color), true, 14); GameObject gameObject = ((Component)val).gameObject; int? num = 20; int? num2 = 9999; UIFactory.SetLayoutElement(gameObject, (int?)null, num, num2, (int?)null, (int?)null, (int?)null, (bool?)null); val.fontSize = 12; GameObject val2 = UIFactory.CreateHorizontalGroup(((PanelBase)this).ContentRoot, "Body", false, true, true, true, 6, new Vector4(4f, 4f, 4f, 4f), new Color(0.12f, 0.12f, 0.12f), (TextAnchor?)null); num2 = 9999; num = 9999; UIFactory.SetLayoutElement(val2, (int?)null, (int?)null, num2, num, (int?)null, (int?)null, (bool?)null); GameObject val3 = UIFactory.CreateVerticalGroup(val2, "CatalogSide", false, false, true, true, 2, new Vector4(2f, 2f, 2f, 2f), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); num = 9999; num2 = 9999; UIFactory.SetLayoutElement(val3, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); Text val4 = UIFactory.CreateLabel(val3, "CatalogLabel", "All Items", (TextAnchor)4, default(Color), true, 14); GameObject gameObject2 = ((Component)val4).gameObject; num2 = 22; num = 9999; UIFactory.SetLayoutElement(gameObject2, (int?)null, num2, num, (int?)null, (int?)null, (int?)null, (bool?)null); _catalogGrid = new IconGrid<ItemDef>((ItemDef def) => Language.GetString(def.nameToken), delegate(ItemDef def, Image icon, Func<bool> stillValid) { IconCache.LoadItemIcon(def, delegate(Sprite sprite) { if (Object.op_Implicit((Object)(object)sprite) && Object.op_Implicit((Object)(object)icon) && stillValid()) { icon.sprite = sprite; } }); }, delegate(ItemDef def, int amount) { Adjust(def, amount); }, (ItemDef def) => _target.GetCount(def)); _catalogGrid.Build(val3, ContentManager._itemDefs); GameObject val5 = UIFactory.CreateVerticalGroup(val2, "InventorySide", false, false, true, true, 2, new Vector4(2f, 2f, 2f, 2f), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); num = 9999; num2 = 9999; UIFactory.SetLayoutElement(val5, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); _rightLabel = UIFactory.CreateLabel(val5, "InventoryLabel", _target.RightLabel, (TextAnchor)4, default(Color), true, 14); GameObject gameObject3 = ((Component)_rightLabel).gameObject; num2 = 22; num = 9999; UIFactory.SetLayoutElement(gameObject3, (int?)null, num2, num, (int?)null, (int?)null, (int?)null, (bool?)null); _inventoryGrid = new IconGrid<ItemDef>((ItemDef def) => Language.GetString(def.nameToken), delegate(ItemDef def, Image icon, Func<bool> stillValid) { IconCache.LoadItemIcon(def, delegate(Sprite sprite) { if (Object.op_Implicit((Object)(object)sprite) && Object.op_Implicit((Object)(object)icon) && stillValid()) { icon.sprite = sprite; } }); }, delegate(ItemDef def, int amount) { Adjust(def, -amount); }, (ItemDef def) => _target.GetCount(def), onlyOwned: true); _inventoryGrid.Build(val5, ContentManager._itemDefs); } public void RefreshGrids() { _catalogGrid?.Refresh(); _inventoryGrid?.Refresh(); } private void Adjust(ItemDef def, int amount) { _target.Adjust(def, amount); RefreshGrids(); } } public static class PlayerSelection { private static readonly Dictionary<NetworkUser, PlayerConfigBinding> Bindings = new Dictionary<NetworkUser, PlayerConfigBinding>(); private static bool _initialized; public static NetworkUser? Selected { get; private set; } public static PlayerConfigBinding? SelectedBinding => ((Object)(object)Selected != (Object)null) ? GetOrCreateBinding(Selected) : null; public static event Action? SelectionChanged; public static void Init() { if (!_initialized) { _initialized = true; CharacterBody.onBodyStartGlobal += OnBodyStart; } } private static void OnBodyStart(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.master)) { return; } PlayerCharacterMasterController playerCharacterMasterController = body.master.playerCharacterMasterController; if (Object.op_Implicit((Object)(object)playerCharacterMasterController) && Object.op_Implicit((Object)(object)playerCharacterMasterController.networkUser)) { NetworkUser networkUser = playerCharacterMasterController.networkUser; PlayerConfigBinding value; if (networkUser.localUser != null) { value = GetOrCreateBinding(networkUser); } else if (!Bindings.TryGetValue(networkUser, out value) || value == null) { return; } value.ApplyAllDeferred(body); } } public static void Select(NetworkUser? user) { if (!((Object)(object)Selected == (Object)(object)user)) { Selected = user; PlayerSelection.SelectionChanged?.Invoke(); } } public static PlayerConfigBinding GetOrCreateBinding(NetworkUser user) { if (!Bindings.TryGetValue(user, out PlayerConfigBinding value) || value == null) { value = new PlayerConfigBinding(user); Bindings[user] = value; } return value; } public static IReadOnlyList<NetworkUser> GetPlayers() { ReadOnlyCollection<NetworkUser> readOnlyInstancesList = NetworkUser.readOnlyInstancesList; if (((Object)(object)Selected == (Object)null || !Object.op_Implicit((Object)(object)Selected)) && readOnlyInstancesList.Count > 0) { NetworkUser val = null; foreach (NetworkUser item in readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)item) && item.localUser != null) { val = item; break; } } Select(val ?? readOnlyInstancesList[0]); } return readOnlyInstancesList; } } } namespace Aerolt.UI.Sections { public class BodySection : IAeroltSection { private IconGrid<CharacterBody> _grid = null; public string Title => "Spawn As"; public GameObject Root { get; private set; } = null; public bool ScrollableContent => false; public void Build(GameObject contentParent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Root = UIFactory.CreateVerticalGroup(contentParent, "BodySection", false, false, true, true, 4, default(Vector4), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); GameObject root = Root; int? num = 9999; int? num2 = 9999; UIFactory.SetLayoutElement(root, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); _grid = new IconGrid<CharacterBody>((CharacterBody body) => Language.GetString(body.baseNameToken), delegate(CharacterBody body, Image icon, Func<bool> stillValid) { Sprite bodyIcon = IconCache.GetBodyIcon(body); if (Object.op_Implicit((Object)(object)bodyIcon) && Object.op_Implicit((Object)(object)icon) && stillValid()) { icon.sprite = bodyIcon; } }, delegate(CharacterBody body, int _) { SpawnAs(body); }); _grid.Build(Root, from x in BodyCatalog.allBodyPrefabBodyBodyComponents where Object.op_Implicit((Object)(object)x) orderby Language.GetString(x.baseNameToken) select x); } public void OnShown() { } private static void SpawnAs(CharacterBody body) { NetworkUser selected = PlayerSelection.Selected; if (!Object.op_Implicit((Object)(object)selected)) { return; } GameObject val = BodyCatalog.FindBodyPrefab(body); if (Object.op_Implicit((Object)(object)val)) { SetBodyMessage setBodyMessage = new SetBodyMessage(selected, val.GetComponent<CharacterBody>()); if (!NetworkServer.active) { setBodyMessage.Handle(); } setBodyMessage.SendToServer(); } } } public class BodyStatsSection : IAeroltSection { private class StatProfile { public readonly Dictionary<FieldInfo, ZioConfigEntry<float>> Entries = new Dictionary<FieldInfo, ZioConfigEntry<float>>(); public StatProfile(int profileIndex, ZioConfigFile configFile) { FieldInfo[] fields = Fields; foreach (FieldInfo fieldInfo in fields) { Entries[fieldInfo] = configFile.Bind<float>("PlayerProfile" + profileIndex, fieldInfo.Name, 1f, ""); } } } private const int ProfileCount = 3; private static readonly FieldInfo[] Fields = (from x in typeof(CharacterBody).GetFields(BindingFlags.Instance | BindingFlags.Public) where x.FieldType == typeof(float) select x).ToArray(); private readonly Dictionary<FieldInfo, InputFieldRef> _inputs = new Dictionary<FieldInfo, InputFieldRef>(); private readonly List<StatProfile> _profiles = new List<StatProfile>(); private ZioConfigEntry<int> _selectedProfile = null; private bool _suppress; private static readonly Dictionary<NetworkUser, Dictionary<string, float>> Overrides = new Dictionary<NetworkUser, Dictionary<string, float>>(); private static bool _hooked; public string Title => "Body Stats"; public GameObject Root { get; private set; } = null; public bool ScrollableContent => false; public void Build(GameObject contentParent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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) Root = UIFactory.CreateVerticalGroup(contentParent, "BodyStatsSection", false, false, true, true, 4, default(Vector4), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); GameObject root = Root; int? num = 9999; int? num2 = 9999; UIFactory.SetLayoutElement(root, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); _selectedProfile = Load.ConfigFile.Bind<int>("Player", "Selected Profile", 0, "Which body-stat profile is selected."); for (int i = 1; i <= 3; i++) { _profiles.Add(new StatProfile(i, Load.ConfigFile)); } GameObject val = UIFactory.CreateHorizontalGroup(Root, "Profiles", false, false, true, true, 4, default(Vector4), default(Color), (TextAnchor?)null); num2 = 30; num = 0; int? num3 = 9999; UIFactory.SetLayoutElement(val, (int?)null, num2, num3, num, (int?)null, (int?)null, (bool?)null); AddProfileButton(val, "Default", 0); for (int j = 1; j <= 3; j++) { AddProfileButton(val, $"Profile {j}", j); } GameObject val2 = default(GameObject); AutoSliderScrollbar val3 = default(AutoSliderScrollbar); UIFactory.CreateScrollView(Root, "Stats", ref val2, ref val3, new Color(0.1f, 0.1f, 0.1f)); UIFactory.SetLayoutGroup<VerticalLayoutGroup>(val2, (bool?)false, (bool?)false, (bool?)true, (bool?)true, (int?)2, (int?)2, (int?)2, (int?)2, (int?)2, (TextAnchor?)null); FieldInfo[] fields = Fields; foreach (FieldInfo field in fields) { CreateStatRow(val2, field); } if (!_hooked) { _hooked = true; CharacterBody.onBodyStartGlobal += OnBodyStart; } } private static void OnBodyStart(CharacterBody body) { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.master)) { PlayerCharacterMasterController playerCharacterMasterController = body.master.playerCharacterMasterController; if (Object.op_Implicit((Object)(object)playerCharacterMasterController) && Object.op_Implicit((Object)(object)playerCharacterMasterController.networkUser) && Overrides.TryGetValue(playerCharacterMasterController.networkUser, out Dictionary<string, float> value) && value.Count != 0 && Object.op_Implicit((Object)(object)Load.Instance)) { ((MonoBehaviour)Load.Instance).StartCoroutine(ReapplyStats(body, new Dictionary<string, float>(value))); } } } private static IEnumerator ReapplyStats(CharacterBody body, Dictionary<string, float> stats) { yield return (object)new WaitForSeconds(0.5f); if (!Object.op_Implicit((Object)(object)body)) { yield break; } foreach (KeyValuePair<string, float> kvp in stats) { new BodyStatMessage(body, kvp.Key, kvp.Value).SendToEveryone(); } } private static void Remember(string field, float value) { NetworkUser selected = PlayerSelection.Selected; if (Object.op_Implicit((Object)(object)selected)) { if (!Overrides.TryGetValue(selected, out Dictionary<string, float> value2)) { value2 = new Dictionary<string, float>(); Overrides[selected] = value2; } value2[field] = value; } } private static void ClearOverrides() { NetworkUser selected = PlayerSelection.Selected; if (Object.op_Implicit((Object)(object)selected)) { Overrides.Remove(selected); } } public void OnShown() { ApplyProfile(_selectedProfile.Value, applyToBody: false); RefreshPlaceholders(); } private void AddProfileButton(GameObject parent, string label, int index) { ButtonRef val = UIFactory.CreateButton(parent, $"Profile_{index}", label, (Color?)null); GameObject gameObject = ((Component)val.Component).gameObject; int? num = 28; int? num2 = 9999; UIFactory.SetLayoutElement(gameObject, (int?)null, num, num2, (int?)null, (int?)null, (int?)null, (bool?)null); val.OnClick = (Action)Delegate.Combine(val.OnClick, (Action)delegate { _selectedProfile.Value = index; ApplyProfile(index, applyToBody: true); }); } private void CreateStatRow(GameObject parent, FieldInfo field) { //IL_0044: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) GameObject val = UIFactory.CreateHorizontalGroup(parent, "Stat_" + field.Name, false, false, true, true, 4, new Vector4(2f, 2f, 2f, 2f), default(Color), (TextAnchor?)null); int? num = 28; int? num2 = 9999; UIFactory.SetLayoutElement(val, (int?)null, num, num2, (int?)null, (int?)null, (int?)null, (bool?)null); Text val2 = UIFactory.CreateLabel(val, "Name", field.Name, (TextAnchor)3, default(Color), true, 14); GameObject gameObject = ((Component)val2).gameObject; int? num3 = 180; num2 = 9999; UIFactory.SetLayoutElement(gameObject, num3, (int?)null, num2, (int?)null, (int?)null, (int?)null, (bool?)null); InputFieldRef val3 = UIFactory.CreateInputField(val, "Value", ""); GameObject gameObject2 = ((Component)val3.Component).gameObject; num2 = 26; UIFactory.SetLayoutElement(gameObject2, (int?)100, num2, (int?)0, (int?)null, (int?)null, (int?)null, (bool?)null); val3.Component.contentType = (ContentType)3; ((UnityEvent<string>)(object)val3.Component.onEndEdit).AddListener((UnityAction<string>)delegate(string text) { OnStatEdited(field, text); }); _inputs[field] = val3; } private void OnStatEdited(FieldInfo field, string text) { if (_suppress || string.IsNullOrWhiteSpace(text)) { return; } CharacterBody body = GetBody(); if (Object.op_Implicit((Object)(object)body) && float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { if (_selectedProfile.Value > 0) { _profiles[_selectedProfile.Value - 1].Entries[field].Value = result; } new BodyStatMessage(body, field.Name, result).SendToEveryone(); Remember(field.Name, result); } } private void ApplyProfile(int index, bool applyToBody) { CharacterBody body = GetBody(); _suppress = true; FieldInfo key; InputFieldRef value; if (index == 0) { if (Object.op_Implicit((Object)(object)body)) { foreach (KeyValuePair<FieldInfo, InputFieldRef> input in _inputs) { input.Deconstruct(out key, out value); FieldInfo fieldInfo = key; InputFieldRef val = value; val.Text = ((float)fieldInfo.GetValue(body)).ToString(CultureInfo.InvariantCulture); } } } else { StatProfile statProfile = _profiles[index - 1]; foreach (KeyValuePair<FieldInfo, InputFieldRef> input2 in _inputs) { input2.Deconstruct(out key, out value); FieldInfo key2 = key; InputFieldRef val2 = value; val2.Text = statProfile.Entries[key2].Value.ToString(CultureInfo.InvariantCulture); } } _suppress = false; if (!applyToBody) { return; } if (index == 0) { ClearOverrides(); } else { if (!Object.op_Implicit((Object)(object)body)) { return; } foreach (KeyValuePair<FieldInfo, InputFieldRef> input3 in _inputs) { input3.Deconstruct(out key, out value); FieldInfo fieldInfo2 = key; InputFieldRef val3 = value; if (float.TryParse(val3.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { new BodyStatMessage(body, fieldInfo2.Name, result).SendToEveryone(); Remember(fieldInfo2.Name, result); } } } } private void RefreshPlaceholders() { CharacterBody body = GetBody(); if (!Object.op_Implicit((Object)(object)body)) { return; } foreach (KeyValuePair<FieldInfo, InputFieldRef> input in _inputs) { input.Deconstruct(out var key, out var value); FieldInfo fieldInfo = key; InputFieldRef val = value; Graphic placeholder = val.Component.placeholder; Text val2 = (Text)(object)((placeholder is Text) ? placeholder : null); if (Object.op_Implicit((Object)(object)val2)) { val2.text = ((float)fieldInfo.GetValue(body)).ToString(CultureInfo.InvariantCulture); } } } private static CharacterBody? GetBody() { NetworkUser selected = PlayerSelection.Selected; if (!Object.op_Implicit((Object)(object)selected) || !Object.op_Implicit((Object)(object)selected.master)) { return null; } CharacterBody val = selected.master.GetBody(); if (!Object.op_Implicit((Object)(object)val) && selected.master.hasBody) { GameObject bodyObject = selected.master.GetBodyObject(); val = ((bodyObject != null) ? bodyObject.GetComponent<CharacterBody>() : null); } return Object.op_Implicit((Object)(object)val) ? val : null; } } public class BuffsSection : IAeroltSection { private IconGrid<BuffDef> _grid = null; public string Title => "Buffs"; public GameObject Root { get; private set; } = null; public bool ScrollableContent => false; public void Build(GameObject contentParent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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) Root = UIFactory.CreateVerticalGroup(contentParent, "BuffsSection", false, false, true, true, 4, default(Vector4), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); GameObject root = Root; int? num = 9999; int? num2 = 9999; UIFactory.SetLayoutElement(root, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); Text val = UIFactory.CreateLabel(Root, "Hint", "Click a buff to add one (Shift +5, right-click to remove).", (TextAnchor)3, default(Color), true, 14); GameObject gameObject = ((Component)val).gameObject; num2 = 18; num = 9999; UIFactory.SetLayoutElement(gameObject, (int?)null, num2, num, (int?)null, (int?)null, (int?)null, (bool?)null); val.fontSize = 12; _grid = new IconGrid<BuffDef>((BuffDef def) => ((Object)def).name, delegate(BuffDef def, Image icon, Func<bool> _) { if (Object.op_Implicit((Object)(object)def.iconSprite)) { icon.sprite = def.iconSprite; } }, Adjust, GetCount, onlyOwned: false, (BuffDef def) => def.buffColor); _grid.Build(Root, from x in ContentManager.buffDefs where Object.op_Implicit((Object)(object)x) orderby ((Object)x).name select x); } public void OnShown() { _grid.Refresh(); } private static int GetCount(BuffDef def) { CharacterBody body = GetBody(); return Object.op_Implicit((Object)(object)body) ? body.GetBuffCount(def) : 0; } private void Adjust(BuffDef def, int amount) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) CharacterBody body = GetBody(); if (Object.op_Implicit((Object)(object)body) && amount != 0) { int buffCount = body.GetBuffCount(def); int num = Mathf.Max(0, buffCount + amount); if (num != buffCount) { new SetBuffCountMessage(body, new Dictionary<BuffIndex, uint> { { def.buffIndex, (uint)num } }).SendToServer(); _grid.Refresh(); } } } private static CharacterBody? GetBody() { NetworkUser selected = PlayerSelection.Selected; if (!Object.op_Implicit((Object)(object)selected) || !Object.op_Implicit((Object)(object)selected.master)) { return null; } CharacterBody body = selected.master.GetBody(); return Object.op_Implicit((Object)(object)body) ? body : null; } } public class EquipmentSection : IAeroltSection { private IconGrid<EquipmentDef> _grid = null; private Image _currentIcon = null; private Text _currentLabel = null; private int _currentIconGeneration; public string Title => "Equipment"; public GameObject Root { get; private set; } = null; public bool ScrollableContent => false; public void Build(GameObject contentParent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) Root = UIFactory.CreateVerticalGroup(contentParent, "EquipmentSection", false, false, true, true, 4, default(Vector4), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); GameObject root = Root; int? num = 9999; int? num2 = 9999; UIFactory.SetLayoutElement(root, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); GameObject val = UIFactory.CreateHorizontalGroup(Root, "Current", false, false, true, true, 6, new Vector4(4f, 4f, 4f, 4f), new Color(0.12f, 0.12f, 0.12f), (TextAnchor?)null); num2 = 44; num = 0; int? num3 = 9999; UIFactory.SetLayoutElement(val, (int?)null, num2, num3, num, (int?)null, (int?)null, (bool?)null); Text val2 = UIFactory.CreateLabel(val, "EquippedLabel", "Equipped:", (TextAnchor)3, default(Color), true, 14); GameObject gameObject = ((Component)val2).gameObject; int? num4 = 75; num3 = 0; UIFactory.SetLayoutElement(gameObject, num4, (int?)null, num3, (int?)null, (int?)null, (int?)null, (bool?)null); val2.fontStyle = (FontStyle)1; GameObject val3 = UIFactory.CreateUIObject("CurrentIcon", val, default(Vector2)); int? num5 = 36; int? num6 = 36; num3 = 36; num = 36; UIFactory.SetLayoutElement(val3, num5, num6, (int?)0, (int?)0, num3, num, (bool?)null); _currentIcon = val3.AddComponent<Image>(); _currentIcon.preserveAspect = true; ((Graphic)_currentIcon).raycastTarget = false; _currentLabel = UIFactory.CreateLabel(val, "CurrentName", "(none)", (TextAnchor)3, default(Color), true, 14); GameObject gameObject2 = ((Component)_currentLabel).gameObject; int? num7 = 100; num = 9999; UIFactory.SetLayoutElement(gameObject2, num7, (int?)null, num, (int?)null, (int?)null, (int?)null, (bool?)null); _grid = new IconGrid<EquipmentDef>((EquipmentDef def) => Language.GetString(def.nameToken), delegate(EquipmentDef def, Image icon, Func<bool> stillValid) { IconCache.LoadEquipmentIcon(def, delegate(Sprite sprite) { if (Object.op_Implicit((Object)(object)sprite) && Object.op_Implicit((Object)(object)icon) && stillValid()) { icon.sprite = sprite; } }); }, delegate(EquipmentDef def, int _) { GiveEquipment(def); }); _grid.Build(Root, from x in ContentManager._equipmentDefs where Object.op_Implicit((Object)(object)x) orderby Language.GetString(x.nameToken) select x); RefreshCurrent(); } public void OnShown() { RefreshCurrent(); } private void RefreshCurrent() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_currentIcon == (Object)null) { return; } EquipmentDef val = CurrentEquipment(); int generation = ++_currentIconGeneration; if ((Object)(object)val == (Object)null) { _currentIcon.sprite = null; ((Graphic)_currentIcon).color = new Color(1f, 1f, 1f, 0f); _currentLabel.text = "(none)"; return; } ((Graphic)_currentIcon).color = Color.white; _currentLabel.text = Language.GetString(val.nameToken); Image icon = _currentIcon; IconCache.LoadEquipmentIcon(val, delegate(Sprite sprite) { if (Object.op_Implicit((Object)(object)sprite) && Object.op_Implicit((Object)(object)icon) && _currentIconGeneration == generation) { icon.sprite = sprite; } }); } private static EquipmentDef? CurrentEquipment() { //IL_0046: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) NetworkUser selected = PlayerSelection.Selected; if (!Object.op_Implicit((Object)(object)selected) || !Object.op_Implicit((Object)(object)selected.master) || !Object.op_Implicit((Object)(object)selected.master.inventory)) { return null; } EquipmentIndex currentEquipmentIndex = selected.master.inventory.currentEquipmentIndex; if ((int)currentEquipmentIndex == -1) { return null; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(currentEquipmentIndex); return Object.op_Implicit((Object)(object)equipmentDef) ? equipmentDef : null; } private void GiveEquipment(EquipmentDef def) { NetworkUser selected = PlayerSelection.Selected; if (Object.op_Implicit((Object)(object)selected) && Object.op_Implicit((Object)(object)selected.master)) { Dictionary<EquipmentDef, int> equipmentCounts = new Dictionary<EquipmentDef, int> { { def, 1 } }; new SetEquipmentMessage(selected.master.inventory, equipmentCounts).SendToServer(); RefreshCurrent(); } } } public class EspSection : IAeroltSection { public string Title => "ESP"; public GameObject Root { get; private set; } = null; public void Build(GameObject contentParent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Root = UIFactory.CreateVerticalGroup(contentParent, "EspSection", false, false, true, true, 4, default(Vector4), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); GameObject root = Root; int? num = 9999; int? num2 = 10; int? num3 = 0; UIFactory.SetLayoutElement(root, (int?)null, num2, num, num3, (int?)null, (int?)null, (bool?)null); GameObject root2 = Root; AddToggle(root2, "Teleporter", Esp.ShowTeleporter); AddToggle(root2, "Chests", Esp.ShowChest); AddToggle(root2, "Multishops", Esp.ShowMultiShop); AddToggle(root2, "Barrels", Esp.ShowBarrel); AddToggle(root2, "Scrappers", Esp.ShowScrapper); AddToggle(root2, "Secret Buttons", Esp.ShowSecret); AddToggle(root2, "Duplicators", Esp.ShowDuplicator); AddToggle(root2, "Drones", Esp.ShowDrone); AddToggle(root2, "Shrines", Esp.ShowShrine); AddToggle(root2, "Cleansing Pools", Esp.ShowCleansePool); AddToggle(root2, "Newt Altars", Esp.ShowNewtAlter); AddToggle(root2, "Enemies", Esp.ShowEnemies); AddToggle(root2, "Enemy Health", Esp.ShowEnemyHealth); AddToggle(root2, "Advanced Info", Esp.ShowAdvanced); } public void OnShown() { } private static void AddToggle(GameObject parent, string label, ZioConfigEntry<bool> entry) { //IL_0020: 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) Toggle val2 = default(Toggle); Text val3 = default(Text); GameObject val = UIFactory.CreateToggle(parent, "Esp_" + label, ref val2, ref val3, default(Color), 20, 20); int? num = 28; int? num2 = 9999; UIFactory.SetLayoutElement(val, (int?)null, num, num2, (int?)null, (int?)null, (int?)null, (bool?)null); val3.text = label; val2.isOn = entry.Value; ((UnityEvent<bool>)(object)val2.onValueChanged).AddListener((UnityAction<bool>)delegate(bool on) { entry.Value = on; }); } } public class InteractableSection : IAeroltSection { private IconGrid<SpawnCard> _grid = null; private GameObject _gridHost = null; private bool _built; public string Title => "Interactables"; public GameObject Root { get; private set; } = null; public bool ScrollableContent => false; public void Build(GameObject contentParent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) Root = UIFactory.CreateVerticalGroup(contentParent, "InteractableSection", false, false, true, true, 4, default(Vector4), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); GameObject root = Root; int? num = 9999; int? num2 = 9999; UIFactory.SetLayoutElement(root, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); ButtonRef val = UIFactory.CreateButton(Root, "Refresh", "Refresh list", (Color?)null); GameObject gameObject = ((Component)val.Component).gameObject; num2 = 26; num = 9999; UIFactory.SetLayoutElement(gameObject, (int?)null, num2, num, (int?)null, (int?)null, (int?)null, (bool?)null); val.OnClick = (Action)Delegate.Combine(val.OnClick, new Action(Rebuild)); _gridHost = UIFactory.CreateVerticalGroup(Root, "GridHost", false, false, true, true, 0, default(Vector4), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); GameObject gridHost = _gridHost; num = 9999; num2 = 9999; UIFactory.SetLayoutElement(gridHost, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); } public void OnShown() { if (!_built) { Rebuild(); } } private void Rebuild() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Invalid comparison between Unknown and I4 foreach (Transform item in _gridHost.transform) { Transform val = item; Object.Destroy((Object)(object)((Component)val).gameObject); } SpawnCard[] cards; try { cards = AeroltInteractableSpawner.Cards; } catch (Exception ex) { Tools.Log(LogLevel.Warning, "Interactables unavailable (not in a stage?): " + ex.Message); _built = false; return; } AeroltInteractableSpawner.StartOfRoundScaledInteractableCosts.Clear(); SpawnCard[] array = cards.Where((SpawnCard x) => Object.op_Implicit((Object)(object)x) && Object.op_Implicit((Object)(object)x.prefab)).OrderBy(DisplayName).ToArray(); SpawnCard[] array2 = array; foreach (SpawnCard val2 in array2) { PurchaseInteraction component = val2.prefab.GetComponent<PurchaseInteraction>(); if (Object.op_Implicit((Object)(object)component) && (int)component.costType == 1 && Object.op_Implicit((Object)(object)Run.instance) && !AeroltInteractableSpawner.StartOfRoundScaledInteractableCosts.ContainsKey(val2)) { AeroltInteractableSpawner.StartOfRoundScaledInteractableCosts.Add(val2, Run.instance.GetDifficultyScaledCost(component.cost)); } } _grid = new IconGrid<SpawnCard>(DisplayName, delegate(SpawnCard card, Image icon, Func<bool> stillValid) { Sprite interactableIcon = PingIndicator.GetInteractableIcon(card.prefab); if (Object.op_Implicit((Object)(object)interactableIcon) && Object.op_Implicit((Object)(object)icon) && stillValid()) { icon.sprite = interactableIcon; } }, delegate(SpawnCard card, int _) { SpawnInteractable(card); }); _grid.Build(_gridHost, array); _built = true; } private static string DisplayName(SpawnCard card) { IDisplayNameProvider componentInChildren = card.prefab.GetComponentInChildren<IDisplayNameProvider>(); return (componentInChildren != null) ? componentInChildren.GetDisplayName() : ((Object)card).name; } private static void SpawnInteractable(SpawnCard card) { //IL_0038: 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_0044: 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_004d: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null); if (!Object.op_Implicit((Object)(object)val)) { Tools.Log(LogLevel.Error, "Can't spawn interactable: local body is null"); return; } Vector3 position = val.transform.position; Ray aimRay = val.inputBank.GetAimRay(); Vector3 val2 = ((Ray)(ref aimRay)).direction * 1.6f; uint index = (uint)Array.IndexOf(AeroltInteractableSpawner.Cards, card); if (NetworkServer.active) { AeroltInteractableSpawner.Spawn(index, position + val2); } else { ClientScene.readyConnection.SendAerolt(new InteractableSpawnMessage(index, position + val2)); } } } public class ItemsSection : IAeroltSection { private IconGrid<ItemDef> _grid = null; public string Title => "Items"; public GameObject Root { get; private set; } = null; public bool ScrollableContent => false; public void Build(GameObject contentParent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) Root = UIFactory.CreateVerticalGroup(contentParent, "ItemsSection", false, false, true, true, 4, default(Vector4), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); GameObject root = Root; int? num = 9999; int? num2 = 9999; UIFactory.SetLayoutElement(root, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); GameObject val = UIFactory.CreateHorizontalGroup(Root, "Actions", false, false, true, true, 4, default(Vector4), default(Color), (TextAnchor?)null); num2 = 30; num = 0; int? num3 = 9999; UIFactory.SetLayoutElement(val, (int?)null, num2, num3, num, (int?)null, (int?)null, (bool?)null); AddAction(val, "Give All", GiveAllItems); AddAction(val, "Give Random", GiveRandomItems); AddAction(val, "Clear", ClearInventory); AddAction(val, "Edit Items", delegate { AeroltUniverseUI.OpenItemEditor(); }); Text val2 = UIFactory.CreateLabel(Root, "Hint", "The player's current items. Click to remove one (Shift -5). Use Edit Items to add.", (TextAnchor)3, default(Color), true, 14); GameObject gameObject = ((Component)val2).gameObject; num3 = 18; num = 9999; UIFactory.SetLayoutElement(gameObject, (int?)null, num3, num, (int?)null, (int?)null, (int?)null, (bool?)null); val2.fontSize = 12; _grid = new IconGrid<ItemDef>((ItemDef def) => Language.GetString(def.nameToken), delegate(ItemDef def, Image icon, Func<bool> stillValid) { IconCache.LoadItemIcon(def, delegate(Sprite sprite) { if (Object.op_Implicit((Object)(object)sprite) && Object.op_Implicit((Object)(object)icon) && stillValid()) { icon.sprite = sprite; } }); }, delegate(ItemDef def, int amount) { Adjust(def, -amount); }, GetCount, onlyOwned: true); _grid.Build(Root, ContentManager._itemDefs); } public void OnShown() { _grid.Refresh(); } public void OnHidden() { AeroltUniverseUI.CloseItemEditor(); } private static void AddAction(GameObject parent, string label, Action onClick) { ButtonRef val = UIFactory.CreateButton(parent, "Action_" + label, label, (Color?)null); GameObject gameObject = ((Component)val.Component).gameObject; int? num = 28; int? num2 = 9999; UIFactory.SetLayoutElement(gameObject, (int?)null, num, num2, (int?)null, (int?)null, (int?)null, (bool?)null); val.OnClick = (Action)Delegate.Combine(val.OnClick, onClick); } private static int GetCount(ItemDef def) { Inventory inventory = GetInventory(); return Object.op_Implicit((Object)(object)inventory) ? inventory.GetItemCountEffective(def) : 0; } private void Adjust(ItemDef def, int amount) { Inventory inventory = GetInventory(); if (Object.op_Implicit((Object)(object)inventory) && amount != 0) { int itemCountEffective = inventory.GetItemCountEffective(def); int num = Mathf.Max(0, itemCountEffective + amount); if (num != itemCountEffective) { new SetItemCountMessage(inventory, new Dictionary<ItemDef, int> { { def, num } }).SendToServer(); _grid.Refresh(); } } } private void GiveAllItems() { CharacterMaster master = GetMaster(); if (Object.op_Implicit((Object)(object)master)) { Dictionary<ItemDef, int> itemCounts = ContentManager.itemDefs.Except(ItemHelpers.GiveAllFilteredItems).ToDictionary((ItemDef x) => x, (ItemDef def) => master.inventory.GetItemCountEffective(def) + 1); new SetItemCountMessage(master.inventory, itemCounts).SendToServer(); _grid.Refresh(); } } private void GiveRandomItems() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) CharacterMaster master = GetMaster(); if (!Object.op_Implicit((Object)(object)master)) { return; } Dictionary<ItemDef, int> dictionary = new Dictionary<ItemDef, int>(); for (int i = 0; i < Random.Range(0, 100); i++) { PickupIndex pickupIndex = ItemHelpers.Chest1DropTable.GeneratePickup(RoR2Application.rng).pickupIndex; PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex))); if (!((Object)(object)itemDef == (Object)null)) { if (!dictionary.ContainsKey(itemDef)) { dictionary[itemDef] = master.inventory.GetItemCountEffective(itemDef); } dictionary[itemDef] += Random.Range(0, 100); } } new SetItemCountMessage(master.inventory, dictionary).SendToServer(); _grid.Refresh(); } private void ClearInventory() { CharacterMaster master = GetMaster(); if (Object.op_Implicit((Object)(object)master)) { Dictionary<ItemDef, int> itemCounts = ContentManager.itemDefs.ToDictionary((ItemDef x) => x, (ItemDef _) => 0); new SetItemCountMessage(master.inventory, itemCounts).SendToServer(); _grid.Refresh(); } } private static Inventory? GetInventory() { CharacterMaster master = GetMaster(); return (Object.op_Implicit((Object)(object)master) && Object.op_Implicit((Object)(object)master.inventory)) ? master.inventory : null; } private static CharacterMaster? GetMaster() { NetworkUser selected = PlayerSelection.Selected; return (Object.op_Implicit((Object)(object)selected) && Object.op_Implicit((Object)(object)selected.master)) ? selected.master : null; } } public class MonsterSection : IAeroltSection { private readonly List<EquipmentIndex> _eliteIndices = new List<EquipmentIndex>(); private Dropdown _teamDropdown = null; private Dropdown _eliteDropdown = null; private Toggle _brainDead = null; private IconGrid<CharacterMaster> _list = null; private readonly Dictionary<ItemDef, int> _items = new Dictionary<ItemDef, int>(); private ButtonRef _editItemsButton = null; private readonly List<string> _eliteNames = new List<string>(); public string Title => "Monsters"; public bool ScrollableContent => false; public GameObject Root { get; private set; } = null; public void Build(GameObject contentParent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_00ac: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) Root = UIFactory.CreateVerticalGroup(contentParent, "MonsterSection", false, false, true, true, 4, default(Vector4), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); GameObject root = Root; int? num = 9999; int? num2 = 9999; UIFactory.SetLayoutElement(root, (int?)null, (int?)null, num, num2, (int?)null, (int?)null, (bool?)null); GameObject val = UIFactory.CreateHorizontalGroup(Root, "Options", false, false, true, true, 6, default(Vector4), default(Color), (TextAnchor?)null); num2 = 32; num = 0; int? num3 = 9999; UIFactory.SetLayoutElement(val, (int?)null, num2, num3, num, (int?)null, (int?)null, (bool?)null); string[] names = Enum.GetNames(typeof(TeamIndex)); UIFactory.CreateDropdown(val, "TeamDropdown", ref _teamDropdown, "Team", 14, (Action<int>)null, names); GameObject gameObject = ((Component)_teamDropdown).gameObject; num3 = 28; UIFactory.SetLayoutElement(gameObject, (int?)120, num3, (int?)9999, (int?)null, (int?)null, (int?)null, (bool?)null); int num4 = Array.IndexOf(names, "Monster"); if (num4 >= 0) { _teamDropdown.value = num4; } BuildEliteOptions(); UIFactory.CreateDropdown(val, "EliteDropdown", ref _eliteDropdown, "Elite", 14, (Action<int>)null, _eliteNames.ToArray()); GameObject gameObject2 = ((Component)_eliteDropdown).gameObject; num3 = 28; UIFactory.SetLayoutElement(gameObject2, (int?)120, num3, (int?)9999, (int?)null, (int?)null, (int?)null, (bool?)null); Text val3 = default(Text); GameObject val2 = UIFactory.CreateToggle(val, "BrainDead", ref _brainDead, ref val3, default(Color), 20, 20); num3 = 28; UIFactory.SetLayoutElement(val2, (int?)100, num3, (int?)0, (int?)null, (int?)null, (int?)null, (bool?)null); val3.text = "Braindead"; _editItemsButton = UIFactory.CreateButton(val, "EditItems", "Edit Items", (Color?)null); GameObject gameObject3 = ((Component)_editItemsButton.Component).gameObject; num3 = 28; UIFactory.SetLayoutElement(gameObject3, (int?)120, num3, (int?)0, (int?)null, (int?)null, (int?)null, (bool?)null); ButtonRef editItemsButton = _editItemsButton; editItemsButton.OnClick = (Action)Delegate.Combine(editItemsButton.OnClick, new Action(OpenItemEditor)); UpdateEditItemsLabel(); ButtonRef val4 = UIFactory.CreateButton(val, "KillAllMonsters", "Kill All Monsters", (Color?)null); GameObject gameObject4 = ((Component)val4.Component).gameObject; num3 = 28; UIFactory.SetLayoutElement(gameObject4, (int?)130, num3, (int?)0, (int?)null, (int?)null, (int?)null, (bool?)null); val4.OnClick = (Action)Delegate.Combine(val4.OnClick, new Action(KillAllMonsters)); _list = new IconGrid<CharacterMaster>((CharacterMaster master) => Language.GetString(master.bodyPrefab.GetComponent<CharacterBody>().baseNameToken), delegate(CharacterMaster master, Image icon, Func<bool> stillValid) { Sprite masterIcon = IconCache.GetMasterIcon(master); if (Object.op_Implicit((Object)(object)masterIcon) && Object.op_Implicit((Object)(object)icon) && stillValid()) { icon.sprite = masterIcon; } }, delegate(CharacterMaster master, int _) { SpawnMonster(master); }); _list.Build(Root, from x in MasterCatalog.allMasters where Object.op_Implicit((Object)(object)x.bodyPrefab) && Object.op_Implicit((Object)(object)x.bodyPrefab.GetComponent<CharacterBody>()?.portraitIcon) orderby Language.GetString(x.bodyPrefab.GetComponent<CharacterBody>().baseNameToken) select x); } private void BuildEliteOptions() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) _eliteNames.Clear(); _eliteIndices.Clear(); _eliteNames.Add("None"); _eliteIndices.Add((EquipmentIndex)(-1)); EliteDef[] eliteDefs = EliteCatalog.eliteDefs; foreach (EliteDef val in eliteDefs) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.eliteEquipmentDef)) { _eliteNames.Add(Language.GetStringFormatted(val.modifierToken, new object[1] { "Monster" })); _eliteIndices.Add(val.eliteEquipmentDef.equipmentIndex); } } } public void OnShown() { UpdateEditItemsLabel(); } public void OnHidden() { AeroltUniverseUI.CloseItemEditor(); } private static void KillAllMonsters() { new KillAllTeamMessage((TeamIndex)1).SendToServer(); } private void OpenItemEditor() { AeroltUniverseUI.OpenItemEditor(new DictionaryItemTarget(_items, "Monster Items")); UpdateEditItemsLabel(); } private void UpdateEditItemsLabel() { ButtonRef editItemsButton = _editItemsButton; if (Object.op_Implicit((Object)(object)((editItemsButton != null) ? editItemsButton.ButtonText : null))) { _editItemsButton.ButtonText.text = ((_items.Count > 0) ? $"Edit Items ({_items.Count})" : "Edit Items"); } } private void SpawnMonster(CharacterMaster monsterMaster) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_008a: 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_0107: 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_010a: Unknown result type (might be due to invalid IL or missing references) LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser != null && Object.op_Implicit((Object)(object)firstLocalUser.cachedBody)) { Vector3 position = firstLocalUser.cachedBody.transform.position; GameObject bodyPrefab = monsterMaster.bodyPrefab; EquipmentIndex equipmentIndex = (EquipmentIndex)((_eliteDropdown.value < 0 || _eliteDropdown.value >= _eliteIndices.Count) ? (-1) : ((int)_eliteIndices[_eliteDropdown.value])); TeamIndex teamIndex = (TeamIndex)(sbyte)_teamDropdown.value; Dictionary<ItemDef, uint> toDictionary = _items.Where<KeyValuePair<ItemDef, int>>((KeyValuePair<ItemDef, int> kvp) => Object.op_Implicit((Object)(object)kvp.Key) && kvp.Value > 0).ToDictionary((KeyValuePair<ItemDef, int> kvp) => kvp.Key, (KeyValuePair<ItemDef, int> kvp) => (uint)kvp.Value); new MonsterSpawnMessage(((Object)monsterMaster).name, ((Object)bodyPrefab).name, position, teamIndex, equipmentIndex, _brainDead.isOn, toDictionary).SendToServer(); } } } public class PlayerSection : IAeroltSection { private Toggle _god = null; private Toggle _noclip = null; private Toggle _aimbot = null; private Toggle _infiniteSkills = null; private Toggle _alwaysSprint = null; private Slider _aimbotWeight = null; private Toggle _disableMobSpawns = null; private Dropdown _teamDropdown = null; private ValueWrapper<bool> _disableMobSpawnsWrapper = null; private bool _suppress; public string Title => "Player"; public GameObject Root { get; private set; } = null; public void Build(GameObject contentParent) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) Root = UIFactory.CreateVerticalGroup(contentParent, "PlayerSection", false, false, true, true, 4, default(Vector4), new Color(0.14f, 0.14f, 0.14f), (TextAnchor?)null); GameObject root = Root; int? num = 9999; int? num2 = 10; int? num3 = 0; UIFactory.SetLayoutElement(root, (int?)null, num2, num, num3, (int?)null, (int?)null, (bool?)null); _disableMobSpawnsWrapper = ValueWrapper.Get("PlayerMenu", "DisableMobSpawns", defaultValue: false, ""); _disableMobSpawnsWrapper.settingChanged += OnMobSpawnsChanged; Header("Cheats"); GameObject val = UIFactory.CreateUIObject("ToggleGrid", Root, default(Vector2)); GridLayoutGroup val2 = val.AddComponent<GridLayoutGroup>(); val2.cellSize = new Vector2(170f, 28f); val2.spacing = new Vector2(6f, 4f); val2.startCorner = (Corner)0; val2.startAxis = (Axis)0; ((LayoutGroup)val2).childAlignment = (TextAnchor)0; val2.constraint = (Constraint)1; val2.constraintCount = 2; ContentSizeFitter val3 = val.AddComponent<ContentSizeFitter>(); val3.verticalFit = (FitMode)2; num3 = 28; num2 = 9999; UIFactory.SetLayoutElement(val, (int?)null, num3, num2, (int?)null, (int?)null, (int?)null, (bool?)null); _god = AddToggle(val, "God Mode", delegate(bool on) { Apply(delegate(PlayerConfigBinding b) { b.GodMode.Value = on; }); }); _noclip = AddToggle(val, "Noclip", delegate(bool on) { Apply(delegate(PlayerConfigBinding b) { b.Noclip.Value = on; }); }); _aimbot = AddToggle(val, "Aimbot", delegate(bool on) { Apply(delegate(PlayerConfigBinding b) { b.Aimbot.Value = on; }); }); _infiniteSkills = AddToggle(val, "Infinite Skills", delegate(bool on) { Apply(delegate(PlayerConfigBinding b) { b.InfiniteSkills.Value = on; }); }); _alwaysSprint = AddToggle(val, "Always Sprint", delegate(bool on) { Apply(delegate(PlayerConfigBinding b) { b.AlwaysSprint.Value = on; }); }); _disableMobSpawns = AddToggle(val, "Disable Mob Spawns", delegate(bool on) { SetMobSpawns(on); }); GameObject val4 = UIFactory.CreateHorizontalGroup(Root, "AimbotWeightRow", false, false, true, true, 4, default(Vector4), default(Color), (TextAnchor?)null); num2 = 28; num3 = 9999; UIFactory.SetLayoutElement(val4, (int?)null, num2, num3, (int?)null, (int?)null, (int?)null, (bool?)null); Text val5 = UIFactory.CreateLabel(val4, "AimbotWeightLabel", "Aimbot Weight", (TextAnchor)3, default(Color), true, 14); GameObject gameObject = ((Component)val5).gameObject; int? num4 = 110; num3 = 0; UIFactory.SetLayoutElement(gameObject, num4, (int?)null, num3, (int?)null, (int?)null, (int?)null, (bool?)null); UIFactory.CreateSlider(val4, "AimbotWeightSlider", ref _aimbotWeight); GameObject gameObject2 = ((Component)_aimbotWeight).gameObject; num3 = 25; UIFactory.SetLayoutElement(gameObject2, (int?)150, num3, (int?)9999, (int?)null, (int?)null, (int?)null, (bool?)null); _aimbotWeight.minValue = 0f; _aimbotWeight.maxValue = 1f; ((UnityEvent<float>)(object)_aimbotWeight.onValueChanged).AddListener((UnityAction<float>)delegate(float value) { Apply(delegate(PlayerConfigBinding b) { b.AimbotWeight.Value = value; }); }); Header("Actions"); GameObject val6 = UIFactory.CreateHorizontalGroup(Root, "Actions", false, false, true, true, 4, default(Vector4), default(Color), (TextAnchor?)null); num3 = 30; num2 = 0; num = 9999; UIFactory.SetLayoutElement(val6, (int?)null, num3, num, num2, (int?)null, (int?)null, (bool?)null); AddButton(val6, "Kill", Kill); AddButton(val6, "Revive", Revive); AddButton(val6, "Goto", Goto); AddButton(val6, "Bring", Bring); AddButton(val6, "Kick", Kick); AddButton(val6, "Ban", Ban); Header("Currency"); AddCurrencyRow("Money", CurrencyType.Money); AddCurrencyRow("Lunar Coins", CurrencyType.Lunar); AddCurrencyRow("Void Coins", CurrencyType.Void); AddCurrencyRow("Level", CurrencyType.Level); GameObject val7 = UIFactory.CreateHorizontalGroup(Root, "TeamRow", false, false, true, true, 4, default(Vector4), default(Color), (TextAnchor?)null); num = 30; num2 = 0; num3 = 9999; UIFactory.SetLayoutElement(val7, (int?)null, num, num3, num2, (int?)null, (int?)null, (bool?)null); Text val8 = UIFactory.CreateLabel(val7, "TeamLabel", "Team", (TextAnchor)3, default(Color), true, 14); GameObject gameObject3 = ((Component)val8).gameObject; int? num5 = 110; num3 = 0; UIFactory.SetLayoutElement(gameObject3, num5, (int?)null, num3, (int?)null, (int?)null, (int?)null, (bool?)null); string[] names = Enum.GetNames(typeof(TeamIndex)); UIFactory.CreateDropdown(val7, "TeamDropdown", ref _teamDropdown, "Team", 14, (Action<int>)OnTeamChanged, names); GameObject gameObject4 = ((Component)_teamDropdown).gameObject; num3 = 28; num2 = 9999; UIFactory.SetLayoutElement(gameObject4, (int?)null, num3, num2, (int?)null, (int?)null, (int?)null, (bool?)null); PlayerSelection.SelectionChanged += SyncFromConfig; } public void OnShown() { SyncFromConfig(); } private Toggle AddToggle(GameObject parent, string label, UnityAction<bool> onChanged) { //IL_0027: 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) Toggle val2 = default(Toggle); Text val3 = default(Text); GameObject val = UIFactory.CreateToggle(parent, "Toggle_" + label, ref val2, ref val3, default(Color), 20, 20); int? num = 28; int? num2 = 9999; UIFactory.SetLayoutElement(val, (int?)null, num, num2, (int?)null, (int?)null, (int?)null, (bool?)null); val3.text = label; ((UnityEvent<bool>)(object)val2.onValueChanged).AddL
UniverseLib.Mono.dll
Decompiled 2 days 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.Collections.Specialized; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using HarmonyLib; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using UniverseLib.Config; using UniverseLib.Input; using UniverseLib.Runtime; using UniverseLib.Runtime.Mono; using UniverseLib.UI; using UniverseLib.UI.Models; using UniverseLib.UI.ObjectPool; using UniverseLib.UI.Panels; using UniverseLib.UI.Widgets; using UniverseLib.UI.Widgets.ScrollView; using UniverseLib.Utility; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("UniverseLib")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Sinai")] [assembly: AssemblyProduct("UniverseLib")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b21dbde3-5d6f-4726-93ab-cc3cc68bae7d")] [assembly: AssemblyFileVersion("1.5.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.1.0")] [module: UnverifiableCode] public static class MonoExtensions { private static PropertyInfo p_childControlHeight = AccessTools.Property(typeof(HorizontalOrVerticalLayoutGroup), "childControlHeight"); private static PropertyInfo p_childControlWidth = AccessTools.Property(typeof(HorizontalOrVerticalLayoutGroup), "childControlWidth"); public static void AddListener(this UnityEvent _event, Action listener) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown _event.AddListener(new UnityAction(listener.Invoke)); } public static void AddListener<T>(this UnityEvent<T> _event, Action<T> listener) { _event.AddListener((UnityAction<T>)listener.Invoke); } public static void RemoveListener(this UnityEvent _event, Action listener) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown _event.RemoveListener(new UnityAction(listener.Invoke)); } public static void RemoveListener<T>(this UnityEvent<T> _event, Action<T> listener) { _event.RemoveListener((UnityAction<T>)listener.Invoke); } public static void Clear(this StringBuilder sb) { sb.Remove(0, sb.Length); } public static void SetChildControlHeight(this HorizontalOrVerticalLayoutGroup group, bool value) { p_childControlHeight?.SetValue(group, value, null); } public static void SetChildControlWidth(this HorizontalOrVerticalLayoutGroup group, bool value) { p_childControlWidth?.SetValue(group, value, null); } } namespace UniverseLib { public static class ReflectionExtensions { public static Type GetActualType(this object obj) { return ReflectionUtility.Instance.Internal_GetActualType(obj); } public static object TryCast(this object obj) { return ReflectionUtility.Instance.Internal_TryCast(obj, ReflectionUtility.Instance.Internal_GetActualType(obj)); } public static object TryCast(this object obj, Type castTo) { return ReflectionUtility.Instance.Internal_TryCast(obj, castTo); } public static T TryCast<T>(this object obj) { try { return (T)ReflectionUtility.Instance.Internal_TryCast(obj, typeof(T)); } catch { return default(T); } } [Obsolete("This method is no longer necessary, just use Assembly.GetTypes().", false)] public static IEnumerable<Type> TryGetTypes(this Assembly asm) { return asm.GetTypes(); } public static bool ReferenceEqual(this object objA, object objB) { if (objA == objB) { return true; } Object val = (Object)((objA is Object) ? objA : null); if (val != null) { Object val2 = (Object)((objB is Object) ? objB : null); if (val2 != null && Object.op_Implicit(val) && Object.op_Implicit(val2) && val.m_CachedPtr == val2.m_CachedPtr) { return true; } } return false; } public static string ReflectionExToString(this Exception e, bool innerMost = true) { if (e == null) { return "The exception was null."; } if (innerMost) { e = e.GetInnerMostException(); } return $"{e.GetType()}: {e.Message}"; } public static Exception GetInnerMostException(this Exception e) { while (e != null && e.InnerException != null) { e = e.InnerException; } return e; } } internal static class ReflectionPatches { internal static void Init() { Universe.Patch(typeof(Assembly), "GetTypes", (MethodType)0, new Type[0], null, null, AccessTools.Method(typeof(ReflectionPatches), "Finalizer_Assembly_GetTypes", (Type[])null, (Type[])null)); } public static Exception Finalizer_Assembly_GetTypes(Assembly __instance, Exception __exception, ref Type[] __result) { if (__exception != null) { if (__exception is ReflectionTypeLoadException e) { __result = ReflectionUtility.TryExtractTypesFromException(e); } else { try { __result = __instance.GetExportedTypes(); } catch (ReflectionTypeLoadException e2) { __result = ReflectionUtility.TryExtractTypesFromException(e2); } catch { __result = ArgumentUtility.EmptyTypes; } } } return null; } } public class ReflectionUtility { public static bool Initializing; public const BindingFlags FLAGS = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static readonly SortedDictionary<string, Type> AllTypes = new SortedDictionary<string, Type>(StringComparer.OrdinalIgnoreCase); public static readonly List<string> AllNamespaces = new List<string>(); private static readonly HashSet<string> uniqueNamespaces = new HashSet<string>(); private static string[] allTypeNamesArray; private static readonly Dictionary<string, Type> shorthandToType = new Dictionary<string, Type> { { "object", typeof(object) }, { "string", typeof(string) }, { "bool", typeof(bool) }, { "byte", typeof(byte) }, { "sbyte", typeof(sbyte) }, { "char", typeof(char) }, { "decimal", typeof(decimal) }, { "double", typeof(double) }, { "float", typeof(float) }, { "int", typeof(int) }, { "uint", typeof(uint) }, { "long", typeof(long) }, { "ulong", typeof(ulong) }, { "short", typeof(short) }, { "ushort", typeof(ushort) }, { "void", typeof(void) } }; internal static readonly Dictionary<string, Type[]> baseTypes = new Dictionary<string, Type[]>(); internal static ReflectionUtility Instance { get; private set; } public static event Action<Type> OnTypeLoaded; internal static void Init() { ReflectionPatches.Init(); Instance = new ReflectionUtility(); Instance.Initialize(); } protected virtual void Initialize() { SetupTypeCache(); Initializing = false; } public static string[] GetTypeNameArray() { if (allTypeNamesArray == null || allTypeNamesArray.Length != AllTypes.Count) { allTypeNamesArray = new string[AllTypes.Count]; int num = 0; foreach (string key in AllTypes.Keys) { allTypeNamesArray[num] = key; num++; } } return allTypeNamesArray; } private static void SetupTypeCache() { if (Universe.Context == RuntimeContext.Mono) { ForceLoadManagedAssemblies(); } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly asm in assemblies) { CacheTypes(asm); } AppDomain.CurrentDomain.AssemblyLoad += AssemblyLoaded; } private static void AssemblyLoaded(object sender, AssemblyLoadEventArgs args) { if ((object)args.LoadedAssembly != null && !(args.LoadedAssembly.GetName().Name == "completions")) { CacheTypes(args.LoadedAssembly); } } private static void ForceLoadManagedAssemblies() { string path = Path.Combine(Application.dataPath, "Managed"); if (!Directory.Exists(path)) { return; } string[] files = Directory.GetFiles(path, "*.dll"); foreach (string path2 in files) { try { Assembly assembly = Assembly.LoadFile(path2); assembly.GetTypes(); } catch { } } } internal static void CacheTypes(Assembly asm) { Type[] types = asm.GetTypes(); foreach (Type type in types) { if (!string.IsNullOrEmpty(type.Namespace) && !uniqueNamespaces.Contains(type.Namespace)) { uniqueNamespaces.Add(type.Namespace); int j; for (j = 0; j < AllNamespaces.Count && type.Namespace.CompareTo(AllNamespaces[j]) >= 0; j++) { } AllNamespaces.Insert(j, type.Namespace); } AllTypes[type.FullName] = type; ReflectionUtility.OnTypeLoaded?.Invoke(type); } } public static Type GetTypeByName(string fullName) { return Instance.Internal_GetTypeByName(fullName); } internal virtual Type Internal_GetTypeByName(string fullName) { if (shorthandToType.TryGetValue(fullName, out var value)) { return value; } AllTypes.TryGetValue(fullName, out var value2); if ((object)value2 == null) { value2 = Type.GetType(fullName); } return value2; } internal virtual Type Internal_GetActualType(object obj) { return obj?.GetType(); } internal virtual object Internal_TryCast(object obj, Type castTo) { return obj; } public static string ProcessTypeInString(Type type, string theString) { return Instance.Internal_ProcessTypeInString(theString, type); } internal virtual string Internal_ProcessTypeInString(string theString, Type type) { return theString; } public static void FindSingleton(string[] possibleNames, Type type, BindingFlags flags, List<object> instances) { Instance.Internal_FindSingleton(possibleNames, type, flags, instances); } internal virtual void Internal_FindSingleton(string[] possibleNames, Type type, BindingFlags flags, List<object> instances) { foreach (string name in possibleNames) { FieldInfo field = type.GetField(name, flags); if ((object)field != null) { object value = field.GetValue(null); if (value != null) { instances.Add(value); break; } } } } public static Type[] TryExtractTypesFromException(ReflectionTypeLoadException e) { try { return e.Types.Where((Type it) => (object)it != null).ToArray(); } catch { return ArgumentUtility.EmptyTypes; } } public static Type[] GetAllBaseTypes(object obj) { return GetAllBaseTypes(obj?.GetActualType()); } public static Type[] GetAllBaseTypes(Type type) { if ((object)type == null) { throw new ArgumentNullException("type"); } string assemblyQualifiedName = type.AssemblyQualifiedName; if (baseTypes.TryGetValue(assemblyQualifiedName, out var value)) { return value; } List<Type> list = new List<Type>(); while ((object)type != null) { list.Add(type); type = type.BaseType; } value = list.ToArray(); baseTypes.Add(assemblyQualifiedName, value); return value; } public static void GetImplementationsOf(Type baseType, Action<HashSet<Type>> onResultsFetched, bool allowAbstract, bool allowGeneric, bool allowEnum) { RuntimeHelper.StartCoroutine(DoGetImplementations(onResultsFetched, baseType, allowAbstract, allowGeneric, allowEnum)); } private static IEnumerator DoGetImplementations(Action<HashSet<Type>> onResultsFetched, Type baseType, bool allowAbstract, bool allowGeneric, bool allowEnum) { List<Type> resolvedTypes = new List<Type>(); OnTypeLoaded += ourListener; HashSet<Type> set = new HashSet<Type>(); IEnumerator coro2 = GetImplementationsAsync(baseType, set, allowAbstract, allowGeneric, allowEnum, DefaultTypesEnumerator()); while (coro2.MoveNext()) { yield return null; } OnTypeLoaded -= ourListener; if (resolvedTypes.Count > 0) { coro2 = GetImplementationsAsync(baseType, set, allowAbstract, allowGeneric, allowEnum, resolvedTypes.GetEnumerator()); while (coro2.MoveNext()) { yield return null; } } onResultsFetched(set); void ourListener(Type t) { resolvedTypes.Add(t); } } private static IEnumerator<Type> DefaultTypesEnumerator() { string[] names = GetTypeNameArray(); foreach (string name in names) { yield return AllTypes[name]; } } private static IEnumerator GetImplementationsAsync(Type baseType, HashSet<Type> set, bool allowAbstract, bool allowGeneric, bool allowEnum, IEnumerator<Type> enumerator) { Stopwatch sw = new Stopwatch(); sw.Start(); bool isGenericParam = baseType?.IsGenericParameter ?? false; while (enumerator.MoveNext()) { if (sw.ElapsedMilliseconds > 10) { yield return null; sw.Reset(); sw.Start(); } try { Type type = enumerator.Current; if (set.Contains(type) || (!allowAbstract && type.IsAbstract) || (!allowGeneric && type.IsGenericType) || (!allowEnum && type.IsEnum) || type.FullName.Contains("PrivateImplementationDetails") || type.FullName.Contains("DisplayClass") || Enumerable.Contains(type.FullName, '<')) { continue; } if (!isGenericParam) { if ((object)baseType == null || baseType.IsAssignableFrom(type)) { goto IL_0269; } } else if ((!type.IsClass || !MiscUtility.HasFlag(baseType.GenericParameterAttributes, GenericParameterAttributes.NotNullableValueTypeConstraint)) && (!type.IsValueType || !MiscUtility.HasFlag(baseType.GenericParameterAttributes, GenericParameterAttributes.ReferenceTypeConstraint)) && !baseType.GetGenericParameterConstraints().Any((Type it) => !it.IsAssignableFrom(type))) { goto IL_0269; } goto end_IL_009f; IL_0269: set.Add(type); end_IL_009f:; } catch { } } } public static bool IsEnumerable(Type type) { return Instance.Internal_IsEnumerable(type); } protected virtual bool Internal_IsEnumerable(Type type) { return typeof(IEnumerable).IsAssignableFrom(type); } public static bool TryGetEnumerator(object ienumerable, out IEnumerator enumerator) { return Instance.Internal_TryGetEnumerator(ienumerable, out enumerator); } protected virtual bool Internal_TryGetEnumerator(object list, out IEnumerator enumerator) { enumerator = (list as IEnumerable).GetEnumerator(); return true; } public static bool TryGetEntryType(Type enumerableType, out Type type) { return Instance.Internal_TryGetEntryType(enumerableType, out type); } protected virtual bool Internal_TryGetEntryType(Type enumerableType, out Type type) { if (enumerableType.IsArray) { type = enumerableType.GetElementType(); return true; } Type[] interfaces = enumerableType.GetInterfaces(); foreach (Type type2 in interfaces) { if (type2.IsGenericType) { Type genericTypeDefinition = type2.GetGenericTypeDefinition(); if ((object)genericTypeDefinition == typeof(IEnumerable<>) || (object)genericTypeDefinition == typeof(IList<>) || (object)genericTypeDefinition == typeof(ICollection<>)) { type = type2.GetGenericArguments()[0]; return true; } } } type = typeof(object); return false; } public static bool IsDictionary(Type type) { return Instance.Internal_IsDictionary(type); } protected virtual bool Internal_IsDictionary(Type type) { return typeof(IDictionary).IsAssignableFrom(type); } public static bool TryGetDictEnumerator(object dictionary, out IEnumerator<DictionaryEntry> dictEnumerator) { return Instance.Internal_TryGetDictEnumerator(dictionary, out dictEnumerator); } protected virtual bool Internal_TryGetDictEnumerator(object dictionary, out IEnumerator<DictionaryEntry> dictEnumerator) { dictEnumerator = EnumerateDictionary((IDictionary)dictionary); return true; } private IEnumerator<DictionaryEntry> EnumerateDictionary(IDictionary dict) { IDictionaryEnumerator enumerator = dict.GetEnumerator(); while (enumerator.MoveNext()) { yield return new DictionaryEntry(enumerator.Key, enumerator.Value); } } public static bool TryGetEntryTypes(Type dictionaryType, out Type keys, out Type values) { return Instance.Internal_TryGetEntryTypes(dictionaryType, out keys, out values); } protected virtual bool Internal_TryGetEntryTypes(Type dictionaryType, out Type keys, out Type values) { Type[] interfaces = dictionaryType.GetInterfaces(); foreach (Type type in interfaces) { if (type.IsGenericType && (object)type.GetGenericTypeDefinition() == typeof(IDictionary<, >)) { Type[] genericArguments = type.GetGenericArguments(); keys = genericArguments[0]; values = genericArguments[1]; return true; } } keys = typeof(object); values = typeof(object); return false; } } public abstract class RuntimeHelper { internal static RuntimeHelper Instance { get; private set; } internal static void Init() { Instance = new MonoProvider(); Instance.OnInitialize(); } protected internal abstract void OnInitialize(); public static Coroutine StartCoroutine(IEnumerator routine) { return Instance.Internal_StartCoroutine(routine); } protected internal abstract Coroutine Internal_StartCoroutine(IEnumerator routine); public static void StopCoroutine(Coroutine coroutine) { Instance.Internal_StopCoroutine(coroutine); } protected internal abstract void Internal_StopCoroutine(Coroutine coroutine); public static T AddComponent<T>(GameObject obj, Type type) where T : Component { return Instance.Internal_AddComponent<T>(obj, type); } protected internal abstract T Internal_AddComponent<T>(GameObject obj, Type type) where T : Component; public static ScriptableObject CreateScriptable(Type type) { return Instance.Internal_CreateScriptable(type); } protected internal abstract ScriptableObject Internal_CreateScriptable(Type type); public static string LayerToName(int layer) { return Instance.Internal_LayerToName(layer); } protected internal abstract string Internal_LayerToName(int layer); public static T[] FindObjectsOfTypeAll<T>() where T : Object { return Instance.Internal_FindObjectsOfTypeAll<T>(); } public static Object[] FindObjectsOfTypeAll(Type type) { return Instance.Internal_FindObjectsOfTypeAll(type); } protected internal abstract T[] Internal_FindObjectsOfTypeAll<T>() where T : Object; protected internal abstract Object[] Internal_FindObjectsOfTypeAll(Type type); public static void GraphicRaycast(GraphicRaycaster raycaster, PointerEventData data, List<RaycastResult> list) { Instance.Internal_GraphicRaycast(raycaster, data, list); } protected internal abstract void Internal_GraphicRaycast(GraphicRaycaster raycaster, PointerEventData data, List<RaycastResult> list); public static GameObject[] GetRootGameObjects(Scene scene) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return Instance.Internal_GetRootGameObjects(scene); } protected internal abstract GameObject[] Internal_GetRootGameObjects(Scene scene); public static int GetRootCount(Scene scene) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return Instance.Internal_GetRootCount(scene); } protected internal abstract int Internal_GetRootCount(Scene scene); public static void SetColorBlockAuto(Selectable selectable, Color baseColor) { //IL_0006: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) Instance.Internal_SetColorBlock(selectable, baseColor, baseColor * 1.2f, baseColor * 0.8f); } public static void SetColorBlock(Selectable selectable, ColorBlock colors) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Instance.Internal_SetColorBlock(selectable, colors); } protected internal abstract void Internal_SetColorBlock(Selectable selectable, ColorBlock colors); public static void SetColorBlock(Selectable selectable, Color? normal = null, Color? highlighted = null, Color? pressed = null, Color? disabled = null) { Instance.Internal_SetColorBlock(selectable, normal, highlighted, pressed, disabled); } protected internal abstract void Internal_SetColorBlock(Selectable selectable, Color? normal = null, Color? highlighted = null, Color? pressed = null, Color? disabled = null); } internal class UniversalBehaviour : MonoBehaviour { internal static UniversalBehaviour Instance { get; private set; } internal static void Setup() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("UniverseLibBehaviour"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D); Instance = val.AddComponent<UniversalBehaviour>(); } internal void Update() { Universe.Update(); } } public class Universe { public enum GlobalState { WaitingToSetup, SettingUp, SetupCompleted } public const string NAME = "UniverseLib"; public const string VERSION = "1.5.1"; public const string AUTHOR = "Sinai"; public const string GUID = "com.sinai.universelib"; private static float startupDelay; private static Action<string, LogType> logHandler; public static RuntimeContext Context { get; } = RuntimeContext.Mono; public static GlobalState CurrentGlobalState { get; private set; } internal static Harmony Harmony { get; } = new Harmony("com.sinai.universelib"); private static event Action OnInitialized; public static void Init(Action onInitialized = null, Action<string, LogType> logHandler = null) { Init(1f, onInitialized, logHandler, default(UniverseLibConfig)); } public static void Init(float startupDelay, Action onInitialized, Action<string, LogType> logHandler, UniverseLibConfig config) { if (CurrentGlobalState == GlobalState.SetupCompleted) { InvokeOnInitialized(onInitialized); return; } if (startupDelay > Universe.startupDelay) { Universe.startupDelay = startupDelay; } ConfigManager.LoadConfig(config); OnInitialized += onInitialized; if (logHandler != null && Universe.logHandler == null) { Universe.logHandler = logHandler; } if (CurrentGlobalState == GlobalState.WaitingToSetup) { CurrentGlobalState = GlobalState.SettingUp; Log("UniverseLib 1.5.1 initializing..."); UniversalBehaviour.Setup(); ReflectionUtility.Init(); RuntimeHelper.Init(); RuntimeHelper.Instance.Internal_StartCoroutine(SetupCoroutine()); Log("Finished UniverseLib initial setup."); } } internal static void Update() { UniversalUI.Update(); } private static IEnumerator SetupCoroutine() { yield return null; Stopwatch sw = new Stopwatch(); sw.Start(); while (ReflectionUtility.Initializing || (float)sw.ElapsedMilliseconds * 0.001f < startupDelay) { yield return null; } InputManager.Init(); UniversalUI.Init(); Log("UniverseLib 1.5.1 initialized."); CurrentGlobalState = GlobalState.SetupCompleted; InvokeOnInitialized(Universe.OnInitialized); } private static void InvokeOnInitialized(Action onInitialized) { if (onInitialized == null) { return; } Delegate[] invocationList = onInitialized.GetInvocationList(); foreach (Delegate @delegate in invocationList) { try { @delegate.DynamicInvoke(); } catch (Exception arg) { LogWarning($"Exception invoking onInitialized callback! {arg}"); } } } internal static void Log(object message) { Log(message, (LogType)3); } internal static void LogWarning(object message) { Log(message, (LogType)2); } internal static void LogError(object message) { Log(message, (LogType)0); } private static void Log(object message, LogType logType) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) logHandler("[UniverseLib] " + (message?.ToString() ?? string.Empty), logType); } internal static bool Patch(Type type, string methodName, MethodType methodType, Type[] arguments = null, MethodInfo prefix = null, MethodInfo postfix = null, MethodInfo finalizer = null) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown try { string text = (((int)methodType == 1) ? "get_" : (((int)methodType != 2) ? string.Empty : "set_")); string text2 = text; MethodInfo methodInfo = ((arguments == null) ? type.GetMethod(text2 + methodName, AccessTools.all) : type.GetMethod(text2 + methodName, AccessTools.all, null, arguments, null)); if ((object)methodInfo == null) { return false; } PatchProcessor val = Harmony.CreateProcessor((MethodBase)methodInfo); if ((object)prefix != null) { val.AddPrefix(new HarmonyMethod(prefix)); } if ((object)postfix != null) { val.AddPostfix(new HarmonyMethod(postfix)); } if ((object)finalizer != null) { val.AddFinalizer(new HarmonyMethod(finalizer)); } val.Patch(); return true; } catch (Exception arg) { LogWarning($"\t Exception patching {type.FullName}.{methodName}: {arg}"); return false; } } internal static bool Patch(Type type, string[] possibleNames, MethodType methodType, Type[] arguments = null, MethodInfo prefix = null, MethodInfo postfix = null, MethodInfo finalizer = null) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) foreach (string methodName in possibleNames) { if (Patch(type, methodName, methodType, arguments, prefix, postfix, finalizer)) { return true; } } return false; } internal static bool Patch(Type type, string[] possibleNames, MethodType methodType, Type[][] possibleArguments, MethodInfo prefix = null, MethodInfo postfix = null, MethodInfo finalizer = null) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) foreach (string methodName in possibleNames) { foreach (Type[] arguments in possibleArguments) { if (Patch(type, methodName, methodType, arguments, prefix, postfix, finalizer)) { return true; } } } return false; } internal static bool Patch(Type type, string methodName, MethodType methodType, Type[][] possibleArguments, MethodInfo prefix = null, MethodInfo postfix = null, MethodInfo finalizer = null) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) foreach (Type[] arguments in possibleArguments) { if (Patch(type, methodName, methodType, arguments, prefix, postfix, finalizer)) { return true; } } return false; } } } namespace UniverseLib.Utility { public static class ArgumentUtility { public static readonly Type[] EmptyTypes = new Type[0]; public static readonly object[] EmptyArgs = new object[0]; public static readonly Type[] ParseArgs = new Type[1] { typeof(string) }; } public static class IOUtility { private static readonly char[] invalidDirectoryCharacters = Path.GetInvalidPathChars(); private static readonly char[] invalidFilenameCharacters = Path.GetInvalidFileNameChars(); public static string EnsureValidFilePath(string fullPathWithFile) { fullPathWithFile = string.Concat(fullPathWithFile.Split(invalidDirectoryCharacters)); Directory.CreateDirectory(Path.GetDirectoryName(fullPathWithFile)); return fullPathWithFile; } public static string EnsureValidFilename(string filename) { return string.Concat(filename.Split(invalidFilenameCharacters)); } } public static class MiscUtility { public static bool ContainsIgnoreCase(this string _this, string s) { return CultureInfo.CurrentCulture.CompareInfo.IndexOf(_this, s, CompareOptions.IgnoreCase) >= 0; } public static bool HasFlag(this Enum flags, Enum value) { try { ulong num = Convert.ToUInt64(value); return (Convert.ToUInt64(flags) & num) == num; } catch { long num2 = Convert.ToInt64(value); return (Convert.ToInt64(flags) & num2) == num2; } } public static bool EndsWith(this StringBuilder sb, string _string) { int length = _string.Length; if (sb.Length < length) { return false; } int num = 0; int num2 = sb.Length - length; while (num2 < sb.Length) { if (sb[num2] != _string[num]) { return false; } num2++; num++; } return true; } } public static class ParseUtility { internal delegate object ParseMethod(string input); internal delegate string ToStringMethod(object obj); public static readonly string NumberFormatString = "0.####"; private static readonly Dictionary<int, string> numSequenceStrings = new Dictionary<int, string>(); private static readonly HashSet<Type> nonPrimitiveTypes = new HashSet<Type> { typeof(string), typeof(decimal), typeof(DateTime) }; private static readonly HashSet<Type> formattedTypes = new HashSet<Type> { typeof(float), typeof(double), typeof(decimal) }; private static readonly Dictionary<string, string> typeInputExamples = new Dictionary<string, string>(); private static readonly Dictionary<string, ParseMethod> customTypes = new Dictionary<string, ParseMethod> { { typeof(Vector2).FullName, TryParseVector2 }, { typeof(Vector3).FullName, TryParseVector3 }, { typeof(Vector4).FullName, TryParseVector4 }, { typeof(Quaternion).FullName, TryParseQuaternion }, { typeof(Rect).FullName, TryParseRect }, { typeof(Color).FullName, TryParseColor }, { typeof(Color32).FullName, TryParseColor32 }, { typeof(LayerMask).FullName, TryParseLayerMask } }; private static readonly Dictionary<string, ToStringMethod> customTypesToString = new Dictionary<string, ToStringMethod> { { typeof(Vector2).FullName, Vector2ToString }, { typeof(Vector3).FullName, Vector3ToString }, { typeof(Vector4).FullName, Vector4ToString }, { typeof(Quaternion).FullName, QuaternionToString }, { typeof(Rect).FullName, RectToString }, { typeof(Color).FullName, ColorToString }, { typeof(Color32).FullName, Color32ToString }, { typeof(LayerMask).FullName, LayerMaskToString } }; public static string FormatDecimalSequence(params object[] numbers) { if (numbers.Length == 0) { return null; } return string.Format(CultureInfo.CurrentCulture, GetSequenceFormatString(numbers.Length), numbers); } internal static string GetSequenceFormatString(int count) { if (count <= 0) { return null; } if (numSequenceStrings.ContainsKey(count)) { return numSequenceStrings[count]; } string[] array = new string[count]; for (int i = 0; i < count; i++) { array[i] = $"{{{i}:{NumberFormatString}}}"; } string text = string.Join(" ", array); numSequenceStrings.Add(count, text); return text; } public static bool CanParse(Type type) { return !string.IsNullOrEmpty(type?.FullName) && (type.IsPrimitive || type.IsEnum || nonPrimitiveTypes.Contains(type) || customTypes.ContainsKey(type.FullName)); } public static bool CanParse<T>() { return CanParse(typeof(T)); } public static bool TryParse<T>(string input, out T obj, out Exception parseException) { object obj2; bool result = TryParse(input, typeof(T), out obj2, out parseException); if (obj2 != null) { obj = (T)obj2; } else { obj = default(T); } return result; } public static bool TryParse(string input, Type type, out object obj, out Exception parseException) { obj = null; parseException = null; if ((object)type == null) { return false; } if ((object)type == typeof(string)) { obj = input; return true; } if (type.IsEnum) { try { obj = Enum.Parse(type, input); return true; } catch (Exception e) { parseException = e.GetInnerMostException(); return false; } } try { if (customTypes.ContainsKey(type.FullName)) { obj = customTypes[type.FullName](input); } else { obj = AccessTools.Method(type, "Parse", ArgumentUtility.ParseArgs, (Type[])null).Invoke(null, new object[1] { input }); } return true; } catch (Exception e2) { Exception innerMostException = e2.GetInnerMostException(); parseException = innerMostException; } return false; } public static string ToStringForInput<T>(object obj) { return ToStringForInput(obj, typeof(T)); } public static string ToStringForInput(object obj, Type type) { if ((object)type == null || obj == null) { return null; } if ((object)type == typeof(string)) { return obj as string; } if (type.IsEnum) { return Enum.IsDefined(type, obj) ? Enum.GetName(type, obj) : obj.ToString(); } try { if (customTypes.ContainsKey(type.FullName)) { return customTypesToString[type.FullName](obj); } if (formattedTypes.Contains(type)) { return AccessTools.Method(type, "ToString", new Type[2] { typeof(string), typeof(IFormatProvider) }, (Type[])null).Invoke(obj, new object[2] { NumberFormatString, CultureInfo.CurrentCulture }) as string; } return obj.ToString(); } catch (Exception arg) { Universe.LogWarning($"Exception formatting object for input: {arg}"); return null; } } public static string GetExampleInput<T>() { return GetExampleInput(typeof(T)); } public static string GetExampleInput(Type type) { if (!typeInputExamples.ContainsKey(type.AssemblyQualifiedName)) { try { if (type.IsEnum) { typeInputExamples.Add(type.AssemblyQualifiedName, Enum.GetNames(type).First()); } else { object obj = Activator.CreateInstance(type); typeInputExamples.Add(type.AssemblyQualifiedName, ToStringForInput(obj, type)); } } catch (Exception message) { Universe.LogWarning("Exception generating default instance for example input for '" + type.FullName + "'"); Universe.Log(message); return ""; } } return typeInputExamples[type.AssemblyQualifiedName]; } internal static object TryParseVector2(string input) { //IL_0003: 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) Vector2 val = default(Vector2); string[] array = input.Split(new char[1] { ' ' }); val.x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture); val.y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture); return val; } internal static string Vector2ToString(object obj) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0035: Unknown result type (might be due to invalid IL or missing references) if (!(obj is Vector2 val) || 1 == 0) { return null; } return FormatDecimalSequence(val.x, val.y); } internal static object TryParseVector3(string input) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); string[] array = input.Split(new char[1] { ' ' }); val.x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture); val.y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture); val.z = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture); return val; } internal static string Vector3ToString(object obj) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0035: 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) if (!(obj is Vector3 val) || 1 == 0) { return null; } return FormatDecimalSequence(val.x, val.y, val.z); } internal static object TryParseVector4(string input) { //IL_0003: 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) Vector4 val = default(Vector4); string[] array = input.Split(new char[1] { ' ' }); val.x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture); val.y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture); val.z = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture); val.w = float.Parse(array[3].Trim(), CultureInfo.CurrentCulture); return val; } internal static string Vector4ToString(object obj) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0035: 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_0051: Unknown result type (might be due to invalid IL or missing references) if (!(obj is Vector4 val) || 1 == 0) { return null; } return FormatDecimalSequence(val.x, val.y, val.z, val.w); } internal static object TryParseQuaternion(string input) { //IL_0003: 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_00e9: 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_0092: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); string[] array = input.Split(new char[1] { ' ' }); if (array.Length == 4) { Quaternion val2 = default(Quaternion); val2.x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture); val2.y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture); val2.z = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture); val2.w = float.Parse(array[3].Trim(), CultureInfo.CurrentCulture); return val2; } val.x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture); val.y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture); val.z = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture); return Quaternion.Euler(val); } internal static string QuaternionToString(object obj) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) if (!(obj is Quaternion val) || 1 == 0) { return null; } Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles; return FormatDecimalSequence(eulerAngles.x, eulerAngles.y, eulerAngles.z); } internal static object TryParseRect(string input) { //IL_0003: 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) Rect val = default(Rect); string[] array = input.Split(new char[1] { ' ' }); ((Rect)(ref val)).x = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture); ((Rect)(ref val)).y = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture); ((Rect)(ref val)).width = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture); ((Rect)(ref val)).height = float.Parse(array[3].Trim(), CultureInfo.CurrentCulture); return val; } internal static string RectToString(object obj) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!(obj is Rect val) || 1 == 0) { return null; } return FormatDecimalSequence(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, ((Rect)(ref val)).height); } internal static object TryParseColor(string input) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); string[] array = input.Split(new char[1] { ' ' }); val.r = float.Parse(array[0].Trim(), CultureInfo.CurrentCulture); val.g = float.Parse(array[1].Trim(), CultureInfo.CurrentCulture); val.b = float.Parse(array[2].Trim(), CultureInfo.CurrentCulture); if (array.Length > 3) { val.a = float.Parse(array[3].Trim(), CultureInfo.CurrentCulture); } else { val.a = 1f; } return val; } internal static string ColorToString(object obj) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0035: 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_0051: Unknown result type (might be due to invalid IL or missing references) if (!(obj is Color val) || 1 == 0) { return null; } return FormatDecimalSequence(val.r, val.g, val.b, val.a); } internal static object TryParseColor32(string input) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) Color32 val = default(Color32); string[] array = input.Split(new char[1] { ' ' }); val.r = byte.Parse(array[0].Trim(), CultureInfo.CurrentCulture); val.g = byte.Parse(array[1].Trim(), CultureInfo.CurrentCulture); val.b = byte.Parse(array[2].Trim(), CultureInfo.CurrentCulture); if (array.Length > 3) { val.a = byte.Parse(array[3].Trim(), CultureInfo.CurrentCulture); } else { val.a = byte.MaxValue; } return val; } internal static string Color32ToString(object obj) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if (!(obj is Color32 val) || 1 == 0) { return null; } return $"{val.r} {val.g} {val.b} {val.a}"; } internal static object TryParseLayerMask(string input) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return LayerMask.op_Implicit(int.Parse(input)); } internal static string LayerMaskToString(object obj) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!(obj is LayerMask val) || 1 == 0) { return null; } return ((LayerMask)(ref val)).value.ToString(); } } public static class SignatureHighlighter { public const string NAMESPACE = "#a8a8a8"; public const string CONST = "#92c470"; public const string CLASS_STATIC = "#3a8d71"; public const string CLASS_INSTANCE = "#2df7b2"; public const string STRUCT = "#0fba3a"; public const string INTERFACE = "#9b9b82"; public const string FIELD_STATIC = "#8d8dc6"; public const string FIELD_INSTANCE = "#c266ff"; public const string METHOD_STATIC = "#b55b02"; public const string METHOD_INSTANCE = "#ff8000"; public const string PROP_STATIC = "#588075"; public const string PROP_INSTANCE = "#55a38e"; public const string LOCAL_ARG = "#a6e9e9"; public const string OPEN_COLOR = "<color="; public const string CLOSE_COLOR = "</color>"; public const string OPEN_ITALIC = "<i>"; public const string CLOSE_ITALIC = "</i>"; public static readonly Regex ArrayTokenRegex = new Regex("\\[,*?\\]"); private static readonly Regex colorTagRegex = new Regex("<color=#?[\\d|\\w]*>"); public static readonly Color StringOrange = new Color(0.83f, 0.61f, 0.52f); public static readonly Color EnumGreen = new Color(0.57f, 0.76f, 0.43f); public static readonly Color KeywordBlue = new Color(0.3f, 0.61f, 0.83f); public static readonly string keywordBlueHex = KeywordBlue.ToHex(); public static readonly Color NumberGreen = new Color(0.71f, 0.8f, 0.65f); private static readonly Dictionary<string, string> typeToRichType = new Dictionary<string, string>(); private static readonly Dictionary<string, string> highlightedMethods = new Dictionary<string, string>(); private static readonly Dictionary<Type, string> builtInTypesToShorthand = new Dictionary<Type, string> { { typeof(object), "object" }, { typeof(string), "string" }, { typeof(bool), "bool" }, { typeof(byte), "byte" }, { typeof(sbyte), "sbyte" }, { typeof(char), "char" }, { typeof(decimal), "decimal" }, { typeof(double), "double" }, { typeof(float), "float" }, { typeof(int), "int" }, { typeof(uint), "uint" }, { typeof(long), "long" }, { typeof(ulong), "ulong" }, { typeof(short), "short" }, { typeof(ushort), "ushort" }, { typeof(void), "void" } }; public static string Parse(Type type, bool includeNamespace, MemberInfo memberInfo = null) { if ((object)type == null) { throw new ArgumentNullException("type"); } if (memberInfo is MethodInfo method) { return ParseMethod(method); } if (memberInfo is ConstructorInfo ctor) { return ParseConstructor(ctor); } StringBuilder stringBuilder = new StringBuilder(); if (type.IsByRef) { AppendOpenColor(stringBuilder, "#" + keywordBlueHex).Append("ref ").Append("</color>"); } Type type2 = type; while (type2.HasElementType) { type2 = type2.GetElementType(); } includeNamespace &= !builtInTypesToShorthand.ContainsKey(type2); if (!type.IsGenericParameter && (!type.HasElementType || !type.GetElementType().IsGenericParameter) && includeNamespace && TryGetNamespace(type, out var ns)) { AppendOpenColor(stringBuilder, "#a8a8a8").Append(ns).Append("</color>").Append('.'); } stringBuilder.Append(ProcessType(type)); if ((object)memberInfo != null) { stringBuilder.Append('.'); int index = stringBuilder.Length - 1; AppendOpenColor(stringBuilder, GetMemberInfoColor(memberInfo, out var isStatic)).Append(memberInfo.Name).Append("</color>"); if (isStatic) { stringBuilder.Insert(index, "<i>"); stringBuilder.Append("</i>"); } } return stringBuilder.ToString(); } private static string ProcessType(Type type) { string key = type.ToString(); if (typeToRichType.ContainsKey(key)) { return typeToRichType[key]; } StringBuilder stringBuilder = new StringBuilder(); if (!type.IsGenericParameter) { int length = stringBuilder.Length; Type declaringType = type.DeclaringType; while ((object)declaringType != null) { stringBuilder.Insert(length, HighlightType(declaringType) + "."); declaringType = declaringType.DeclaringType; } stringBuilder.Append(HighlightType(type)); if (type.IsGenericType) { ProcessGenericArguments(type, stringBuilder); } } else { stringBuilder.Append("<color=").Append("#92c470").Append('>') .Append(type.Name) .Append("</color>"); } string text = stringBuilder.ToString(); typeToRichType.Add(key, text); return text; } internal static string GetClassColor(Type type) { if (type.IsAbstract && type.IsSealed) { return "#3a8d71"; } if (type.IsEnum || type.IsGenericParameter) { return "#92c470"; } if (type.IsValueType) { return "#0fba3a"; } if (type.IsInterface) { return "#9b9b82"; } return "#2df7b2"; } private static bool TryGetNamespace(Type type, out string ns) { return !string.IsNullOrEmpty(ns = type.Namespace?.Trim()); } private static StringBuilder AppendOpenColor(StringBuilder sb, string color) { return sb.Append("<color=").Append(color).Append('>'); } private static string HighlightType(Type type) { StringBuilder stringBuilder = new StringBuilder(); if (type.IsByRef) { type = type.GetElementType(); } int num = 0; Match match = ArrayTokenRegex.Match(type.Name); if (match != null && match.Success) { num = 1 + match.Value.Count((char c) => c == ','); type = type.GetElementType(); } if (builtInTypesToShorthand.TryGetValue(type, out var value)) { AppendOpenColor(stringBuilder, "#" + keywordBlueHex).Append(value).Append("</color>"); } else { stringBuilder.Append("<color=" + GetClassColor(type) + ">").Append(type.Name).Append("</color>"); } if (num > 0) { stringBuilder.Append('[').Append(new string(',', num - 1)).Append(']'); } return stringBuilder.ToString(); } private static void ProcessGenericArguments(Type type, StringBuilder sb) { List<Type> list = type.GetGenericArguments().ToList(); for (int i = 0; i < sb.Length; i++) { if (!list.Any()) { break; } if (sb[i] != '`') { continue; } int num = i; i++; StringBuilder stringBuilder = new StringBuilder(); for (; char.IsDigit(sb[i]); i++) { stringBuilder.Append(sb[i]); } string text = stringBuilder.ToString(); int num2 = int.Parse(text); sb.Remove(num, text.Length + 1); int num3 = 1; num++; while (num3 < "</color>".Length && sb[num] == "</color>"[num3]) { num3++; num++; } sb.Insert(num, '<'); num++; int length = sb.Length; while (num2 > 0 && list.Any()) { num2--; Type type2 = list.First(); list.RemoveAt(0); sb.Insert(num, ProcessType(type2)); if (num2 > 0) { num += sb.Length - length; sb.Insert(num, ", "); num += 2; length = sb.Length; } } sb.Insert(num + sb.Length - length, '>'); } } public static string RemoveHighlighting(string _string) { if (_string == null) { throw new ArgumentNullException("_string"); } _string = _string.Replace("<i>", string.Empty); _string = _string.Replace("</i>", string.Empty); _string = colorTagRegex.Replace(_string, string.Empty); _string = _string.Replace("</color>", string.Empty); return _string; } [Obsolete("Use 'ParseMethod(MethodInfo)' instead (rename).")] public static string HighlightMethod(MethodInfo method) { return ParseMethod(method); } public static string ParseMethod(MethodInfo method) { string key = GeneralExtensions.FullDescription((MethodBase)method); if (highlightedMethods.ContainsKey(key)) { return highlightedMethods[key]; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(Parse(method.DeclaringType, includeNamespace: false)); stringBuilder.Append('.'); string text = ((!method.IsStatic) ? "#ff8000" : "#b55b02"); stringBuilder.Append("<color=" + text + ">" + method.Name + "</color>"); if (method.IsGenericMethod) { stringBuilder.Append("<"); Type[] genericArguments = method.GetGenericArguments(); for (int i = 0; i < genericArguments.Length; i++) { Type type = genericArguments[i]; if (type.IsGenericParameter) { stringBuilder.Append("<color=#92c470>" + genericArguments[i].Name + "</color>"); } else { stringBuilder.Append(Parse(type, includeNamespace: false)); } if (i < genericArguments.Length - 1) { stringBuilder.Append(", "); } } stringBuilder.Append(">"); } stringBuilder.Append('('); ParameterInfo[] parameters = method.GetParameters(); for (int j = 0; j < parameters.Length; j++) { ParameterInfo parameterInfo = parameters[j]; stringBuilder.Append(Parse(parameterInfo.ParameterType, includeNamespace: false)); if (j < parameters.Length - 1) { stringBuilder.Append(", "); } } stringBuilder.Append(')'); string text2 = stringBuilder.ToString(); highlightedMethods.Add(key, text2); return text2; } [Obsolete("Use 'ParseConstructor(ConstructorInfo)' instead (rename).")] public static string HighlightConstructor(ConstructorInfo ctor) { return ParseConstructor(ctor); } public static string ParseConstructor(ConstructorInfo ctor) { string key = GeneralExtensions.FullDescription((MethodBase)ctor); if (highlightedMethods.ContainsKey(key)) { return highlightedMethods[key]; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(Parse(ctor.DeclaringType, includeNamespace: false)); string value = stringBuilder.ToString(); stringBuilder.Append('.'); stringBuilder.Append(value); stringBuilder.Append('('); ParameterInfo[] parameters = ctor.GetParameters(); for (int i = 0; i < parameters.Length; i++) { ParameterInfo parameterInfo = parameters[i]; stringBuilder.Append(Parse(parameterInfo.ParameterType, includeNamespace: false)); if (i < parameters.Length - 1) { stringBuilder.Append(", "); } } stringBuilder.Append(')'); string text = stringBuilder.ToString(); highlightedMethods.Add(key, text); return text; } public static string GetMemberInfoColor(MemberInfo memberInfo, out bool isStatic) { isStatic = false; if (memberInfo is FieldInfo fieldInfo) { if (fieldInfo.IsStatic) { isStatic = true; return "#8d8dc6"; } return "#c266ff"; } if (memberInfo is MethodInfo methodInfo) { if (methodInfo.IsStatic) { isStatic = true; return "#b55b02"; } return "#ff8000"; } if (memberInfo is PropertyInfo propertyInfo) { if (propertyInfo.GetAccessors(nonPublic: true)[0].IsStatic) { isStatic = true; return "#588075"; } return "#55a38e"; } if (memberInfo is ConstructorInfo) { isStatic = true; return "#2df7b2"; } throw new NotImplementedException(memberInfo.GetType().Name + " is not supported"); } } public static class ToStringUtility { internal static Dictionary<string, MethodInfo> toStringMethods = new Dictionary<string, MethodInfo>(); private const string nullString = "<color=grey>null</color>"; private const string nullUnknown = "<color=grey>null</color> (?)"; private const string destroyedString = "<color=red>Destroyed</color>"; private const string untitledString = "<i><color=grey>untitled</color></i>"; private const string eventSystemNamespace = "UnityEngine.EventSystem"; public static string PruneString(string s, int chars = 200, int lines = 5) { if (string.IsNullOrEmpty(s)) { return s; } StringBuilder stringBuilder = new StringBuilder(Math.Max(chars, s.Length)); int num = 0; for (int i = 0; i < s.Length; i++) { if (num >= lines || i >= chars) { stringBuilder.Append("..."); break; } char c = s[i]; if (c == '\r' || c == '\n') { num++; } stringBuilder.Append(c); } return stringBuilder.ToString(); } public static string ToStringWithType(object value, Type fallbackType, bool includeNamespace = true) { if (value.IsNullOrDestroyed() && (object)fallbackType == null) { return "<color=grey>null</color> (?)"; } Type type = value?.GetActualType() ?? fallbackType; string text = SignatureHighlighter.Parse(type, includeNamespace); StringBuilder stringBuilder = new StringBuilder(); if (value.IsNullOrDestroyed()) { if (value == null) { stringBuilder.Append("<color=grey>null</color>"); AppendRichType(stringBuilder, text); return stringBuilder.ToString(); } stringBuilder.Append("<color=red>Destroyed</color>"); AppendRichType(stringBuilder, text); return stringBuilder.ToString(); } Object val = (Object)((value is Object) ? value : null); if (val != null) { if (string.IsNullOrEmpty(val.name)) { stringBuilder.Append("<i><color=grey>untitled</color></i>"); } else { stringBuilder.Append('"'); stringBuilder.Append(PruneString(val.name, 50, 1)); stringBuilder.Append('"'); } AppendRichType(stringBuilder, text); } else if (type.FullName.StartsWith("UnityEngine.EventSystem")) { stringBuilder.Append(text); } else { string text2 = ToString(value); if (type.IsGenericType || text2 == type.FullName || text2 == type.FullName + " " + type.FullName || text2 == "Il2Cpp" + type.FullName || type.FullName == "Il2Cpp" + text2) { stringBuilder.Append(text); } else { stringBuilder.Append(PruneString(text2)); AppendRichType(stringBuilder, text); } } return stringBuilder.ToString(); } private static void AppendRichType(StringBuilder sb, string richType) { sb.Append(' '); sb.Append('('); sb.Append(richType); sb.Append(')'); } private static string ToString(object value) { if (value.IsNullOrDestroyed()) { if (value == null) { return "<color=grey>null</color>"; } return "<color=red>Destroyed</color>"; } Type actualType = value.GetActualType(); if (!toStringMethods.ContainsKey(actualType.AssemblyQualifiedName)) { MethodInfo method = actualType.GetMethod("ToString", ArgumentUtility.EmptyTypes); toStringMethods.Add(actualType.AssemblyQualifiedName, method); } value = value.TryCast(actualType); string theString; try { theString = (string)toStringMethods[actualType.AssemblyQualifiedName].Invoke(value, ArgumentUtility.EmptyArgs); } catch (Exception e) { theString = e.ReflectionExToString(); } return ReflectionUtility.ProcessTypeInString(actualType, theString); } } public static class UnityHelpers { private static PropertyInfo onEndEdit; public static bool OccuredEarlierThanDefault(this float time) { return Time.realtimeSinceStartup - 0.01f >= time; } public static bool OccuredEarlierThan(this float time, float secondsAgo) { return Time.realtimeSinceStartup - secondsAgo >= time; } public static bool IsNullOrDestroyed(this object obj, bool suppressWarning = true) { try { if (obj == null) { if (!suppressWarning) { Universe.LogWarning("The target instance is null!"); } return true; } Object val = (Object)((obj is Object) ? obj : null); if (val != null && !Object.op_Implicit(val)) { if (!suppressWarning) { Universe.LogWarning("The target UnityEngine.Object was destroyed!"); } return true; } return false; } catch { return true; } } public static string GetTransformPath(this Transform transform, bool includeSelf = false) { StringBuilder stringBuilder = new StringBuilder(); if (includeSelf) { stringBuilder.Append(((Object)transform).name); } while (Object.op_Implicit((Object)(object)transform.parent)) { transform = transform.parent; stringBuilder.Insert(0, '/'); stringBuilder.Insert(0, ((Object)transform).name); } return stringBuilder.ToString(); } public static string ToHex(this Color color) { //IL_0001: 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_003d: Unknown result type (might be due to invalid IL or missing references) byte b = (byte)Mathf.Clamp(Mathf.RoundToInt(color.r * 255f), 0, 255); byte b2 = (byte)Mathf.Clamp(Mathf.RoundToInt(color.g * 255f), 0, 255); byte b3 = (byte)Mathf.Clamp(Mathf.RoundToInt(color.b * 255f), 0, 255); return $"{b:X2}{b2:X2}{b3:X2}"; } public static Color ToColor(this string _string) { //IL_006c: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //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_00ec: Unknown result type (might be due to invalid IL or missing references) _string = _string.Replace("#", ""); if (_string.Length != 6) { return Color.magenta; } byte b = byte.Parse(_string.Substring(0, 2), NumberStyles.HexNumber); byte b2 = byte.Parse(_string.Substring(2, 2), NumberStyles.HexNumber); byte b3 = byte.Parse(_string.Substring(4, 2), NumberStyles.HexNumber); Color result = default(Color); result.r = (float)((decimal)b / 255m); result.g = (float)((decimal)b2 / 255m); result.b = (float)((decimal)b3 / 255m); result.a = 1f; return result; } public static UnityEvent<string> GetOnEndEdit(this InputField _this) { if ((object)onEndEdit == null) { onEndEdit = AccessTools.Property(typeof(InputField), "onEndEdit") ?? throw new Exception("Could not get InputField.onEndEdit property!"); } return onEndEdit.GetValue(_this, null).TryCast<UnityEvent<string>>(); } } } namespace UniverseLib.UI { public class UIBase { internal static readonly int TOP_SORTORDER = 30000; public string ID { get; } public GameObject RootObject { get; } public RectTransform RootRect { get; } public Canvas Canvas { get; } public Action UpdateMethod { get; } public PanelManager Panels { get; } public bool Enabled { get { return Object.op_Implicit((Object)(object)RootObject) && RootObject.activeSelf; } set { UniversalUI.SetUIActive(ID, value); } } public UIBase(string id, Action updateMethod) { //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_00f7: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(id)) { throw new ArgumentException("Cannot register a UI with a null or empty id!"); } if (UniversalUI.registeredUIs.ContainsKey(id)) { throw new ArgumentException("A UI with the id '" + id + "' is already registered!"); } ID = id; UpdateMethod = updateMethod; RootObject = UIFactory.CreateUIObject(id + "_Root", UniversalUI.CanvasRoot); RootObject.SetActive(false); RootRect = RootObject.GetComponent<RectTransform>(); Canvas = RootObject.AddComponent<Canvas>(); Canvas.renderMode = (RenderMode)1; Canvas.referencePixelsPerUnit = 100f; Canvas.sortingOrder = TOP_SORTORDER; Canvas.overrideSorting = true; CanvasScaler val = RootObject.AddComponent<CanvasScaler>(); val.referenceResolution = new Vector2(1920f, 1080f); val.screenMatchMode = (ScreenMatchMode)1; RootObject.AddComponent<GraphicRaycaster>(); RectTransform component = RootObject.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.pivot = new Vector2(0.5f, 0.5f); Panels = CreatePanelManager(); RootObject.SetActive(true); UniversalUI.registeredUIs.Add(id, this); UniversalUI.uiBases.Add(this); } protected virtual PanelManager CreatePanelManager() { return new PanelManager(this); } public void SetOnTop() { RootObject.transform.SetAsLastSibling(); foreach (UIBase uiBasis in UniversalUI.uiBases) { int num = UniversalUI.CanvasRoot.transform.childCount - ((Transform)uiBasis.RootRect).GetSiblingIndex(); uiBasis.Canvas.sortingOrder = TOP_SORTORDER - num; } UniversalUI.uiBases.Sort((UIBase a, UIBase b) => b.RootObject.transform.GetSiblingIndex().CompareTo(a.RootObject.transform.GetSiblingIndex())); } internal void Update() { try { Panels.Update(); UpdateMethod?.Invoke(); } catch (Exception arg) { Universe.LogWarning($"Exception invoking update method for {ID}: {arg}"); } } } public static class UIFactory { internal static Vector2 largeElementSize = new Vector2(100f, 30f); internal static Vector2 smallElementSize = new Vector2(25f, 25f); internal static Color defaultTextColor = Color.white; public static GameObject CreateUIObject(string name, GameObject parent, Vector2 sizeDelta = default(Vector2)) { //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) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name) { layer = 5, hideFlags = (HideFlags)61 }; if (Object.op_Implicit((Object)(object)parent)) { val.transform.SetParent(parent.transform, false); } RectTransform val2 = val.AddComponent<RectTransform>(); val2.sizeDelta = sizeDelta; return val; } internal static void SetDefaultTextValues(Text text) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((Graphic)text).color = defaultTextColor; text.font = UniversalUI.DefaultFont; text.fontSize = 14; } internal static void SetDefaultSelectableValues(Selectable selectable) { //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) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0060: Unknown result type (might be due to invalid IL or missing references) Navigation navigation = selectable.navigation; ((Navigation)(ref navigation)).mode = (Mode)4; selectable.navigation = navigation; RuntimeHelper.Instance.Internal_SetColorBlock(selectable, (Color?)new Color(0.2f, 0.2f, 0.2f), (Color?)new Color(0.3f, 0.3f, 0.3f), (Color?)new Color(0.15f, 0.15f, 0.15f), (Color?)null); } public static LayoutElement SetLayoutElement(GameObject gameObject, int? minWidth = null, int? minHeight = null, int? flexibleWidth = null, int? flexibleHeight = null, int? preferredWidth = null, int? preferredHeight = null, bool? ignoreLayout = null) { LayoutElement val = gameObject.GetComponent<LayoutElement>(); if (!Object.op_Implicit((Object)(object)val)) { val = gameObject.AddComponent<LayoutElement>(); } if (minWidth.HasValue) { val.minWidth = minWidth.Value; } if (minHeight.HasValue) { val.minHeight = minHeight.Value; } if (flexibleWidth.HasValue) { val.flexibleWidth = flexibleWidth.Value; } if (flexibleHeight.HasValue) { val.flexibleHeight = flexibleHeight.Value; } if (preferredWidth.HasValue) { val.preferredWidth = preferredWidth.Value; } if (preferredHeight.HasValue) { val.preferredHeight = preferredHeight.Value; } if (ignoreLayout.HasValue) { val.ignoreLayout = ignoreLayout.Value; } return val; } public static T SetLayoutGroup<T>(GameObject gameObject, bool? forceWidth = null, bool? forceHeight = null, bool? childControlWidth = null, bool? childControlHeight = null, int? spacing = null, int? padTop = null, int? padBottom = null, int? padLeft = null, int? padRight = null, TextAnchor? childAlignment = null) where T : HorizontalOrVerticalLayoutGroup { T val = gameObject.GetComponent<T>(); if (!Object.op_Implicit((Object)(object)val)) { val = gameObject.AddComponent<T>(); } return SetLayoutGroup(val, forceWidth, forceHeight, childControlWidth, childControlHeight, spacing, padTop, padBottom, padLeft, padRight, childAlignment); } public static T SetLayoutGroup<T>(T group, bool? forceWidth = null, bool? forceHeight = null, bool? childControlWidth = null, bool? childControlHeight = null, int? spacing = null, int? padTop = null, int? padBottom = null, int? padLeft = null, int? padRight = null, TextAnchor? childAlignment = null) where T : HorizontalOrVerticalLayoutGroup { //IL_0143: Unknown result type (might be due to invalid IL or missing references) if (forceWidth.HasValue) { ((HorizontalOrVerticalLayoutGroup)group).childForceExpandWidth = forceWidth.Value; } if (forceHeight.HasValue) { ((HorizontalOrVerticalLayoutGroup)group).childForceExpandHeight = forceHeight.Value; } if (childControlWidth.HasValue) { ((HorizontalOrVerticalLayoutGroup)(object)group).SetChildControlWidth(childControlWidth.Value); } if (childControlHeight.HasValue) { ((HorizontalOrVerticalLayoutGroup)(object)group).SetChildControlHeight(childControlHeight.Value); } if (spacing.HasValue) { ((HorizontalOrVerticalLayoutGroup)group).spacing = spacing.Value; } if (padTop.HasValue) { ((LayoutGroup)(object)group).padding.top = padTop.Value; } if (padBottom.HasValue) { ((LayoutGroup)(object)group).padding.bottom = padBottom.Value; } if (padLeft.HasValue) { ((LayoutGroup)(object)group).padding.left = padLeft.Value; } if (padRight.HasValue) { ((LayoutGroup)(object)group).padding.right = padRight.Value; } if (childAlignment.HasValue) { ((LayoutGroup)(object)group).childAlignment = childAlignment.Value; } return group; } public static GameObject CreatePanel(string name, GameObject parent, out GameObject contentHolder, Color? bgColor = null) { //IL_0005: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent); UIFactory.SetLayoutGroup<VerticalLayoutGroup>(val, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)0, (int?)1, (int?)1, (int?)1, (int?)1, (TextAnchor?)null); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.anchoredPosition = Vector2.zero; component.sizeDelta = Vector2.zero; ((Graphic)val.AddComponent<Image>()).color = Color.black; val.AddComponent<RectMask2D>(); contentHolder = CreateUIObject("Content", val); Image val2 = contentHolder.AddComponent<Image>(); val2.type = (Type)3; ((Graphic)val2).color = (Color)((!bgColor.HasValue) ? new Color(0.07f, 0.07f, 0.07f) : bgColor.Value); UIFactory.SetLayoutGroup<VerticalLayoutGroup>(contentHolder, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)3, (int?)3, (int?)3, (int?)3, (int?)3, (TextAnchor?)null); return val; } public static GameObject CreateVerticalGroup(GameObject parent, string name, bool forceWidth, bool forceHeight, bool childControlWidth, bool childControlHeight, int spacing = 0, Vector4 padding = default(Vector4), Color bgColor = default(Color), TextAnchor? childAlignment = null) { //IL_0005: 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_0034: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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) GameObject val = CreateUIObject(name, parent); UIFactory.SetLayoutGroup<VerticalLayoutGroup>(val, (bool?)forceWidth, (bool?)forceHeight, (bool?)childControlWidth, (bool?)childControlHeight, (int?)spacing, (int?)(int)padding.x, (int?)(int)padding.y, (int?)(int)padding.z, (int?)(int)padding.w, childAlignment); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = (Color)((bgColor == default(Color)) ? new Color(0.17f, 0.17f, 0.17f) : bgColor); return val; } public static GameObject CreateHorizontalGroup(GameObject parent, string name, bool forceExpandWidth, bool forceExpandHeight, bool childControlWidth, bool childControlHeight, int spacing = 0, Vector4 padding = default(Vector4), Color bgColor = default(Color), TextAnchor? childAlignment = null) { //IL_0005: 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_0034: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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) GameObject val = CreateUIObject(name, parent); UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(val, (bool?)forceExpandWidth, (bool?)forceExpandHeight, (bool?)childControlWidth, (bool?)childControlHeight, (int?)spacing, (int?)(int)padding.x, (int?)(int)padding.y, (int?)(int)padding.z, (int?)(int)padding.w, childAlignment); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = (Color)((bgColor == default(Color)) ? new Color(0.17f, 0.17f, 0.17f) : bgColor); return val; } public static GameObject CreateGridGroup(GameObject parent, string name, Vector2 cellSize, Vector2 spacing, Color bgColor = default(Color)) { //IL_0005: 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_0022: 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_0039: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent); GridLayoutGroup val2 = val.AddComponent<GridLayoutGroup>(); ((LayoutGroup)val2).childAlignment = (TextAnchor)0; val2.cellSize = cellSize; val2.spacing = spacing; Image val3 = val.AddComponent<Image>(); ((Graphic)val3).color = (Color)((bgColor == default(Color)) ? new Color(0.17f, 0.17f, 0.17f) : bgColor); return val; } public static Text CreateLabel(GameObject parent, string name, string defaultText, TextAnchor alignment = 3, Color color = default(Color), bool supportRichText = true, int fontSize = 14) { //IL_0005: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent); Text val2 = val.AddComponent<Text>(); SetDefaultTextValues(val2); val2.text = defaultText; ((Graphic)val2).color = ((color == default(Color)) ? defaultTextColor : color); val2.supportRichText = supportRichText; val2.alignment = alignment; val2.fontSize = fontSize; return val2; } public static ButtonRef CreateButton(GameObject parent, string name, string text, Color? normalColor = null) { //IL_0003: 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_0037: 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_002a: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) Color valueOrDefault = normalColor.GetValueOrDefault(); if (!normalColor.HasValue) { ((Color)(ref valueOrDefault))..ctor(0.25f, 0.25f, 0.25f); normalColor = valueOrDefault; } ButtonRef buttonRef = CreateButton(parent, name, text, default(ColorBlock)); RuntimeHelper instance = RuntimeHelper.Instance; Button component = buttonRef.Component; Color? normal = normalColor; Color? val = normalColor; float num = 1.2f; Color? highlighted = (val.HasValue ? new Color?(val.GetValueOrDefault() * num) : null); val = normalColor; num = 0.7f; instance.Internal_SetColorBlock((Selectable)(object)component, normal, highlighted, val.HasValue ? new Color?(val.GetValueOrDefault() * num) : null); return buttonRef; } public static ButtonRef CreateButton(GameObject parent, string name, string text, ColorBlock colors) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent, smallElementSize); GameObject val2 = CreateUIObject("Text", val); Image val3 = val.AddComponent<Image>(); val3.type = (Type)1; ((Graphic)val3).color = new Color(1f, 1f, 1f, 1f); Button val4 = val.AddComponent<Button>(); SetDefaultSelectableValues((Selectable)(object)val4); ((ColorBlock)(ref colors)).colorMultiplier = 1f; RuntimeHelper.Instance.Internal_SetColorBlock((Selectable)(object)val4, colors); Text val5 = val2.AddComponent<Text>(); val5.text = text; SetDefaultTextValues(val5); val5.alignment = (TextAnchor)4; RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; SetButtonDeselectListener(val4); return new ButtonRef(val4); } internal static void SetButtonDeselectListener(Button button) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown ((UnityEvent)button.onClick).AddListener((UnityAction)delegate { ((Selectable)button).OnDeselect((BaseEventData)null); }); } public static GameObject CreateSlider(GameObject parent, string name, out Slider slider) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent, smallElementSize); GameObject val2 = CreateUIObject("Background", val); GameObject val3 = CreateUIObject("Fill Area", val); GameObject val4 = CreateUIObject("Fill", val3); GameObject val5 = CreateUIObject("Handle Slide Area", val); GameObject val6 = CreateUIObject("Handle", val5); Image val7 = val2.AddComponent<Image>(); val7.type = (Type)1; ((Graphic)val7).color = new Color(0.15f, 0.15f, 0.15f, 1f); RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0.25f); component.anchorMax = new Vector2(1f, 0.75f); component.sizeDelta = new Vector2(0f, 0f); RectTransform component2 = val3.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0.25f); component2.anchorMax = new Vector2(1f, 0.75f); component2.anchoredPosition = new Vector2(-5f, 0f); component2.sizeDelta = new Vector2(-20f, 0f); Image val8 = val4.AddComponent<Image>(); val8.type = (Type)1; ((Graphic)val8).color = new Color(0.3f, 0.3f, 0.3f, 1f); val4.GetComponent<RectTransform>().sizeDelta = new Vector2(10f, 0f); RectTransform component3 = val5.GetComponent<RectTransform>(); component3.sizeDelta = new Vector2(-20f, 0f); component3.anchorMin = new Vector2(0f, 0f); component3.anchorMax = new Vector2(1f, 1f); Image val9 = val6.AddComponent<Image>(); ((Graphic)val9).color = new Color(0.5f, 0.5f, 0.5f, 1f); val6.GetComponent<RectTransform>().sizeDelta = new Vector2(20f, 0f); slider = val.AddComponent<Slider>(); slider.fillRect = val4.GetComponent<RectTransform>(); slider.handleRect = val6.GetComponent<RectTransform>(); ((Selectable)slider).targetGraphic = (Graphic)(object)val9; slider.direction = (Direction)0; RuntimeHelper.Instance.Internal_SetColorBlock((Selectable)(object)slider, (Color?)new Color(0.4f, 0.4f, 0.4f), (Color?)new Color(0.55f, 0.55f, 0.55f), (Color?)new Color(0.3f, 0.3f, 0.3f), (Color?)null); return val; } public static GameObject CreateScrollbar(GameObject parent, string name, out Scrollbar scrollbar) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent, smallElementSize); GameObject val2 = CreateUIObject("Sliding Area", val); GameObject val3 = CreateUIObject("Handle", val2); Image val4 = val.AddComponent<Image>(); val4.type = (Type)1; ((Graphic)val4).color = new Color(0.1f, 0.1f, 0.1f); Image val5 = val3.AddComponent<Image>(); val5.type = (Type)1; ((Graphic)val5).color = new Color(0.4f, 0.4f, 0.4f); RectTransform component = val2.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(-20f, -20f); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; RectTransform component2 = val3.GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(20f, 20f); scrollbar = val.AddComponent<Scrollbar>(); scrollbar.handleRect = component2; ((Selectable)scrollbar).targetGraphic = (Graphic)(object)val5; SetDefaultSelectableValues((Selectable)(object)scrollbar); return val; } public static GameObject CreateToggle(GameObject parent, string name, out Toggle toggle, out Text text, Color bgColor = default(Color), int checkWidth = 20, int checkHeight = 20) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent, smallElementSize); UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(val, (bool?)false, (bool?)false, (bool?)true, (bool?)true, (int?)5, (int?)0, (int?)0, (int?)0, (int?)0, (TextAnchor?)(TextAnchor)3); toggle = val.AddComponent<Toggle>(); toggle.isOn = true; SetDefaultSelectableValues((Selectable)(object)toggle); Toggle t2 = toggle; ((UnityEvent<bool>)(object)toggle.onValueChanged).AddListener((UnityAction<bool>)delegate { ((Selectable)t2).OnDeselect((BaseEventData)null); }); GameObject val2 = CreateUIObject("Background", val); Image val3 = val2.AddComponent<Image>(); ((Graphic)val3).color = (Color)((bgColor == default(Color)) ? new Color(0.04f, 0.04f, 0.04f, 0.75f) : bgColor); UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(val2, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)0, (int?)2, (int?)2, (int?)2, (int?)2, (TextAnchor?)null); SetLayoutElement(val2, checkWidth, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0); GameObject val4 = CreateUIObject("Checkmark", val2); Image val5 = val4.AddComponent<Image>(); ((Graphic)val5).color = new Color(0.8f, 1f, 0.8f, 0.3f); GameObject val6 = CreateUIObject("Label", val); text = val6.AddComponent<Text>(); text.text = ""; text.alignment = (TextAnchor)3; SetDefaultTextValues(text); SetLayoutElement(val6, 0, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0); toggle.graphic = (Graphic)(object)val5; ((Selectable)toggle).targetGraphic = (Graphic)(object)val3; return val; } public static InputFieldRef CreateInputField(GameObject parent, string name, string placeHolderText) { //IL_0005: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent); Image val2 = val.AddComponent<Image>(); val2.type = (Type)1; ((Graphic)val2).color = new Color(0f, 0f, 0f, 0.5f); InputField val3 = val.AddComponent<InputField>(); Navigation navigation = ((Selectable)val3).navigation; ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)val3).navigation = navigation; val3.lineType = (LineType)0; ((Selectable)val3).interactable = true; ((Selectable)val3).transition = (Transition)1; ((Selectable)val3).targetGraphic = (Graphic)(object)val2; RuntimeHelper.Instance.Internal_SetColorBlock((Selectable)(object)val3, (Color?)new Color(1f, 1f, 1f, 1f), (Color?)new Color(0.95f, 0.95f, 0.95f, 1f), (Color?)new Color(0.78f, 0.78f, 0.78f, 1f), (Color?)null); GameObject val4 = CreateUIObject("TextArea", val); val4.AddComponent<RectMask2D>(); RectTransform component = val4.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; GameObject val5 = CreateUIObject("Placeholder", val4); Text val6 = val5.AddComponent<Text>(); SetDefaultTextValues(val6); val6.text = placeHolderText ?? "..."; ((Graphic)val6).color = new Color(0.5f, 0.5f, 0.5f, 1f); val6.horizontalOverflow = (HorizontalWrapMode)0; val6.alignment = (TextAnchor)3; val6.fontSize = 14; RectTransform component2 = val5.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; val3.placeholder = (Graphic)(object)val6; GameObject val7 = CreateUIObject("Text", val4); Text val8 = val7.AddComponent<Text>(); SetDefaultTextValues(val8); val8.text = ""; ((Graphic)val8).color = new Color(1f, 1f, 1f, 1f); val8.horizontalOverflow = (HorizontalWrapMode)0; val8.alignment = (TextAnchor)3; val8.fontSize = 14; RectTransform component3 = val7.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.offsetMin = Vector2.zero; component3.offsetMax = Vector2.zero; val3.textComponent = val8; val3.characterLimit = 16000; return new InputFieldRef(val3); } public static GameObject CreateDropdown(GameObject parent, string name, out Dropdown dropdown, string defaultItemText, int itemFontSize, Action<int> onValueChanged, string[] defaultOptions = null) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0048: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00de: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing