Decompiled source of BloodCraftEZLife v0.4.0
BloodCraftEZLife.Plugins.dll
Decompiled 11 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; 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.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BloodCraftEZLife.Behaviors; using BloodCraftEZLife.Config; using BloodCraftEZLife.Patches; using BloodCraftEZLife.Services; using BloodCraftEZLife.UI; using BloodCraftEZLife.UI.CustomLib; using BloodCraftEZLife.UI.CustomLib.Cells; using BloodCraftEZLife.UI.CustomLib.Cells.Handlers; using BloodCraftEZLife.UI.CustomLib.Controls; using BloodCraftEZLife.UI.CustomLib.Panel; using BloodCraftEZLife.UI.CustomLib.Util; using BloodCraftEZLife.UI.ModContent; using BloodCraftEZLife.UI.ModContent.Data; using BloodCraftEZLife.UI.ModernLib; using BloodCraftEZLife.UI.UniverseLib.UI; using BloodCraftEZLife.UI.UniverseLib.UI.Models; using BloodCraftEZLife.UI.UniverseLib.UI.ObjectPool; using BloodCraftEZLife.UI.UniverseLib.UI.Panels; using BloodCraftEZLife.UI.UniverseLib.UI.Widgets; using BloodCraftEZLife.UI.UniverseLib.UI.Widgets.ScrollView; using BloodCraftEZLife.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.Scripting; 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.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("TiBen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("BloodCraft plugins to help in pve servers")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+bb8fba0d182e3fb84b524a02229198e8a75dadbe")] [assembly: AssemblyProduct("BloodCraftEZLife.Plugins")] [assembly: AssemblyTitle("BloodCraftEZLife.Plugins")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.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; } } } internal class CommandInput : PanelBase { private bool _isInitialized; public GameObject Root; public InputFieldRef Input; public Action<Hotkey> _onCommand; private Hotkey _currentHotkey; public override string PanelId => "SettingsList"; public override int MinWidth => 480; public override int MinHeight => 240; public override int MaxWidth => 3840; public override Vector2 DefaultAnchorMin => new Vector2(0.5f, 0.5f); public override Vector2 DefaultAnchorMax => new Vector2(0.5f, 0.5f); public override Vector2 DefaultPivot => new Vector2(0.5f, 0.5f); public override bool CanDrag => false; public override PanelDragger.ResizeTypes CanResize => PanelDragger.ResizeTypes.None; public override PanelType PanelType => PanelType.SettingsPanel; public CommandInput(UIBase owner) : base(owner) { SetTitle("InputBox"); } protected override void ConstructPanelContent() { //IL_0013: 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) GameObject val = UIFactory.CreateVerticalGroup(base.ContentRoot, "CommandPanel", forceWidth: true, forceHeight: true, childControlWidth: true, childControlHeight: true); UIFactory.SetLayoutElement(val, minHeight: 100, minWidth: 250); LabelRef labelRef = UIFactory.CreateLabel(val, "CommandTitle", "Enter Command you can make 2 command in one if you separate with |", (TextAlignmentOptions)514); TextMeshProUGUI component = labelRef.GameObject.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).fontSize = 22f; ((TMP_Text)component).alignment = (TextAlignmentOptions)4098; Input = UIFactory.CreateInputField(val, "CommandInput", ""); GameObject gameObject2 = Input.GameObject; int? minHeight2 = 30; int? flexibleWidth = 9999; UIFactory.SetLayoutElement(gameObject2, null, minHeight2, flexibleWidth); Input.Component.textComponent.fontSize = 22f; ((UnityEvent<string>)(object)Input.Component.onSubmit).AddListener(delegate(string cmd) { Debug.Log(Object.op_Implicit("Command submitted: " + cmd)); _currentHotkey.action = cmd; _onCommand?.Invoke(_currentHotkey); }); } protected override void OnClosePanelClicked() { SetActive(active: false); } protected override void LateConstructUI() { //IL_0013: 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_0042: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) base.LateConstructUI(); float num = base.Owner.Scaler.referenceResolution.x / 1920f; float num2 = base.Owner.Scaler.referenceResolution.y / 1080f; FullscreenSettingService.ResFactor = new Vector2(num, num2); Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(FullscreenSettingService.DeltaRect.x * num * 0.5f, FullscreenSettingService.DeltaRect.y * num2 * 0.5f); base.Rect.sizeDelta = sizeDelta; base.Rect.anchoredPosition = FullscreenSettingService.AnchorRect; EnsureValidSize(); EnsureValidPosition(); } public void Show(Hotkey oldcommand) { _currentHotkey = oldcommand; Input.Text = oldcommand.action; Input.Component.ActivateInputField(); Input.Component.selectionAnchorPosition = Input.Text.Length; Input.Component.selectionFocusPosition = Input.Text.Length; } } namespace BloodCraftEZLife { [BepInProcess("VRising.exe")] [BepInPlugin("BloodCraftEZLife.PluginsUI", "BloodCraftEZLife", "1.03")] public class Plugin : BasePlugin { private static World _client; public const bool IS_TESTING = false; private static Harmony _harmonyChatPatch; private static Harmony _harmonyPlayerlistPatch; private static Harmony _harmonyInitPatch; internal static Harmony HarmonyVersionStringPatch; 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 PrefabCollectionSystem PrefabCollectionSystem => _client.GetExistingSystemManaged<PrefabCollectionSystem>(); public static bool IsInitialized { get; private set; } public static bool IsGameDataInitialized { get; set; } public static BCUIManager UIManager { get; set; } public static BloodCraftEZLife.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 void Reset() { _client = null; IsInitialized = false; IsGameDataInitialized = false; } public override void Load() { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown IsClient = Application.productName != "VRisingServer"; LogUtils.Init(((BasePlugin)this).Log); Instance = this; if (!IsClient) { LogUtils.LogInfo($"{"BloodCraftEZLife"}[{"1.03"}] is a client mod! ({Application.productName})"); return; } Settings = new Settings().InitConfig(); Theme.Opacity = Settings.UITransparency; UIManager = new BCUIManager(); CoreUpdateBehavior = new BloodCraftEZLife.UI.ModernLib.CoreUpdateBehavior(); CoreUpdateBehavior.Setup(); IsInitialized = true; HarmonyVersionStringPatch = Harmony.CreateAndPatchAll(typeof(VersionStringPatch), (string)null); _harmonyChatPatch = Harmony.CreateAndPatchAll(typeof(ClientChatPatch), (string)null); _harmonyPlayerlistPatch = Harmony.CreateAndPatchAll(typeof(FullscreenPatch), (string)null); _harmonyInitPatch = Harmony.CreateAndPatchAll(typeof(InitializationPatch), (string)null); HotkeyService.Initialise(); 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>("BloodCraftEZLife.PluginsUI"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.03"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); } public override bool Unload() { HarmonyVersionStringPatch.UnpatchSelf(); _harmonyChatPatch.UnpatchSelf(); _harmonyPlayerlistPatch.UnpatchSelf(); _harmonyInitPatch.UnpatchSelf(); return true; } public static void GameDataOnInitialize(World world) { //IL_001b: 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) if (!IsGameDataInitialized && IsClient) { _client = world; FullscreenSettingService.InitialiseVbloodData(Client.GetServerId(EntityManager)); ClientScriptMapper existingSystemManaged = _client.GetExistingSystemManaged<ClientScriptMapper>(); ClientGameManager clientGameManager = existingSystemManaged._ClientGameManager; IsGameDataInitialized = true; } } public static void UIOnInitialize() { UIManager.SetupAndShowUI(); BloodCraftStateService.Initialize(); LogUtils.LogInfo("UI Manager initialized"); } } public static class PluginInfo { public const string PLUGIN_GUID = "BloodCraftEZLife.PluginsUI"; public const string PLUGIN_NAME = "BloodCraftEZLife"; public const string PLUGIN_VERSION = "1.03"; } } namespace BloodCraftEZLife.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 string GetText(this SimpleStunButton helper) { TextMeshProUGUI componentInChildren = ((Component)helper).GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren != (Object)null) { return ((TMP_Text)componentInChildren).text; } return ""; } public static void SetText(this SimpleStunButton helper, string text) { TextMeshProUGUI componentInChildren = ((Component)helper).GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)componentInChildren).text = text; } } 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(")) { return false; } ref ReadOnlySpan<char> reference = ref span; span = reference.Slice(7, reference.Length - 7); int num = span.IndexOf(':'); if (num <= 0) { return false; } reference = ref span; int result = num + 1; ReadOnlySpan<char> span2 = reference.Slice(result, reference.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)("BloodCraftEZLife: " + 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); } } } 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 void HideObject(GameObject obj) { //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_0028: Unknown result type (might be due to invalid IL or missing references) Image component = obj.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { Color color = ((Graphic)component).color; color.a = 0f; ((Graphic)component).color = color; } } public static void ListAllComponentsWithChildren(GameObject root) { Component[] array = Il2CppArrayBase<Component>.op_Implicit(root.GetComponentsInChildren<Component>(true)); Component[] array2 = array; foreach (Component val in array2) { if (!((Object)(object)val == (Object)null)) { LogUtils.LogInfo($"[{((object)val).GetType().Name} on {((Object)val.gameObject).name}]"); } } } public static void DeleteComponentNamed(GameObject root, string compname) { Component[] array = Il2CppArrayBase<Component>.op_Implicit(root.GetComponentsInChildren<Component>(true)); for (int i = 0; i < array.Count() - 1; i++) { Component val = array[i]; if (!((Object)(object)val == (Object)null)) { if (((Object)val).name == compname) { Object.Destroy((Object)(object)val.gameObject); break; } LogUtils.LogInfo($"[{((object)val).GetType().Name} on {((Object)val.gameObject).name}]"); } } } public static void ListAllComponents(GameObject root) { Component[] array = Il2CppArrayBase<Component>.op_Implicit(root.GetComponents<Component>()); Component[] array2 = array; foreach (Component val in array2) { if (!((Object)(object)val == (Object)null)) { Debug.Log(Object.op_Implicit($"[{((object)val).GetType().Name} on {((Object)val.gameObject).name}]")); } } } 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}"); } } public static void PrintParents(Transform t) { int num = 0; Transform val = t; while ((Object)(object)val != (Object)null) { string text = new string('-', num); Debug.Log(Object.op_Implicit(text + ((Object)((Component)val).gameObject).name)); val = val.parent; num++; } } public static void PrintChilds(Transform t, int depth, bool withcomponent = false) { string text = new string('-', depth); Debug.Log(Object.op_Implicit(text + ((Object)((Component)t).gameObject).name + GetLabelValue(((Component)t).gameObject))); if (withcomponent) { ListAllComponentsWithChildren(((Component)t).gameObject); } for (int i = 0; i < t.childCount; i++) { Transform child = t.GetChild(i); PrintChilds(child, depth + 1); } } public static string GetLabelValue(GameObject obj) { TextMeshProUGUI componentInChildren = obj.GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren != (Object)null) { return " Text: " + ((TMP_Text)componentInChildren).text; } return ""; } public static void DumpUI(GameObject go, int depth = 0) { //IL_0070: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)go == (Object)null)) { string text = new string('-', depth); Debug.Log(Object.op_Implicit(text + " GameObject: " + ((Object)go).name)); RectTransform component = go.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { Debug.Log(Object.op_Implicit($"{text} RectTransform: Pos={component.anchoredPosition}, Size={component.sizeDelta}, Pivot={component.pivot}")); } Image component2 = go.GetComponent<Image>(); if ((Object)(object)component2 != (Object)null) { Debug.Log(Object.op_Implicit($"{text} Image: Color={((Graphic)component2).color}, Sprite={(((Object)(object)component2.sprite != (Object)null) ? ((Object)component2.sprite).name : "None")}, Type={component2.type}")); } TextMeshProUGUI component3 = go.GetComponent<TextMeshProUGUI>(); if ((Object)(object)component3 != (Object)null) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(52, 6); defaultInterpolatedStringHandler.AppendFormatted(text); defaultInterpolatedStringHandler.AppendLiteral(" TMP_Text: Text='"); defaultInterpolatedStringHandler.AppendFormatted(((TMP_Text)component3).text); defaultInterpolatedStringHandler.AppendLiteral("', Font="); TMP_FontAsset font = ((TMP_Text)component3).font; defaultInterpolatedStringHandler.AppendFormatted((font != null) ? ((Object)font).name : null); defaultInterpolatedStringHandler.AppendLiteral(", Size="); defaultInterpolatedStringHandler.AppendFormatted(((TMP_Text)component3).fontSize); defaultInterpolatedStringHandler.AppendLiteral(", Color="); defaultInterpolatedStringHandler.AppendFormatted<Color>(((Graphic)component3).color); defaultInterpolatedStringHandler.AppendLiteral(", Alignment="); defaultInterpolatedStringHandler.AppendFormatted<TextAlignmentOptions>(((TMP_Text)component3).alignment); Debug.Log(Object.op_Implicit(defaultInterpolatedStringHandler.ToStringAndClear())); } Text component4 = go.GetComponent<Text>(); if ((Object)(object)component4 != (Object)null) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(48, 6); defaultInterpolatedStringHandler.AppendFormatted(text); defaultInterpolatedStringHandler.AppendLiteral(" Text: Text='"); defaultInterpolatedStringHandler.AppendFormatted(component4.text); defaultInterpolatedStringHandler.AppendLiteral("', Font="); Font font2 = component4.font; defaultInterpolatedStringHandler.AppendFormatted((font2 != null) ? ((Object)font2).name : null); defaultInterpolatedStringHandler.AppendLiteral(", Size="); defaultInterpolatedStringHandler.AppendFormatted(component4.fontSize); defaultInterpolatedStringHandler.AppendLiteral(", Color="); defaultInterpolatedStringHandler.AppendFormatted<Color>(((Graphic)component4).color); defaultInterpolatedStringHandler.AppendLiteral(", Alignment="); defaultInterpolatedStringHandler.AppendFormatted<TextAnchor>(component4.alignment); Debug.Log(Object.op_Implicit(defaultInterpolatedStringHandler.ToStringAndClear())); } Button component5 = go.GetComponent<Button>(); if ((Object)(object)component5 != (Object)null) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(31, 5); defaultInterpolatedStringHandler.AppendFormatted(text); defaultInterpolatedStringHandler.AppendLiteral(" Button: Transition="); defaultInterpolatedStringHandler.AppendFormatted<Transition>(((Selectable)component5).transition); defaultInterpolatedStringHandler.AppendLiteral(", Colors="); ColorBlock colors = ((Selectable)component5).colors; defaultInterpolatedStringHandler.AppendFormatted<Color>(((ColorBlock)(ref colors)).normalColor); defaultInterpolatedStringHandler.AppendLiteral("/"); colors = ((Selectable)component5).colors; defaultInterpolatedStringHandler.AppendFormatted<Color>(((ColorBlock)(ref colors)).highlightedColor); defaultInterpolatedStringHandler.AppendLiteral("/"); colors = ((Selectable)component5).colors; defaultInterpolatedStringHandler.AppendFormatted<Color>(((ColorBlock)(ref colors)).pressedColor); Debug.Log(Object.op_Implicit(defaultInterpolatedStringHandler.ToStringAndClear())); } Toggle component6 = go.GetComponent<Toggle>(); if ((Object)(object)component6 != (Object)null) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(24, 3); defaultInterpolatedStringHandler.AppendFormatted(text); defaultInterpolatedStringHandler.AppendLiteral(" Toggle: IsOn="); defaultInterpolatedStringHandler.AppendFormatted(component6.isOn); defaultInterpolatedStringHandler.AppendLiteral(", Graphic="); Graphic graphic = component6.graphic; defaultInterpolatedStringHandler.AppendFormatted((graphic != null) ? ((Object)graphic).name : null); Debug.Log(Object.op_Implicit(defaultInterpolatedStringHandler.ToStringAndClear())); } Slider component7 = go.GetComponent<Slider>(); if ((Object)(object)component7 != (Object)null) { Debug.Log(Object.op_Implicit($"{text} Slider: Min={component7.minValue}, Max={component7.maxValue}, Value={component7.value}")); } HorizontalOrVerticalLayoutGroup component8 = go.GetComponent<HorizontalOrVerticalLayoutGroup>(); if ((Object)(object)component8 != (Object)null) { Debug.Log(Object.op_Implicit($"{text} LayoutGroup: Padding={((LayoutGroup)component8).padding}, Spacing={component8.spacing}")); } ContentSizeFitter component9 = go.GetComponent<ContentSizeFitter>(); if ((Object)(object)component9 != (Object)null) { Debug.Log(Object.op_Implicit($"{text} ContentSizeFitter: HorizontalFit={component9.horizontalFit}, VerticalFit={component9.verticalFit}")); } for (int i = 0; i < go.transform.childCount; i++) { Transform child = go.transform.GetChild(i); DumpUI(((Component)child).gameObject, depth + 1); } } } } } namespace BloodCraftEZLife.UI { public class BCUIManager : UIManagerBase { public IPanelBase _contentPanel; private readonly List<string> _visibilityAffectedPanels = new List<string>(); private List<IPanelBase> UIPanels { get; } = new List<IPanelBase>(); 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 AdjustOpacity() { //IL_0048: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) foreach (IPanelBase uIPanel in UIPanels) { if (uIPanel is PanelBase panelBase) { Image component = panelBase.ContentRoot.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = Extensions.GetTransparent(new Color(((Graphic)component).color.r, ((Graphic)component).color.g, ((Graphic)component).color.b), Settings.UITransparency); } } } } public void AddPanel(PanelType type, string param = null) { switch (type) { case PanelType.Base: _contentPanel = new ContentPanel(base.UiBase); break; case PanelType.PopupPanel: { PopupPanel panel2 = GetPanel<PopupPanel>(); if (panel2 == null) { PopupPanel item2 = new PopupPanel(base.UiBase); UIPanels.Add(item2); } else { panel2.SetActive(active: true); } break; } case PanelType.TeleportList: { TeleportListPanel panel5 = GetPanel<TeleportListPanel>(); if (panel5 == null) { TeleportListPanel item5 = new TeleportListPanel(base.UiBase); UIPanels.Add(item5); } else { panel5.SetActive(active: true); } break; } case PanelType.SettingsPanel: { SettingsPanel panel7 = GetPanel<SettingsPanel>(); if (panel7 == null) { SettingsPanel item7 = new SettingsPanel(base.UiBase); UIPanels.Add(item7); } else { panel7.SetActive(active: true); } break; } case PanelType.HotkeysPanel: { HotkeysPanel panel3 = GetPanel<HotkeysPanel>(); if (panel3 == null) { HotkeysPanel item3 = new HotkeysPanel(base.UiBase); UIPanels.Add(item3); } else { panel3.SetActive(active: true); } break; } case PanelType.InputBox: { CommandInput panel6 = GetPanel<CommandInput>(); if (panel6 == null) { CommandInput item6 = new CommandInput(base.UiBase); UIPanels.Add(item6); } else { panel6.SetActive(active: true); } break; } case PanelType.PullPanel: { PullItemsPanel panel4 = GetPanel<PullItemsPanel>(); if (panel4 == null) { PullItemsPanel item4 = new PullItemsPanel(base.UiBase); UIPanels.Add(item4); } else { panel4.SetActive(!panel4.Enabled); } break; } case PanelType.TestPanel: { TestPanel panel = GetPanel<TestPanel>(); if (panel == null) { TestPanel item = new TestPanel(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; } } } namespace BloodCraftEZLife.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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) 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} id:{id}"); 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, bool bold = false) { //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_0089: 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_008e: 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; ((TMP_Text)val2).m_isUsingBold = bold; 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