using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Lc.Common; using LethalCompanyInputUtils; using LethalCompanyInputUtils.Api; using LethalCompanyInputUtils.Components; using LethalCompanyInputUtils.Config; using LethalCompanyInputUtils.Glyphs; using LethalControls.Aim; using LethalControls.Bindings; using LethalControls.Core; using LethalControls.Core.Aim; using LethalControls.Core.Favorites; using LethalControls.Favorites; using LethalControls.UI; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("LethalCompanyInputUtils")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("thatumi")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.8.0")] [assembly: AssemblyInformationalVersion("0.2.8+7b112dc5529fd329152c1ec62e374aa48dc435fc")] [assembly: AssemblyProduct("LethalControls")] [assembly: AssemblyTitle("LethalControls")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.2.8.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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 Lc.Common { internal static class FontProvider { private static TMP_FontAsset? _hudFont; internal static TMP_FontAsset? Get() { if ((Object)(object)_hudFont != (Object)null) { return _hudFont; } TMP_FontAsset val = ReflectionGuard.Run("FontProvider.HUD", delegate { HUDManager instance = HUDManager.Instance; return (!((Object)(object)instance != (Object)null) || !((Object)(object)instance.chatText != (Object)null)) ? null : ((TMP_Text)instance.chatText).font; }, null); if ((Object)(object)val != (Object)null) { _hudFont = val; return val; } TMP_FontAsset val2 = ReflectionGuard.Run("FontProvider.Default", () => TMP_Settings.defaultFontAsset, null); if ((Object)(object)val2 != (Object)null) { return val2; } TMP_FontAsset? obj = ReflectionGuard.Run("FontProvider.Any", () => Resources.FindObjectsOfTypeAll().FirstOrDefault(), null); if ((Object)(object)obj == (Object)null) { Log.WarnOnce("FontProvider.none", "FontProvider: no TMP font available yet; text will use TMP defaults"); } return obj; } internal static void Invalidate() { _hudFont = null; } } internal enum LogKind { Debug, Info, Warning, Error } internal static class Log { private static readonly object Gate = new object(); private static readonly HashSet OnceKeys = new HashSet(StringComparer.Ordinal); private static Action? _sink; internal static bool DebugEnabled { get; set; } internal static void SetSink(Action? sink) { _sink = sink; } internal static void Debug(string message) { if (DebugEnabled) { Write(LogKind.Debug, message); } } internal static void Info(string message) { Write(LogKind.Info, message); } internal static void Warn(string message) { Write(LogKind.Warning, message); } internal static void Error(string message) { Write(LogKind.Error, message); } internal static bool WarnOnce(string key, string message) { if (!MarkOnce(key)) { return false; } Write(LogKind.Warning, message); return true; } internal static bool ErrorOnce(string key, string message) { if (!MarkOnce(key)) { return false; } Write(LogKind.Error, message); return true; } internal static bool MarkOnce(string key) { lock (Gate) { return OnceKeys.Add(key); } } internal static void ResetOnce() { lock (Gate) { OnceKeys.Clear(); } } private static void Write(LogKind kind, string message) { Action sink = _sink; try { if (sink != null) { sink(kind, message); } else { Console.WriteLine("[" + kind.ToString() + "] " + message); } } catch { } } } internal static class LogBepInEx { internal static void Init(ManualLogSource source) { Log.SetSink(delegate(LogKind kind, string message) { switch (kind) { case LogKind.Debug: source.LogDebug((object)message); break; case LogKind.Info: source.LogInfo((object)message); break; case LogKind.Warning: source.LogWarning((object)message); break; default: source.LogError((object)message); break; } }); } } internal static class ReflectionGuard { internal const BindingFlags AllMembers = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private const BindingFlags Declared = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static readonly object Gate = new object(); private static readonly Dictionary DisabledReasons = new Dictionary(StringComparer.Ordinal); private static readonly Dictionary FailureCounts = new Dictionary(StringComparer.Ordinal); private static readonly Dictionary TypeCache = new Dictionary(StringComparer.Ordinal); internal static int MaxFailuresBeforeDisable { get; set; } = 25; internal static IReadOnlyDictionary DisabledFeatures { get { lock (Gate) { return new Dictionary(DisabledReasons, StringComparer.Ordinal); } } } internal static event Action? FeatureDisabled; internal static bool IsEnabled(string feature) { lock (Gate) { return !DisabledReasons.ContainsKey(feature); } } internal static void Disable(string feature, string reason) { lock (Gate) { if (DisabledReasons.ContainsKey(feature)) { return; } DisabledReasons[feature] = reason; } Log.Warn("[" + feature + "] disabled: " + reason); try { ReflectionGuard.FeatureDisabled?.Invoke(feature, reason); } catch { } } internal static void Reset() { lock (Gate) { DisabledReasons.Clear(); FailureCounts.Clear(); TypeCache.Clear(); } } internal static Type? FindType(string fullName, string feature, string? assemblyName = null) { string key = (assemblyName ?? "*") + "|" + fullName; lock (Gate) { if (TypeCache.TryGetValue(key, out Type value) && value != null) { return value; } } Type type = null; try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (assemblyName == null || string.Equals(assembly.GetName().Name, assemblyName, StringComparison.Ordinal)) { type = assembly.GetType(fullName, throwOnError: false); if (type != null) { break; } } } } catch (Exception ex) { Disable(feature, "type lookup " + fullName + " threw " + ex.GetType().Name + ": " + ex.Message); return null; } if (type != null) { lock (Gate) { TypeCache[key] = type; } } else { Disable(feature, "type " + fullName + ((assemblyName != null) ? (" (in " + assemblyName + ")") : "") + " not found"); } return type; } internal static FieldInfo? Field(Type? type, string name, string feature) { if (type == null) { Disable(feature, "field " + name + ": owner type is null"); return null; } Type type2 = type; while (type2 != null) { FieldInfo field = type2.GetField(name, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field; } type2 = type2.BaseType; } Disable(feature, "field " + type.FullName + "." + name + " not found"); return null; } internal static MethodInfo? Method(Type? type, string name, Type[]? parameterTypes, string feature) { if (type == null) { Disable(feature, "method " + name + ": owner type is null"); return null; } Type type2 = type; while (type2 != null) { List list = (from m in type2.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) where m.Name == name select m).ToList(); if (list.Count != 0) { if (parameterTypes == null) { if (list.Count == 1) { return list[0]; } Disable(feature, "method " + type2.FullName + "." + name + " is ambiguous (" + list.Count + " overloads); pass parameter types"); return null; } foreach (MethodInfo item in list) { if (ParametersMatch(item.GetParameters(), parameterTypes)) { return item; } } } type2 = type2.BaseType; } Disable(feature, "method " + type.FullName + "." + name + Signature(parameterTypes) + " not found"); return null; } internal static PropertyInfo? Property(Type? type, string name, string feature) { if (type == null) { Disable(feature, "property " + name + ": owner type is null"); return null; } Type type2 = type; while (type2 != null) { PropertyInfo property = type2.GetProperty(name, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { return property; } type2 = type2.BaseType; } Disable(feature, "property " + type.FullName + "." + name + " not found"); return null; } internal static bool TryGet(FieldInfo? field, object? instance, out T value, string feature) { value = default(T); if (field == null || !IsEnabled(feature)) { return false; } try { object value2 = field.GetValue(field.IsStatic ? null : instance); if (value2 is T val) { value = val; return true; } if (value2 == null && default(T) == null) { return true; } Log.WarnOnce(feature + "|type|" + field.Name, "[" + feature + "] field " + field.Name + " is " + (value2?.GetType().FullName ?? "null") + ", expected " + typeof(T).FullName); return false; } catch (Exception e) { CountFailure(feature, "get " + field.Name, e); return false; } } internal static bool TryGet(PropertyInfo? property, object? instance, out T value, string feature) { value = default(T); MethodInfo methodInfo = property?.GetGetMethod(nonPublic: true); if (property == null || methodInfo == null || !IsEnabled(feature)) { return false; } try { object value2 = property.GetValue(methodInfo.IsStatic ? null : instance, null); if (value2 is T val) { value = val; return true; } if (value2 == null && default(T) == null) { return true; } Log.WarnOnce(feature + "|type|" + property.Name, "[" + feature + "] property " + property.Name + " is " + (value2?.GetType().FullName ?? "null") + ", expected " + typeof(T).FullName); return false; } catch (Exception e) { CountFailure(feature, "get " + property.Name, e); return false; } } internal static bool TrySet(FieldInfo? field, object? instance, object? value, string feature) { if (field == null || !IsEnabled(feature)) { return false; } try { field.SetValue(field.IsStatic ? null : instance, value); return true; } catch (Exception e) { CountFailure(feature, "set " + field.Name, e); return false; } } internal static bool TryInvoke(MethodInfo? method, object? instance, object?[]? args, out object? result, string feature) { result = null; if (method == null || !IsEnabled(feature)) { return false; } try { result = method.Invoke(method.IsStatic ? null : instance, args); return true; } catch (TargetInvocationException ex) when (ex.InnerException != null) { CountFailure(feature, "invoke " + method.Name, ex.InnerException); return false; } catch (Exception e) { CountFailure(feature, "invoke " + method.Name, e); return false; } } internal static void Run(string key, Action body) { if (!IsEnabled(key)) { return; } try { body(); } catch (Exception e) { CountFailure(key, "threw", e); } } internal static T Run(string key, Func body, T fallback) { if (!IsEnabled(key)) { return fallback; } try { return body(); } catch (Exception e) { CountFailure(key, "threw", e); return fallback; } } internal static bool Prefix(string key, Func body) { return Run(key, body, fallback: true); } internal static int FailureCount(string key) { lock (Gate) { int value; return FailureCounts.TryGetValue(key, out value) ? value : 0; } } private static void CountFailure(string key, string what, Exception e) { int value; lock (Gate) { FailureCounts.TryGetValue(key, out value); value++; FailureCounts[key] = value; } if (value == 1) { Log.Error("[" + key + "] " + what + ": " + e); } if (value >= MaxFailuresBeforeDisable) { Disable(key, value + " exceptions (first logged above)"); } } private static bool ParametersMatch(ParameterInfo[] actual, Type[] expected) { if (actual.Length != expected.Length) { return false; } for (int i = 0; i < actual.Length; i++) { if (actual[i].ParameterType != expected[i]) { return false; } } return true; } private static string Signature(Type[]? parameterTypes) { if (parameterTypes != null) { return "(" + string.Join(", ", parameterTypes.Select((Type t) => t.Name)) + ")"; } return ""; } } internal static class TexGen { private delegate float CoverageFn(float x, float y); private static readonly Dictionary Cache = new Dictionary(); internal static Sprite RoundedRect(int radius = 12, int size = 0) { if (size <= 0) { size = radius * 2 + 4; } string key = "rr|" + radius + "|" + size; return Get(key, delegate { //IL_0054: 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_0093: Unknown result type (might be due to invalid IL or missing references) Texture2D obj = NewTexture(size, size, key); Paint(obj, (float x, float y) => TexGenMath.FillCoverage(TexGenMath.RoundedRectDistance(x, y, size, size, radius))); return Sprite.Create(obj, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)(radius + 1), (float)(radius + 1), (float)(radius + 1), (float)(radius + 1))); }); } internal static Sprite Outline(int radius = 12, int thickness = 2, int size = 0) { if (size <= 0) { size = radius * 2 + 4; } string key = "ol|" + radius + "|" + thickness + "|" + size; return Get(key, delegate { //IL_0068: 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_008b: Unknown result type (might be due to invalid IL or missing references) Texture2D obj = NewTexture(size, size, key); Paint(obj, (float x, float y) => TexGenMath.StrokeCoverage(TexGenMath.RoundedRectDistance(x, y, size, size, radius), thickness)); int num = Mathf.Max(radius, thickness) + 1; return Sprite.Create(obj, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)num, (float)num, (float)num, (float)num)); }); } internal static Sprite Circle(int diameter = 64, int thickness = 0) { string key = "ci|" + diameter + "|" + thickness; return Get(key, delegate { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) Texture2D obj = NewTexture(diameter, diameter, key); float r = (float)diameter * 0.5f; Paint(obj, delegate(float x, float y) { float distance = TexGenMath.CircleDistance(x, y, r, r, r - 0.5f); return (thickness <= 0) ? TexGenMath.FillCoverage(distance) : TexGenMath.StrokeCoverage(distance, thickness); }); return Sprite.Create(obj, new Rect(0f, 0f, (float)diameter, (float)diameter), new Vector2(0.5f, 0.5f), 100f); }); } internal static Sprite White() { return Get("white", delegate { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Texture2D obj = NewTexture(1, 1, "white"); obj.SetPixel(0, 0, Color.white); obj.Apply(false, false); return Sprite.Create(obj, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 100f); }); } private static Sprite Get(string key, Func create) { if (Cache.TryGetValue(key, out Sprite value) && (Object)(object)value != (Object)null) { return value; } value = create(); ((Object)value).name = "LcTexGen_" + key; ((Object)value).hideFlags = (HideFlags)52; Cache[key] = value; return value; } private static Texture2D NewTexture(int w, int h, string key) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown return new Texture2D(w, h, (TextureFormat)4, false) { name = "LcTexGen_" + key, wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1, hideFlags = (HideFlags)52 }; } private static void Paint(Texture2D tex, CoverageFn coverage) { //IL_005d: 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) int width = ((Texture)tex).width; int height = ((Texture)tex).height; Color32[] array = (Color32[])(object)new Color32[width * height]; for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { float num = coverage((float)j + 0.5f, (float)i + 0.5f); array[i * width + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)Mathf.RoundToInt(num * 255f)); } } tex.SetPixels32(array); tex.Apply(false, false); } } internal static class TexGenMath { internal static float RoundedRectDistance(float px, float py, float w, float h, float r) { r = Math.Max(0f, Math.Min(r, Math.Min(w, h) * 0.5f)); float num = w * 0.5f; float num2 = h * 0.5f; float val = Math.Abs(px - num) - (num - r); float num3 = Math.Abs(py - num2) - (num2 - r); float num4 = Math.Max(val, 0f); float num5 = Math.Max(num3, 0f); float num6 = (float)Math.Sqrt(num4 * num4 + num5 * num5); float num7 = Math.Min(Math.Max(val, num3), 0f); return num6 + num7 - r; } internal static float CircleDistance(float px, float py, float cx, float cy, float r) { float num = px - cx; float num2 = py - cy; return (float)Math.Sqrt(num * num + num2 * num2) - r; } internal static float FillCoverage(float distance) { return Clamp01(0.5f - distance); } internal static float StrokeCoverage(float distance, float thickness) { float num = FillCoverage(distance); float num2 = FillCoverage(distance + thickness); return Clamp01(num - num2); } internal static float Clamp01(float v) { if (!(v < 0f)) { if (!(v > 1f)) { return v; } return 1f; } return 0f; } } internal static class UiFactory { internal static class Theme { internal static Color PanelBg = new Color(0.05f, 0.05f, 0.06f, 0.92f); internal static Color PanelBorder = new Color(1f, 0.45f, 0.1f, 0.9f); internal static Color Text = new Color(0.98f, 0.62f, 0.25f, 1f); internal static Color TextDim = new Color(0.75f, 0.6f, 0.45f, 1f); internal static Color ButtonBg = new Color(0.16f, 0.09f, 0.05f, 0.95f); internal static Color ButtonHighlight = new Color(0.45f, 0.22f, 0.07f, 1f); internal static Color ButtonPressed = new Color(0.7f, 0.33f, 0.08f, 1f); internal static Color ButtonDisabled = new Color(0.12f, 0.12f, 0.12f, 0.7f); internal static Color Danger = new Color(0.9f, 0.18f, 0.15f, 1f); internal static Color BackdropColor = new Color(0f, 0f, 0f, 0.72f); internal static int CornerRadius = 10; internal static float FontSize = 26f; } internal static readonly Vector2 ReferenceResolution = new Vector2(1920f, 1080f); internal static Canvas Canvas(string name, int sortingOrder, bool dontDestroyOnLoad = false) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.layer = 5; if (dontDestroyOnLoad) { Object.DontDestroyOnLoad((Object)(object)val); } Canvas obj = val.AddComponent(); obj.renderMode = (RenderMode)0; obj.sortingOrder = sortingOrder; obj.pixelPerfect = false; CanvasScaler obj2 = val.AddComponent(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = ReferenceResolution; obj2.screenMatchMode = (ScreenMatchMode)0; obj2.matchWidthOrHeight = 0.5f; val.AddComponent(); return obj; } internal static RectTransform Rect(Transform parent, string name) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown RectTransform val = (RectTransform)new GameObject(name, new Type[1] { typeof(RectTransform) }) { layer = 5 }.transform; ((Transform)val).SetParent(parent, false); return val; } internal static RectTransform Fill(RectTransform rt, float padding = 0f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_003d: Unknown result type (might be due to invalid IL or missing references) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.pivot = new Vector2(0.5f, 0.5f); rt.offsetMin = new Vector2(padding, padding); rt.offsetMax = new Vector2(0f - padding, 0f - padding); return rt; } internal static RectTransform Place(RectTransform rt, Vector2 anchor, Vector2 offset, Vector2 size, Vector2? pivot = null) { //IL_0001: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) rt.anchorMin = anchor; rt.anchorMax = anchor; rt.pivot = pivot ?? anchor; rt.anchoredPosition = offset; rt.sizeDelta = size; return rt; } internal static RectTransform PlaceTL(RectTransform rt, float cx, float cy, float w, float h) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) rt.anchorMin = new Vector2(0f, 1f); rt.anchorMax = new Vector2(0f, 1f); rt.pivot = new Vector2(0.5f, 0.5f); rt.anchoredPosition = new Vector2(cx, 0f - cy); rt.sizeDelta = new Vector2(w, h); return rt; } internal static LayoutElement Size(Component c, float width = -1f, float height = -1f, float flexibleWidth = -1f) { LayoutElement val = c.GetComponent(); if ((Object)(object)val == (Object)null) { val = c.gameObject.AddComponent(); } val.preferredWidth = width; val.preferredHeight = height; val.minHeight = height; val.flexibleWidth = flexibleWidth; return val; } internal static VerticalLayoutGroup Vertical(Component c, float spacing = 8f, int padding = 12) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown VerticalLayoutGroup obj = c.gameObject.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = spacing; ((LayoutGroup)obj).padding = new RectOffset(padding, padding, padding, padding); ((LayoutGroup)obj).childAlignment = (TextAnchor)0; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; return obj; } internal static HorizontalLayoutGroup Horizontal(Component c, float spacing = 8f, int padding = 0) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown HorizontalLayoutGroup obj = c.gameObject.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = spacing; ((LayoutGroup)obj).padding = new RectOffset(padding, padding, padding, padding); ((LayoutGroup)obj).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; return obj; } internal static Image Panel(Transform parent, string name, Color? color = null, bool border = true) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Fill(Rect(parent, name)); Image obj = ((Component)val).gameObject.AddComponent(); obj.sprite = TexGen.RoundedRect(Theme.CornerRadius); obj.type = (Type)1; ((Graphic)obj).color = (Color)(((??)color) ?? Theme.PanelBg); ((Graphic)obj).raycastTarget = true; if (border) { Image obj2 = ((Component)Fill(Rect((Transform)(object)val, "Border"))).gameObject.AddComponent(); obj2.sprite = TexGen.Outline(Theme.CornerRadius); obj2.type = (Type)1; ((Graphic)obj2).color = Theme.PanelBorder; ((Graphic)obj2).raycastTarget = false; } return obj; } internal static TextMeshProUGUI Text(Transform parent, string text, float size = 0f, TextAlignmentOptions align = (TextAlignmentOptions)513, Color? color = null, string name = "Text") { //IL_0047: 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_005a: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = ((Component)Rect(parent, name)).gameObject.AddComponent(); TMP_FontAsset val2 = FontProvider.Get(); if ((Object)(object)val2 != (Object)null) { ((TMP_Text)val).font = val2; } ((TMP_Text)val).text = text; ((TMP_Text)val).fontSize = ((size > 0f) ? size : Theme.FontSize); ((TMP_Text)val).alignment = align; ((Graphic)val).color = (Color)(((??)color) ?? Theme.Text); ((TMP_Text)val).enableWordWrapping = true; ((TMP_Text)val).overflowMode = (TextOverflowModes)1; ((Graphic)val).raycastTarget = false; return val; } internal static Button Button(Transform parent, string label, Action onClick, Vector2? size = null, string? name = null) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Rect(parent, name ?? ("Button_" + label)); obj.sizeDelta = (Vector2)(((??)size) ?? new Vector2(260f, 52f)); Image val = ((Component)obj).gameObject.AddComponent(); val.sprite = TexGen.RoundedRect(Theme.CornerRadius); val.type = (Type)1; ((Graphic)val).color = Color.white; Button val2 = ((Component)obj).gameObject.AddComponent