Decompiled source of BloodCraftUI OnlyFams v1.1.0
BepInEx\plugins\panthernet.BloodCraftUI.OnlyFams.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.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 BepInEx.Unity.IL2CPP.Utils.Collections; using BloodCraftUI.Behaviors; using BloodCraftUI.Config; using BloodCraftUI.Patches; using BloodCraftUI.Services; using BloodCraftUI.UI; using BloodCraftUI.UI.CustomLib; using BloodCraftUI.UI.CustomLib.Cells; using BloodCraftUI.UI.CustomLib.Cells.Handlers; using BloodCraftUI.UI.CustomLib.Controls; using BloodCraftUI.UI.CustomLib.Panel; using BloodCraftUI.UI.CustomLib.Util; using BloodCraftUI.UI.ModContent; using BloodCraftUI.UI.ModContent.CustomElements; using BloodCraftUI.UI.ModContent.Data; using BloodCraftUI.UI.ModernLib; using BloodCraftUI.UI.UniverseLib.UI; using BloodCraftUI.UI.UniverseLib.UI.Models; using BloodCraftUI.UI.UniverseLib.UI.ObjectPool; using BloodCraftUI.UI.UniverseLib.UI.Panels; using BloodCraftUI.UI.UniverseLib.UI.Widgets; using BloodCraftUI.UI.UniverseLib.UI.Widgets.ScrollView; using BloodCraftUI.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.Physics; 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.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("panthernet")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("BloodCraft mod UI")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+ea2c65ef3438456010e5a3860c9b7514eea2e240")] [assembly: AssemblyProduct("panthernet.BloodCraftUI.OnlyFams")] [assembly: AssemblyTitle("panthernet.BloodCraftUI.OnlyFams")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BloodCraftUI { [BepInProcess("VRising.exe")] [BepInPlugin("panthernet.BloodCraftUI", "BloodCraftUI", "1.1.0")] public class Plugin : BasePlugin { private static World _client; public const bool IS_TESTING = false; private static Harmony _harmonyBootPatch; private static Harmony _harmonyChatPatch; private static Harmony _harmonyInitPatch; private static Harmony _harmonyCanvasPatch; private static Harmony _harmonyMenuPatch; internal static Harmony HarmonyVersionStringPatch; private static FrameTimer _uiInitializedTimer; public static Plugin Instance { get; private set; } public static ManualLogSource LogInstance => ((BasePlugin)Instance).Log; public static Settings Settings { get; private set; } public static EntityManager EntityManager => _client.EntityManager; public static bool IsInitialized { get; private set; } public static bool IsGameDataInitialized { get; set; } public static BCUIManager UIManager { get; set; } public static BloodCraftUI.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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown IsClient = Application.productName != "VRisingServer"; LogUtils.Init(((BasePlugin)this).Log); Instance = this; if (!IsClient) { LogUtils.LogInfo($"{"BloodCraftUI"}[{"1.1.0"}] is a client mod! ({Application.productName})"); return; } Settings = new Settings().InitConfig(); Theme.Opacity = Settings.UITransparency; UIManager = new BCUIManager(); CoreUpdateBehavior = new BloodCraftUI.UI.ModernLib.CoreUpdateBehavior(); CoreUpdateBehavior.Setup(); IsInitialized = true; _harmonyBootPatch = Harmony.CreateAndPatchAll(typeof(GameManagerPatch), (string)null); _harmonyMenuPatch = Harmony.CreateAndPatchAll(typeof(EscapeMenuPatch), (string)null); _harmonyCanvasPatch = Harmony.CreateAndPatchAll(typeof(UICanvasSystemPatch), (string)null); HarmonyVersionStringPatch = Harmony.CreateAndPatchAll(typeof(VersionStringPatch), (string)null); _harmonyChatPatch = Harmony.CreateAndPatchAll(typeof(ClientChatPatch), (string)null); _harmonyInitPatch = Harmony.CreateAndPatchAll(typeof(InitializationPatch), (string)null); ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("panthernet.BloodCraftUI"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.1.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); } public override bool Unload() { _harmonyBootPatch.UnpatchSelf(); _harmonyCanvasPatch.UnpatchSelf(); _harmonyMenuPatch.UnpatchSelf(); HarmonyVersionStringPatch.UnpatchSelf(); _harmonyChatPatch.UnpatchSelf(); _harmonyInitPatch.UnpatchSelf(); return true; } private void AddTestUI() { UIManager.SetupAndShowUI(); } public static void GameDataOnInitialize(World world) { if (!IsGameDataInitialized && IsClient) { _client = world; IsGameDataInitialized = true; _harmonyBootPatch.UnpatchSelf(); _uiInitializedTimer = new FrameTimer(); _uiInitializedTimer.Initialise(delegate { _uiInitializedTimer.Stop(); }, TimeSpan.FromSeconds(5.0)).Start(); } } public static void UIOnInitialize() { UIManager.SetupAndShowUI(); if (Settings.AutoEnableFamiliarEquipment) { MessageService.StartAutoEnableFamiliarEquipmentSequence(); } BloodCraftStateService.Initialize(); LogUtils.LogInfo("UI Manager initialized"); } } public static class PluginInfo { public const string PLUGIN_GUID = "panthernet.BloodCraftUI"; public const string PLUGIN_NAME = "BloodCraftUI"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace BloodCraftUI.Utils { internal static class Extensions { public delegate void WithRefHandler<T>(ref T item); private const string EMPTY_KEY = "LocalizationKey.Empty"; private const string PREFIX = "Entity("; private const int LENGTH = 7; private static EntityManager EntityManager => Plugin.EntityManager; public static bool IsEnabled(this TextMeshProUGUI entity) { bool? obj; if (entity == null) { obj = null; } else { GameObject gameObject = ((Component)entity).gameObject; obj = ((gameObject != null) ? new bool?(gameObject.activeSelf) : null); } bool? flag = obj; return flag.GetValueOrDefault(); } public static Color GetTransparent(this Color baseColor, float alpha = 0.7f) { //IL_0000: 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_000c: 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) 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_0000: 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_0017: 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_0000: 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_0008: 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_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) TypeIndex typeIndex = new ComponentType(Il2CppType.Of<T>(), (AccessMode)0).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_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) //IL_001a: Unknown result type (might be due to invalid IL or missing references) TypeIndex typeIndex = new ComponentType(Il2CppType.Of<T>(), (AccessMode)0).TypeIndex; EntityManager entityManager = EntityManager; return Marshal.PtrToStructure<T>(new IntPtr(((EntityManager)(ref entityManager)).GetComponentDataRawRW(entity, typeIndex))); } public unsafe static T Read<T>(this Entity entity) where T : struct { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) //IL_001a: Unknown result type (might be due to invalid IL or missing references) TypeIndex typeIndex = new ComponentType(Il2CppType.Of<T>(), (AccessMode)0).TypeIndex; EntityManager entityManager = EntityManager; return Marshal.PtrToStructure<T>(new IntPtr(((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, typeIndex))); } public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_000a: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0009: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0009: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0009: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0009: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0009: 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_0000: 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_0011: 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_0009: 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) 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_0007: 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) 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_0009: 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) 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_0000: 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) if (entity.Has<T>()) { entity.Remove<T>(); return true; } return false; } public static bool Has<T>(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0009: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0009: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_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_000b: 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_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) 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_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_000b: 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) player = Entity.Null; if (entity.Has<PlayerCharacter>()) { player = entity; return true; } return false; } public static bool IsPlayer(this Entity entity) { //IL_0000: 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_0000: 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_0012: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //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.TryGetComponent<Follower>(out Follower componentData) && componentData.Followed._Value.IsPlayer()) { return true; } return false; } public static string GetLocalizedName(this PrefabGUID prefabGuid) { //IL_0005: 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) 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return CreateGameplayEventServerUtility.GetBuffTarget(EntityManager, entity); } public static Entity GetSpellTarget(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return CreateGameplayEventServerUtility.GetSpellTarget(EntityManager, entity); } public static bool TryGetTeamEntity(this Entity entity, out Entity teamEntity) { //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_000b: 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_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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) 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_0000: 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_0010: 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_0018: Unknown result type (might be due to invalid IL or missing references) if (entity.HasValue() && entity.IndexWithinCapacity()) { EntityManager entityManager = EntityManager; return ((EntityManager)(ref entityManager)).Exists(entity); } return false; } public static bool IsDisabled(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return entity.Has<Disabled>(); } public static bool IsVBlood(this Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return entity.Has<VBloodUnit>(); } public static ulong GetSteamId(this Entity entity) { //IL_0000: 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_000a: 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_0025: 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_0000: 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_000a: 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_0000: 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_000a: 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_0000: 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_000a: 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 (character.TryGetComponent<PlayerCharacter>(out PlayerCharacter componentData)) { return componentData.UserEntity; } return Entity.Null; } public static User GetUser(this Entity entity) { //IL_0000: 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_000a: 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_0027: 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_0019: 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_0000: 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_000a: 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<EntityInput>(out EntityInput componentData)) { return componentData.AimPosition; } return float3.zero; } public static bool TryGetPosition(this Entity entity, out float3 position) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0000: 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_000a: 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<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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (entity.TryGetComponent<IsMinion>(out IsMinion componentData) && componentData.Value) { return true; } return false; } public static void Destroy(this Entity entity) { //IL_0000: 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_000d: 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_0000: 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_0010: 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_002b: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0059: 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_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) 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_000d: 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) if (entity.Has<FactionReference>()) { entity.With<FactionReference>((WithRefHandler<FactionReference>)delegate(ref FactionReference factionReference) { //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) factionReference.FactionGuid._Value = factionPrefabGUID; }); } } public static bool HasKeyValue<T>(this Dictionary<T, int> dic, T key, int value) { if (dic.ContainsKey(key)) { return dic[key] == value; } return false; } 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0014: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) return entity != Entity.Null; } public static bool IndexWithinCapacity(this Entity entity) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) ReadOnlySpan<char> span = ((object)(Entity)(ref entity)).ToString().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; return (uint)result2 < (uint)entityCapacity; } } internal static class FamHelper { public static Entity FindActiveFamiliar(Entity playerCharacter) { //IL_0000: 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_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_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_0029: 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()) { return enumerator.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_001a: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Invalid comparison between Unknown and I4 //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected I4, but got Unknown //IL_0142: 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_006c: Invalid comparison between Unknown and I4 //IL_0096: 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_00ec: 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: Invalid comparison between Unknown and I4 //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if (!schoolType.HasValue) { return new ColorNameData { Name = "Normal", Color = Color.white }; } if (schoolType.HasValue) { AbilitySchoolType valueOrDefault = schoolType.GetValueOrDefault(); if ((int)valueOrDefault <= 8) { switch (valueOrDefault - 1) { default: if ((int)valueOrDefault != 8) { break; } return new ColorNameData { Name = "Frost", Color = new Color(0f, 255f, 255f) }; case 0: return new ColorNameData { Name = "Blood", Color = new Color(255f, 0f, 0f) }; case 1: return new ColorNameData { Name = "Unholy", Color = new Color(0f, 255f, 0f) }; case 3: return new ColorNameData { Name = "Illusion", Color = new Color(0f, 128f, 128f) }; case 2: break; } } else { if ((int)valueOrDefault == 16) { return new ColorNameData { Name = "Chaos", Color = new Color(160f, 32f, 240f) }; } if ((int)valueOrDefault == 32) { return new ColorNameData { Name = "Storm", Color = new Color(255f, 215f, 0f) }; } } } throw new ArgumentOutOfRangeException("schoolType"); } internal static AbilitySchoolType? GetSchoolFromHexColor(string colorText) { return colorText switch { "#008080" => (AbilitySchoolType)4, "#00FFFF" => (AbilitySchoolType)8, "#FF0000" => (AbilitySchoolType)1, "#FFD700" => (AbilitySchoolType)32, "#A020F0" => (AbilitySchoolType)16, "#00FF00" => (AbilitySchoolType)2, _ => null, }; } } public static class LogUtils { private static ManualLogSource Log; public static void LogDebugError(Exception exception) { ManualLogSource log = Log; if (log != null) { log.LogError((object)exception); } } public static void Init(ManualLogSource log) { Log = log; } public static void LogInfo(string text) { ManualLogSource log = Log; if (log != null) { log.LogInfo((object)text); } } public static void LogError(string text) { ManualLogSource log = Log; if (log != null) { log.LogError((object)text); } } public static void LogWarning(string text) { ManualLogSource log = Log; if (log != null) { log.LogWarning((object)text); } } } internal static class TimerHelper { public static void OneTickTimer(float interval, Action action) { System.Timers.Timer timer = new System.Timers.Timer(interval); timer.Elapsed += delegate { action(); timer.Stop(); timer.Dispose(); }; timer.AutoReset = false; timer.Enabled = true; } } public static class UnityHelper { public static GameObject FindInHierarchy(string path) { if (string.IsNullOrEmpty(path)) { return null; } string[] array = path.Split('|'); if (array.Length == 0) { return null; } GameObject val = GameObject.Find(array[0]); if ((Object)(object)val == (Object)null) { return null; } for (int i = 1; i < array.Length; i++) { Transform val2 = val.transform.Find(array[i]); if ((Object)(object)val2 == (Object)null) { return null; } val = ((Component)val2).gameObject; } return val; } public static void LogShader(Material material) { //IL_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_0050: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected I4, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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); switch (propertyType - 1) { case 0: value = material.shader.GetPropertyDefaultVectorValue(i); break; case 1: value = material.shader.GetPropertyDefaultFloatValue(i); break; case 4: value = material.shader.GetPropertyDefaultIntValue(i); break; } LogUtils.LogInfo($"Property {i}: {propertyName} - {propertyDescription} - {((propertyAttributes != null) ? string.Join(',', ((IEnumerable<string>)propertyAttributes).Select((string a) => a)) : null)} - {propertyFlags} - {propertyType} - {value} - {val.x}:{val.y}"); } } } } namespace BloodCraftUI.UI { public class BCUIManager : UIManagerBase { private IPanelBase _contentPanel; private readonly List<string> _visibilityAffectedPanels = new List<string>(); private List<IPanelBase> UIPanels { get; } = new List<IPanelBase>(); public override void Reset() { base.Reset(); foreach (IPanelBase uIPanel in UIPanels) { if (uIPanel is ResizeablePanelBase resizeablePanelBase) { resizeablePanelBase.Reset(); } uIPanel.Destroy(); } UIPanels.Clear(); } protected override void AddMainContentPanel() { AddPanel(PanelType.Base); } public override void SetActive(bool active) { if (active && _visibilityAffectedPanels.Any()) { foreach (IPanelBase item in _visibilityAffectedPanels.Select((string panel) => UIPanels.FirstOrDefault((IPanelBase a) => a.PanelId.Equals(panel)))) { item?.SetActiveOnly(active: true); } _visibilityAffectedPanels.Clear(); } if (!active) { foreach (IPanelBase item2 in UIPanels.Where((IPanelBase a) => a.Enabled)) { _visibilityAffectedPanels.Add(item2.PanelId); item2.SetActiveOnly(active: false); } } _contentPanel?.SetActive(active); } public void AddPanel(PanelType type, string param = null) { switch (type) { case PanelType.Base: _contentPanel = new ContentPanel(base.UiBase); break; case PanelType.BoxList: { BoxListPanel panel3 = GetPanel<BoxListPanel>(); if (panel3 == null) { BoxListPanel item3 = new BoxListPanel(base.UiBase); UIPanels.Add(item3); } else { panel3.SetActive(active: true); } break; } case PanelType.BoxContent: { BoxContentPanel boxPanel = GetBoxPanel(param); if (boxPanel == null) { UIPanels.Add(new BoxContentPanel(base.UiBase, param)); } else { boxPanel.SetActive(active: true); } break; } case PanelType.FamStats: { FamStatsPanel panel2 = GetPanel<FamStatsPanel>(); if (panel2 == null) { FamStatsPanel item2 = new FamStatsPanel(base.UiBase); UIPanels.Add(item2); } else { panel2.SetActive(!panel2.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; } internal BoxContentPanel GetBoxPanel(string currentBox) { return UIPanels.FirstOrDefault((IPanelBase a) => a.PanelType == PanelType.BoxContent && a.PanelId.Equals(currentBox)) as BoxContentPanel; } } public class FrameTimer { private bool _enabled; private bool _isRunning; private bool _runOnce; private DateTime _executeAfter = DateTime.MinValue; private DateTime _lastExecution = DateTime.MinValue; private TimeSpan _delay; private Action _action; private Func<TimeSpan> _delayGenerator; public TimeSpan TimeSinceLastRun => DateTime.Now - _lastExecution; public bool Enabled => _enabled; public FrameTimer Initialise(Action action, TimeSpan delay, bool runOnce = true) { _delayGenerator = null; _delay = delay; _executeAfter = DateTime.Now + delay; _action = action; _runOnce = runOnce; return this; } public FrameTimer Initialise(Action action, Func<TimeSpan> delayGenerator, bool runOnce = true) { _delayGenerator = delayGenerator; _delay = _delayGenerator(); _executeAfter = DateTime.Now + _delay; _action = action; _runOnce = runOnce; return this; } public void Start() { Refresh(); if (!_enabled) { _lastExecution = DateTime.MinValue; BloodCraftUI.Behaviors.CoreUpdateBehavior.Actions.Add(GameFrame_OnUpdate); _enabled = true; } } public void Stop() { if (_enabled) { BloodCraftUI.Behaviors.CoreUpdateBehavior.Actions.Remove(GameFrame_OnUpdate); _enabled = false; } } private void Refresh() { if (_delayGenerator != null) { _delay = _delayGenerator(); } _executeAfter = DateTime.Now + _delay; } private void GameFrame_OnUpdate() { Update(); } private void Update() { if (!_enabled || _isRunning || _executeAfter >= DateTime.Now) { return; } _isRunning = true; try { _action(); _lastExecution = DateTime.Now; } catch (Exception ex) { LogUtils.LogError("Timer failed " + ex.Message + "\n" + ex.StackTrace); _runOnce = true; Stop(); } finally { if (_runOnce) { Stop(); } else { Refresh(); } _isRunning = false; } } } } namespace BloodCraftUI.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 { if (Object.op_Implicit((Object)(object)RootObject)) { return RootObject.activeSelf; } return false; } set { UniversalUI.SetUIActive(ID, value); } } public UIBase(string id, Action updateMethod) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(id)) { throw new ArgumentException("Cannot register a UI with a null or empty id!"); } if (UniversalUI.registeredUIs.ContainsKey(id)) { throw new ArgumentException("A UI with the id '" + id + "' is already registered!"); } ID = id; UpdateMethod = updateMethod; RootObject = UIFactory.CreateUIObject(id + "_Root", UniversalUI.CanvasRoot); RootObject.SetActive(false); RootRect = RootObject.GetComponent<RectTransform>(); Canvas = RootObject.AddComponent<Canvas>(); Canvas.renderMode = (RenderMode)0; Canvas.referencePixelsPerUnit = 100f; Canvas.sortingOrder = TOP_SORTORDER; Canvas.overrideSorting = true; Scaler = RootObject.AddComponent<CanvasScaler>(); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Screen.width, (float)Screen.height); LogUtils.LogInfo($"Scaler ref: {val.x}x{val.y}"); Scaler.referenceResolution = val; Scaler.uiScaleMode = (ScaleMode)1; Scaler.screenMatchMode = (ScreenMatchMode)0; RootObject.AddComponent<GraphicRaycaster>(); RectTransform component = RootObject.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.pivot = new Vector2(0.5f, 0.5f); Panels = CreatePanelManager(); RootObject.SetActive(true); UniversalUI.registeredUIs.Add(id, this); UniversalUI.uiBases.Add(this); } protected virtual PanelManager CreatePanelManager() { return new PanelManager(this); } public void SetOnTop() { RootObject.transform.SetAsLastSibling(); foreach (UIBase uiBasis in UniversalUI.uiBases) { int num = UniversalUI.CanvasRoot.transform.childCount - ((Transform)uiBasis.RootRect).GetSiblingIndex(); uiBasis.Canvas.sortingOrder = TOP_SORTORDER - num; } UniversalUI.uiBases.Sort((UIBase a, UIBase b) => b.RootObject.transform.GetSiblingIndex().CompareTo(a.RootObject.transform.GetSiblingIndex())); } internal void Update() { try { Panels.Update(); UpdateMethod?.Invoke(); } catch (Exception value) { LogUtils.LogWarning($"Exception invoking update method for {ID}: {value}"); } } } public static class UIFactory { internal static Vector2 largeElementSize = new Vector2(100f, 30f); internal static Vector2 smallElementSize = new Vector2(25f, 25f); internal static Vector2 outlineDistance = new Vector2(2f, 2f); public static GameObject PlayerHUDCanvas { get; set; } public static TMP_FontAsset Font { get; set; } public static Material FontMaterial { get; set; } public static GameObject CreateUIObject(string name, GameObject parent, Vector2 sizeDelta = default(Vector2)) { //IL_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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0036: 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); } val.AddComponent<RectTransform>().sizeDelta = sizeDelta; return val; } internal static void SetDefaultTextValues(TextMeshProUGUI text) { //IL_0001: 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_0017: 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_002b: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0119: 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_0004: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_0142: 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 obj = contentHolder.AddComponent<Image>(); obj.type = (Type)3; ((Graphic)obj).color = (Color)(((??)bgColor) ?? Theme.DarkBackground); Outline obj2 = contentHolder.AddComponent<Outline>(); ((Shadow)obj2).effectColor = Theme.DarkBackground; ((Shadow)obj2).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_0004: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_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) GameObject obj = CreateUIObject(name, parent); UIFactory.SetLayoutGroup<VerticalLayoutGroup>(obj, (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)obj.AddComponent<Image>()).color = (Color)(((??)bgColor) ?? Theme.PanelBackground); return obj; } 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_0004: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_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) GameObject obj = CreateUIObject(name, parent); UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(obj, (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)obj.AddComponent<Image>()).color = (Color)(((??)bgColor) ?? Theme.PanelBackground); return obj; } public static GameObject CreateGridGroup(GameObject parent, string name, Vector2 cellSize, Vector2 spacing, Color? bgColor = null) { //IL_0004: 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_001e: 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_0045: 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) GameObject obj = CreateUIObject(name, parent); GridLayoutGroup obj2 = obj.AddComponent<GridLayoutGroup>(); ((LayoutGroup)obj2).childAlignment = (TextAnchor)0; obj2.cellSize = cellSize; obj2.spacing = spacing; ((Graphic)obj.AddComponent<Image>()).color = (Color)(((??)bgColor) ?? Theme.PanelBackground); return obj; } public static LabelRef CreateLabel(GameObject parent, string name, string defaultText, TextAlignmentOptions alignment = 514, Color? color = null, int fontSize = 14, float outlineWidth = 0.15f, Color? outlineColor = null) { //IL_0004: 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_002e: 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_004b: 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_006f: 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) GameObject val = CreateUIObject(name, parent); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); ((Graphic)val2).color = (Color)(((??)color) ?? Theme.DefaultText); ((TMP_Text)val2).font = Font; ((TMP_Text)val2).text = defaultText; ((TMP_Text)val2).alignment = alignment; ((TMP_Text)val2).fontSize = fontSize; try { ((TMP_Text)val2).outlineWidth = outlineWidth; ((TMP_Text)val2).outlineColor = Color32.op_Implicit((Color)(((??)outlineColor) ?? Color.black)); } catch (Exception) { } return new LabelRef { GameObject = val, TextMesh = val2 }; } public static ButtonRef CreateButton(GameObject parent, string name, string text, Color? normalColor = null) { //IL_0014: 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_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) //IL_0024: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_0097: 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_0002: 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_001b: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent, smallElementSize); GameObject val2 = CreateUIObject("Text", val); Image obj = val.AddComponent<Image>(); obj.type = (Type)1; ((Graphic)obj).color = Theme.White; Outline obj2 = val.AddComponent<Outline>(); ((Shadow)obj2).effectColor = Theme.DarkBackground; ((Shadow)obj2).effectDistance = outlineDistance; Button obj3 = val.AddComponent<Button>(); SetDefaultSelectableValues((Selectable)(object)obj3); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((Selectable)obj3).colors = colors; TextMeshProUGUI obj4 = val2.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj4).text = text; SetDefaultTextValues(obj4); ((TMP_Text)obj4).alignment = (TextAlignmentOptions)514; RectTransform component = val2.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; SetButtonDeselectListener(obj3); return new ButtonRef(obj3); } 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_0002: 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_001b: 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_0030: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: 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_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent, smallElementSize); GameObject obj = CreateUIObject("Background", val); GameObject val2 = CreateUIObject("Fill Area", val); GameObject val3 = CreateUIObject("Fill", val2); GameObject val4 = CreateUIObject("Handle Slide Area", val); GameObject val5 = CreateUIObject("Handle", val4); Image obj2 = obj.AddComponent<Image>(); obj2.type = (Type)1; ((Graphic)obj2).color = Theme.PanelBackground; RectTransform component = obj.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0.25f); component.anchorMax = new Vector2(1f, 0.75f); component.sizeDelta = new Vector2(0f, 0f); RectTransform component2 = val2.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 obj3 = val3.AddComponent<Image>(); obj3.type = (Type)1; ((Graphic)obj3).color = Theme.SliderFill; val3.GetComponent<RectTransform>().sizeDelta = new Vector2(10f, 0f); RectTransform component3 = val4.GetComponent<RectTransform>(); component3.sizeDelta = new Vector2(-20f, 0f); component3.anchorMin = new Vector2(0f, 0f); component3.anchorMax = new Vector2(1f, 1f); Image val6 = val5.AddComponent<Image>(); ((Graphic)val6).color = Theme.SliderHandle; Outline obj4 = val5.AddComponent<Outline>(); ((Shadow)obj4).effectColor = Theme.DarkBackground; ((Shadow)obj4).effectDistance = outlineDistance; val5.GetComponent<RectTransform>().sizeDelta = new Vector2(20f, 0f); slider = val.AddComponent<Slider>(); slider.fillRect = val3.GetComponent<RectTransform>(); slider.handleRect = val5.GetComponent<RectTransform>(); ((Selectable)slider).targetGraphic = (Graphic)(object)val6; slider.direction = (Direction)0; ColorBlock val7 = default(ColorBlock); ((ColorBlock)(ref val7)).normalColor = Theme.SliderNormal; ((ColorBlock)(ref val7)).highlightedColor = Theme.SliderHighlighted; ((ColorBlock)(ref val7)).pressedColor = Theme.SliderPressed; ((ColorBlock)(ref val7)).colorMultiplier = 1f; ColorBlock colors = val7; ((Selectable)slider).colors = colors; return val; } public static GameObject CreateScrollbar(GameObject parent, string name, out Scrollbar scrollbar) { //IL_0002: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00a9: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent, smallElementSize); GameObject val2 = CreateUIObject("Sliding Area", val); GameObject obj = CreateUIObject("Handle", val2); Image obj2 = val.AddComponent<Image>(); obj2.type = (Type)1; ((Graphic)obj2).color = Theme.DarkBackground; Image val3 = obj.AddComponent<Image>(); val3.type = (Type)1; ((Graphic)val3).color = Theme.SliderHandle; RectTransform component = val2.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(-20f, -20f); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; RectTransform component2 = obj.GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(20f, 20f); scrollbar = val.AddComponent<Scrollbar>(); scrollbar.handleRect = component2; ((Selectable)scrollbar).targetGraphic = (Graphic)(object)val3; SetDefaultSelectableValues((Selectable)(object)scrollbar); return val; } public static ToggleRef CreateToggle(GameObject parent, string name, Color bgColor = default(Color), int checkWidth = 20, int checkHeight = 20, string text = "") { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) ToggleRef toggleRef = new ToggleRef(); toggleRef.GameObject = CreateUIObject(name, parent, smallElementSize); UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(toggleRef.GameObject, (bool?)false, (bool?)false, (bool?)true, (bool?)true, (int?)5, (int?)0, (int?)0, (int?)0, (int?)0, (TextAnchor?)(TextAnchor)3); toggleRef.Toggle = toggleRef.GameObject.AddComponent<Toggle>(); toggleRef.Toggle.isOn = true; SetDefaultSelectableValues((Selectable)(object)toggleRef.Toggle); GameObject val = CreateUIObject("Background", toggleRef.GameObject); Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = ((bgColor == default(Color)) ? Theme.ToggleNormal : bgColor); UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(val, (bool?)true, (bool?)true, (bool?)true, (bool?)true, (int?)0, (int?)2, (int?)2, (int?)2, (int?)2, (TextAnchor?)null); SetLayoutElement(val, checkWidth, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0); Image val3 = CreateUIObject("Checkmark", val).AddComponent<Image>(); ((Graphic)val3).color = Theme.ToggleCheckMark; GameObject val4 = CreateUIObject("Label", toggleRef.GameObject); toggleRef.Text = val4.AddComponent<TextMeshProUGUI>(); ((TMP_Text)toggleRef.Text).text = text; ((TMP_Text)toggleRef.Text).alignment = (TextAlignmentOptions)4097; SetDefaultTextValues(toggleRef.Text); SetLayoutElement(val4, 0, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0); toggleRef.Toggle.graphic = (Graphic)(object)val3; ((Selectable)toggleRef.Toggle).targetGraphic = (Graphic)(object)val2; return toggleRef; } public static InputFieldRef CreateInputField(GameObject parent, string name, string placeHolderText) { //IL_0004: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0084: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateUIObject(name, parent); Image val2 = val.AddComponent<Image>(); val2.type = (Type)1; ((Graphic)val2).color = Theme.DarkBackground; TMP_InputField obj = val.AddComponent<TMP_InputField>(); Navigation navigation = ((Selectable)obj).navigation; navigation.mode = (Mode)0; ((Selectable)obj).navigation = navigation; obj.lineType = (LineType)0; ((Selectable)obj).interactable = true; ((Selectable)obj).transition = (Transition)1; ((Selectable)obj).targetGraphic = (Graphic)(object)val2; ColorBlock val3 = default(ColorBlock); ((ColorBlock)(ref val3)).normalColor = Theme.InputFieldNormal; ((ColorBlock)(ref val3)).highlightedColor = Theme.InputFieldHighlighted; ((ColorBlock)(ref val3)).pressedColor = Theme.InputFieldPressed; ((ColorBlock)(ref val3)).colorMultiplier = 1f; ColorBlock colors = val3; ((Selectable)obj).colors = colors; GameObject val4 = CreateUIObject("TextArea", val); val4.AddComponent<RectMask2D>(); RectTransform component = val4.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; GameObject obj2 = CreateUIObject("Placeholder", val4); TextMeshProUGUI val5 = obj2.AddComponent<TextMeshProUGUI>(); SetDefaultTextValues(val5); ((TMP_Text)val5).text = placeHolderText ?? "..."; ((Graphic)val5).color = Theme.PlaceHolderText; ((TMP_Text)val5).enableWordWrapping = true; ((TMP_Text)val5).alignment = (TextAlignmentOptions)4097; ((TMP_Text)val5).fontSize = 14f; RectTransform component2 = obj2.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; obj.placeholder = (Graphic)(object)val5; GameObject obj3 = CreateUIObject("Text", val4); TextMeshProUGUI val6 = obj3.AddComponent<TextMeshProUGUI>(); SetDefaultTextValues(val6); ((TMP_Text)val6).text = ""; ((Graphic)val6).color = Theme.DefaultText; ((TMP_Text)val6).enableWordWrapping = true; ((TMP_Text)val6).alignment = (TextAlignmentOptions)4097; ((TMP_Text)val6).fontSize = 14f; RectTransform component3 = obj3.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.offsetMin = Vector2.zero; component3.offsetMax = Vector2.zero; obj.textComponent = (TMP_Text)(object)val6; obj.characterLimit = 16000; return new InputFieldRef(obj); } public static GameObject CreateDropdown(GameObject parent, string name, out TMP_Dropdown dropdown, string defaultItemText, int itemFontSize, Action<int> onValueChanged, string[] defaultOptions = null) { //IL_0008: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_004b: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_034f: 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_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Expected O, but got Unknown GameObject val = CreateUIObject(name, parent, largeElementSize); GameObject obj = CreateUIObject("Label", val); GameObject obj2 = CreateUIObject("Arrow", val); GameObject val2 = CreateUIObject("Template", val); GameObject val3 = CreateUIObject("Viewport", val2); GameObject val4 = CreateUIObject("Content", val3); GameObject val5 = CreateUIObject("Item", val4); GameObject val6 = CreateUIObject("Item Background", val5); CreateUIObject("Item Checkmark", val5); GameObject val7 = CreateUIObject("Item Label", val5); Scrollbar scrollbar; GameObject obj3 = CreateScrollbar(val2, "DropdownScroll", out scrollbar); scrollbar.SetDirection((Direction)2, true); ColorBlock val8 = default(ColorBlock); ((ColorBlock)(ref val8)).normalColor = Theme.DropDownScrollBarNormal; ((ColorBlock)(ref val8)).highlightedColor = Theme.DropDownScrollbarHighlighted; ((ColorBlock)(ref val8)).pressedColor = Theme.DropDownScrollbarPressed; ((ColorBlock)(ref val8)).colorMultiplier = 1f; ColorBlock colors = val8; ((Selectable)scrollbar).colors = colors; RectTransform component = obj3.GetComponent<RectTransform>(); component.anchorMin = Vector2.right; component.anchorMax = Vector2.one; component.pivot = Vector2.one; component.sizeDelta = new Vector2(component.sizeDelta.x, 0f); TextMeshProUGUI val9 = val7.AddComponent<TextMeshProUGUI>(); SetDefaultTextValues(val9); ((TMP_Text)val9).alignment = (TextAlignmentOptions)4097; ((TMP_Text)val9).text = defaultItemText; ((TMP_Text)val9).fontSize = itemFontSize; TextMeshProUGUI obj4 = obj2.AddComponent<TextMeshProUGUI>(); SetDefaultTextValues(obj4); ((TMP_Text)obj4).text = "▼"; RectTransform component2 = obj2.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(1f, 0.5f); component2.anchorMax = new Vector2(1f, 0.5f); component2.sizeDelta = new Vector2(20f, 20f); component2.anchoredPosition = new Vector2(-15f, 0f); Image val10 = val6.AddComponent<Image>(); ((Graphic)val10).color = Theme.SliderFill; Toggle itemToggle = val5.AddComponent<Toggle>(); ((Selectable)itemToggle).targetGraphic = (Graphic)(object)val10; itemToggle.isOn = true; val8 = default(ColorBlock); ((ColorBlock)(ref val8)).normalColor = Theme.DropDownToggleNormal; ((ColorBlock)(ref val8)).highlightedColor = Theme.DropDownToggleHighlighted; ((ColorBlock)(ref val8)).colorMultiplier = 1f; ColorBlock colors2 = val8; ((Selectable)itemToggle).colors = colors2;