Decompiled source of BetterUI v0.12.3
BepInEx\plugins\BetterUI\InfernoProtocol.BetterUI.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using FrankMods; using Game.Data; using Game.LevelOperations; using Game.PlayerOperations; using Game.UI; using Game.UI.Trade; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Attributes; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("InfernoProtocol.BetterUI")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.12.3.0")] [assembly: AssemblyInformationalVersion("0.12.3+42c07716b0f1760aa9b937f1baf249ddeb6011f6")] [assembly: AssemblyProduct("InfernoProtocol.BetterUI")] [assembly: AssemblyTitle("InfernoProtocol.BetterUI")] [assembly: AssemblyVersion("0.12.3.0")] namespace InfernoProtocol.BetterUI; public sealed class BetterUIController : MonoBehaviour { private readonly CraftingMenuOverhaul _craftingMenu = new CraftingMenuOverhaul(); private readonly BuildingMenuOverhaul _buildingMenu = new BuildingMenuOverhaul(); private readonly TraderMenuOverhaul _traderMenu = new TraderMenuOverhaul(); private readonly GeneticsTree _genetics = new GeneticsTree(); private readonly HotbarDurabilityDisplay _hotbarDurability = new HotbarDurabilityDisplay(); private float _nextRefresh; private float _nextBuildingRefresh; private float _retryAt; private float _buildingRetryAt; private float _nextTraderRefresh; private float _traderRetryAt; private bool _sessionEnabled = true; private bool _craftingOpen; private bool _buildingOpen; private bool _traderOpen; private bool _failureReported; private bool _buildingFailureReported; private bool _traderFailureReported; public BetterUIController(IntPtr pointer) : base(pointer) { } private void Update() { HandleToggle(); _genetics.Tick(_sessionEnabled && BetterUIPlugin.Enabled.Value); bool enabled = _sessionEnabled && BetterUIPlugin.Enabled.Value; _hotbarDurability.Tick(enabled); UpdateCrafting(enabled); UpdateBuilding(enabled); UpdateTrader(enabled); } private void UpdateTrader(bool enabled) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown if (!enabled || !BetterUIPlugin.TraderEnabled.Value || !_traderOpen) { _traderMenu.SetVisible(visible: false); return; } TradeUI instance = MonoSingleton<TradeUI>.instance; if ((Object)(object)instance == (Object)null) { _traderMenu.SetVisible(visible: false); return; } _traderMenu.SetVisible(visible: true); if (_traderMenu.HandleInput()) { _nextTraderRefresh = 0f; } float unscaledTime = Time.unscaledTime; if (unscaledTime < _nextTraderRefresh || unscaledTime < _traderRetryAt) { return; } _nextTraderRefresh = unscaledTime + BetterUIPlugin.RefreshSeconds; try { _traderMenu.Apply(instance); _traderRetryAt = 0f; _traderFailureReported = false; } catch (Exception ex) { _traderRetryAt = unscaledTime + 2f; if (!_traderFailureReported) { _traderFailureReported = true; ManualLogSource modLog = BetterUIPlugin.ModLog; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not style the trader menu; retrying: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } modLog.LogWarning(val); } } } private void UpdateCrafting(bool enabled) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown CraftingTableUI instance = MonoSingleton<CraftingTableUI>.instance; if (!enabled || !_craftingOpen || (Object)(object)instance == (Object)null) { _craftingMenu.SetVisible(visible: false); return; } _craftingMenu.SetVisible(visible: true); if (_craftingMenu.HandleInput()) { _nextRefresh = 0f; } _craftingMenu.RefreshCraftingProgress(instance); float unscaledTime = Time.unscaledTime; if (unscaledTime < _nextRefresh || unscaledTime < _retryAt) { return; } _nextRefresh = unscaledTime + BetterUIPlugin.RefreshSeconds; try { _craftingMenu.Apply(instance); _retryAt = 0f; _failureReported = false; } catch (Exception ex) { _retryAt = unscaledTime + 2f; if (!_failureReported) { _failureReported = true; ManualLogSource modLog = BetterUIPlugin.ModLog; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(45, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not style the crafting menu; retrying: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } modLog.LogWarning(val); } } } private void UpdateBuilding(bool enabled) { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown BuildTemplatesUI instance = MonoSingleton<BuildTemplatesUI>.instance; if (!enabled || !_buildingOpen || (Object)(object)instance == (Object)null) { _buildingMenu.SetVisible(visible: false); return; } _buildingMenu.SetVisible(visible: true); if (_buildingMenu.HandleInput()) { _nextBuildingRefresh = 0f; } float unscaledTime = Time.unscaledTime; if (unscaledTime < _nextBuildingRefresh || unscaledTime < _buildingRetryAt) { return; } _nextBuildingRefresh = unscaledTime + BetterUIPlugin.RefreshSeconds; try { _buildingMenu.Apply(instance); _buildingRetryAt = 0f; _buildingFailureReported = false; } catch (Exception ex) { _buildingRetryAt = unscaledTime + 2f; if (!_buildingFailureReported) { _buildingFailureReported = true; ManualLogSource modLog = BetterUIPlugin.ModLog; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(45, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not style the building menu; retrying: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } modLog.LogWarning(val); } } } private void HandleToggle() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown if (BetterUIPlugin.ToggleKeyPressed(Keyboard.current)) { _sessionEnabled = !_sessionEnabled; if (!_sessionEnabled) { _craftingMenu.SetVisible(visible: false); _buildingMenu.SetVisible(visible: false); _traderMenu.SetVisible(visible: false); } ManualLogSource modLog = BetterUIPlugin.ModLog; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BetterUI menus "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(_sessionEnabled ? "enabled" : "paused"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" for this session"); } modLog.LogInfo(val); _nextRefresh = 0f; _nextBuildingRefresh = 0f; _nextTraderRefresh = 0f; } } internal void SetBuildingOpen(bool open) { _buildingOpen = open; _nextBuildingRefresh = 0f; if (!open) { _buildingMenu.SetVisible(visible: false); } } internal void PrepareBuildingMenu(BuildTemplatesUI building) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown if (!_sessionEnabled || !BetterUIPlugin.Enabled.Value || (Object)(object)building == (Object)null) { return; } try { _buildingMenu.Prepare(building); } catch (Exception ex) { if (!_buildingFailureReported) { _buildingFailureReported = true; ManualLogSource modLog = BetterUIPlugin.ModLog; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(37, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not prepare the building menu: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } modLog.LogWarning(val); } } } internal void SetBuildingFilter(PlacableType filter) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) _buildingMenu.SetActiveFilter(filter); _nextBuildingRefresh = 0f; } internal void ResetBuildingFilter() { _buildingMenu.ResetActiveFilter(); _nextBuildingRefresh = 0f; } internal void InvalidateBuilding() { _nextBuildingRefresh = 0f; } internal void SetCraftingOpen(bool open) { _craftingOpen = open; _nextRefresh = 0f; if (!open) { _craftingMenu.SetVisible(visible: false); } } internal void PrepareTraderMenu(TradeUI trader) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown if (!_sessionEnabled || !BetterUIPlugin.Enabled.Value || !BetterUIPlugin.TraderEnabled.Value || (Object)(object)trader == (Object)null) { return; } try { _traderMenu.Prepare(trader); } catch (Exception ex) { if (!_traderFailureReported) { _traderFailureReported = true; ManualLogSource modLog = BetterUIPlugin.ModLog; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not prepare the trader menu: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } modLog.LogWarning(val); } } } internal void SetTraderOpen(bool open) { _traderOpen = open; _nextTraderRefresh = 0f; if (!open) { _traderMenu.SetVisible(visible: false); } } internal void InvalidateTrader() { _nextTraderRefresh = 0f; } private void OnDestroy() { _hotbarDurability.Dispose(); _genetics.Dispose(); } } [BepInPlugin("com.holden.infernoprotocol.betterui", "BetterUI", "0.12.3")] [BepInDependency("com.holden.infernoprotocol.frankmodscore", "1.0.0")] public sealed class BetterUIPlugin : BasePlugin { [HarmonyPatch] private static class GeneticsRefreshPatches { [HarmonyPostfix] [HarmonyPatch(typeof(GeneticFeaturesUI), "UpdateList")] private static void ListChanged() { GeneticsTree.Invalidate(); } [HarmonyPostfix] [HarmonyPatch(typeof(GeneticFeaturesFieldUI), "SetFeature")] private static void FeatureChanged() { GeneticsTree.Invalidate(); } [HarmonyPostfix] [HarmonyPatch(typeof(GeneticFeaturesFieldUI), "UpdateLocalization")] private static void LanguageChanged() { GeneticsTree.Invalidate(); } } [HarmonyPatch] private static class CraftingVisibilityPatches { [HarmonyPostfix] [HarmonyPatch(typeof(CraftingTableUI), "Show")] private static void AfterShow() { SetCraftingOpen(open: true); } [HarmonyPostfix] [HarmonyPatch(typeof(CraftingTableUI), "Hide")] private static void AfterHide() { SetCraftingOpen(open: false); } [HarmonyPostfix] [HarmonyPatch(typeof(CraftingTableUI), "HideRaw")] private static void AfterHideRaw() { SetCraftingOpen(open: false); } } [HarmonyPatch] private static class TraderVisibilityPatches { [HarmonyPrefix] [HarmonyPatch(typeof(TradeUI), "Open")] private static void BeforeOpen(TradeUI __instance) { PrepareTraderMenu(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(TradeUI), "Open")] private static void AfterOpen() { SetTraderOpen(open: true); InvalidateTrader(); } [HarmonyPostfix] [HarmonyPatch(typeof(TradeUI), "Close")] private static void AfterClose() { SetTraderOpen(open: false); } [HarmonyPostfix] [HarmonyPatch(typeof(TradeUI), "OnDisable")] private static void AfterDisable() { SetTraderOpen(open: false); } [HarmonyPostfix] [HarmonyPatch(typeof(TradeUI), "Refresh")] private static void AfterRefresh() { InvalidateTrader(); } [HarmonyPostfix] [HarmonyPatch(typeof(TradeUI), "ApplyFilters")] private static void AfterFiltersChanged() { InvalidateTrader(); } [HarmonyPostfix] [HarmonyPatch(typeof(TradeUI), "OnTradeButtonClicked")] private static void AfterTrade() { InvalidateTrader(); } [HarmonyPostfix] [HarmonyPatch(typeof(TradeUI), "ToggleHideUntradable")] private static void AfterAvailabilityToggle() { InvalidateTrader(); } [HarmonyPostfix] [HarmonyPatch(typeof(TradeUI), "OnGetField")] private static void AfterFieldCreated() { InvalidateTrader(); } } [HarmonyPatch] private static class BuildingVisibilityPatches { [HarmonyPrefix] [HarmonyPatch(typeof(ITBuildHammer), "ShowBuildMiniTutorial")] private static bool SuppressHammerLegendBehindCatalog() { return !BuildingCatalogOpen; } [HarmonyPrefix] [HarmonyPatch(typeof(BuildTemplatesUI), "OnFilterApplied")] private static void NormalizeStairFilter(ref PlacableType filter) { if ((int)filter == 3) { filter = (PlacableType)21; } } [HarmonyPrefix] [HarmonyPatch(typeof(BuildTemplatesUI), "Show")] private static void BeforeShow() { PrepareBuildingMenu(); } [HarmonyPostfix] [HarmonyPatch(typeof(BuildTemplatesUI), "Show")] private static void AfterShow() { SetBuildingOpen(open: true); } [HarmonyPostfix] [HarmonyPatch(typeof(BuildTemplatesUI), "Hide")] private static void AfterHide() { SetBuildingOpen(open: false); } [HarmonyPostfix] [HarmonyPatch(typeof(BuildTemplatesUI), "HideRaw")] private static void AfterHideRaw() { SetBuildingOpen(open: false); } [HarmonyPostfix] [HarmonyPatch(typeof(BuildTemplatesUI), "OnFilterApplied")] private static void AfterFilterApplied(PlacableType filter) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SetBuildingFilter(filter); } [HarmonyPostfix] [HarmonyPatch(typeof(BuildTemplatesUI), "ResetFilter")] private static void AfterFilterReset() { ResetBuildingFilter(); } [HarmonyPostfix] [HarmonyPatch(typeof(BuildTemplatesUI), "CheckAllBuildableRecipes")] private static void AfterRecipesChecked() { InvalidateBuilding(); } [HarmonyPostfix] [HarmonyPatch(typeof(SelectedBuildRecipeUI), "SetRecipe", new Type[] { typeof(BuildRecipeUI) })] private static void AfterSelectedRecipeChanged() { InvalidateBuilding(); } [HarmonyPostfix] [HarmonyPatch(typeof(BuildRecipeUI), "SetItemCraftable")] private static void AfterRecipeCraftabilityChanged() { InvalidateBuilding(); } [HarmonyPostfix] [HarmonyPatch(typeof(BuildRecipeUI), "SetSelected")] private static void AfterRecipeSelectionChanged() { InvalidateBuilding(); } [HarmonyPostfix] [HarmonyPatch(typeof(BuildRecipeUI), "UpdateName")] private static void AfterRecipeNameChanged() { InvalidateBuilding(); } } private static BetterUIController _controller; private Harmony _harmony; internal static ManualLogSource ModLog { get; private set; } internal static bool BuildingCatalogOpen { get; private set; } internal static ConfigEntry<bool> Enabled { get; private set; } internal static ConfigEntry<bool> GeneticsEnabled { get; private set; } internal static ConfigEntry<bool> GeneticsReducedMotion { get; private set; } internal static ConfigEntry<bool> TraderEnabled { get; private set; } internal static ConfigEntry<int> TraderOfferFontSize { get; private set; } internal static ConfigEntry<float> RefreshInterval { get; private set; } internal static ConfigEntry<int> ColorPalette { get; private set; } internal static ConfigEntry<Key> ToggleKey { get; private set; } internal static float RefreshSeconds => Sanitize(RefreshInterval.Value, 0.5f, 0.2f, 5f); internal static int PaletteIndex { get { if (ColorPalette == null) { return 0; } return Mathf.Clamp(ColorPalette.Value, 0, 4); } } internal static int TraderOfferFontSizeValue { get { if (TraderOfferFontSize == null) { return 18; } return Mathf.Clamp(TraderOfferFontSize.Value, 13, 24); } } public override void Load() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown ModLog = ((BasePlugin)this).Log; Enabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enables BetterUI crafting, building, trader and genetics presentation. The configured toggle key pauses or resumes it for the current session."); ToggleKey = ((BasePlugin)this).Config.Bind<Key>("General", "ToggleKey", (Key)101, "Keyboard shortcut that pauses or resumes BetterUI for the current session."); GeneticsEnabled = ((BasePlugin)this).Config.Bind<bool>("Genetics", "Enabled", true, "Displays acquired genetics as a navigable DNA tree. Presentation only; disable to keep the original genetics list."); GeneticsReducedMotion = ((BasePlugin)this).Config.Bind<bool>("Genetics", "ReducedMotion", false, "Disables decorative DNA motion and uses immediate focus transitions in the genetics panel."); TraderEnabled = ((BasePlugin)this).Config.Bind<bool>("Trader", "Enabled", true, "Displays the native trader inside the BetterUI exchange interface."); TraderOfferFontSize = ((BasePlugin)this).Config.Bind<int>("Trader", "OfferFontSize", 18, new ConfigDescription("Font size used for trader offer names and their stock amounts.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(13, 24), Array.Empty<object>())); RefreshInterval = ((BasePlugin)this).Config.Bind<float>("General", "RefreshInterval", 0.5f, new ConfigDescription("Seconds between lightweight crafting, building and trader menu state refreshes.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 5f), Array.Empty<object>())); ColorPalette = ((BasePlugin)this).Config.Bind<int>("Crafting", "ColorPalette", 0, new ConfigDescription("Remembered BetterUI palette: 0 green, 1 blue, 2 cyan, 3 violet, 4 amber.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 4), Array.Empty<object>())); ModSettingsRegistry.RegisterKeyBinding("com.holden.infernoprotocol.betterui", "BetterUI", "ToggleKey", "Pause / resume BetterUI", (Key)101, (Func<Key>)(() => ToggleKey.Value), (Action<Key>)delegate(Key key) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) ToggleKey.Value = key; }); ClassInjector.RegisterTypeInIl2Cpp<GeneBranchGraphic>(); _controller = ((BasePlugin)this).AddComponent<BetterUIController>(); _harmony = new Harmony("com.holden.infernoprotocol.betterui"); _harmony.PatchAll(typeof(CraftingVisibilityPatches)); _harmony.PatchAll(typeof(BuildingVisibilityPatches)); _harmony.PatchAll(typeof(GeneticsRefreshPatches)); _harmony.PatchAll(typeof(TraderVisibilityPatches)); ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(8, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BetterUI"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("0.12.3"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded"); } log.LogInfo(val); ((BasePlugin)this).Log.LogInfo((object)"Genetics tree: compact organic layout, read-only gene display and reduced-motion support."); ((BasePlugin)this).Log.LogInfo((object)"GeneUI: batched branches, cached panel and event-driven gene refresh."); ((BasePlugin)this).Log.LogInfo((object)"Building catalog: unified BetterUI filters, plan browser and material inspection."); ((BasePlugin)this).Log.LogInfo((object)"Trader exchange: native offers and callbacks inside a responsive BetterUI shell."); } public override bool Unload() { ModSettingsRegistry.UnregisterMod("com.holden.infernoprotocol.betterui"); SetBuildingOpen(open: false); SetTraderOpen(open: false); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } _harmony = null; if ((Object)(object)_controller != (Object)null) { Object.Destroy((Object)(object)_controller); _controller = null; } return true; } internal static bool ToggleKeyPressed(Keyboard keyboard) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (keyboard == null || ToggleKey == null || (int)ToggleKey.Value == 0) { return false; } try { return ((ButtonControl)keyboard[ToggleKey.Value]).wasPressedThisFrame; } catch { return false; } } internal static void SetCraftingOpen(bool open) { _controller?.SetCraftingOpen(open); } internal static void SetBuildingOpen(bool open) { bool num = BuildingCatalogOpen != open; BuildingCatalogOpen = open; if (num) { if (open) { MiniTutorial.Hide(); } else { ITBuildHammer.ShowBuildMiniTutorial(); } } _controller?.SetBuildingOpen(open); } internal static void PrepareBuildingMenu() { _controller?.PrepareBuildingMenu(MonoSingleton<BuildTemplatesUI>.instance); } internal static void SetBuildingFilter(PlacableType filter) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) _controller?.SetBuildingFilter(filter); } internal static void ResetBuildingFilter() { _controller?.ResetBuildingFilter(); } internal static void InvalidateBuilding() { _controller?.InvalidateBuilding(); } internal static void PrepareTraderMenu(TradeUI trader) { _controller?.PrepareTraderMenu(trader); } internal static void SetTraderOpen(bool open) { _controller?.SetTraderOpen(open); } internal static void InvalidateTrader() { _controller?.InvalidateTrader(); } internal static void CyclePalette() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown if (ColorPalette != null) { ColorPalette.Value = (PaletteIndex + 1) % 5; string[] array = new string[5] { "green", "blue", "cyan", "violet", "amber" }; ManualLogSource modLog = ModLog; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(29, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BetterUI palette changed to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(array[PaletteIndex]); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } modLog.LogInfo(val); } } internal static void SetTraderOfferFontSize(float value) { if (TraderOfferFontSize != null) { TraderOfferFontSize.Value = Mathf.Clamp(Mathf.RoundToInt(value), 13, 24); } } private static float Sanitize(float value, float fallback, float minimum, float maximum) { if (!float.IsNaN(value) && !float.IsInfinity(value)) { return Mathf.Clamp(value, minimum, maximum); } return fallback; } } internal enum ButtonVariant { Secondary, Primary, Danger } internal static class BetterUIStyler { internal static Image Surface(RectTransform rect, Color fill, Color border, bool addShadow = true) { //IL_002f: 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) if ((Object)(object)rect == (Object)null) { return null; } Image val = ((Component)rect).GetComponent<Image>(); if ((Object)(object)val == (Object)null) { val = ((Component)rect).gameObject.AddComponent<Image>(); ((Graphic)val).raycastTarget = false; } RoundedImage(val, fill); Effects((Graphic)(object)val, border, addShadow); return val; } internal static void RoundedImage(Image image, Color color) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)image == (Object)null)) { image.sprite = BetterUITheme.RoundedSprite; image.type = (Type)1; ((Graphic)image).color = color; } } internal static void Tint(Image image, Color color) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)image != (Object)null) { ((Graphic)image).color = color; } } internal static void Effects(Graphic target, Color border, bool addShadow) { //IL_0027: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_009c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return; } Outline val = ((Component)target).GetComponent<Outline>(); if ((Object)(object)val == (Object)null) { val = ((Component)target).gameObject.AddComponent<Outline>(); } ((Shadow)val).effectColor = border; ((Shadow)val).effectDistance = new Vector2(1.25f, -1.25f); ((Shadow)val).useGraphicAlpha = true; Shadow val2 = null; Il2CppArrayBase<Shadow> components = ((Component)target).GetComponents<Shadow>(); for (int i = 0; i < components.Length; i++) { Shadow val3 = components[i]; if ((Object)(object)val3 != (Object)null && (Object)(object)((Il2CppObjectBase)val3).TryCast<Outline>() == (Object)null) { val2 = val3; break; } } if (!addShadow) { if ((Object)(object)val2 != (Object)null && ColorsMatch(val2.effectColor, BetterUITheme.Shadow)) { ((Behaviour)val2).enabled = false; } return; } if ((Object)(object)val2 == (Object)null) { val2 = ((Component)target).gameObject.AddComponent<Shadow>(); } ((Behaviour)val2).enabled = true; val2.effectColor = BetterUITheme.Shadow; val2.effectDistance = new Vector2(0f, -4f); val2.useGraphicAlpha = true; } private static bool ColorsMatch(Color left, Color right) { //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_0019: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(left.r - right.r) < 0.002f && Mathf.Abs(left.g - right.g) < 0.002f && Mathf.Abs(left.b - right.b) < 0.002f) { return Mathf.Abs(left.a - right.a) < 0.002f; } return false; } internal static void Text(TMP_Text text, float size, Color color, FontStyles style, bool preserveSize = false) { //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) if (!((Object)(object)text == (Object)null)) { text.enableAutoSizing = false; if (!preserveSize) { text.fontSize = size; } ((Graphic)text).color = color; text.fontStyle = style; ((Graphic)text).raycastTarget = false; } } internal static void Heading(TMP_Text text, float size) { //IL_0002: 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) Text(text, size, BetterUITheme.Text, (FontStyles)1); if (!((Object)(object)text == (Object)null)) { text.characterSpacing = 2.2f; text.outlineWidth = 0.12f; text.outlineColor = new Color32((byte)0, (byte)0, (byte)0, (byte)190); } } internal static void Button(MazeButton button, ButtonVariant variant) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00bc: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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) if ((Object)(object)button == (Object)null) { return; } Color val = default(Color); Color slotHover = default(Color); Color border; Color val2; switch (variant) { case ButtonVariant.Primary: ((Color)(ref val))..ctor(BetterUITheme.Primary.r, BetterUITheme.Primary.g, BetterUITheme.Primary.b, 0.18f); ((Color)(ref slotHover))..ctor(BetterUITheme.PrimaryHover.r, BetterUITheme.PrimaryHover.g, BetterUITheme.PrimaryHover.b, 0.34f); border = BetterUITheme.Primary; val2 = BetterUITheme.PrimaryHover; break; case ButtonVariant.Danger: val = BetterUITheme.DangerSoft; ((Color)(ref slotHover))..ctor(BetterUITheme.Danger.r, BetterUITheme.Danger.g, BetterUITheme.Danger.b, 0.34f); border = BetterUITheme.Danger; val2 = BetterUITheme.Text; break; default: val = BetterUITheme.PanelSoft; slotHover = BetterUITheme.SlotHover; border = BetterUITheme.Border; val2 = BetterUITheme.TextMuted; break; } button.backgroundColor = val; button.hoverColor = slotHover; button.textColor = val2; button.hoverTextColor = BetterUITheme.Text; button._disabledBackgroundColor = BetterUITheme.PanelSoft; button._disabledTextColor = BetterUITheme.TextDim; Graphic backgroundImage = button.backgroundImage; Image val3 = (((Object)(object)backgroundImage != (Object)null) ? ((Il2CppObjectBase)backgroundImage).TryCast<Image>() : null); if ((Object)(object)val3 != (Object)null) { RoundedImage(val3, val); Effects((Graphic)(object)val3, border, addShadow: false); Outline component = ((Component)val3).GetComponent<Outline>(); if ((Object)(object)component != (Object)null) { ((Shadow)component).effectDistance = new Vector2(0.65f, -0.65f); } } if ((Object)(object)button.buttonText != (Object)null) { Text((TMP_Text)(object)button.buttonText, Mathf.Max(15f, ((TMP_Text)button.buttonText).fontSize), val2, (FontStyles)1); ((TMP_Text)button.buttonText).characterSpacing = 0.8f; } LayoutElement val4 = ((Component)button).GetComponent<LayoutElement>(); if ((Object)(object)val4 == (Object)null) { val4 = ((Component)button).gameObject.AddComponent<LayoutElement>(); } val4.minHeight = 42f; button.UpdateVisualState(true); } internal static void ToggleButton(MazeButton button, bool active) { //IL_0014: 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_0019: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0039: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)button == (Object)null) { return; } Color val = (active ? BetterUITheme.AccentSoft : BetterUITheme.PanelSoft); Color hoverColor = (active ? BetterUITheme.CraftingSelectedHover : BetterUITheme.SlotHover); Color border = (active ? BetterUITheme.Accent : BetterUITheme.BorderSoft); Color val2 = (active ? BetterUITheme.Text : BetterUITheme.TextMuted); button.backgroundColor = val; button.hoverColor = hoverColor; button.textColor = val2; button.hoverTextColor = BetterUITheme.Text; button._disabledBackgroundColor = BetterUITheme.PanelSoft; button._disabledTextColor = BetterUITheme.TextDim; Graphic backgroundImage = button.backgroundImage; Image val3 = (((Object)(object)backgroundImage != (Object)null) ? ((Il2CppObjectBase)backgroundImage).TryCast<Image>() : null); if ((Object)(object)val3 != (Object)null) { RoundedImage(val3, val); Effects((Graphic)(object)val3, border, addShadow: false); Outline component = ((Component)val3).GetComponent<Outline>(); if ((Object)(object)component != (Object)null) { ((Shadow)component).effectDistance = new Vector2(0.65f, -0.65f); } } if ((Object)(object)button.buttonText != (Object)null) { Text((TMP_Text)(object)button.buttonText, 14f, val2, (FontStyles)1); ((TMP_Text)button.buttonText).characterSpacing = 0.5f; } } internal static void InputField(TMP_InputField input) { //IL_003c: 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_0026: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)input == (Object)null)) { Image component = ((Component)input).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { RoundedImage(component, BetterUITheme.PanelElevated); Effects((Graphic)(object)component, BetterUITheme.Border, addShadow: false); } Text(input.textComponent, 16f, BetterUITheme.Text, (FontStyles)0); Text(((Object)(object)input.placeholder != (Object)null) ? ((Il2CppObjectBase)input.placeholder).TryCast<TMP_Text>() : null, 16f, BetterUITheme.TextDim, (FontStyles)2); input.selectionColor = BetterUITheme.AccentSoft; input.caretColor = BetterUITheme.Accent; input.caretWidth = 2; } } internal static void Scrollbars(Transform root) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_00b5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)root == (Object)null) { return; } Il2CppArrayBase<Scrollbar> componentsInChildren = ((Component)root).GetComponentsInChildren<Scrollbar>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Scrollbar val = componentsInChildren[i]; if (!((Object)(object)val == (Object)null)) { Image component = ((Component)val).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { RoundedImage(component, new Color(BetterUITheme.PanelSoft.r, BetterUITheme.PanelSoft.g, BetterUITheme.PanelSoft.b, 0.62f)); } Image val2 = (((Object)(object)val.handleRect != (Object)null) ? ((Component)val.handleRect).GetComponent<Image>() : null); if ((Object)(object)val2 != (Object)null) { RoundedImage(val2, BetterUITheme.Accent); Effects((Graphic)(object)val2, new Color(1f, 1f, 1f, 0.24f), addShadow: false); } ColorBlock colors = ((Selectable)val).colors; ((ColorBlock)(ref colors)).normalColor = BetterUITheme.TextMuted; ((ColorBlock)(ref colors)).highlightedColor = BetterUITheme.Text; ((ColorBlock)(ref colors)).pressedColor = BetterUITheme.Accent; ((ColorBlock)(ref colors)).disabledColor = BetterUITheme.TextDim; ((ColorBlock)(ref colors)).fadeDuration = 0.08f; ((Selectable)val).colors = colors; } } } internal static ButtonVariant ClassifyButton(MazeButton button) { string text = (((Object)(object)button != (Object)null && (Object)(object)button.buttonText != (Object)null) ? ((TMP_Text)button.buttonText).text.ToUpperInvariant() : string.Empty); if (text.Contains("CLOSE") || text.Contains("DROP") || text.Contains("REMOVE") || text.Contains("DELETE")) { return ButtonVariant.Danger; } if (text.Contains("CRAFT") || text.Contains("PACK") || text.Contains("CONFIRM") || text.Contains("APPLY") || text.Contains("PLACE")) { return ButtonVariant.Primary; } return ButtonVariant.Secondary; } } internal static class BetterUITheme { private sealed class Palette { internal Color Scrim; internal Color Panel; internal Color PanelElevated; internal Color PanelSoft; internal Color CraftingCanvas; internal Color CraftingWell; internal Color CraftingReady; internal Color CraftingSelected; internal Color CraftingSelectedHover; internal Color Slot; internal Color SlotHover; internal Color SlotSelected; internal Color Border; internal Color BorderSoft; internal Color CardBorder; internal Color Accent; internal Color AccentSoft; internal Color Primary; internal Color PrimaryHover; internal Color PrimarySoft; internal Color Success; internal Color SuccessSoft; internal Color Text; internal Color TextMuted; internal Color TextUnavailable; internal Color TextDim; internal Color Shadow; } internal const int PaletteCount = 5; internal static readonly Color Danger = Hex("FFB45C", 1f); internal static readonly Color DangerSoft = Hex("FFB45C", 0.18f); internal static readonly Color CountBackground = Hex("010302", 0.94f); private static readonly Texture2D[] CategoryIcons = (Texture2D[])(object)new Texture2D[5]; private static int _cachedPaletteIndex = -1; private static Palette _current; private static Sprite _roundedSprite; private static Texture2D _scanlineTexture; private static Texture2D _colorWheelTexture; private static Texture2D _gearTexture; internal static Color Scrim => Current.Scrim; internal static Color Panel => Current.Panel; internal static Color PanelElevated => Current.PanelElevated; internal static Color PanelSoft => Current.PanelSoft; internal static Color CraftingCanvas => Current.CraftingCanvas; internal static Color CraftingWell => Current.CraftingWell; internal static Color CraftingReady => Current.CraftingReady; internal static Color CraftingSelected => Current.CraftingSelected; internal static Color CraftingSelectedHover => Current.CraftingSelectedHover; internal static Color Slot => Current.Slot; internal static Color SlotHover => Current.SlotHover; internal static Color SlotSelected => Current.SlotSelected; internal static Color Border => Current.Border; internal static Color BorderSoft => Current.BorderSoft; internal static Color CardBorder => Current.CardBorder; internal static Color Accent => Current.Accent; internal static Color AccentSoft => Current.AccentSoft; internal static Color Primary => Current.Primary; internal static Color PrimaryHover => Current.PrimaryHover; internal static Color PrimarySoft => Current.PrimarySoft; internal static Color Success => Current.Success; internal static Color SuccessSoft => Current.SuccessSoft; internal static Color Text => Current.Text; internal static Color TextMuted => Current.TextMuted; internal static Color TextUnavailable => Current.TextUnavailable; internal static Color TextDim => Current.TextDim; internal static Color Shadow => Current.Shadow; private static Palette Current { get { int paletteIndex = BetterUIPlugin.PaletteIndex; if (_current == null || _cachedPaletteIndex != paletteIndex) { _cachedPaletteIndex = paletteIndex; _current = BuildPalette(paletteIndex); } return _current; } } internal static Texture2D ScanlineTexture { get { if ((Object)(object)_scanlineTexture == (Object)null) { _scanlineTexture = CreateScanlineTexture(); } return _scanlineTexture; } } internal static Texture2D ColorWheelTexture { get { if ((Object)(object)_colorWheelTexture == (Object)null) { _colorWheelTexture = CreateColorWheelTexture(); } return _colorWheelTexture; } } internal static Texture2D GearTexture { get { if ((Object)(object)_gearTexture == (Object)null) { _gearTexture = CreateGearTexture(); } return _gearTexture; } } internal static Sprite RoundedSprite { get { if ((Object)(object)_roundedSprite == (Object)null) { _roundedSprite = CreateRoundedSprite(); } return _roundedSprite; } } internal static Texture2D GetCategoryIconTexture(string label) { string text = label?.ToUpperInvariant() ?? string.Empty; int num = ((!text.Contains("WEAPON") && !text.Contains("COMBAT")) ? ((text.Contains("MED") || text.Contains("HEALTH")) ? 1 : ((text.Contains("TOOL") || text.Contains("FOOD")) ? 2 : (text.Contains("CLOTH") ? 3 : 4))) : 0); if ((Object)(object)CategoryIcons[num] == (Object)null) { CategoryIcons[num] = CreateCategoryIcon(num); } return CategoryIcons[num]; } private static Palette BuildPalette(int index) { //IL_005a: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_009c: 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_00b2: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: 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) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0228: 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_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) float shift = Mathf.Clamp(index, 0, 4) switch { 1 => 0.25f, 2 => 0.13f, 3 => 0.43f, 4 => -0.23f, _ => 0f, }; return new Palette { Scrim = ShiftedHex("020704", 0.72f, shift), Panel = ShiftedHex("040C07", 0.88f, shift), PanelElevated = ShiftedHex("08140C", 0.9f, shift), PanelSoft = ShiftedHex("0C2113", 0.86f, shift), CraftingCanvas = ShiftedHex("020805", 0.8f, shift), CraftingWell = ShiftedHex("010403", 0.84f, shift), CraftingReady = ShiftedHex("07190C", 0.9f, shift), CraftingSelected = ShiftedHex("103A1C", 1f, shift), CraftingSelectedHover = ShiftedHex("165326", 1f, shift), Slot = ShiftedHex("07130B", 0.99f, shift), SlotHover = ShiftedHex("102B18", 1f, shift), SlotSelected = ShiftedHex("174923", 1f, shift), Border = ShiftedHex("2D6B3B", 0.9f, shift), BorderSoft = ShiftedHex("1C4327", 0.76f, shift), CardBorder = ShiftedHex("16331E", 0.68f, shift), Accent = ShiftedHex("6DFF83", 1f, shift), AccentSoft = ShiftedHex("6DFF83", 0.2f, shift), Primary = ShiftedHex("B8FF78", 1f, shift), PrimaryHover = ShiftedHex("DFFF9D", 1f, shift), PrimarySoft = ShiftedHex("B8FF78", 0.15f, shift), Success = ShiftedHex("66E97A", 1f, shift), SuccessSoft = ShiftedHex("66E97A", 0.18f, shift), Text = ShiftedHex("D9FFD7", 1f, shift), TextMuted = ShiftedHex("8FBC91", 1f, shift), TextUnavailable = ShiftedHex("688B6C", 1f, shift), TextDim = ShiftedHex("4F7556", 1f, shift), Shadow = ShiftedHex("000D03", 0.66f, shift) }; } private static Color ShiftedHex(string hex, float alpha, float shift) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) Color val = Hex(hex, alpha); if (Mathf.Abs(shift) < 0.001f) { return val; } float num = default(float); float num2 = default(float); float num3 = default(float); Color.RGBToHSV(val, ref num, ref num2, ref num3); Color result = Color.HSVToRGB(Mathf.Repeat(num + shift, 1f), num2, num3); result.a = alpha; return result; } private static Sprite CreateRoundedSprite() { //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_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) //IL_002d: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_0091: 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_00d5: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false) { name = "BetterUI_RoundedSurface", filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; Color32[] array = (Color32[])(object)new Color32[4096]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num = Mathf.Clamp((float)j + 0.5f, 13f, 51f); float num2 = Mathf.Clamp((float)i + 0.5f, 13f, 51f); float num3 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), new Vector2(num, num2)); byte b = (byte)Mathf.RoundToInt(Mathf.Clamp01(13.75f - num3) * 255f); array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } } val.SetPixels32(Il2CppStructArray<Color32>.op_Implicit(array)); val.Apply(false, true); Object.DontDestroyOnLoad((Object)(object)val); Sprite obj = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(16f, 16f, 16f, 16f)); ((Object)obj).name = "BetterUI_RoundedSurfaceSprite"; ((Object)obj).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)obj); return obj; } private static Texture2D CreateScanlineTexture() { //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_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_005a: 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_0062: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(2, 4, (TextureFormat)4, false) { name = "BetterUI_TerminalScanlines", filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)0, hideFlags = (HideFlags)61 }; Color32 val2 = default(Color32); ((Color32)(ref val2))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0); Color32 val3 = default(Color32); ((Color32)(ref val3))..ctor((byte)0, (byte)0, (byte)0, byte.MaxValue); val.SetPixels32(Il2CppStructArray<Color32>.op_Implicit((Color32[])(object)new Color32[8] { val2, val2, val2, val2, val3, val3, val2, val2 })); val.Apply(false, true); Object.DontDestroyOnLoad((Object)(object)val); return val; } private static Texture2D CreateColorWheelTexture() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) Texture2D val = NewIconTexture("BetterUI_ColorWheel", 32); Color32[] array = (Color32[])(object)new Color32[1024]; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(15.5f, 15.5f); for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { Vector2 val3 = new Vector2((float)j, (float)i) - val2; float magnitude = ((Vector2)(ref val3)).magnitude; if (magnitude < 7f || magnitude > 14.5f) { array[i * 32 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0); continue; } float num = Mathf.Repeat(Mathf.Atan2(val3.y, val3.x) / ((float)Math.PI * 2f), 1f); array[i * 32 + j] = Color32.op_Implicit(Color.HSVToRGB(num, 0.86f, 1f)); } } val.SetPixels32(Il2CppStructArray<Color32>.op_Implicit(array)); val.Apply(false, true); Object.DontDestroyOnLoad((Object)(object)val); return val; } private static Texture2D CreateGearTexture() { //IL_005a: 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_0060: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) Texture2D val = NewIconTexture("BetterUI_Gear", 32); Color32[] array = (Color32[])(object)new Color32[1024]; Color32 val2 = default(Color32); ((Color32)(ref val2))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(15.5f, 15.5f); for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { Vector2 val4 = new Vector2((float)j, (float)i) - val3; float magnitude = ((Vector2)(ref val4)).magnitude; float num = Mathf.Abs(Mathf.Sin(Mathf.Atan2(val4.y, val4.x) * 4f)); bool flag = magnitude >= 7f && magnitude <= 11.5f; bool flag2 = magnitude > 10.5f && magnitude <= 14f && num < 0.34f; bool flag3 = magnitude >= 3.25f && magnitude <= 6.25f; array[i * 32 + j] = (Color32)((flag || flag2 || flag3) ? val2 : new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0)); } } val.SetPixels32(Il2CppStructArray<Color32>.op_Implicit(array)); val.Apply(false, true); Object.DontDestroyOnLoad((Object)(object)val); return val; } private static Texture2D CreateCategoryIcon(int iconIndex) { //IL_0078: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_012b: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) Texture2D val = NewIconTexture($"BetterUI_CategoryIcon_{iconIndex}", 32); Color32[] array = (Color32[])(object)new Color32[1024]; Color32 color = default(Color32); ((Color32)(ref color))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); switch (iconIndex) { case 0: DrawLine(array, 32, 7, 6, 25, 25, 2, color); DrawLine(array, 32, 25, 6, 7, 25, 2, color); break; case 1: FillRect(array, 32, 13, 5, 19, 27, color); FillRect(array, 32, 5, 13, 27, 19, color); break; case 2: DrawLine(array, 32, 9, 25, 21, 11, 3, color); FillRect(array, 32, 15, 6, 27, 12, color); break; case 3: FillRect(array, 32, 10, 10, 22, 27, color); FillRect(array, 32, 5, 10, 12, 17, color); FillRect(array, 32, 20, 10, 27, 17, color); FillRect(array, 32, 13, 7, 19, 12, new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0)); break; default: FillRect(array, 32, 6, 6, 13, 13, color); FillRect(array, 32, 19, 6, 26, 13, color); FillRect(array, 32, 6, 19, 13, 26, color); FillRect(array, 32, 19, 19, 26, 26, color); break; } val.SetPixels32(Il2CppStructArray<Color32>.op_Implicit(array)); val.Apply(false, true); Object.DontDestroyOnLoad((Object)(object)val); return val; } private static Texture2D NewIconTexture(string name, int size) { //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_0010: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown return new Texture2D(size, size, (TextureFormat)4, false) { name = name, filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; } private static void FillRect(Color32[] pixels, int size, int left, int bottom, int right, int top, Color32 color) { //IL_001a: 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) for (int i = Mathf.Max(0, bottom); i < Mathf.Min(size, top); i++) { for (int j = Mathf.Max(0, left); j < Mathf.Min(size, right); j++) { pixels[i * size + j] = color; } } } private static void DrawLine(Color32[] pixels, int size, int startX, int startY, int endX, int endY, int thickness, Color32 color) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Max(Mathf.Abs(endX - startX), Mathf.Abs(endY - startY)); for (int i = 0; i <= num; i++) { float num2 = ((num > 0) ? ((float)i / (float)num) : 0f); int num3 = Mathf.RoundToInt(Mathf.Lerp((float)startX, (float)endX, num2)); int num4 = Mathf.RoundToInt(Mathf.Lerp((float)startY, (float)endY, num2)); FillRect(pixels, size, num3 - thickness, num4 - thickness, num3 + thickness + 1, num4 + thickness + 1, color); } } private static Color Hex(string hex, float alpha) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); ColorUtility.TryParseHtmlString("#" + hex, ref result); result.a = alpha; return result; } } internal sealed class BuildingMenuBuilder { private int _builtForRootId; internal GameObject ReplacementRoot { get; private set; } internal RectTransform ThemeButton { get; private set; } internal MazeButton CloseButton { get; private set; } internal void Build(BuildTemplatesUI building) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)building == (Object)null || _builtForRootId == ((Object)building).GetInstanceID()) { return; } TextMeshProUGUI val = FindTextTemplate(building); if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("The building menu has no initialized text template."); } Transform transform = ((Component)building).transform; Canvas componentInParent = ((Component)building).GetComponentInParent<Canvas>(); Canvas val2 = (((Object)(object)componentInParent != (Object)null) ? componentInParent.rootCanvas : null); Transform parent = (((Object)(object)val2 != (Object)null) ? ((Component)val2).transform : (((Object)(object)componentInParent != (Object)null) ? ((Component)componentInParent).transform : transform)); DisableOwnerShellGraphics(building); List<Transform> list = new List<Transform>(); for (int i = 0; i < transform.childCount; i++) { list.Add(transform.GetChild(i)); } RectTransform val3 = CreateSurface("BetterUI_BuildMenu", parent, BetterUITheme.CraftingCanvas, shadow: true); val3.anchorMin = new Vector2(0.035f, 0.055f); val3.anchorMax = new Vector2(0.965f, 0.945f); val3.offsetMin = Vector2.zero; val3.offsetMax = Vector2.zero; ((Transform)val3).SetAsLastSibling(); ReplacementRoot = ((Component)val3).gameObject; BuildHeader(val3, val); RectTransform val4 = CreateRect("BetterUI_BuildBody", (Transform)(object)val3); val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; val4.offsetMin = new Vector2(14f, 64f); val4.offsetMax = new Vector2(-14f, -92f); RectTransform val5 = CreateSurface("BetterUI_BuildCategories", (Transform)(object)val4, BetterUITheme.PanelElevated); val5.anchorMin = Vector2.zero; val5.anchorMax = new Vector2(0.19f, 1f); val5.offsetMin = Vector2.zero; val5.offsetMax = Vector2.zero; RectTransform val6 = CreateSurface("BetterUI_BuildBrowser", (Transform)(object)val4, BetterUITheme.Panel); val6.anchorMin = new Vector2(0.202f, 0f); val6.anchorMax = new Vector2(0.625f, 1f); val6.offsetMin = Vector2.zero; val6.offsetMax = Vector2.zero; RectTransform val7 = CreateSurface("BetterUI_BuildDetails", (Transform)(object)val4, BetterUITheme.PanelElevated); val7.anchorMin = new Vector2(0.637f, 0f); val7.anchorMax = Vector2.one; val7.offsetMin = Vector2.zero; val7.offsetMax = Vector2.zero; BuildCategories(building, val5, val); BuildBrowser(building, val6, val); BuildDetails(building, val7, val); BuildFooter(building, val3, val); int instanceID = ((Object)transform).GetInstanceID(); for (int j = 0; j < list.Count; j++) { Transform val8 = list[j]; if ((Object)(object)val8 != (Object)null && (Object)(object)val8.parent != (Object)null && ((Object)val8.parent).GetInstanceID() == instanceID) { ((Component)val8).gameObject.SetActive(false); } } ((Component)val3).gameObject.SetActive(true); _builtForRootId = ((Object)building).GetInstanceID(); BetterUIPlugin.ModLog.LogInfo((object)"Built BetterUI structure-catalog hierarchy."); } private static void DisableOwnerShellGraphics(BuildTemplatesUI building) { Il2CppArrayBase<Graphic> components = ((Component)building).GetComponents<Graphic>(); for (int i = 0; i < components.Length; i++) { if ((Object)(object)components[i] != (Object)null) { ((Behaviour)components[i]).enabled = false; } } } private static void BuildHeader(RectTransform root, TextMeshProUGUI template) { //IL_0006: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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) RectTransform val = CreateSurface("BetterUI_BuildHeader", (Transform)(object)root, BetterUITheme.Panel); AnchorTop(val, 78f, 0f, 0f); TextMeshProUGUI obj = CreateLabel("BetterUI_BuildTitle", (Transform)(object)val, template); ((TMP_Text)obj).text = "BUILDING // STRUCTURE CATALOG"; BetterUIStyler.Heading((TMP_Text)(object)obj, 28f); ((TMP_Text)obj).alignment = (TextAlignmentOptions)4097; Stretch(((TMP_Text)obj).rectTransform, 20f, 270f); TextMeshProUGUI obj2 = CreateLabel("BetterUI_BuildStatus", (Transform)(object)val, template); ((TMP_Text)obj2).text = "FIELD CONSTRUCTION // READY\nHAMMER LINK ACTIVE"; BetterUIStyler.Text((TMP_Text)(object)obj2, 11f, BetterUITheme.Accent, (FontStyles)1); ((TMP_Text)obj2).characterSpacing = 1.2f; ((TMP_Text)obj2).alignment = (TextAlignmentOptions)4100; RectTransform rectTransform = ((TMP_Text)obj2).rectTransform; rectTransform.anchorMin = new Vector2(0.65f, 0f); rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = new Vector2(0f, 8f); rectTransform.offsetMax = new Vector2(-18f, -8f); } private static void BuildCategories(BuildTemplatesUI building, RectTransform panel, TextMeshProUGUI template) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) VerticalLayoutGroup obj = ((Component)panel).gameObject.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)obj).padding = Padding(12, 12, 16, 12); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 8f; ((LayoutGroup)obj).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; TextMeshProUGUI obj2 = CreateLabel("BetterUI_BuildCategoriesHeading", (Transform)(object)panel, template); ((TMP_Text)obj2).text = "BUILD CLASS"; BetterUIStyler.Text((TMP_Text)(object)obj2, 13f, BetterUITheme.TextMuted, (FontStyles)1); ((TMP_Text)obj2).characterSpacing = 1.5f; ((TMP_Text)obj2).alignment = (TextAlignmentOptions)4097; SetLayout(((Component)obj2).gameObject, 0f, 0f, 1f, 27f, 27f, 0f); AddCategory(building.filterWallButton, (Transform)(object)panel, "WALLS", 0); AddCategory(building.filterFloorCeilingButton, (Transform)(object)panel, "FLOORS + CEILINGS", 1); AddCategory(building.filterStairButton, (Transform)(object)panel, "STAIRS", 2); AddCategory(building.filterFunctionalButton, (Transform)(object)panel, "UTILITY", 3); AddCategory(building.filterMiscButton, (Transform)(object)panel, "DECOR", 4); SetLayout(((Component)CreateRect("BetterUI_BuildCategorySpacer", (Transform)(object)panel)).gameObject, 0f, 0f, 1f, 1f, 1f, 1f); TextMeshProUGUI obj3 = CreateLabel("BetterUI_BuildCategoryHint", (Transform)(object)panel, template); ((TMP_Text)obj3).text = "FILTER THE CATALOG\nTHEN CHOOSE A PLAN"; BetterUIStyler.Text((TMP_Text)(object)obj3, 10f, BetterUITheme.TextDim, (FontStyles)0); ((TMP_Text)obj3).characterSpacing = 0.8f; ((TMP_Text)obj3).alignment = (TextAlignmentOptions)1025; SetLayout(((Component)obj3).gameObject, 0f, 0f, 1f, 38f, 38f, 0f); } private static void AddCategory(MazeButton button, Transform panel, string label, int sibling) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)button == (Object)null)) { MoveToLayout(((Component)button).transform, panel, 0f, 0f, 1f, 52f); ((Component)button).transform.SetSiblingIndex(sibling + 1); if ((Object)(object)button.buttonText != (Object)null) { ((TMP_Text)button.buttonText).text = label; ((TMP_Text)button.buttonText).alignment = (TextAlignmentOptions)4097; ((TMP_Text)button.buttonText).margin = new Vector4(16f, 0f, 8f, 0f); } } } private static void BuildBrowser(BuildTemplatesUI building, RectTransform panel, TextMeshProUGUI template) { //IL_0006: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_0248: 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_0272: 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_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) RectTransform val = CreateSurface("BetterUI_BuildBrowserHeader", (Transform)(object)panel, BetterUITheme.PanelElevated); AnchorTop(val, 94f, 8f, 8f); TextMeshProUGUI obj = CreateLabel("BetterUI_BuildBrowserHeading", (Transform)(object)val, template); ((TMP_Text)obj).text = "AVAILABLE PLANS"; BetterUIStyler.Text((TMP_Text)(object)obj, 13f, BetterUITheme.TextMuted, (FontStyles)1); ((TMP_Text)obj).characterSpacing = 1.5f; ((TMP_Text)obj).alignment = (TextAlignmentOptions)4097; RectTransform rectTransform = ((TMP_Text)obj).rectTransform; rectTransform.anchorMin = new Vector2(0f, 0.5f); rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = new Vector2(12f, 0f); rectTransform.offsetMax = new Vector2(-12f, 0f); if ((Object)(object)building._searchInputField != (Object)null) { RectTransform component = ((Component)building._searchInputField).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { ((Transform)component).SetParent((Transform)(object)val, false); component.anchorMin = Vector2.zero; component.anchorMax = new Vector2(1f, 0.5f); component.offsetMin = new Vector2(10f, 8f); component.offsetMax = new Vector2(-10f, -4f); LayoutElement component2 = ((Component)component).GetComponent<LayoutElement>(); if ((Object)(object)component2 != (Object)null) { component2.ignoreLayout = true; } } } RectTransform val2 = CreateSurface("BetterUI_BuildScroll", (Transform)(object)panel, BetterUITheme.CraftingWell); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = new Vector2(8f, 8f); val2.offsetMax = new Vector2(-8f, -102f); RectTransform val3 = CreateSurface("Viewport", (Transform)(object)val2, BetterUITheme.CraftingWell); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = new Vector2(7f, 7f); val3.offsetMax = new Vector2(-22f, -7f); ((Graphic)((Component)val3).GetComponent<Image>()).raycastTarget = true; ((Component)val3).gameObject.AddComponent<Mask>().showMaskGraphic = true; RectTransform val4 = (((Object)(object)building._buildRecipesContainer != (Object)null) ? ((Component)building._buildRecipesContainer).GetComponent<RectTransform>() : null); if ((Object)(object)val4 != (Object)null) { ((Transform)val4).SetParent((Transform)(object)val3, false); val4.anchorMin = new Vector2(0f, 1f); val4.anchorMax = new Vector2(1f, 1f); val4.pivot = new Vector2(0.5f, 1f); val4.anchoredPosition = Vector2.zero; val4.sizeDelta = new Vector2(0f, val4.sizeDelta.y); } Scrollbar verticalScrollbar = CreateScrollbar(val2); ScrollRect obj2 = ((Component)val2).gameObject.AddComponent<ScrollRect>(); obj2.content = val4; obj2.viewport = val3; obj2.horizontal = false; obj2.vertical = true; obj2.movementType = (MovementType)2; obj2.inertia = true; obj2.decelerationRate = 0.12f; obj2.scrollSensitivity = 36f; obj2.verticalScrollbar = verticalScrollbar; obj2.verticalScrollbarVisibility = (ScrollbarVisibility)2; obj2.verticalScrollbarSpacing = 4f; } private static void BuildDetails(BuildTemplatesUI building, RectTransform panel, TextMeshProUGUI template) { //IL_0006: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) RectTransform val = CreateSurface("BetterUI_BuildDetailsHeader", (Transform)(object)panel, BetterUITheme.CraftingWell); AnchorTop(val, 50f, 8f, 8f); TextMeshProUGUI obj = CreateLabel("BetterUI_BuildDetailsHeading", (Transform)(object)val, template); ((TMP_Text)obj).text = "PLAN INSPECTION // MATERIALS"; BetterUIStyler.Text((TMP_Text)(object)obj, 14f, BetterUITheme.TextMuted, (FontStyles)1); ((TMP_Text)obj).characterSpacing = 1.5f; ((TMP_Text)obj).alignment = (TextAlignmentOptions)4097; Stretch(((TMP_Text)obj).rectTransform, 12f, 12f); SelectedBuildRecipeUI selectedRecipeUI = building._selectedRecipeUI; if (!((Object)(object)selectedRecipeUI == (Object)null)) { RectTransform component = ((Component)selectedRecipeUI).GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)panel, false); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = new Vector2(10f, 10f); component.offsetMax = new Vector2(-10f, -58f); ((Component)selectedRecipeUI).gameObject.SetActive(true); DisableSelectedShellGraphic(((Component)selectedRecipeUI).gameObject); ConfigureEmptyState(selectedRecipeUI, template); ConfigureSelectedState(selectedRecipeUI, template); } } private static void DisableSelectedShellGraphic(GameObject target) { if ((Object)(object)target == (Object)null) { return; } Il2CppArrayBase<Graphic> components = target.GetComponents<Graphic>(); for (int i = 0; i < components.Length; i++) { Image val = (((Object)(object)components[i] != (Object)null) ? ((Il2CppObjectBase)components[i]).TryCast<Image>() : null); if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = false; } } } private static void ConfigureEmptyState(SelectedBuildRecipeUI selected, TextMeshProUGUI template) { //IL_0025: 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_003b: 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_00a1: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)selected.didntSelectRecipeParent == (Object)null)) { RectTransform component = selected.didntSelectRecipeParent.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } TextMeshProUGUI val = null; Il2CppArrayBase<TextMeshProUGUI> componentsInChildren = selected.didntSelectRecipeParent.GetComponentsInChildren<TextMeshProUGUI>(true); if (componentsInChildren.Length > 0) { val = componentsInChildren[0]; } if ((Object)(object)val == (Object)null) { val = CreateLabel("BetterUI_BuildSelectPrompt", selected.didntSelectRecipeParent.transform, template); } ((TMP_Text)val).text = "SELECT A BUILDING PLAN\n<size=70%>Choose a category or search the catalog</size>"; BetterUIStyler.Text((TMP_Text)(object)val, 17f, BetterUITheme.TextMuted, (FontStyles)1); ((TMP_Text)val).alignment = (TextAlignmentOptions)514; RectTransform rectTransform = ((TMP_Text)val).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = new Vector2(24f, 24f); rectTransform.offsetMax = new Vector2(-24f, -24f); } } private static void ConfigureSelectedState(SelectedBuildRecipeUI selected, TextMeshProUGUI template) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)selected.approvedParent == (Object)null) { return; } Transform transform = selected.approvedParent.transform; DisableSelectedShellGraphic(selected.approvedParent); RectTransform component = ((Component)transform).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } List<Transform> list = new List<Transform>(); for (int i = 0; i < transform.childCount; i++) { list.Add(transform.GetChild(i)); } RectTransform val = CreateRect("BetterUI_BuildSelectedContent", transform); val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.offsetMin = new Vector2(14f, 14f); val.offsetMax = new Vector2(-14f, -14f); VerticalLayoutGroup obj = ((Component)val).gameObject.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)obj).padding = Padding(8, 8, 8, 8); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 12f; ((LayoutGroup)obj).childAlignment = (TextAnchor)1; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; RectTransform val2 = CreateSurface("BetterUI_BuildSummary", (Transform)(object)val, BetterUITheme.CraftingWell); SetLayout(((Component)val2).gameObject, 0f, 0f, 1f, 136f, 136f, 0f); HorizontalLayoutGroup obj2 = ((Component)val2).gameObject.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)obj2).padding = Padding(16, 16, 12, 12); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 18f; ((LayoutGroup)obj2).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; MoveToLayout(((Object)(object)selected._outputItemContainer != (Object)null) ? ((Component)selected._outputItemContainer).transform : null, (Transform)(object)val2, 108f, 108f, 0f, 108f); MoveToLayout(((Object)(object)selected._outputItemNameTMP != (Object)null) ? ((TMP_Text)selected._outputItemNameTMP).transform : null, (Transform)(object)val2, 120f, 220f, 1f, 72f); TextMeshProUGUI obj3 = CreateLabel("BetterUI_BuildMaterialsHeading", (Transform)(object)val, template); ((TMP_Text)obj3).text = "REQUIRED MATERIALS // AVAILABLE / NEEDED"; BetterUIStyler.Text((TMP_Text)(object)obj3, 12f, BetterUITheme.TextMuted, (FontStyles)1); ((TMP_Text)obj3).characterSpacing = 1.1f; ((TMP_Text)obj3).alignment = (TextAlignmentOptions)4097; SetLayout(((Component)obj3).gameObject, 0f, 0f, 1f, 28f, 28f, 0f); RectTransform val3 = CreateSurface("BetterUI_BuildRequirements", (Transform)(object)val, BetterUITheme.PanelSoft); SetLayout(((Component)val3).gameObject, 0f, 0f, 1f, 270f, 270f, 0f); if ((Object)(object)selected._requiredItemsContainer != (Object)null) { RectTransform component2 = ((Component)selected._requiredItemsContainer).GetComponent<RectTransform>(); ((Transform)component2).SetParent((Transform)(object)val3, false); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = new Vector2(10f, 10f); component2.offsetMax = new Vector2(-10f, -10f); } SetLayout(((Component)CreateRect("BetterUI_BuildDetailsSpacer", (Transform)(object)val)).gameObject, 0f, 0f, 1f, 1f, 1f, 1f); if ((Object)(object)selected._placeButton != (Object)null) { if ((Object)(object)selected._placeButton.buttonText != (Object)null) { ((TMP_Text)selected._placeButton.buttonText).text = "PLACE STRUCTURE"; } MoveToLayout(((Component)selected._placeButton).transform, (Transform)(object)val, 0f, 0f, 1f, 56f); } int instanceID = ((Object)transform).GetInstanceID(); for (int j = 0; j < list.Count; j++) { Transform val4 = list[j]; if ((Object)(object)val4 != (Object)null && (Object)(object)val4.parent != (Object)null && ((Object)val4.parent).GetInstanceID() == instanceID) { ((Component)val4).gameObject.SetActive(false); } } } private void BuildFooter(BuildTemplatesUI building, RectTransform root, TextMeshProUGUI template) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) RectTransform val = CreateSurface("BetterUI_BuildFooter", (Transform)(object)root, BetterUITheme.Panel); val.anchorMin = Vector2.zero; val.anchorMax = new Vector2(1f, 0f); val.pivot = new Vector2(0.5f, 0f); val.offsetMin = Vector2.zero; val.offsetMax = new Vector2(0f, 52f); HorizontalLayoutGroup obj = ((Component)val).gameObject.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)obj).padding = Padding(18, 18, 7, 7); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 10f; ((LayoutGroup)obj).childAlignment = (TextAnchor)4; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; AddFooterPrompt((Transform)(object)val, template, "SELECT / PLACE", 150f); AddFooterPrompt((Transform)(object)val, template, "SCROLL / NAVIGATE", 180f); SetLayout(((Component)CreateRect("BetterUI_BuildFooterSpacer", (Transform)(object)val)).gameObject, 0f, 0f, 1f, 1f, 1f, 0f); ThemeButton = CreateSurface("BetterUI_BuildThemeButton", (Transform)(object)val, BetterUITheme.PanelSoft); SetLayout(((Component)ThemeButton).gameObject, 42f, 46f, 0f, 38f, 38f, 0f); ((Graphic)((Component)ThemeButton).GetComponent<Image>()).raycastTarget = true; GameObject val2 = new GameObject("BetterUI_BuildColorWheel", (Type[])(object)new Type[3] { Il2CppType.Of<RectTransform>(), Il2CppType.Of<CanvasRenderer>(), Il2CppType.Of<RawImage>() }); val2.transform.SetParent((Transform)(object)ThemeButton, false); RectTransform component = val2.GetComponent<RectTransform>(); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); component.pivot = val3; Vector2 anchorMin = (component.anchorMax = val3); component.anchorMin = anchorMin; component.sizeDelta = new Vector2(25f, 25f); RawImage component2 = val2.GetComponent<RawImage>(); component2.texture = (Texture)(object)BetterUITheme.ColorWheelTexture; ((Graphic)component2).raycastTarget = false; if ((Object)(object)building._hideUncraftableButton != (Object)null) { MoveToLayout(((Component)building._hideUncraftableButton).transform, (Transform)(object)val, 42f, 46f, 0f, 38f); } MazeButton val5 = FindCloseButton(((Component)building).transform); if ((Object)(object)val5 != (Object)null) { CloseButton = val5; if ((Object)(object)val5.buttonText != (Object)null) { ((TMP_Text)val5.buttonText).text = "[ ESC ] CLOSE"; } MoveToLayout(((Component)val5).transform, (Transform)(object)val, 130f, 150f, 0f, 38f); } } private static void AddFooterPrompt(Transform footer, TextMeshProUGUI template, string text, float width) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = CreateLabel("BetterUI_BuildFooterPrompt", footer, template); ((TMP_Text)obj).text = text; BetterUIStyler.Text((TMP_Text)(object)obj, 11f, BetterUITheme.TextMuted, (FontStyles)1); ((TMP_Text)obj).characterSpacing = 0.8f; ((TMP_Text)obj).alignment = (TextAlignmentOptions)4097; SetLayout(((Component)obj).gameObject, width * 0.65f, width, 0f, 30f, 30f, 0f); } private static TextMeshProUGUI FindTextTemplate(BuildTemplatesUI building) { if ((Object)(object)building._selectedRecipeUI != (Object)null && (Object)(object)building._selectedRecipeUI._outputItemNameTMP != (Object)null) { return building._selectedRecipeUI._outputItemNameTMP; } Il2CppArrayBase<TextMeshProUGUI> componentsInChildren = ((Component)building).GetComponentsInChildren<TextMeshProUGUI>(true); if (componentsInChildren.Length <= 0) { return null; } return componentsInChildren[0]; } private static MazeButton FindCloseButton(Transform root) { Il2CppArrayBase<MazeButton> componentsInChildren = ((Component)root).GetComponentsInChildren<MazeButton>(true); for (int i = 0; i < componentsInChildren.Length; i++) { MazeButton val = componentsInChildren[i]; string text = ((!((Object)(object)val != (Object)null) || !((Object)(object)val.buttonText != (Object)null)) ? string.Empty : ((TMP_Text)val.buttonText).text?.Trim().ToUpperInvariant()); if (text == "CLOSE" || text == "EXIT" || text.Contains("CLOSE")) { return val; } } return null; } private static Scrollbar CreateScrollbar(RectTransform parent) { //IL_0006: 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_0028: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00b1: Unknown result type (might be due to invalid IL or missing references) RectTransform val = CreateSurface("BetterUI_BuildScrollbar", (Transform)(object)parent, BetterUITheme.PanelSoft); val.anchorMin = new Vector2(1f, 0f); val.anchorMax = Vector2.one; val.pivot = new Vector2(1f, 0.5f); val.offsetMin = new Vector2(-14f, 8f); val.offsetMax = new Vector2(-4f, -8f); ((Graphic)((Component)val).GetComponent<Image>()).raycastTarget = true; RectTransform val2 = CreateSurface("Handle", (Transform)(object)val, BetterUITheme.Accent); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; ((Graphic)((Component)val2).GetComponent<Image>()).raycastTarget = true; Scrollbar obj = ((Component)val).gameObject.AddComponent<Scrollbar>(); obj.handleRect = val2; ((Selectable)obj).targetGraphic = (Graphic)(object)((Component)val2).GetComponent<Image>(); obj.direction = (Direction)2; obj.size = 0.2f; return obj; } private static void MoveToLayout(Transform item, Transform parent, float minWidth, float preferredWidth, float flexibleWidth, float height) { if (!((Object)(object)item == (Object)null)) { item.SetParent(parent, false); RectTransform component = ((Component)item).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { NormalizeRect(component); } SetLayout(((Component)item).gameObject, minWidth, preferredWidth, flexibleWidth, height, height, 0f); } } internal static void SetLayout(GameObject target, float minWidth, float preferredWidth, float flexibleWidth, float minHeight, float preferredHeight, float flexibleHeight) { LayoutElement val = target.GetComponent<LayoutElement>(); if ((Object)(object)val == (Object)null) { val = target.AddComponent<LayoutElement>(); } val.minWidth = minWidth; val.preferredWidth = preferredWidth; val.flexibleWidth = flexibleWidth; val.minHeight = minHeight; val.preferredHeight = preferredHeight; val.flexibleHeight = flexibleHeight; } internal static RectTransform CreateSurface(string name, Transform parent, Color color, bool shadow = false) { //IL_001f: Unknown result type (might be due