Decompiled source of ZUI v2.1.0
ZUI.dll
Decompiled 2 weeks 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.Concurrent; using System.Collections.Generic; 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.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json; using System.Text.RegularExpressions; using System.Threading; using System.Timers; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections; using Microsoft.CodeAnalysis; using ProjectM; using ProjectM.Gameplay.Systems; using ProjectM.Network; using ProjectM.Shared; using ProjectM.UI; using Stunlock.Core; using Stunlock.Localization; using TMPro; using Unity.Collections; using Unity.Entities; using Unity.Mathematics; using Unity.Transforms; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; using ZUI.API; using ZUI.Behaviors; using ZUI.Config; using ZUI.InputBlocking; using ZUI.Patches; using ZUI.Services; using ZUI.UI; using ZUI.UI.CustomLib; using ZUI.UI.CustomLib.Cells; using ZUI.UI.CustomLib.Cells.Handlers; using ZUI.UI.CustomLib.Controls; using ZUI.UI.CustomLib.Panel; using ZUI.UI.CustomLib.Util; using ZUI.UI.ModContent; using ZUI.UI.ModContent.CustomElements; using ZUI.UI.ModContent.Data; using ZUI.UI.ModernLib; using ZUI.UI.UniverseLib.UI; using ZUI.UI.UniverseLib.UI.Models; using ZUI.UI.UniverseLib.UI.ObjectPool; using ZUI.UI.UniverseLib.UI.Panels; using ZUI.UI.UniverseLib.UI.Widgets; using ZUI.UI.UniverseLib.UI.Widgets.ScrollView; using ZUI.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Zanakinz")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("ZUI is an overhaul UI Framework for VRising Mods.")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0+067f670c0f7af80ae8c998c9341bfb11245a3a20")] [assembly: AssemblyProduct("ZUI")] [assembly: AssemblyTitle("ZUI")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ZUI { [BepInProcess("VRising.exe")] [BepInPlugin("Zanakinz.ZUI", "ZUI", "1.1.0")] public class Plugin : BasePlugin { private static World _client; public const bool IS_TESTING = false; private static Harmony _harmonyBootPatch; private static Harmony _harmonyChatPatch; private static Harmony _harmonyInitPatch; private static Harmony _harmonyCanvasPatch; private static Harmony _harmonyMenuPatch; internal static Harmony HarmonyVersionStringPatch; private static FrameTimer _uiInitializedTimer; public static Plugin Instance { get; private set; } public static ManualLogSource LogInstance => ((BasePlugin)Instance).Log; public static Settings Settings { get; private set; } public static EntityManager EntityManager => _client.EntityManager; public static bool IsInitialized { get; private set; } public static bool IsGameDataInitialized { get; set; } public static BCUIManager UIManager { get; set; } public static ZUI.UI.ModernLib.CoreUpdateBehavior CoreUpdateBehavior { get; set; } public static bool IsClient { get; private set; } public static Entity LocalCharacter { get; set; } public static bool IsClientNull() { return _client == null; } public static bool AddButton(string buttonText, string command, string tooltip = "") { return ModRegistry.AddButton(buttonText, command, tooltip); } public static bool RemoveButton(string buttonText) { return ModRegistry.RemoveButton(buttonText); } public static Sprite LoadSprite(string filename, float pixelsPerUnit = 100f) { return SpriteLoader.LoadSprite(filename, pixelsPerUnit); } public static void Reset() { _client = null; IsInitialized = false; IsGameDataInitialized = false; } public override void Load() { //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown IsClient = Application.productName != "VRisingServer"; LogUtils.Init(((BasePlugin)this).Log); Instance = this; if (!IsClient) { LogUtils.LogInfo($"{"ZUI"}[{"1.1.0"}] is a client mod! ({Application.productName})"); return; } Settings = new Settings().InitConfig(); Theme.Opacity = Settings.UITransparency; ClassInjector.RegisterTypeInIl2Cpp<ImageDownloader>(); DependencyService.ForceDisableBloodCraft = !Settings.ServerHasBloodCraft; DependencyService.ForceDisableKindredCommands = !Settings.ServerHasKindredCommands; DependencyService.ForceDisableKinPonds = !Settings.ServerHasKinPonds; DependencyService.ForceDisableScarletSigns = !Settings.ServerHasScarletSigns; DependencyService.Initialize(); UIManager = new BCUIManager(); CoreUpdateBehavior = new ZUI.UI.ModernLib.CoreUpdateBehavior(); CoreUpdateBehavior.Setup(); IsInitialized = true; _harmonyBootPatch = Harmony.CreateAndPatchAll(typeof(GameManagerPatch), (string)null); _harmonyMenuPatch = Harmony.CreateAndPatchAll(typeof(EscapeMenuPatch), (string)null); _harmonyCanvasPatch = Harmony.CreateAndPatchAll(typeof(UICanvasSystemPatch), (string)null); HarmonyVersionStringPatch = Harmony.CreateAndPatchAll(typeof(VersionStringPatch), (string)null); _harmonyChatPatch = Harmony.CreateAndPatchAll(typeof(ClientChatPatch), (string)null); _harmonyInitPatch = Harmony.CreateAndPatchAll(typeof(InitializationPatch), (string)null); ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Zanakinz.ZUI"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.1.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); bool flag2 = false; } public override bool Unload() { _harmonyBootPatch.UnpatchSelf(); _harmonyCanvasPatch.UnpatchSelf(); _harmonyMenuPatch.UnpatchSelf(); HarmonyVersionStringPatch.UnpatchSelf(); _harmonyChatPatch.UnpatchSelf(); _harmonyInitPatch.UnpatchSelf(); return true; } private void AddTestUI() { UIManager.SetupAndShowUI(); } public static void GameDataOnInitialize(World world) { if (!IsGameDataInitialized && IsClient) { _client = world; IsGameDataInitialized = true; _harmonyBootPatch.UnpatchSelf(); _uiInitializedTimer = new FrameTimer(); _uiInitializedTimer.Initialise(delegate { _uiInitializedTimer.Stop(); }, TimeSpan.FromSeconds(5.0)).Start(); } } public static void UIOnInitialize() { UIManager.SetupAndShowUI(); ModRegistry.ProcessInitQueue(); if (Settings.AutoEnableFamiliarEquipment) { MessageService.EnqueueMessage(".fam e"); } FamiliarStateService.Initialize(); LogUtils.LogInfo("UI Manager initialized"); } } public static class PluginInfo { public const string PLUGIN_GUID = "Zanakinz.ZUI"; public const string PLUGIN_NAME = "ZUI"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace ZUI.Utils { internal static class Extensions { public delegate void WithRefHandler<T>(ref T item); private const string EMPTY_KEY = "LocalizationKey.Empty"; private const string PREFIX = "Entity("; private const int LENGTH = 7; private static EntityManager EntityManager => Plugin.EntityManager; public static bool IsEnabled(this TextMeshProUGUI entity) { bool? obj; if (entity == null) { obj = null; } else { GameObject gameObject = ((Component)entity).gameObject; obj = ((gameObject != null) ? new bool?(gameObject.activeSelf) : null); } bool? flag = obj; return flag.GetValueOrDefault(); } public static Color GetTransparent(this Color baseColor, float alpha = 0.7f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0019: 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) return new Color(baseColor.r, baseColor.g, baseColor.b, alpha); } public static void With<T>(this Entity entity, WithRefHandler<T> action) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) T item = entity.ReadRW<T>(); action(ref item); EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<T>(entity, item); } public static void AddWith<T>(this Entity entity, WithRefHandler<T> action) where T : struct { //IL_0001: 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_000f: Unknown result type (might be due to invalid IL or missing references) if (!entity.Has<T>()) { entity.Add<T>(); } entity.With(action); } public unsafe static void Write<T>(this Entity entity, T componentData) where T : struct { //IL_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0); TypeIndex typeIndex = val.TypeIndex; byte[] array = StructureToByteArray(componentData); int num = Marshal.SizeOf<T>(); fixed (byte* ptr = array) { EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, typeIndex, (void*)ptr, num); } } private static byte[] StructureToByteArray<T>(T structure) where T : struct { int num = Marshal.SizeOf(structure); byte[] array = new byte[num]; IntPtr intPtr = Marshal.AllocHGlobal(num); Marshal.StructureToPtr(structure, intPtr, fDeleteOld: true); Marshal.Copy(intPtr, array, 0, num); Marshal.FreeHGlobal(intPtr); return array; } private unsafe static T ReadRW<T>(this Entity entity) where T : struct { //IL_000e: 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_0014: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0); TypeIndex typeIndex = val.TypeIndex; EntityManager entityManager = EntityManager; void* componentDataRawRW = ((EntityManager)(ref entityManager)).GetComponentDataRawRW(entity, typeIndex); return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRW)); } public unsafe static T Read<T>(this Entity entity) where T : struct { //IL_000e: 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_0014: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0); TypeIndex typeIndex = val.TypeIndex; EntityManager entityManager = EntityManager; void* componentDataRawRO = ((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, typeIndex); return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRO)); } public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).GetBuffer<T>(entity, false); } public static DynamicBuffer<T> AddBuffer<T>(this Entity entity) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).AddBuffer<T>(entity); } public unsafe static void* GetComponentData(this Entity entity, TypeIndex typeIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, typeIndex); } public unsafe static void SetComponentData(this Entity entity, TypeIndex typeIndex, void* byteData, int size) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, typeIndex, byteData, size); } public unsafe static void* GetBufferData(this Entity entity, TypeIndex typeIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).GetBufferRawRO(entity, typeIndex); } public static int GetBufferLength(this Entity entity, TypeIndex typeIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).GetBufferLength(entity, typeIndex); } public static void SetBufferData<T>(Entity prefabSource, T[] bufferArray) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) DynamicBuffer<T> val = (prefabSource.Has<T>() ? prefabSource.ReadBuffer<T>() : prefabSource.AddBuffer<T>()); val.Clear(); foreach (T val2 in bufferArray) { val.Add(val2); } } public static bool TryGetComponent<T>(this Entity entity, out T componentData) where T : struct { //IL_0008: 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) componentData = default(T); if (entity.Has<T>()) { componentData = entity.Read<T>(); return true; } return false; } public static bool TryGetComponentObject<T>(this Entity entity, EntityManager entityManager, out T componentObject) where T : class { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) componentObject = null; if (((EntityManager)(ref entityManager)).HasComponent<T>(entity)) { componentObject = ((EntityManager)(ref entityManager)).GetComponentObject<T>(entity); return componentObject != null; } return false; } public static bool TryRemoveComponent<T>(this Entity entity) where T : struct { //IL_0001: 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) if (entity.Has<T>()) { entity.Remove<T>(); return true; } return false; } public static bool Has<T>(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).HasComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0)); } public static bool Has(this Entity entity, ComponentType componentType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).HasComponent(entity, componentType); } public static void Add<T>(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).AddComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0)); } public static void Add(this Entity entity, ComponentType componentType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).AddComponent(entity, componentType); } public static void Remove<T>(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = EntityManager; ((EntityManager)(ref entityManager)).RemoveComponent(entity, new ComponentType(Il2CppType.Of<T>(), (AccessMode)0)); } public static bool TryGetFollowedPlayer(this Entity entity, out Entity player) { //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_000c: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) player = Entity.Null; if (entity.TryGetComponent<Follower>(out Follower componentData) && componentData.Followed._Value.TryGetPlayer(out player)) { return true; } return false; } public static bool TryGetPlayer(this Entity entity, out Entity player) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) player = Entity.Null; if (entity.Has<PlayerCharacter>()) { player = entity; return true; } return false; } public static bool IsPlayer(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (entity.Has<VampireTag>()) { return true; } return false; } public static bool IsDifferentPlayer(this Entity entity, Entity target) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (entity.IsPlayer() && target.IsPlayer() && !((Entity)(ref entity)).Equals(target)) { return true; } return false; } public static bool IsFollowingPlayer(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<Follower>(out Follower componentData) && componentData.Followed._Value.IsPlayer()) { return true; } return false; } public static string GetLocalizedName(this PrefabGUID prefabGuid) { //IL_0006: 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) string text = default(string); if (PrefabNames.LocalizedNameKeys.TryGetValue(prefabGuid, out var value) && Localization.LocalizedStrings.TryGetValue(AssetGuid.FromString(value), ref text) && !string.IsNullOrEmpty(text)) { return text; } return "LocalizationKey.Empty"; } public static int GetUnitLevel(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<UnitLevel>(out UnitLevel componentData)) { return componentData.Level._Value; } return 0; } public static Entity GetBuffTarget(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return CreateGameplayEventServerUtility.GetBuffTarget(EntityManager, entity); } public static Entity GetSpellTarget(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return CreateGameplayEventServerUtility.GetSpellTarget(EntityManager, entity); } public static bool TryGetTeamEntity(this Entity entity, out Entity teamEntity) { //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_000c: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0031: 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) teamEntity = Entity.Null; if (entity.TryGetComponent<TeamReference>(out TeamReference componentData)) { Entity value = componentData.Value._Value; if (value.Exists()) { teamEntity = value; return true; } } return false; } public static bool Exists(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) int result; if (entity.HasValue() && entity.IndexWithinCapacity()) { EntityManager entityManager = EntityManager; result = (((EntityManager)(ref entityManager)).Exists(entity) ? 1 : 0); } else { result = 0; } return (byte)result != 0; } public static bool IsDisabled(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return entity.Has<Disabled>(); } public static bool IsVBlood(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return entity.Has<VBloodUnit>(); } public static ulong GetSteamId(this Entity entity) { //IL_0001: 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_000e: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData)) { return componentData.UserEntity.Read<User>().PlatformId; } if (entity.TryGetComponent<User>(out User componentData2)) { return componentData2.PlatformId; } return 0uL; } public static NetworkId GetNetworkId(this Entity entity) { //IL_0001: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) if (entity.TryGetComponent<NetworkId>(out NetworkId componentData)) { return componentData; } return NetworkId.Empty; } public static void ForEach<T>(this IEnumerable<T> source, Action<T> action) { foreach (T item in source) { action(item); } } public static PrefabGUID GetPrefabGUID(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) if (entity.TryGetComponent<PrefabGUID>(out PrefabGUID componentData)) { return componentData; } return PrefabGUID.Empty; } public static Entity GetUserEntity(this Entity character) { //IL_0001: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) if (character.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData)) { return componentData.UserEntity; } return Entity.Null; } public static User GetUser(this Entity entity) { //IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0020: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData) && componentData.UserEntity.TryGetComponent<User>(out User componentData2)) { return componentData2; } if (entity.TryGetComponent<User>(out componentData2)) { return componentData2; } return User.Empty; } public static float3 GetAimPosition(this Entity entity) { //IL_0001: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001f: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<EntityInput>(out EntityInput componentData)) { return componentData.AimPosition; } return float3.zero; } public static bool TryGetPosition(this Entity entity, out float3 position) { //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_000c: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) position = float3.zero; if (entity.TryGetComponent<Translation>(out Translation componentData)) { position = componentData.Value; return true; } return false; } public static float3 GetPosition(this Entity entity) { //IL_0001: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_001f: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<Translation>(out Translation componentData)) { return componentData.Value; } return float3.zero; } public static bool TryGetMatch(this HashSet<(ulong, ulong)> hashSet, ulong value, out (ulong, ulong) matchingPair) { matchingPair = default((ulong, ulong)); foreach (var item in hashSet) { if (item.Item1 == value || item.Item2 == value) { matchingPair = item; return true; } } return false; } public static bool IsCustomSpawned(this Entity entity) { //IL_0001: 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) if (entity.TryGetComponent<IsMinion>(out IsMinion componentData) && componentData.Value) { return true; } return false; } public static void Destroy(this Entity entity) { //IL_0001: 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_0010: Unknown result type (might be due to invalid IL or missing references) if (entity.Exists()) { DestroyUtility.Destroy(EntityManager, entity, (DestroyDebugReason)0, (string)null, 0); } } public static void SetTeam(this Entity entity, Entity teamSource) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_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_0043: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (entity.Has<Team>() && entity.Has<TeamReference>() && teamSource.TryGetComponent<Team>(out Team componentData) && teamSource.TryGetComponent<TeamReference>(out TeamReference componentData2)) { Entity teamRefEntity = componentData2.Value._Value; int teamId = componentData.Value; entity.With<TeamReference>((WithRefHandler<TeamReference>)delegate(ref TeamReference teamReference) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) teamReference.Value._Value = teamRefEntity; }); entity.With<Team>((WithRefHandler<Team>)delegate(ref Team team) { team.Value = teamId; }); } } public static void SetFaction(this Entity entity, PrefabGUID factionPrefabGUID) { //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) //IL_000e: 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) if (entity.Has<FactionReference>()) { entity.With<FactionReference>((WithRefHandler<FactionReference>)delegate(ref FactionReference factionReference) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) factionReference.FactionGuid._Value = factionPrefabGUID; }); } } public static bool HasKeyValue<T>(this Dictionary<T, int> dic, T key, int value) { return dic.ContainsKey(key) && dic[key] == value; } public static void SetValue<T>(this Dictionary<T, int> dic, T key, int value) { dic[key] = value; } public static bool TryGetBuffer<T>(this Entity entity, out DynamicBuffer<T> dynamicBuffer) where T : struct { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) EntityManager entityManager = Plugin.EntityManager; if (((EntityManager)(ref entityManager)).TryGetBuffer<T>(entity, ref dynamicBuffer)) { return true; } dynamicBuffer = default(DynamicBuffer<T>); return false; } public static bool HasValue(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return entity != Entity.Null; } public static bool IndexWithinCapacity(this Entity entity) { //IL_00e2: 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) string text = ((object)(Entity)(ref entity)).ToString(); ReadOnlySpan<char> span = text.AsSpan(); if (!span.StartsWith("Entity(".AsSpan())) { return false; } span = span.Slice(7, span.Length - 7); int num = span.IndexOf(':'); if (num <= 0) { return false; } int result = num + 1; ReadOnlySpan<char> span2 = span.Slice(result, span.Length - result); int num2 = span2.IndexOf(')'); if (num2 <= 0) { return false; } if (!int.TryParse(span.Slice(0, num), out var result2)) { return false; } if (!int.TryParse(span2.Slice(0, num2), out result)) { return false; } EntityManager entityManager = EntityManager; int entityCapacity = ((EntityManager)(ref entityManager)).EntityCapacity; bool flag = (uint)result2 < (uint)entityCapacity; if (!flag) { } return flag; } } internal static class FamHelper { public static Entity FindActiveFamiliar(Entity playerCharacter) { //IL_0001: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_002a: 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_0031: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (playerCharacter.TryGetBuffer<FollowerBuffer>(out DynamicBuffer<FollowerBuffer> dynamicBuffer) && !dynamicBuffer.IsEmpty) { Enumerator<FollowerBuffer> enumerator = dynamicBuffer.GetEnumerator(); if (enumerator.MoveNext()) { FollowerBuffer current = enumerator.Current; return current.Entity._Entity; } } return Entity.Null; } } internal static class GameHelper { public class ColorNameData { public Color Color { get; set; } public string Name { get; set; } } internal static ColorNameData GetColorNameFromSchool(AbilitySchoolType? schoolType) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected I4, but got Unknown //IL_0173: 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_00e0: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) if (!schoolType.HasValue) { return new ColorNameData { Name = "Normal", Color = Color.white }; } AbilitySchoolType? val = schoolType; AbilitySchoolType? val2 = val; if (val2.HasValue) { AbilitySchoolType valueOrDefault = val2.GetValueOrDefault(); if ((int)valueOrDefault <= 8) { switch (valueOrDefault - 1) { default: if ((int)valueOrDefault != 8) { break; } return new ColorNameData { Name = "Frost", Color = new Color(0f, 255f, 255f) }; case 0: return new ColorNameData { Name = "Blood", Color = new Color(255f, 0f, 0f) }; case 1: return new ColorNameData { Name = "Unholy", Color = new Color(0f, 255f, 0f) }; case 3: return new ColorNameData { Name = "Illusion", Color = new Color(0f, 128f, 128f) }; case 2: break; } } else { if ((int)valueOrDefault == 16) { return new ColorNameData { Name = "Chaos", Color = new Color(160f, 32f, 240f) }; } if ((int)valueOrDefault == 32) { return new ColorNameData { Name = "Storm", Color = new Color(255f, 215f, 0f) }; } } } throw new ArgumentOutOfRangeException("schoolType"); } internal static AbilitySchoolType? GetSchoolFromHexColor(string colorText) { return colorText switch { "#008080" => (AbilitySchoolType)4, "#00FFFF" => (AbilitySchoolType)8, "#FF0000" => (AbilitySchoolType)1, "#FFD700" => (AbilitySchoolType)32, "#A020F0" => (AbilitySchoolType)16, "#00FF00" => (AbilitySchoolType)2, _ => null, }; } } public static class LogUtils { private static ManualLogSource Log; public static void LogDebugError(Exception exception) { ManualLogSource log = Log; if (log != null) { log.LogError((object)exception); } } public static void Init(ManualLogSource log) { Log = log; } public static void LogInfo(string text) { ManualLogSource log = Log; if (log != null) { log.LogInfo((object)text); } } public static void LogError(string text) { ManualLogSource log = Log; if (log != null) { log.LogError((object)text); } } public static void LogWarning(string text) { ManualLogSource log = Log; if (log != null) { log.LogWarning((object)text); } } } public static class SpriteLoader { private static readonly Dictionary<string, Sprite> _cachedSprites = new Dictionary<string, Sprite>(); private static readonly Dictionary<string, Sprite> _manualSprites = new Dictionary<string, Sprite>(); private static readonly Dictionary<Assembly, string> _pluginPaths = new Dictionary<Assembly, string>(); public static void RegisterSprite(string name, Sprite sprite) { if (string.IsNullOrEmpty(name) || (Object)(object)sprite == (Object)null) { return; } if (_manualSprites.ContainsKey(name)) { Sprite val = _manualSprites[name]; if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } _manualSprites[name] = sprite; } else { _manualSprites.Add(name, sprite); } } public static Sprite LoadSprite(string filename, float pixelsPerUnit = 100f, Vector4? border = null) { try { Assembly callingAssembly = Assembly.GetCallingAssembly(); return LoadSpriteFromAssembly(callingAssembly, filename, pixelsPerUnit, border); } catch (Exception ex) { LogUtils.LogError("[SpriteLoader] Failed to load sprite '" + filename + "': " + ex.Message); return null; } } public static Sprite LoadSpriteFromAssembly(Assembly pluginAssembly, string filename, float pixelsPerUnit = 100f, Vector4? border = null) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(filename)) { return null; } if (_manualSprites.TryGetValue(filename, out var value)) { if ((Object)(object)value != (Object)null) { return value; } _manualSprites.Remove(filename); } string text = ((pluginAssembly != null) ? pluginAssembly.FullName : "Global"); string text2 = (border.HasValue ? $"_{border.Value}" : "_0"); string key = text + "|" + filename + text2; if (_cachedSprites.TryGetValue(key, out var value2)) { if ((Object)(object)value2 != (Object)null && (Object)(object)value2.texture != (Object)null) { return value2; } _cachedSprites.Remove(key); } string text3 = FindImageFile(pluginAssembly, filename); if (string.IsNullOrEmpty(text3)) { return null; } try { Texture2D val = LoadTexture(text3); if ((Object)(object)val == (Object)null) { LogUtils.LogError("[SpriteLoader] Failed to decode texture from: " + text3); return null; } Vector4 val2 = (Vector4)(((??)border) ?? Vector4.zero); Sprite val3 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), pixelsPerUnit, 0u, (SpriteMeshType)0, val2); if ((Object)(object)val3 != (Object)null) { ((Object)val3).name = Path.GetFileNameWithoutExtension(filename); _cachedSprites[key] = val3; } return val3; } catch (Exception ex) { LogUtils.LogError("[SpriteLoader] Error creating sprite from '" + text3 + "': " + ex.Message); return null; } } private static string FindImageFile(Assembly assembly, string filename) { if (assembly != null) { string pluginDirectory = GetPluginDirectory(assembly); if (!string.IsNullOrEmpty(pluginDirectory)) { string text = Path.Combine(pluginDirectory, "Sprites", filename); if (File.Exists(text)) { return text; } } } try { string text2 = Path.Combine(Paths.PluginPath, "Sprites", filename); if (File.Exists(text2)) { return text2; } } catch { } if (assembly != null) { string pluginDirectory2 = GetPluginDirectory(assembly); if (!string.IsNullOrEmpty(pluginDirectory2)) { string text3 = Path.Combine(pluginDirectory2, filename); if (File.Exists(text3)) { return text3; } } } return null; } public static void ClearCache() { foreach (Sprite value in _manualSprites.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } } _manualSprites.Clear(); foreach (Sprite value2 in _cachedSprites.Values) { if ((Object)(object)value2 != (Object)null) { if ((Object)(object)value2.texture != (Object)null) { Object.Destroy((Object)(object)value2.texture); } Object.Destroy((Object)(object)value2); } } _cachedSprites.Clear(); _pluginPaths.Clear(); LogUtils.LogInfo("[SpriteLoader] Cleared all sprite caches."); } private static string GetPluginDirectory(Assembly assembly) { if (assembly == null) { return null; } if (_pluginPaths.TryGetValue(assembly, out var value)) { return value; } try { if (string.IsNullOrEmpty(assembly.Location)) { return null; } string directoryName = Path.GetDirectoryName(assembly.Location); _pluginPaths[assembly] = directoryName; return directoryName; } catch { return null; } } private static Texture2D LoadTexture(string filePath) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown try { byte[] array = File.ReadAllBytes(filePath); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; if (!ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array))) { LogUtils.LogError("[SpriteLoader] Texture.LoadImage failed for: " + filePath); Object.Destroy((Object)(object)val); return null; } return val; } catch (Exception ex) { LogUtils.LogError("[SpriteLoader] Exception loading texture I/O: " + ex.Message); return null; } } } internal static class TimerHelper { public static void OneTickTimer(float interval, Action action) { System.Timers.Timer timer = new System.Timers.Timer(interval); timer.Elapsed += delegate { action(); timer.Stop(); timer.Dispose(); }; timer.AutoReset = false; timer.Enabled = true; } } public static class UnityHelper { public static GameObject FindInHierarchy(string path) { if (string.IsNullOrEmpty(path)) { return null; } string[] array = path.Split('|'); if (array.Length == 0) { return null; } GameObject val = GameObject.Find(array[0]); if ((Object)(object)val == (Object)null) { return null; } for (int i = 1; i < array.Length; i++) { Transform val2 = val.transform.Find(array[i]); if ((Object)(object)val2 == (Object)null) { return null; } val = ((Component)val2).gameObject; } return val; } public static void LogShader(Material material) { //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_0052: 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_005f: Invalid comparison between Unknown and I4 //IL_006f: 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_0074: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected I4, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) int propertyCount = material.shader.GetPropertyCount(); for (int i = 0; i < propertyCount; i++) { string propertyName = material.shader.GetPropertyName(i); string propertyDescription = material.shader.GetPropertyDescription(i); Il2CppStringArray propertyAttributes = material.shader.GetPropertyAttributes(i); ShaderPropertyFlags propertyFlags = material.shader.GetPropertyFlags(i); ShaderPropertyType propertyType = material.shader.GetPropertyType(i); object value = null; Vector2 val = (((int)propertyType == 3) ? material.shader.GetPropertyRangeLimits(i) : Vector2.zero); ShaderPropertyType val2 = propertyType; ShaderPropertyType val3 = val2; switch (val3 - 1) { case 0: value = material.shader.GetPropertyDefaultVectorValue(i); break; case 1: value = material.shader.GetPropertyDefaultFloatValue(i); break; case 4: value = material.shader.GetPropertyDefaultIntValue(i); break; } LogUtils.LogInfo($"Property {i}: {propertyName} - {propertyDescription} - {((propertyAttributes != null) ? string.Join(',', ((IEnumerable<string>)propertyAttributes).Select((string a) => a)) : null)} - {propertyFlags} - {propertyType} - {value} - {val.x}:{val.y}"); } } } } namespace ZUI.UI { public class BCUIManager : UIManagerBase { private IPanelBase _contentPanel; private readonly List<string> _visibilityAffectedPanels = new List<string>(); private List<IPanelBase> UIPanels { get; } = new List<IPanelBase>(); public void RegisterPanel(IPanelBase panel) { if (panel != null && !UIPanels.Contains(panel)) { UIPanels.Add(panel); } } public override void Reset() { base.Reset(); foreach (IPanelBase uIPanel in UIPanels) { if (uIPanel is ResizeablePanelBase resizeablePanelBase) { resizeablePanelBase.Reset(); } uIPanel.Destroy(); } UIPanels.Clear(); } protected override void AddMainContentPanel() { AddPanel(PanelType.Base); } public override void SetActive(bool active) { if (active && _visibilityAffectedPanels.Any()) { foreach (IPanelBase item in _visibilityAffectedPanels.Select((string panel) => UIPanels.FirstOrDefault((IPanelBase a) => a.PanelId.Equals(panel)))) { item?.SetActiveOnly(active: true); } _visibilityAffectedPanels.Clear(); } if (!active) { foreach (IPanelBase item2 in UIPanels.Where((IPanelBase a) => a.Enabled)) { _visibilityAffectedPanels.Add(item2.PanelId); item2.SetActiveOnly(active: false); } } _contentPanel?.SetActive(active); } public void AddPanel(PanelType type, string param = null) { switch (type) { case PanelType.Base: _contentPanel = new ContentPanel(base.UiBase); RegisterPanel(_contentPanel); break; case PanelType.BoxList: { BoxListPanel panel2 = GetPanel<BoxListPanel>(); if (panel2 == null) { BoxListPanel item2 = new BoxListPanel(base.UiBase); UIPanels.Add(item2); bool flag = false; } else { panel2.SetActive(active: true); } break; } case PanelType.BoxContent: { BoxContentPanel boxPanel = GetBoxPanel(param); if (boxPanel == null) { UIPanels.Add(new BoxContentPanel(base.UiBase, param)); } else { boxPanel.SetActive(active: true); } break; } case PanelType.FamStats: { FamStatsPanel panel5 = GetPanel<FamStatsPanel>(); if (panel5 == null) { FamStatsPanel item5 = new FamStatsPanel(base.UiBase); UIPanels.Add(item5); } else { panel5.SetActive(!panel5.Enabled); } break; } case PanelType.TestPanel: { TestPanel panel7 = GetPanel<TestPanel>(); if (panel7 == null) { TestPanel item7 = new TestPanel(base.UiBase); UIPanels.Add(item7); } else { panel7.SetActive(!panel7.Enabled); } break; } case PanelType.LevelUp: { LevelUpPanel levelUpPanel = GetPanel<LevelUpPanel>(); if (levelUpPanel == null) { LevelUpPanel levelUpPanel2 = new LevelUpPanel(base.UiBase); UIPanels.Add(levelUpPanel2); levelUpPanel = levelUpPanel2; } levelUpPanel.SetActive(active: true); bool mode = param == "Weapon"; levelUpPanel.SetMode(mode); break; } case PanelType.FamActions: { FamActionsPanel panel8 = GetPanel<FamActionsPanel>(); if (panel8 == null) { FamActionsPanel item8 = new FamActionsPanel(base.UiBase); UIPanels.Add(item8); } else { panel8.SetActive(!panel8.Enabled); } break; } case PanelType.Class: { ClassPanel panel4 = GetPanel<ClassPanel>(); if (panel4 == null) { ClassPanel item4 = new ClassPanel(base.UiBase); UIPanels.Add(item4); } else { panel4.SetActive(!panel4.Enabled); } break; } case PanelType.Quests: { QuestsPanel panel10 = GetPanel<QuestsPanel>(); if (panel10 == null) { QuestsPanel item10 = new QuestsPanel(base.UiBase); UIPanels.Add(item10); } else { panel10.SetActive(!panel10.Enabled); } break; } case PanelType.Signs: { SignsPanel panel9 = GetPanel<SignsPanel>(); if (panel9 == null) { SignsPanel item9 = new SignsPanel(base.UiBase); UIPanels.Add(item9); } else { panel9.SetActive(!panel9.Enabled); } break; } case PanelType.Admin: { AdminPanel panel6 = GetPanel<AdminPanel>(); if (panel6 == null) { AdminPanel item6 = new AdminPanel(base.UiBase); UIPanels.Add(item6); } else { panel6.SetActive(!panel6.Enabled); } break; } case PanelType.User: { UserPanel panel3 = GetPanel<UserPanel>(); if (panel3 == null) { UserPanel item3 = new UserPanel(base.UiBase); UIPanels.Add(item3); } else { panel3.SetActive(!panel3.Enabled); } break; } case PanelType.Mods: { ModsPanel panel = GetPanel<ModsPanel>(); if (panel == null) { ModsPanel item = new ModsPanel(base.UiBase); UIPanels.Add(item); } else { panel.SetActive(!panel.Enabled); } break; } default: throw new ArgumentOutOfRangeException("type", type, null); } } internal T GetPanel<T>() where T : class { Type t = typeof(T); return UIPanels.FirstOrDefault((IPanelBase a) => a.GetType() == t) as T; } internal BoxContentPanel GetBoxPanel(string currentBox) { return UIPanels.FirstOrDefault((IPanelBase a) => a.PanelType == PanelType.BoxContent && a.PanelId.Equals(currentBox)) as BoxContentPanel; } protected override void UiUpdate() { base.UiUpdate(); if (Input.GetKeyDown((KeyCode)27)) { foreach (IPanelBase uIPanel in UIPanels) { if (uIPanel.Enabled && uIPanel.PanelType != 0) { uIPanel.SetActive(active: false); } } } foreach (IPanelBase uIPanel2 in UIPanels) { if (uIPanel2 is PanelBase panelBase && panelBase.Enabled) { panelBase.Update(); } } } } public class FrameTimer { private bool _enabled; private bool _isRunning; private bool _runOnce; private DateTime _executeAfter = DateTime.MinValue; private DateTime _lastExecution = DateTime.MinValue; private TimeSpan _delay; private Action _action; private Func<TimeSpan> _delayGenerator; public TimeSpan TimeSinceLastRun => DateTime.Now - _lastExecution; public bool Enabled => _enabled; public FrameTimer Initialise(Action action, TimeSpan delay, bool runOnce = true) { _delayGenerator = null; _delay = delay; _executeAfter = DateTime.Now + delay; _action = action; _runOnce = runOnce; return this; } public FrameTimer Initialise(Action action, Func<TimeSpan> delayGenerator, bool runOnce = true) { _delayGenerator = delayGenerator; _delay = _delayGenerator(); _executeAfter = DateTime.Now + _delay; _action = action; _runOnce = runOnce; return this; } public void Start() { Refresh(); if (!_enabled) { _lastExecution = DateTime.MinValue; ZUI.Behaviors.CoreUpdateBehavior.Actions.Add(GameFrame_OnUpdate); _enabled = true; } } public void Stop() { if (_enabled) { ZUI.Behaviors.CoreUpdateBehavior.Actions.Remove(GameFrame_OnUpdate); _enabled = false; } } private void Refresh() { if (_delayGenerator != null) { _delay = _delayGenerator(); } _executeAfter = DateTime.Now + _delay; } private void GameFrame_OnUpdate() { Update(); } private void Update() { if (!_enabled || _isRunning || _executeAfter >= DateTime.Now) { return; } _isRunning = true; try { _action(); _lastExecution = DateTime.Now; } catch (Exception ex) { LogUtils.LogError("Timer failed " + ex.Message + "\n" + ex.StackTrace); _runOnce = true; Stop(); } finally { if (_runOnce) { Stop(); } else { Refresh(); } _isRunning = false; } } } } namespace ZUI.UI.UniverseLib.UI { public static class CoroutineUtility { private static ConcurrentBag<IEnumerator> _nextFrameRoutines = new ConcurrentBag<IEnumerator>(); private static ConcurrentBag<IEnumerator> _thisFrameRoutines = new ConcurrentBag<IEnumerator>(); public static void StartCoroutine(IEnumerator coroutine) { _nextFrameRoutines.Add(coroutine); } public static void TickRoutines() { ConcurrentBag<IEnumerator> nextFrameRoutines = _nextFrameRoutines; ConcurrentBag<IEnumerator> thisFrameRoutines = _thisFrameRoutines; _thisFrameRoutines = nextFrameRoutines; _nextFrameRoutines = thisFrameRoutines; while (!_thisFrameRoutines.IsEmpty) { if (_thisFrameRoutines.TryTake(out var result) && result.MoveNext()) { _nextFrameRoutines.Add(result); } } } } public static class Il2CppExtensions { public static void AddListener(this UnityEvent action, Action listener) { action.AddListener(UnityAction.op_Implicit(listener)); } public static void AddListener<T>(this UnityEvent<T> action, Action<T> listener) { action.AddListener(UnityAction<T>.op_Implicit(listener)); } public static void RemoveListener(this UnityEvent action, Action listener) { action.RemoveListener(UnityAction.op_Implicit(listener)); } public static void RemoveListener<T>(this UnityEvent<T> action, Action<T> listener) { action.RemoveListener(UnityAction<T>.op_Implicit(listener)); } public static void SetChildControlHeight(this HorizontalOrVerticalLayoutGroup group, bool value) { group.childControlHeight = value; } public static void SetChildControlWidth(this HorizontalOrVerticalLayoutGroup group, bool value) { group.childControlWidth = value; } } 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 CanvasScaler Scaler { 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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)0; Canvas.referencePixelsPerUnit = 100f; Canvas.sortingOrder = TOP_SORTORDER; Canvas.overrideSorting = true; Scaler = RootObject.AddComponent<CanvasScaler>(); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Screen.width, (float)Screen.height); LogUtils.LogInfo($"Scaler ref: {val.x}x{val.y}"); Scaler.referenceResolution = val; Scaler.uiScaleMode = (ScaleMode)1; Scaler.screenMatchMode = (ScreenMatchMode)0; 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 value) { LogUtils.LogWarning($"Exception invoking update method for {ID}: {value}"); } } } public static class UIFactory { internal static Vector2 largeElementSize = new Vector2(100f, 30f); internal static Vector2 smallElementSize = new Vector2(25f, 25f); internal static Vector2 outlineDistance = new Vector2(2f, 2f); public static GameObject PlayerHUDCanvas { get; set; } public static TMP_FontAsset Font { get; set; } public static Material FontMaterial { get; set; } 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_0040: 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(TextMeshProUGUI text) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) ((Graphic)text).color = Theme.DefaultText; ((TMP_Text)text).font = Font; ((TMP_Text)text).fontSize = 14f; } internal static void SetDefaultSelectableValues(Selectable selectable) { //IL_001a: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) Navigation navigation = selectable.navigation; navigation.mode = (Mode)4; selectable.navigation = navigation; ColorBlock val = default(ColorBlock); ((ColorBlock)(ref val)).normalColor = Theme.SelectableNormal; ((ColorBlock)(ref val)).highlightedColor = Theme.SelectableHighlighted; ((ColorBlock)(ref val)).pressedColor = Theme.SelectablePressed; ((ColorBlock)(ref val)).colorMultiplier = 1f; ColorBlock colors = val; selectable.colors = colors; } 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)group).childControlWidth = childControlWidth.Value; } if (childControlHeight.HasValue) { ((HorizontalOrVerticalLayoutGroup)group).childControlHeight = 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, float opacity = 1f) { //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_0076: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_013e: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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?)null, (int?)null, (int?)null, (int?)null, (int?)null, (TextAnchor?)null); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.anchoredPosition = Vector2.zero; component.sizeDelta = Vector2.zero; contentHolder = CreateUIObject("Content", val); UIFactory.SetLayoutGroup<VerticalLayoutGroup>(contentHolder, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)null, (int?)null, (int?)null, (int?)null, (int?)null, (TextAnchor?)null); Image val2 = contentHolder.AddComponent<Image>(); val2.type = (Type)3; ((Graphic)val2).color = (Color)(((??)bgColor) ?? Theme.DarkBackground); Outline val3 = contentHolder.AddComponent<Outline>(); ((Shadow)val3).effectColor = Theme.DarkBackground; ((Shadow)val3).effectDistance = outlineDistance; 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 = null, TextAnchor? childAlignment = null, float opacity = 1f) { //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_008b: 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) 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); ((Graphic)val.AddComponent<Image>()).color = (Color)(((??)bgColor) ?? Theme.PanelBackground); 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 = null, TextAnchor? childAlignment = null, float opacity = 1f) { //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_008b: 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) 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); ((Graphic)val.AddComponent<Image>()).color = (Color)(((??)bgColor) ?? Theme.PanelBackground); return val; } public static GameObject CreateGridGroup(GameObject parent, string name, Vector2 cellSize, Vector2 spacing, 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_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_004c: 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) GameObject val = CreateUIObject(name, parent); GridLayoutGroup val2 = val.AddComponent<GridLayoutGroup>(); ((LayoutGroup)val2).childAlignment = (TextAnchor)0; val2.cellSize = cellSize; val2.spacing = spacing; ((Graphic)val.AddComponent<Image>()).color = (Color)(((??)bgColor) ?? Theme.PanelBackground); return val; } public static LabelRef CreateLabel(GameObject parent, string name, string defaultText, TextAlignmentOptions alignment = 514, Color? color = null, int fontSize = 14, float outlineWidth = 0.15f, Color? outlineColor = 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_002f: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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) GameObject val = CreateUIObject(name, parent); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); ((Graphic)val2).color = (Color)(((??)color) ?? Theme.DefaultText); ((TMP_Text)val2).font = Font; ((TMP_Text)val2).text = defaultText; ((TMP_Text)val2).alignment = alignment; ((TMP_Text)val2).fontSize = fontSize; try { ((TMP_Text)val2).outlineWidth = outlineWidth; ((TMP_Text)val2).outlineColor = Color32.op_Implicit((Color)(((??)outlineColor) ?? Color.black)); } catch (Exception) { } return new LabelRef { GameObject = val, TextMesh = val2 }; } public static ButtonRef CreateButton(GameObject parent, string name, string text, Color? normalColor = null) { //IL_0015: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0087: 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_0093: 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) Color val = (Color)(((??)normalColor) ?? Theme.SliderFill); ColorBlock val2 = default(ColorBlock); ((ColorBlock)(ref val2)).normalColor = val; ((ColorBlock)(ref val2)).highlightedColor = val * 1.2f; ((ColorBlock)(ref val2)).selectedColor = val * 1.1f; ((ColorBlock)(ref val2)).pressedColor = val * 0.7f; ((ColorBlock)(ref val2)).disabledColor = val * 0.4f; ((ColorBlock)(ref val2)).colorMultiplier = 1f; ColorBlock colors = val2; val2 = default(ColorBlock); ButtonRef buttonRef = CreateButton(parent, name, text, val2); ((Selectable)buttonRef.Component).colors = colors; 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_0034: 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_0053: 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_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) //IL_00ce: 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 = Theme.White; Outline val4 = val.AddComponent<Outline>(); ((Shadow)val4).effectColor = Theme.DarkBackground; ((Shadow)val4).effectDistance = outlineDistance; Button val5 = val.AddComponent<Button>(); SetDefaultSelectableValues((Selectable)(object)val5); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((Selectable)val5).colors = colors; TextMeshProUGUI val6 = val2.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val6).text = text; SetDefaultTextValues(val6); ((TMP_Text)val6).alignment = (TextAlignmentOptions)514; RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; SetButtonDeselectListener(val5); return new ButtonRef(val5); } internal static void SetButtonDeselectListener(Button button) { ((UnityEvent)(object)button.onClick).AddListener(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_0092: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: 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 = Theme.PanelBackground; 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 = Theme.SliderFill; 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 = Theme.SliderHandle; Outline val10 = val6.AddComponent<Outline>(); ((Shadow)val10).effectColor = Theme.DarkBackground; ((Shadow)val10).effectDistance = outlineDistance; 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; ColorBlock val11 = default(ColorBlock); ((ColorBlock)(ref val11)).normalColor = Theme.SliderNormal; ((ColorBlock)(ref val11)).highlightedColor = Theme.SliderHighlighted; ((ColorBlock)(ref val11)).pressedColor = Theme.SliderPressed; ((ColorBlock)(ref val11)).colorMultiplier = 1f; ColorBlock colors = val11; ((Selectable)slider).colors = colors; 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00c0: 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 = Theme.DarkBackground; Image val5 = val3.AddComponent<Image>(); val5.type = (Type)1; ((Graphic)val5).color = Theme.SliderHandle; 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 ToggleRef CreateToggle(GameObject parent, string name, Color bgColor = default(Color), int checkWidth = 20, int checkHeight = 20, string text = "") { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00c5: 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_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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) ToggleRef toggleRef = new ToggleRef(); toggleRef.GameObject = CreateUIObject(name, parent, smallElementSize); UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(toggleRef.GameObject, (bool?)false, (bool?)false, (bool?)true, (bool?)true, (int?)5, (int?)0, (int?)0, (int?)0, (int?)0, (TextAnchor?)(TextAnchor)3); toggleRef.Toggle = toggleRef.GameObject.AddComponent<Toggle>(); toggleRef.Toggle.isOn = true; SetDefaultSelectableValues((Selectable)(object)toggleRef.Toggle); GameObject val = CreateUIObject("Background", toggleRef.GameObject); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = ((bgColor == default(Color)) ? Theme.ToggleNormal : bgColor); UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(val, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)0, (int?)2, (int?)2, (int?)2, (int?)2, (TextAnchor?)null); SetLayoutElement(val, checkWidth, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0); GameObject val3 = CreateUIObject("Checkmark", val); Image val4 = val3.AddComponent<Image>(); ((Graphic)val4).color = Theme.ToggleCheckMark; GameObject val5 = CreateUIObject("Label", toggleRef.GameObject); toggleRef.Text = val5.AddComponent<TextMeshProUGUI>(); ((TMP_Text)toggleRef.Text).text = text; ((TMP_Text)toggleRef.Text).alignment = (TextAlignmentOptions)4097; SetDefaultTextValues(toggleRef.Text); SetLayoutElement(val5, 0, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0); toggleRef.Toggle.graphic = (Graphic)(object)val4; ((Selectable)toggleRef.Toggle).targetGraphic = (Graphic)(object)val2; return toggleRef; } 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