Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SafeTrash v1.0.1
BepInEx/plugins/SafeTrash.dll
Decompiled a day 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using SafeTrash.Core; using SafeTrash.UI; using SafeTrash.UI.Components; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ADERiGMS")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright © 2026 ADERiGMS")] [assembly: AssemblyDescription("A safe pending trash queue for Valheim.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SafeTrash")] [assembly: AssemblyTitle("SafeTrash")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace SafeTrash { [BepInPlugin("ADERiGMS.SafeTrash", "SafeTrash", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "ADERiGMS.SafeTrash"; public const string PluginName = "SafeTrash"; public const string PluginVersion = "1.0.0"; internal const float DefaultWindowScale = 1f; internal const float MinimumWindowScale = 0.75f; internal const float MaximumWindowScale = 1.5f; internal const float WindowScaleStep = 0.05f; internal const float DefaultDestroyConfirmationTimeout = 15f; internal const float MinimumDestroyConfirmationTimeout = 3f; internal const float MaximumDestroyConfirmationTimeout = 30f; internal const float DestroyConfirmationTimeoutStep = 1f; internal const bool DefaultDebugLogging = false; internal static ManualLogSource Log; internal static ConfigEntry<float> WindowPositionX; internal static ConfigEntry<float> WindowPositionY; internal static ConfigEntry<float> WindowScale; internal static ConfigEntry<bool> EnableDebugLogging; internal static ConfigEntry<float> DestroyConfirmationTimeout; private Harmony? _harmony; private static ConfigEntry<KeyboardShortcut>? _toggleKey; private Inventory? _trackedPlayerInventory; internal static float WindowScaleValue => Mathf.Clamp(WindowScale?.Value ?? 1f, 0.75f, 1.5f); internal static float DestroyConfirmationTimeoutSeconds => Mathf.Clamp(DestroyConfirmationTimeout?.Value ?? 15f, 3f, 30f); internal static string ToggleKeyDisplay { get { //IL_001d: 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_0009: Unknown result type (might be due to invalid IL or missing references) if (_toggleKey == null) { return ((object)(KeyCode)127/*cast due to .constrained prefix*/).ToString(); } return ((object)_toggleKey.Value/*cast due to .constrained prefix*/).ToString(); } } internal static string BepInExVersion => typeof(BaseUnityPlugin).Assembly.GetName().Version?.ToString() ?? "Unknown"; private void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "ToggleKey", new KeyboardShortcut((KeyCode)127, Array.Empty<KeyCode>()), "Open or close the SafeTrash window."); WindowPositionX = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "WindowPositionX", 330f, "Saved horizontal position of the SafeTrash window."); WindowPositionY = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "WindowPositionY", 0f, "Saved vertical position of the SafeTrash window."); WindowScale = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "WindowScale", 1f, new ConfigDescription("Scale of the main SafeTrash window.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.75f, 1.5f), Array.Empty<object>())); EnableDebugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "EnableDebugLogging", false, "Enable detailed SafeTrash diagnostic logging. Requires a restart."); DestroyConfirmationTimeout = ((BaseUnityPlugin)this).Config.Bind<float>("Safety", "DestroyConfirmationTimeout", 15f, new ConfigDescription("Seconds available for confirming item destruction.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 30f), Array.Empty<object>())); _harmony = new Harmony("ADERiGMS.SafeTrash"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded successfully."); } private void Update() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) UpdatePlayerSession(); if (_toggleKey == null) { return; } if (!InventoryGui.IsVisible()) { TrashUI.Hide(); return; } TrashUI.RefreshRuntimeUi(); TrashUI.UpdateDestroyConfirmation(); KeyboardShortcut value = _toggleKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { TrashUI.Toggle(); } } private void UpdatePlayerSession() { Player localPlayer = Player.m_localPlayer; Inventory val = (((Object)(object)localPlayer != (Object)null) ? ((Humanoid)localPlayer).GetInventory() : null); if (_trackedPlayerInventory == val) { return; } bool num = _trackedPlayerInventory != null; _trackedPlayerInventory = val; if (num) { bool num2 = PendingTrashQueue.EntryCount > 0; TrashUI.ResetForPlayerSessionChange(); if (num2) { DebugLog("SafeTrash queue cleared safely because the player session changed."); } } } private void OnDestroy() { PendingTrashQueue.Clear(); Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } internal static void SaveWindowPosition(Vector2 position) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //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) WindowPositionX.Value = position.x; WindowPositionY.Value = position.y; DebugLog($"SafeTrash window position saved: X={position.x:F1}, Y={position.y:F1}"); } internal static void DebugLog(string message) { ConfigEntry<bool> enableDebugLogging = EnableDebugLogging; if (enableDebugLogging != null && enableDebugLogging.Value) { Log.LogInfo((object)message); } } } } namespace SafeTrash.UI { internal sealed class QueueSlotHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler { private Image? _border; private TrashQueueView? _owner; private PendingTrashEntry? _entry; internal void Initialize(Image border, TrashQueueView owner, PendingTrashEntry entry) { _border = border; _owner = owner; _entry = entry; } public void OnPointerEnter(PointerEventData eventData) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_border != (Object)null) { ((Graphic)_border).color = SafeTrashTheme.DropZoneLabel; } } public void OnPointerExit(PointerEventData eventData) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_border != (Object)null) { ((Graphic)_border).color = SafeTrashTheme.Accent; } } public void OnPointerClick(PointerEventData eventData) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if ((int)eventData.button == 0 && !((Object)(object)_owner == (Object)null) && _entry != null) { _owner.Unqueue(_entry); ((AbstractEventData)eventData).Use(); } } } internal sealed class RowSnapScrollRect : ScrollRect { internal float RowStep { get; set; } = 62f; public override void OnScroll(PointerEventData eventData) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_00c4: Unknown result type (might be due to invalid IL or missing references) if (!((UIBehaviour)this).IsActive() || (Object)(object)((ScrollRect)this).content == (Object)null || (Object)(object)((ScrollRect)this).viewport == (Object)null) { return; } Canvas.ForceUpdateCanvases(); Rect rect = ((ScrollRect)this).content.rect; float height = ((Rect)(ref rect)).height; rect = ((ScrollRect)this).viewport.rect; float num = height - ((Rect)(ref rect)).height; if (num <= 0f) { ((ScrollRect)this).verticalNormalizedPosition = 1f; return; } float num2 = Mathf.Sign(eventData.scrollDelta.y); if (!Mathf.Approximately(num2, 0f)) { float num3 = Mathf.Clamp((Mathf.Round((1f - ((ScrollRect)this).verticalNormalizedPosition) * num / RowStep) - num2) * RowStep, 0f, num); ((ScrollRect)this).verticalNormalizedPosition = 1f - num3 / num; ((ScrollRect)this).velocity = Vector2.zero; ((AbstractEventData)eventData).Use(); } } public override void OnEndDrag(PointerEventData eventData) { ((ScrollRect)this).OnEndDrag(eventData); SnapToNearestRow(); } internal void SnapToNearestRow() { //IL_0028: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((ScrollRect)this).content == (Object)null) && !((Object)(object)((ScrollRect)this).viewport == (Object)null)) { Canvas.ForceUpdateCanvases(); Rect rect = ((ScrollRect)this).content.rect; float height = ((Rect)(ref rect)).height; rect = ((ScrollRect)this).viewport.rect; float num = height - ((Rect)(ref rect)).height; if (num <= 0f) { ((ScrollRect)this).verticalNormalizedPosition = 1f; return; } float num2 = Mathf.Clamp(Mathf.Round((1f - ((ScrollRect)this).verticalNormalizedPosition) * num / RowStep) * RowStep, 0f, num); ((ScrollRect)this).verticalNormalizedPosition = 1f - num2 / num; ((ScrollRect)this).velocity = Vector2.zero; } } } internal sealed class ScrollbarRowSnapHandler : MonoBehaviour, IEndDragHandler, IEventSystemHandler, IPointerUpHandler { private RowSnapScrollRect? _scroll; internal void Initialize(RowSnapScrollRect scroll) { _scroll = scroll; } public void OnEndDrag(PointerEventData eventData) { _scroll?.SnapToNearestRow(); } public void OnPointerUp(PointerEventData eventData) { _scroll?.SnapToNearestRow(); } } internal sealed class DropZoneHandler : MonoBehaviour, IPointerDownHandler, IEventSystemHandler { private static readonly FieldInfo? DragItemField = AccessTools.Field(typeof(InventoryGui), "m_dragItem"); private static readonly FieldInfo? DragInventoryField = AccessTools.Field(typeof(InventoryGui), "m_dragInventory"); private static readonly FieldInfo? DragAmountField = AccessTools.Field(typeof(InventoryGui), "m_dragAmount"); private static readonly MethodInfo? SetupDragItemMethod = AccessTools.Method(typeof(InventoryGui), "SetupDragItem", new Type[3] { typeof(ItemData), typeof(Inventory), typeof(int) }, (Type[])null); private InventoryGui? _inventoryGui; internal void Initialize(InventoryGui inventoryGui) { _inventoryGui = inventoryGui; if (DragItemField == null || DragInventoryField == null || DragAmountField == null || SetupDragItemMethod == null) { Plugin.Log.LogError((object)"SafeTrash could not locate InventoryGui drag members."); ((Behaviour)this).enabled = false; } else { Plugin.DebugLog("SafeTrash DropZoneHandler initialized."); } } public void OnPointerDown(PointerEventData eventData) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_inventoryGui == (Object)null || !InventoryGui.IsVisible() || (int)eventData.button != 0) { return; } object? value = DragItemField.GetValue(_inventoryGui); ItemData val = (ItemData)((value is ItemData) ? value : null); if (val == null) { return; } object? value2 = DragInventoryField.GetValue(_inventoryGui); Inventory val2 = (Inventory)((value2 is Inventory) ? value2 : null); if (val2 != null) { int draggedAmount = GetDraggedAmount(_inventoryGui); string name = val.m_shared.m_name; if (!PendingTrashQueue.TryAdd(val, val2, draggedAmount, out string failureReason)) { ShowRelevantFailure(failureReason); Plugin.DebugLog("SafeTrash could not queue item: " + failureReason); ((AbstractEventData)eventData).Use(); return; } TrashUI.SetQueueStatus(PendingTrashQueue.EntryCount); Plugin.DebugLog($"SafeTrash safe drop captured: item={name}, amount={draggedAmount}"); SetupDragItemMethod.Invoke(_inventoryGui, new object[3] { null, null, 1 }); ((AbstractEventData)eventData).Use(); Plugin.DebugLog("SafeTrash vanilla drag cleared safely."); } } private static int GetDraggedAmount(InventoryGui inventoryGui) { if (!(DragAmountField.GetValue(inventoryGui) is int num) || num <= 0) { return 1; } return num; } private static void ShowRelevantFailure(string failureReason) { if (failureReason == "UNEQUIP FIRST" || failureReason == "MOVE FROM HOTBAR") { TrashUI.ShowStatusMessage(failureReason); } } } internal static class SafeTrashAssets { private const string TrashIconResource = "SafeTrash.Assets.SafeTrashIcon.png"; private static Sprite? _trashIcon; private static bool _trashIconLoaded; internal static Sprite? TrashIcon { get { if (!_trashIconLoaded) { _trashIconLoaded = true; _trashIcon = LoadSprite("SafeTrash.Assets.SafeTrashIcon.png"); } return _trashIcon; } } private static Sprite? LoadSprite(string resourceName) { //IL_003c: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); if (stream == null) { Plugin.Log.LogWarning((object)("SafeTrash UI asset was not found: " + resourceName)); return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { name = "SafeTrashIconTexture", filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; if (!ImageConversion.LoadImage(val, memoryStream.ToArray(), true)) { Object.Destroy((Object)(object)val); Plugin.Log.LogWarning((object)("SafeTrash UI asset could not be decoded: " + resourceName)); return null; } Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); ((Object)obj).name = "SafeTrashIcon"; ((Object)obj).hideFlags = (HideFlags)61; return obj; } } internal static class SafeTrashTheme { internal static readonly Color WindowBorder = new Color(0.29f, 0.18f, 0.08f, 1f); internal static readonly Color WindowBackground = new Color(0.05f, 0.043f, 0.033f, 0.985f); internal static readonly Color HeaderBackground = new Color(0.13f, 0.07f, 0.038f, 1f); internal static readonly Color FooterBackground = new Color(0.065f, 0.05f, 0.037f, 1f); internal static readonly Color Gold = new Color(1f, 0.63f, 0.16f, 1f); internal static readonly Color SoftGold = new Color(0.77f, 0.65f, 0.48f, 1f); internal static readonly Color MutedText = new Color(0.5f, 0.46f, 0.39f, 1f); internal static readonly Color Accent = new Color(0.56f, 0.29f, 0.085f, 1f); internal static readonly Color Danger = new Color(0.95f, 0.28f, 0.1f, 1f); internal static readonly Color DropZoneBorder = new Color(0.4f, 0.23f, 0.075f, 1f); internal static readonly Color DropZoneInner = new Color(0.037f, 0.034f, 0.029f, 0.985f); internal static readonly Color DropZoneLabel = new Color(0.94f, 0.5f, 0.11f, 1f); internal static readonly Color CloseBorder = new Color(0.46f, 0.24f, 0.075f, 1f); internal static readonly Color CloseBackground = new Color(0.085f, 0.042f, 0.022f, 1f); internal static readonly Color CloseHover = new Color(0.25f, 0.09f, 0.035f, 1f); internal static readonly Color ClosePressed = new Color(0.43f, 0.13f, 0.04f, 1f); internal const float WindowWidth = 470f; internal const float WindowHeight = 440f; internal const float BorderSize = 3f; internal const float HeaderHeight = 56f; internal const float FooterHeight = 38f; internal const float ContentPadding = 18f; internal const float HeaderLineHeight = 1f; internal const float CloseButtonSize = 32f; internal const float CloseButtonBorder = 1f; internal const float DropZoneBorderSize = 1f; internal const float DropZoneLabelWidth = 132f; internal const float DropZoneLabelHeight = 24f; internal const float DropZoneTopGap = 18f; internal const float DropZoneBottomGap = 15f; } internal static class SafeTrashUiFactory { internal static RectTransform CreateRect(string name, Transform parent) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = new GameObject(name).AddComponent<RectTransform>(); ((Transform)obj).SetParent(parent, false); return obj; } internal static Image AddImage(RectTransform rect, Color color, bool raycastTarget) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Image obj = ((Component)rect).gameObject.AddComponent<Image>(); ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = raycastTarget; return obj; } internal static TextMeshProUGUI CreateText(string name, Transform parent, TMP_FontAsset? font) { TextMeshProUGUI val = ((Component)CreateRect(name, parent)).gameObject.AddComponent<TextMeshProUGUI>(); if ((Object)(object)font != (Object)null) { ((TMP_Text)val).font = font; } return val; } internal static void Stretch(RectTransform rect, Vector2 offsetMin, Vector2 offsetMax) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_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) rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.offsetMin = offsetMin; rect.offsetMax = offsetMax; } internal static void ApplyButtonColors(Button button) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_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_005c: Unknown result type (might be due to invalid IL or missing references) ColorBlock colors = ((Selectable)button).colors; ((ColorBlock)(ref colors)).normalColor = SafeTrashTheme.CloseBackground; ((ColorBlock)(ref colors)).highlightedColor = SafeTrashTheme.CloseHover; ((ColorBlock)(ref colors)).pressedColor = SafeTrashTheme.ClosePressed; ((ColorBlock)(ref colors)).selectedColor = SafeTrashTheme.CloseHover; ((ColorBlock)(ref colors)).disabledColor = SafeTrashTheme.CloseBackground; ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.08f; ((Selectable)button).colors = colors; if ((Object)(object)((Component)button).GetComponent<ButtonPressFeedback>() == (Object)null) { ((Component)button).gameObject.AddComponent<ButtonPressFeedback>(); } } } internal sealed class ScaleAwareStrokeRegistry : MonoBehaviour { private enum StrokeLayout { Inset, Horizontal } private sealed class StrokeBinding { internal RectTransform Rect { get; } internal StrokeLayout Layout { get; } internal float InsideDirection { get; } internal StrokeBinding(RectTransform rect, StrokeLayout layout, float insideDirection) { Rect = rect; Layout = layout; InsideDirection = insideDirection; } } private const float TargetStrokePixels = 2f; private const float MinimumStrokeUnits = 0.5f; private const float MaximumStrokeUnits = 6f; private readonly List<StrokeBinding> _bindings = new List<StrokeBinding>(); private Canvas? _canvas; private Vector3 _lastLocalScale = new Vector3(-1f, -1f, -1f); private float _lastCanvasScaleFactor = -1f; internal void RegisterInset(RectTransform rect) { Register(new StrokeBinding(rect, StrokeLayout.Inset, 0f)); } internal void RegisterHorizontal(RectTransform rect, float insideDirection) { Register(new StrokeBinding(rect, StrokeLayout.Horizontal, Mathf.Sign(insideDirection))); } internal void Refresh(bool force = false) { //IL_005e: 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_003b: 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_00b3: 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_009e: Unknown result type (might be due to invalid IL or missing references) _canvas = ((Component)this).GetComponentInParent<Canvas>(); float num = (((Object)(object)_canvas != (Object)null) ? _canvas.rootCanvas.scaleFactor : 1f); if (!force && Approximately(((Component)this).transform.localScale, _lastLocalScale) && Mathf.Approximately(num, _lastCanvasScaleFactor)) { return; } Vector2 strokeSize = CalculateStrokeSize(num); for (int num2 = _bindings.Count - 1; num2 >= 0; num2--) { StrokeBinding strokeBinding = _bindings[num2]; if ((Object)(object)strokeBinding.Rect == (Object)null) { _bindings.RemoveAt(num2); } else { Apply(strokeBinding, strokeSize); } } _lastLocalScale = ((Component)this).transform.localScale; _lastCanvasScaleFactor = num; } private void LateUpdate() { Refresh(); } private void Register(StrokeBinding binding) { for (int i = 0; i < _bindings.Count; i++) { StrokeBinding strokeBinding = _bindings[i]; if ((Object)(object)strokeBinding.Rect == (Object)(object)binding.Rect && strokeBinding.Layout == binding.Layout) { return; } } _bindings.Add(binding); Refresh(force: true); } private Vector2 CalculateStrokeSize(float canvasScaleFactor) { //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_0011: 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_0068: Unknown result type (might be due to invalid IL or missing references) Vector3 localScale = ((Component)this).transform.localScale; float num = Mathf.Max(0.001f, Mathf.Abs(localScale.x) * canvasScaleFactor); float num2 = Mathf.Max(0.001f, Mathf.Abs(localScale.y) * canvasScaleFactor); return new Vector2(Mathf.Clamp(2f / num, 0.5f, 6f), Mathf.Clamp(2f / num2, 0.5f, 6f)); } private static void Apply(StrokeBinding binding, Vector2 strokeSize) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_003f: 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_004d: 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_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_0018: Unknown result type (might be due to invalid IL or missing references) RectTransform rect = binding.Rect; if (binding.Layout == StrokeLayout.Inset) { rect.offsetMin = strokeSize; rect.offsetMax = -strokeSize; return; } Vector2 sizeDelta = rect.sizeDelta; sizeDelta.y = strokeSize.y; rect.sizeDelta = sizeDelta; Vector2 anchoredPosition = rect.anchoredPosition; anchoredPosition.y = binding.InsideDirection * strokeSize.y * 0.5f; rect.anchoredPosition = anchoredPosition; } private static bool Approximately(Vector3 first, Vector3 second) { //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Approximately(first.x, second.x) && Mathf.Approximately(first.y, second.y)) { return Mathf.Approximately(first.z, second.z); } return false; } } internal static class SettingsUI { private static GameObject? _root; private static int _lastScreenWidth = -1; private static int _lastScreenHeight = -1; private static Rect _lastSafeArea; private static float _lastCanvasScaleFactor = -1f; private const float SettingsWidth = 430f; private const float SettingsHeight = 420f; private const float HorizontalPadding = 20f; private const float RowHeight = 30f; private const float ControlHeight = 30f; private const float ControlBorderSize = 2f; private static TextMeshProUGUI? _windowScaleValue; private static TextMeshProUGUI? _toggleKeyValue; private static TextMeshProUGUI? _confirmTimeValue; private static TextMeshProUGUI? _debugLoggingValue; private static Button? _windowScaleDecreaseButton; private static TextMeshProUGUI? _windowScaleDecreaseLabel; private static Button? _windowScaleIncreaseButton; private static TextMeshProUGUI? _windowScaleIncreaseLabel; private static Button? _confirmTimeDecreaseButton; private static TextMeshProUGUI? _confirmTimeDecreaseLabel; private static Button? _confirmTimeIncreaseButton; private static TextMeshProUGUI? _confirmTimeIncreaseLabel; internal static void Toggle(InventoryGui inventoryGui) { if ((Object)(object)_root == (Object)null) { Create(inventoryGui); } if (!((Object)(object)_root == (Object)null)) { bool flag = !_root.activeSelf; _root.SetActive(flag); if (flag) { _root.transform.SetAsLastSibling(); RefreshValues(); RefreshRuntimeUi(force: true); } Plugin.DebugLog(flag ? "SafeTrash settings opened." : "SafeTrash settings closed."); } } internal static void Hide() { if ((Object)(object)_root != (Object)null && _root.activeSelf) { _root.SetActive(false); } } internal static void RefreshRuntimeUi(bool force = false) { //IL_0048: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) if ((Object)(object)_root == (Object)null || !_root.activeInHierarchy) { return; } Transform transform = _root.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); Canvas componentInParent = _root.GetComponentInParent<Canvas>(); if (!((Object)(object)val == (Object)null) && !((Object)(object)componentInParent == (Object)null)) { Rect safeArea = Screen.safeArea; float scaleFactor = componentInParent.rootCanvas.scaleFactor; if (force || _lastScreenWidth != Screen.width || _lastScreenHeight != Screen.height || !(_lastSafeArea == safeArea) || !Mathf.Approximately(_lastCanvasScaleFactor, scaleFactor)) { WindowBounds.FitAndClampToScreen(val); _lastScreenWidth = Screen.width; _lastScreenHeight = Screen.height; _lastSafeArea = safeArea; _lastCanvasScaleFactor = scaleFactor; } } } private static void DecreaseWindowScale() { SetWindowScale(Plugin.WindowScaleValue - 0.05f); } private static void IncreaseWindowScale() { SetWindowScale(Plugin.WindowScaleValue + 0.05f); } private static void SetWindowScale(float value) { float num = Mathf.Round(value / 0.05f) * 0.05f; Plugin.WindowScale.Value = Mathf.Clamp(num, 0.75f, 1.5f); TrashUI.ApplyWindowScale(); RefreshValues(); } private static void DecreaseConfirmationTimeout() { SetConfirmationTimeout(Plugin.DestroyConfirmationTimeoutSeconds - 1f); } private static void IncreaseConfirmationTimeout() { SetConfirmationTimeout(Plugin.DestroyConfirmationTimeoutSeconds + 1f); } private static void SetConfirmationTimeout(float value) { float num = Mathf.Round(value / 1f) * 1f; Plugin.DestroyConfirmationTimeout.Value = Mathf.Clamp(num, 3f, 30f); RefreshValues(); } private static void ToggleDebugLogging() { Plugin.EnableDebugLogging.Value = !Plugin.EnableDebugLogging.Value; RefreshValues(); Plugin.Log.LogInfo((object)("SafeTrash debug logging setting changed to " + (Plugin.EnableDebugLogging.Value ? "ON" : "OFF") + ". Restart the game to apply diagnostic patch changes.")); } private static void ResetDefaults() { Plugin.WindowScale.Value = 1f; Plugin.DestroyConfirmationTimeout.Value = 15f; Plugin.EnableDebugLogging.Value = false; TrashUI.ApplyWindowScale(); RefreshValues(); Plugin.DebugLog("SafeTrash settings reset to defaults."); } private static void RefreshValues() { //IL_00b6: 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) float windowScaleValue = Plugin.WindowScaleValue; float destroyConfirmationTimeoutSeconds = Plugin.DestroyConfirmationTimeoutSeconds; if ((Object)(object)_windowScaleValue != (Object)null) { ((TMP_Text)_windowScaleValue).text = $"{windowScaleValue:0.00}x"; } if ((Object)(object)_toggleKeyValue != (Object)null) { ((TMP_Text)_toggleKeyValue).text = Plugin.ToggleKeyDisplay; } if ((Object)(object)_confirmTimeValue != (Object)null) { ((TMP_Text)_confirmTimeValue).text = $"{destroyConfirmationTimeoutSeconds:0}s"; } if ((Object)(object)_debugLoggingValue != (Object)null) { bool value = Plugin.EnableDebugLogging.Value; ((TMP_Text)_debugLoggingValue).text = (value ? "ON" : "OFF"); ((Graphic)_debugLoggingValue).color = (value ? SafeTrashTheme.Gold : SafeTrashTheme.SoftGold); } SetActionButtonEnabled(_windowScaleDecreaseButton, _windowScaleDecreaseLabel, windowScaleValue > 0.751f); SetActionButtonEnabled(_windowScaleIncreaseButton, _windowScaleIncreaseLabel, windowScaleValue < 1.499f); SetActionButtonEnabled(_confirmTimeDecreaseButton, _confirmTimeDecreaseLabel, destroyConfirmationTimeoutSeconds > 3.001f); SetActionButtonEnabled(_confirmTimeIncreaseButton, _confirmTimeIncreaseLabel, destroyConfirmationTimeoutSeconds < 29.999f); } private static void Create(InventoryGui inventoryGui) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0071: Expected O, but got Unknown //IL_00b5: 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_00e4: Expected O, but got Unknown //IL_00e4: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown RectTransform obj = CreateRoot(inventoryGui); RectTransform obj2 = CreateBackground(obj); TMP_FontAsset defaultFontAsset = TMP_Settings.defaultFontAsset; CreateHeader(obj2, defaultFontAsset); CreateSectionTitle(obj2, defaultFontAsset, "INTERFACE", -70f); CreateStepperRow(obj2, defaultFontAsset, "WindowSizeRow", "WINDOW SIZE", -95f, new UnityAction(DecreaseWindowScale), new UnityAction(IncreaseWindowScale), out _windowScaleValue, out _windowScaleDecreaseButton, out _windowScaleDecreaseLabel, out _windowScaleIncreaseButton, out _windowScaleIncreaseLabel); CreateSectionTitle(obj2, defaultFontAsset, "BEHAVIOR", -130f); CreateReadOnlyRow(obj2, defaultFontAsset, "ToggleKeyRow", "TOGGLE KEY", -155f, out _toggleKeyValue); CreateStepperRow(obj2, defaultFontAsset, "ConfirmTimeRow", "CONFIRM TIME", -185f, new UnityAction(DecreaseConfirmationTimeout), new UnityAction(IncreaseConfirmationTimeout), out _confirmTimeValue, out _confirmTimeDecreaseButton, out _confirmTimeDecreaseLabel, out _confirmTimeIncreaseButton, out _confirmTimeIncreaseLabel); CreateToggleRow(obj2, defaultFontAsset, "DebugLoggingRow", "DEBUG LOGGING", -215f, new UnityAction(ToggleDebugLogging), out _debugLoggingValue); CreateHint(obj2, defaultFontAsset, "DebugRestartHint", "CHANGES TO FULL DIAGNOSTICS REQUIRE A RESTART", -245f); CreateResetButton(obj2, defaultFontAsset, -270f); CreateDivider(obj2, -310f); CreateSectionTitle(obj2, defaultFontAsset, "ABOUT", -320f); CreateAbout(obj2, defaultFontAsset, -345f); RefreshValues(); ((Component)obj).gameObject.SetActive(false); } private static RectTransform CreateRoot(InventoryGui inventoryGui) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0031: 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_005b: 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_007b: 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) _root = new GameObject("SafeTrash_SettingsWindow"); RectTransform obj = _root.AddComponent<RectTransform>(); ((Transform)obj).SetParent(inventoryGui.m_inventoryRoot, false); obj.anchorMin = new Vector2(0.5f, 0.5f); obj.anchorMax = new Vector2(0.5f, 0.5f); obj.pivot = new Vector2(0.5f, 0.5f); obj.sizeDelta = new Vector2(430f, 420f); obj.anchoredPosition = Vector2.zero; SafeTrashUiFactory.AddImage(obj, SafeTrashTheme.WindowBorder, raycastTarget: false); return obj; } private static RectTransform CreateBackground(RectTransform rootRect) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = SafeTrashUiFactory.CreateRect("Background", (Transform)(object)rootRect); SafeTrashUiFactory.Stretch(obj, new Vector2(3f, 3f), new Vector2(-3f, -3f)); SafeTrashUiFactory.AddImage(obj, SafeTrashTheme.WindowBackground, raycastTarget: true); return obj; } private static void CreateHeader(RectTransform backgroundRect, TMP_FontAsset? font) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) RectTransform val = SafeTrashUiFactory.CreateRect("Header", (Transform)(object)backgroundRect); val.anchorMin = new Vector2(0f, 1f); val.anchorMax = new Vector2(1f, 1f); val.pivot = new Vector2(0.5f, 1f); val.sizeDelta = new Vector2(0f, 56f); val.anchoredPosition = Vector2.zero; SafeTrashUiFactory.AddImage(val, SafeTrashTheme.HeaderBackground, raycastTarget: true); TextMeshProUGUI obj = SafeTrashUiFactory.CreateText("Title", (Transform)(object)val, font); SafeTrashUiFactory.Stretch(((TMP_Text)obj).rectTransform, new Vector2(46f, 0f), new Vector2(-46f, 0f)); ((TMP_Text)obj).text = "SAFE TRASH SETTINGS"; ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).fontSize = 20f; ((TMP_Text)obj).fontStyle = (FontStyles)1; ((Graphic)obj).color = SafeTrashTheme.Gold; ConfigureText(obj, (TextOverflowModes)1); CreateCloseButton(val, font); RectTransform obj2 = SafeTrashUiFactory.CreateRect("HeaderBottomLine", (Transform)(object)val); obj2.anchorMin = new Vector2(0f, 0f); obj2.anchorMax = new Vector2(1f, 0f); obj2.pivot = new Vector2(0.5f, 0.5f); obj2.sizeDelta = new Vector2(0f, 1f); obj2.anchoredPosition = new Vector2(0f, 0.5f); SafeTrashUiFactory.AddImage(obj2, SafeTrashTheme.Accent, raycastTarget: false); } private static void CreateSectionTitle(RectTransform parent, TMP_FontAsset? font, string text, float y) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = SafeTrashUiFactory.CreateText(text + "Title", (Transform)(object)parent, font); ConfigureTopRect(((TMP_Text)obj).rectTransform, 18f, y, 20f); ((TMP_Text)obj).text = text; ((TMP_Text)obj).alignment = (TextAlignmentOptions)513; ((TMP_Text)obj).fontSize = 13f; ((TMP_Text)obj).fontStyle = (FontStyles)1; ((Graphic)obj).color = SafeTrashTheme.Gold; ConfigureText(obj, (TextOverflowModes)1); } private static void CreateStepperRow(RectTransform parent, TMP_FontAsset? font, string name, string labelText, float y, UnityAction decreaseAction, UnityAction increaseAction, out TextMeshProUGUI value, out Button decreaseButton, out TextMeshProUGUI decreaseLabel, out Button increaseButton, out TextMeshProUGUI increaseLabel) { RectTransform val = CreateRow(parent, name, y); CreateRowLabel(val, font, labelText, 142f); decreaseButton = CreateActionButton("DecreaseButton", val, font, "-", 16f, 30f, -104f, decreaseAction, out decreaseLabel); value = CreateRightValue(val, font, "Value", 64f, -34f); increaseButton = CreateActionButton("IncreaseButton", val, font, "+", 16f, 30f, 0f, increaseAction, out increaseLabel); } private static void CreateReadOnlyRow(RectTransform parent, TMP_FontAsset? font, string name, string labelText, float y, out TextMeshProUGUI value) { RectTransform rowRect = CreateRow(parent, name, y); CreateRowLabel(rowRect, font, labelText, 150f); value = CreateRightValue(rowRect, font, "Value", 140f, 0f); } private static void CreateToggleRow(RectTransform parent, TMP_FontAsset? font, string name, string labelText, float y, UnityAction toggleAction, out TextMeshProUGUI value) { RectTransform val = CreateRow(parent, name, y); CreateRowLabel(val, font, labelText, 100f); CreateActionButton("ToggleButton", val, font, "OFF", 12f, 90f, 0f, toggleAction, out value); } private static RectTransform CreateRow(RectTransform parent, string name, float y) { RectTransform obj = SafeTrashUiFactory.CreateRect(name, (Transform)(object)parent); ConfigureTopRect(obj, 30f, y, 20f); return obj; } private static void CreateRowLabel(RectTransform rowRect, TMP_FontAsset? font, string labelText, float reservedRightWidth) { //IL_0012: 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_0046: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = SafeTrashUiFactory.CreateText("Label", (Transform)(object)rowRect, font); SafeTrashUiFactory.Stretch(((TMP_Text)obj).rectTransform, Vector2.zero, new Vector2(0f - reservedRightWidth, 0f)); ((TMP_Text)obj).text = labelText; ((TMP_Text)obj).alignment = (TextAlignmentOptions)513; ((TMP_Text)obj).fontSize = 13f; ((Graphic)obj).color = SafeTrashTheme.SoftGold; ConfigureText(obj, (TextOverflowModes)1); } private static TextMeshProUGUI CreateRightValue(RectTransform rowRect, TMP_FontAsset? font, string name, float width, float rightOffset) { //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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) TextMeshProUGUI obj = SafeTrashUiFactory.CreateText(name, (Transform)(object)rowRect, font); RectTransform rectTransform = ((TMP_Text)obj).rectTransform; rectTransform.anchorMin = new Vector2(1f, 0f); rectTransform.anchorMax = Vector2.one; rectTransform.pivot = new Vector2(1f, 0.5f); rectTransform.sizeDelta = new Vector2(width, 0f); rectTransform.anchoredPosition = new Vector2(rightOffset, 0f); ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).fontSize = 13f; ((TMP_Text)obj).fontStyle = (FontStyles)1; ((Graphic)obj).color = SafeTrashTheme.Gold; ConfigureText(obj, (TextOverflowModes)1); return obj; } private static Button CreateActionButton(string name, RectTransform parent, TMP_FontAsset? font, string text, float fontSize, float width, float rightOffset, UnityAction onClick, out TextMeshProUGUI label) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) return CreateControlButton(name, parent, font, text, fontSize, new Vector2(1f, 0.5f), new Vector2(width, 30f), new Vector2(rightOffset, 0f), onClick, SafeTrashTheme.Gold, out label); } private static Button CreateControlButton(string name, RectTransform parent, TMP_FontAsset? font, string text, float fontSize, Vector2 anchor, Vector2 size, Vector2 position, UnityAction onClick, Color labelColor, out TextMeshProUGUI label) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_0103: Unknown result type (might be due to invalid IL or missing references) RectTransform val = SafeTrashUiFactory.CreateRect(name, (Transform)(object)parent); val.anchorMin = anchor; val.anchorMax = anchor; val.pivot = anchor; val.sizeDelta = size; val.anchoredPosition = position; SafeTrashUiFactory.AddImage(val, SafeTrashTheme.Accent, raycastTarget: true); RectTransform rect = SafeTrashUiFactory.CreateRect("Background", (Transform)(object)val); SafeTrashUiFactory.Stretch(rect, new Vector2(2f, 2f), new Vector2(-2f, -2f)); Image targetGraphic = SafeTrashUiFactory.AddImage(rect, SafeTrashTheme.CloseBackground, raycastTarget: true); Button obj = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)obj).targetGraphic = (Graphic)(object)targetGraphic; SafeTrashUiFactory.ApplyButtonColors(obj); ((UnityEvent)obj.onClick).AddListener(onClick); label = SafeTrashUiFactory.CreateText("Label", (Transform)(object)val, font); SafeTrashUiFactory.Stretch(((TMP_Text)label).rectTransform, new Vector2(2f, 0f), new Vector2(-2f, 0f)); ((TMP_Text)label).text = text; ((TMP_Text)label).alignment = (TextAlignmentOptions)514; ((TMP_Text)label).fontSize = fontSize; ((TMP_Text)label).fontStyle = (FontStyles)1; ((Graphic)label).color = labelColor; ConfigureText(label, (TextOverflowModes)0); return obj; } private static void CreateHint(RectTransform parent, TMP_FontAsset? font, string name, string text, float y) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = SafeTrashUiFactory.CreateText(name, (Transform)(object)parent, font); ConfigureTopRect(((TMP_Text)obj).rectTransform, 16f, y, 20f); ((TMP_Text)obj).text = text; ((TMP_Text)obj).alignment = (TextAlignmentOptions)516; ((TMP_Text)obj).fontSize = 11f; ((TMP_Text)obj).fontStyle = (FontStyles)1; ((Graphic)obj).color = SafeTrashTheme.MutedText; ConfigureText(obj, (TextOverflowModes)1); } private static void CreateResetButton(RectTransform parent, TMP_FontAsset? font, float y) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0059: Expected O, but got Unknown RectTransform parent2 = CreateRow(parent, "ResetDefaultsRow", y); CreateControlButton("ResetDefaultsButton", parent2, font, "RESET DEFAULTS", 11f, new Vector2(0.5f, 0.5f), new Vector2(140f, 30f), Vector2.zero, new UnityAction(ResetDefaults), SafeTrashTheme.SoftGold, out TextMeshProUGUI _); } private static void CreateDivider(RectTransform parent, float y) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) RectTransform rect = SafeTrashUiFactory.CreateRect("AboutDivider", (Transform)(object)parent); ConfigureTopRect(rect, 1f, y, 20f); SafeTrashUiFactory.AddImage(rect, SafeTrashTheme.Accent, raycastTarget: false); } private static void CreateAbout(RectTransform parent, TMP_FontAsset? font, float y) { CreateAboutRow(parent, font, "ModVersion", "MOD VERSION", "1.0.0", y); CreateAboutRow(parent, font, "BepInExVersion", "BEPINEX VERSION", Plugin.BepInExVersion, y - 18f); CreateAboutRow(parent, font, "Author", "AUTHOR", "ADERiGMS", y - 36f); } private static void CreateAboutRow(RectTransform parent, TMP_FontAsset? font, string name, string labelText, string valueText, float y) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) RectTransform val = SafeTrashUiFactory.CreateRect(name + "Row", (Transform)(object)parent); ConfigureTopRect(val, 18f, y, 20f); TextMeshProUGUI obj = SafeTrashUiFactory.CreateText("Label", (Transform)(object)val, font); SafeTrashUiFactory.Stretch(((TMP_Text)obj).rectTransform, Vector2.zero, new Vector2(-170f, 0f)); ((TMP_Text)obj).text = labelText; ((TMP_Text)obj).alignment = (TextAlignmentOptions)513; ((TMP_Text)obj).fontSize = 12f; ((Graphic)obj).color = SafeTrashTheme.SoftGold; ConfigureText(obj, (TextOverflowModes)1); TextMeshProUGUI obj2 = SafeTrashUiFactory.CreateText("Value", (Transform)(object)val, font); RectTransform rectTransform = ((TMP_Text)obj2).rectTransform; rectTransform.anchorMin = new Vector2(1f, 0f); rectTransform.anchorMax = Vector2.one; rectTransform.pivot = new Vector2(1f, 0.5f); rectTransform.sizeDelta = new Vector2(160f, 0f); rectTransform.anchoredPosition = Vector2.zero; ((TMP_Text)obj2).text = valueText; ((TMP_Text)obj2).alignment = (TextAlignmentOptions)516; ((TMP_Text)obj2).fontSize = 12f; ((TMP_Text)obj2).fontStyle = (FontStyles)1; ((Graphic)obj2).color = SafeTrashTheme.Gold; ConfigureText(obj2, (TextOverflowModes)1); } private static void CreateCloseButton(RectTransform headerRect, TMP_FontAsset? font) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) RectTransform val = SafeTrashUiFactory.CreateRect("CloseButton", (Transform)(object)headerRect); val.anchorMin = new Vector2(1f, 0.5f); val.anchorMax = new Vector2(1f, 0.5f); val.pivot = new Vector2(1f, 0.5f); val.sizeDelta = new Vector2(32f, 32f); val.anchoredPosition = new Vector2(-10f, 0f); SafeTrashUiFactory.AddImage(val, SafeTrashTheme.CloseBorder, raycastTarget: true); RectTransform rect = SafeTrashUiFactory.CreateRect("Background", (Transform)(object)val); SafeTrashUiFactory.Stretch(rect, new Vector2(2f, 2f), new Vector2(-2f, -2f)); Image targetGraphic = SafeTrashUiFactory.AddImage(rect, SafeTrashTheme.CloseBackground, raycastTarget: true); Button obj = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)obj).targetGraphic = (Graphic)(object)targetGraphic; SafeTrashUiFactory.ApplyButtonColors(obj); ((UnityEvent)obj.onClick).AddListener(new UnityAction(Hide)); TextMeshProUGUI obj2 = SafeTrashUiFactory.CreateText("X", (Transform)(object)val, font); SafeTrashUiFactory.Stretch(((TMP_Text)obj2).rectTransform, Vector2.zero, Vector2.zero); ((TMP_Text)obj2).rectTransform.anchoredPosition = new Vector2(0f, 1f); ((TMP_Text)obj2).text = "X"; ((TMP_Text)obj2).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj2).fontSize = 18f; ((TMP_Text)obj2).fontStyle = (FontStyles)1; ((Graphic)obj2).color = SafeTrashTheme.Gold; ConfigureText(obj2, (TextOverflowModes)0); } private static void ConfigureText(TextMeshProUGUI text, TextOverflowModes overflowMode = (TextOverflowModes)1) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)text).enableAutoSizing = false; ((TMP_Text)text).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)text).extraPadding = true; ((TMP_Text)text).overflowMode = overflowMode; ((Graphic)text).raycastTarget = false; } private static void ConfigureTopRect(RectTransform rect, float height, float y, float horizontalPadding) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = new Vector2(0f, 1f); rect.anchorMax = new Vector2(1f, 1f); rect.pivot = new Vector2(0.5f, 1f); rect.sizeDelta = new Vector2((0f - horizontalPadding) * 2f, height); rect.anchoredPosition = new Vector2(0f, y); } private static void SetActionButtonEnabled(Button? button, TextMeshProUGUI? label, bool enabled) { //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) if ((Object)(object)button != (Object)null) { ((Selectable)button).interactable = enabled; } if ((Object)(object)label != (Object)null) { ((Graphic)label).color = (enabled ? SafeTrashTheme.Gold : SafeTrashTheme.MutedText); } } } internal sealed class TrashQueueView : MonoBehaviour { private const int ColumnCount = 6; private const float HeaderHeight = 28f; private const float CellWidth = 56f; private const float CellHeight = 56f; private const float HorizontalSpacing = 5f; private const float VerticalSpacing = 6f; private const int MaskSafetyPadding = 3; private RectTransform? _content; private RectTransform? _viewport; private GridLayoutGroup? _grid; private RowSnapScrollRect? _scroll; private GameObject? _emptyState; private TMP_FontAsset? _font; private float _lastViewportWidth = -1f; private float _lastViewportHeight = -1f; internal void Initialize(RectTransform host, TMP_FontAsset? font, params GameObject[] legacyEmptyStateObjects) { _font = font; DisableLegacyElements(host, legacyEmptyStateObjects); CreateHeader(host); CreateScrollView(host); CreateEmptyState(host); Refresh(PendingTrashQueue.Items); } internal void Refresh(IReadOnlyList<PendingTrashEntry> entries) { if ((Object)(object)_content == (Object)null) { return; } bool flag = entries.Count == 0; if ((Object)(object)_emptyState != (Object)null) { _emptyState.SetActive(flag); } for (int num = ((Transform)_content).childCount - 1; num >= 0; num--) { GameObject gameObject = ((Component)((Transform)_content).GetChild(num)).gameObject; gameObject.SetActive(false); Object.Destroy((Object)(object)gameObject); } foreach (PendingTrashEntry entry in entries) { CreateSlot(entry); } Canvas.ForceUpdateCanvases(); UpdateGridPadding(force: true); LayoutRebuilder.ForceRebuildLayoutImmediate(_content); if ((Object)(object)_scroll != (Object)null) { ((ScrollRect)_scroll).StopMovement(); ((ScrollRect)_scroll).verticalNormalizedPosition = (flag ? 1f : 0f); } } internal void Unqueue(PendingTrashEntry entry) { if (PendingTrashQueue.TryRemove(entry)) { Plugin.DebugLog("SafeTrash item removed from queue: item=" + entry.Snapshot.m_shared.m_name + ", " + $"amount={entry.Amount}"); TrashUI.SetQueueStatus(PendingTrashQueue.EntryCount); } } private void LateUpdate() { UpdateGridPadding(); } private void UpdateGridPadding(bool force = false) { //IL_0023: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown if ((Object)(object)_viewport == (Object)null || (Object)(object)_grid == (Object)null) { return; } Rect rect = _viewport.rect; float width = ((Rect)(ref rect)).width; rect = _viewport.rect; float height = ((Rect)(ref rect)).height; if (!(width <= 0f) && !(height <= 0f) && (force || !Mathf.Approximately(width, _lastViewportWidth) || !Mathf.Approximately(height, _lastViewportHeight))) { _lastViewportWidth = width; _lastViewportHeight = height; float num = 361f; int num2 = Mathf.Max(6, Mathf.FloorToInt(width - num)); int num3 = Mathf.Max(0, num2 - 6); int num4 = 3 + num3 / 2; int num5 = 3 + num3 - num3 / 2; float num6 = 62f; int num7 = Mathf.Max(1, Mathf.FloorToInt((height + 6f) / num6)); float num8 = (float)num7 * 56f + (float)(num7 - 1) * 6f; int num9 = Mathf.Max(0, Mathf.RoundToInt(height - num8)); int num10 = num9 / 2; int num11 = num9 - num10; ((LayoutGroup)_grid).padding = new RectOffset(num4, num5, num10, num11); if ((Object)(object)_content != (Object)null) { LayoutRebuilder.MarkLayoutForRebuild(_content); } } } private static void DisableLegacyElements(RectTransform host, IEnumerable<GameObject> legacyObjects) { foreach (GameObject legacyObject in legacyObjects) { if ((Object)(object)legacyObject != (Object)null) { legacyObject.SetActive(false); } } Transform parent = ((Transform)host).parent; Transform val = ((parent != null) ? parent.Find("DropZoneLabelPatch") : null); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } } private void CreateHeader(RectTransform host) { //IL_0017: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0085: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) RectTransform val = SafeTrashUiFactory.CreateRect("QueueHeader", (Transform)(object)host); val.anchorMin = new Vector2(0f, 1f); val.anchorMax = Vector2.one; val.pivot = new Vector2(0.5f, 1f); val.offsetMin = new Vector2(0f, -28f); val.offsetMax = Vector2.zero; SafeTrashUiFactory.AddImage(val, SafeTrashTheme.FooterBackground, raycastTarget: false); TextMeshProUGUI obj = SafeTrashUiFactory.CreateText("QueueHeaderLabel", (Transform)(object)val, _font); SafeTrashUiFactory.Stretch(((TMP_Text)obj).rectTransform, Vector2.zero, Vector2.zero); ((TMP_Text)obj).text = "DROP ZONE"; ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).fontSize = 14f; ((TMP_Text)obj).fontStyle = (FontStyles)1; ((Graphic)obj).color = SafeTrashTheme.DropZoneLabel; ((Graphic)obj).raycastTarget = false; RectTransform val2 = SafeTrashUiFactory.CreateRect("HeaderAccentLine", (Transform)(object)val); val2.anchorMin = new Vector2(0f, 0f); val2.anchorMax = new Vector2(1f, 0f); val2.pivot = new Vector2(0.5f, 0.5f); val2.sizeDelta = new Vector2(0f, 1f); val2.anchoredPosition = new Vector2(0f, 0.5f); SafeTrashUiFactory.AddImage(val2, SafeTrashTheme.Accent, raycastTarget: false); ((Component)host).GetComponentInParent<ScaleAwareStrokeRegistry>()?.RegisterHorizontal(val2, 1f); } private void CreateScrollView(RectTransform host) { //IL_0017: 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_00a8: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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_0172: 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_01a6: Expected O, but got Unknown //IL_01b6: 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) RectTransform val = SafeTrashUiFactory.CreateRect("QueueScrollView", (Transform)(object)host); SafeTrashUiFactory.Stretch(val, new Vector2(8f, 8f), new Vector2(-8f, -32f)); _scroll = ((Component)val).gameObject.AddComponent<RowSnapScrollRect>(); ((ScrollRect)_scroll).horizontal = false; ((ScrollRect)_scroll).vertical = true; ((ScrollRect)_scroll).movementType = (MovementType)2; ((ScrollRect)_scroll).inertia = false; ((ScrollRect)_scroll).scrollSensitivity = 62f; _scroll.RowStep = 62f; _viewport = SafeTrashUiFactory.CreateRect("Viewport", (Transform)(object)val); SafeTrashUiFactory.Stretch(_viewport, Vector2.zero, new Vector2(-20f, 0f)); SafeTrashUiFactory.AddImage(_viewport, new Color(1f, 1f, 1f, 0f), raycastTarget: true); ((Component)_viewport).gameObject.AddComponent<RectMask2D>(); _content = SafeTrashUiFactory.CreateRect("Content", (Transform)(object)_viewport); _content.anchorMin = new Vector2(0f, 1f); _content.anchorMax = new Vector2(1f, 1f); _content.pivot = new Vector2(0.5f, 1f); _content.anchoredPosition = Vector2.zero; _content.sizeDelta = Vector2.zero; _grid = ((Component)_content).gameObject.AddComponent<GridLayoutGroup>(); ((LayoutGroup)_grid).padding = new RectOffset(4, 4, 0, 0); _grid.cellSize = new Vector2(56f, 56f); _grid.spacing = new Vector2(5f, 6f); _grid.startCorner = (Corner)0; _grid.startAxis = (Axis)0; _grid.constraint = (Constraint)1; _grid.constraintCount = 6; ContentSizeFitter obj = ((Component)_content).gameObject.AddComponent<ContentSizeFitter>(); obj.horizontalFit = (FitMode)0; obj.verticalFit = (FitMode)2; ((ScrollRect)_scroll).viewport = _viewport; ((ScrollRect)_scroll).content = _content; CreateScrollbar(val, _scroll); } private static void CreateScrollbar(RectTransform parent, RowSnapScrollRect scroll) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_0142: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) RectTransform val = SafeTrashUiFactory.CreateRect("VerticalScrollbar", (Transform)(object)parent); val.anchorMin = new Vector2(1f, 0f); val.anchorMax = new Vector2(1f, 1f); val.pivot = new Vector2(1f, 0.5f); val.sizeDelta = new Vector2(14f, 0f); val.anchoredPosition = Vector2.zero; SafeTrashUiFactory.AddImage(val, SafeTrashTheme.Accent, raycastTarget: true); RectTransform rect = SafeTrashUiFactory.CreateRect("Track", (Transform)(object)val); SafeTrashUiFactory.Stretch(rect, new Vector2(1f, 1f), new Vector2(-1f, -1f)); ((Component)parent).GetComponentInParent<ScaleAwareStrokeRegistry>()?.RegisterInset(rect); SafeTrashUiFactory.AddImage(rect, SafeTrashTheme.DropZoneInner, raycastTarget: false); Scrollbar val2 = ((Component)val).gameObject.AddComponent<Scrollbar>(); ((Component)val).gameObject.AddComponent<ScrollbarRowSnapHandler>().Initialize(scroll); val2.direction = (Direction)2; val2.numberOfSteps = 0; RectTransform val3 = SafeTrashUiFactory.CreateRect("SlidingArea", (Transform)(object)val); SafeTrashUiFactory.Stretch(val3, new Vector2(3f, 5f), new Vector2(-3f, -5f)); RectTransform val4 = SafeTrashUiFactory.CreateRect("Handle", (Transform)(object)val3); SafeTrashUiFactory.Stretch(val4, Vector2.zero, Vector2.zero); Image targetGraphic = SafeTrashUiFactory.AddImage(val4, SafeTrashTheme.SoftGold, raycastTarget: true); val2.handleRect = val4; ((Selectable)val2).targetGraphic = (Graphic)(object)targetGraphic; ColorBlock colors = ((Selectable)val2).colors; ((ColorBlock)(ref colors)).normalColor = SafeTrashTheme.SoftGold; ((ColorBlock)(ref colors)).highlightedColor = SafeTrashTheme.Gold; ((ColorBlock)(ref colors)).pressedColor = SafeTrashTheme.DropZoneLabel; ((ColorBlock)(ref colors)).selectedColor = SafeTrashTheme.Gold; ((ColorBlock)(ref colors)).disabledColor = SafeTrashTheme.MutedText; ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.08f; ((Selectable)val2).colors = colors; ((ScrollRect)scroll).verticalScrollbar = val2; ((ScrollRect)scroll).verticalScrollbarVisibility = (ScrollbarVisibility)0; ((ScrollRect)scroll).verticalScrollbarSpacing = 4f; } private void CreateEmptyState(RectTransform host) { //IL_0023: 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_0068: 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_00aa: Unknown result type (might be due to invalid IL or missing references) RectTransform val = SafeTrashUiFactory.CreateRect("QueueEmptyState", (Transform)(object)host); _emptyState = ((Component)val).gameObject; SafeTrashUiFactory.Stretch(val, new Vector2(18f, 18f), new Vector2(-18f, -38f)); Sprite trashIcon = SafeTrashAssets.TrashIcon; if ((Object)(object)trashIcon != (Object)null) { CreateEmptyStateIcon(val, trashIcon); } CreateEmptyText(val, "MainText", "DROP ITEMS HERE", 20f, 28f, SafeTrashTheme.SoftGold, (FontStyles)1); CreateEmptyText(val, "Instruction", "Drag an item from your inventory", 13f, -5f, SafeTrashTheme.SoftGold, (FontStyles)0); CreateEmptyText(val, "SafetyMessage", "Nothing is destroyed until you confirm", 11f, -38f, SafeTrashTheme.MutedText, (FontStyles)0); } private static void CreateEmptyStateIcon(RectTransform parent, Sprite trashIcon) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) RectTransform obj = SafeTrashUiFactory.CreateRect("TrashIcon", (Transform)(object)parent); obj.anchorMin = new Vector2(0.5f, 0.5f); obj.anchorMax = new Vector2(0.5f, 0.5f); obj.pivot = new Vector2(0.5f, 0.5f); obj.sizeDelta = new Vector2(58f, 58f); obj.anchoredPosition = new Vector2(0f, 92f); Image obj2 = SafeTrashUiFactory.AddImage(obj, new Color(1f, 1f, 1f, 0.82f), raycastTarget: false); obj2.sprite = trashIcon; obj2.preserveAspect = true; } private void CreateEmptyText(RectTransform parent, string name, string value, float fontSize, float y, Color color, FontStyles style) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = SafeTrashUiFactory.CreateText(name, (Transform)(object)parent, _font); RectTransform rectTransform = ((TMP_Text)obj).rectTransform; rectTransform.anchorMin = new Vector2(0f, 0.5f); rectTransform.anchorMax = new Vector2(1f, 0.5f); rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.sizeDelta = new Vector2(0f, 28f); rectTransform.anchoredPosition = new Vector2(0f, y); ((TMP_Text)obj).text = value; ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).fontSize = fontSize; ((TMP_Text)obj).fontStyle = style; ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; } private void CreateSlot(PendingTrashEntry entry) { //IL_0021: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00c5: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_content == (Object)null)) { RectTransform val = SafeTrashUiFactory.CreateRect("QueuedItem", (Transform)(object)_content); SafeTrashUiFactory.AddImage(val, Color.clear, raycastTarget: true); RectTransform val2 = SafeTrashUiFactory.CreateRect("Frame", (Transform)(object)val); SafeTrashUiFactory.Stretch(val2, new Vector2(1f, 1f), new Vector2(-1f, -1f)); Image border = SafeTrashUiFactory.AddImage(val2, SafeTrashTheme.Accent, raycastTarget: false); ((Component)val).gameObject.AddComponent<QueueSlotHover>().Initialize(border, this, entry); RectTransform val3 = SafeTrashUiFactory.CreateRect("Background", (Transform)(object)val2); SafeTrashUiFactory.Stretch(val3, new Vector2(2f, 2f), new Vector2(-2f, -2f)); ((Component)_content).GetComponentInParent<ScaleAwareStrokeRegistry>()?.RegisterInset(val3); SafeTrashUiFactory.AddImage(val3, SafeTrashTheme.FooterBackground, raycastTarget: false); RectTransform rect = SafeTrashUiFactory.CreateRect("Icon", (Transform)(object)val3); SafeTrashUiFactory.Stretch(rect, new Vector2(5f, 5f), new Vector2(-5f, -5f)); Image obj = SafeTrashUiFactory.AddImage(rect, Color.white, raycastTarget: false); obj.sprite = entry.Snapshot.GetIcon(); obj.preserveAspect = true; TextMeshProUGUI obj2 = SafeTrashUiFactory.CreateText("Amount", (Transform)(object)val3, _font); SafeTrashUiFactory.Stretch(((TMP_Text)obj2).rectTransform, Vector2.zero, new Vector2(-3f, -2f)); ((TMP_Text)obj2).text = ((entry.Amount > 1) ? entry.Amount.ToString() : string.Empty); ((TMP_Text)obj2).alignment = (TextAlignmentOptions)1028; ((TMP_Text)obj2).fontSize = 14f; ((TMP_Text)obj2).fontStyle = (FontStyles)1; ((Graphic)obj2).color = Color.white; ((TMP_Text)obj2).outlineColor = Color32.op_Implicit(Color.black); ((TMP_Text)obj2).outlineWidth = 0.25f; ((Graphic)obj2).raycastTarget = false; } } } internal static class TrashUI { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__32_0; internal void <CreateSettingsButton>b__32_0() { if ((Object)(object)_inventoryGui != (Object)null) { SettingsUI.Toggle(_inventoryGui); } } } private const float DestroyConfirmationMinimumDelay = 0.5f; private static GameObject? _root; private static InventoryGui? _inventoryGui; private static TextMeshProUGUI? _queueStatus; private static TrashQueueView? _queueView; private static Button? _clearButton; private static TextMeshProUGUI? _clearButtonText; private static Button? _destroyButton; private static TextMeshProUGUI? _destroyButtonText; private static ScaleAwareStrokeRegistry? _strokeRegistry; private static bool _destroyConfirmationArmed; private static bool _otherPlayerWarningAcknowledged; private static float _destroyConfirmationArmedAt; internal static void Create(InventoryGui inventoryGui) { _inventoryGui = inventoryGui; if (!((Object)(object)_root != (Object)null)) { RectTransform val = CreateWindowRoot(inventoryGui); RectTransform backgroundRect = CreateBackground(val); TMP_FontAsset font = ResolveValheimFont(inventoryGui); WindowDragHandler windowDragHandler = CreateHeader(backgroundRect, val, font); CreateDropZone(backgroundRect, inventoryGui, font); CreateFooter(backgroundRect, font); _strokeRegistry?.Refresh(force: true); windowDragHandler.ClampToScreen(); SetQueueStatus(PendingTrashQueue.EntryCount); ((Component)val).gameObject.SetActive(false); Plugin.DebugLog("SafeTrash window created."); } } internal static void SetQueueStatus(int count) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00f6: Unknown result type (might be due to invalid IL or missing references) ResetDestroyConfirmation(); bool flag = count > 0; if ((Object)(object)_clearButton != (Object)null) { ((Selectable)_clearButton).interactable = flag; } if ((Object)(object)_destroyButton != (Object)null) { ((Selectable)_destroyButton).interactable = flag; } if ((Object)(object)_clearButtonText != (Object)null) { ((Graphic)_clearButtonText).color = (flag ? SafeTrashTheme.SoftGold : SafeTrashTheme.MutedText); } if ((Object)(object)_destroyButtonText != (Object)null) { ((Graphic)_destroyButtonText).color = (flag ? SafeTrashTheme.Gold : SafeTrashTheme.MutedText); } if (!((Object)(object)_queueStatus == (Object)null)) { int totalAmount = PendingTrashQueue.TotalAmount; string text = ((totalAmount == 1) ? "ITEM" : "ITEMS"); string text2 = ((count == 1) ? "SLOT" : "SLOTS"); ((TMP_Text)_queueStatus).text = $"{totalAmount} {text} / {count} {text2}"; ((Graphic)_queueStatus).color = SafeTrashTheme.MutedText; _queueView?.Refresh(PendingTrashQueue.Items); } } internal static void ShowStatusMessage(string message) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) ResetDestroyConfirmation(message != "OTHER PLAYER ITEM"); if (!((Object)(object)_queueStatus == (Object)null)) { ((TMP_Text)_queueStatus).text = message; ((Graphic)_queueStatus).color = SafeTrashTheme.DropZoneLabel; } } internal static void Toggle() { if (!((Object)(object)_root == (Object)null)) { bool num = !_root.activeSelf; if (num) { _root.SetActive(true); _root.transform.SetAsLastSibling(); Canvas.ForceUpdateCanvases(); RefreshRuntimeUi(); } else { SettingsUI.Hide(); ResetDestroyConfirmation(); _root.SetActive(false); } Plugin.DebugLog(num ? "SafeTrash window opened." : "SafeTrash window closed."); } } internal static void RefreshRuntimeUi() { //IL_008c: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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) if ((Object)(object)_root == (Object)null) { if ((Object)(object)_inventoryGui == (Object)null) { return; } Create(_inventoryGui); if ((Object)(object)_root == (Object)null) { return; } } if (!_root.activeInHierarchy) { return; } Canvas.ForceUpdateCanvases(); _strokeRegistry?.Refresh(); SettingsUI.RefreshRuntimeUi(); WindowDragHandler componentInChildren = _root.GetComponentInChildren<WindowDragHandler>(true); Transform transform = _root.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if (!((Object)(object)componentInChildren == (Object)null) && !((Object)(object)val == (Object)null)) { Vector2 anchoredPosition = val.anchoredPosition; componentInChildren.ClampToScreen(); Vector2 val2 = val.anchoredPosition - anchoredPosition; if (((Vector2)(ref val2)).sqrMagnitude > 0.01f) { Plugin.SaveWindowPosition(val.anchoredPosition); } } } internal static void UpdateDestroyConfirmation() { if (_destroyConfirmationArmed && !(Time.unscaledTime - _destroyConfirmationArmedAt <= Plugin.DestroyConfirmationTimeoutSeconds)) { ResetDestroyConfirmation(); Plugin.DebugLog("SafeTrash destruction confirmation expired."); } } internal static void ApplyWindowScale() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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) if ((Object)(object)_root == (Object)null) { return; } Transform transform = _root.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if ((Object)(object)val == (Object)null) { return; } float windowScaleValue = Plugin.WindowScaleValue; ((Transform)val).localScale = new Vector3(windowScaleValue, windowScaleValue, 1f); Canvas.ForceUpdateCanvases(); _strokeRegistry?.Refresh(force: true); WindowDragHandler componentInChildren = _root.GetComponentInChildren<WindowDragHandler>(true); if (!((Object)(object)componentInChildren == (Object)null)) { Vector2 anchoredPosition = val.anchoredPosition; componentInChildren.ClampToScreen(); Vector2 val2 = val.anchoredPosition - anchoredPosition; if (((Vector2)(ref val2)).sqrMagnitude > 0.01f) { Plugin.SaveWindowPosition(val.anchoredPosition); } } } internal static void ResetForPlayerSessionChange() { SettingsUI.Hide(); ResetDestroyConfirmation(); PendingTrashQueue.Clear(); if (!((Object)(object)_root == (Object)null)) { SetQueueStatus(0); _root.SetActive(false); } } internal static void Hide() { SettingsUI.Hide(); ResetDestroyConfirmation(); if ((Object)(object)_root != (Object)null && _root.activeSelf) { _root.SetActive(false); } } private static void HandleDestroyButton() { if (PendingTrashQueue.EntryCount == 0) { ResetDestroyConfirmation(); return; } if (!_otherPlayerWarningAcknowledged && PendingTrashQueue.ShouldWarnAboutOtherPlayerItem()) { _otherPlayerWarningAcknowledged = true; ShowStatusMessage("OTHER PLAYER ITEM"); Plugin.DebugLog("SafeTrash warned about an item crafted by another player."); return; } if (!_destroyConfirmationArmed) { ArmDestroyConfirmation(); return; } float num = Time.unscaledTime - _destroyConfirmationArmedAt; if (!(num < 0.5f)) { if (num > Plugin.DestroyConfirmationTimeoutSeconds) { ResetDestroyConfirmation(); Plugin.DebugLog("SafeTrash destruction confirmation expired."); } else { ResetDestroyConfirmation(); DestroyQueuedItems(); } } } private static void ArmDestroyConfirmation() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) _destroyConfirmationArmed = true; _destroyConfirmationArmedAt = Time.unscaledTime; if ((Object)(object)_destroyButtonText != (Object)null) { ((TMP_Text)_destroyButtonText).text = "CONFIRM"; ((Graphic)_destroyButtonText).color = SafeTrashTheme.Danger; } Plugin.DebugLog("SafeTrash destruction confirmation armed."); } private static void DestroyQueuedItems() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!PendingTrashQueue.TryDestroyAll(out string failureReason)) { if (IsDirectStatusFailure(failureReason)) { ShowStatusMessage(failureReason); } else if ((Object)(object)_queueStatus != (Object)null) { ((TMP_Text)_queueStatus).text = "QUEUE CHANGED - RE-ADD"; ((Graphic)_queueStatus).color = SafeTrashTheme.DropZoneLabel; } Plugin.Log.LogWarning((object)("SafeTrash could not destroy queue: " + failureReason)); } else { SetQueueStatus(0); Plugin.DebugLog("SafeTrash queue destroyed successfully."); } } private static bool IsDirectStatusFailure(string failureReason) { if (!(failureReason == "UNEQUIP FIRST")) { return failureReason == "MOVE FROM HOTBAR"; } return true; } private static void ClearQueue() { ResetDestroyConfirmation(); if (PendingTrashQueue.EntryCount != 0) { PendingTrashQueue.Clear(); SetQueueStatus(0); Plugin.DebugLog("SafeTrash queue cleared safely."); } } private static void ResetDestroyConfirmation(bool resetOtherPlayerWarning = true) { //IL_0049: 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) _destroyConfirmationArmed = false; _destroyConfirmationArmedAt = 0f; if (resetOtherPlayerWarning) { _otherPlayerWarningAcknowledged = false; } if ((Object)(object)_destroyButtonText != (Object)null) { ((TMP_Text)_destroyButtonText).text = "DESTROY"; ((Graphic)_destroyButtonText).color = ((PendingTrashQueue.EntryCount > 0) ? SafeTrashTheme.Gold : SafeTrashTheme.MutedText); } } private static RectTransform CreateWindowRoot(InventoryGui inventoryGui) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0031: 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_005b: 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_008f: 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_00c4: Unknown result type (might be due to invalid IL or missing references) _root = new GameObject("SafeTrash_Window"); RectTransform obj = _root.AddComponent<RectTransform>(); ((Transform)obj).SetParent(inventoryGui.m_inventoryRoot, false); obj.anchorMin = new Vector2(0.5f, 0.5f); obj.anchorMax = new Vector2(0.5f, 0.5f); obj.pivot = new Vector2(0.5f, 0.5f); obj.sizeDelta = new Vector2(470f, 440f); obj.anchoredPosition = new Vector2(Plugin.WindowPositionX.Value, Plugin.WindowPositionY.Value); ((Transform)obj).localScale = new Vector3(Plugin.WindowScaleValue, Plugin.WindowScaleValue, 1f); _strokeRegistry = ((Component)obj).gameObject.AddComponent<ScaleAwareStrokeRegistry>(); SafeTrashUiFactory.AddImage(obj, SafeTrashTheme.WindowBorder, raycastTarget: false); return obj; } private static RectTransform CreateBackground(RectTransform rootRect) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = SafeTrashUiFactory.CreateRect("Background", (Transform)(object)rootRect); SafeTrashUiFactory.Stretch(obj, new Vector2(3f, 3f), new Vector2(-3f, -3f)); SafeTrashUiFactory.AddImage(obj, SafeTrashTheme.WindowBackground, raycastTarget: false); return obj; } private static TMP_FontAsset? ResolveValheimFont(InventoryGui inventoryGui) { TMP_Text componentInChildren = ((Component)inventoryGui).GetComponentInChildren<TMP_Text>(true); TMP_FontAsset val = (((Object)(object)componentInChildren != (Object)null) ? componentInChildren.font : null); if ((Object)(object)val != (Object)null) { TMP_Settings.defaultFontAsset = val; } return val; } private static WindowDragHandler CreateHeader(RectTransform backgroundRect, RectTransform rootRect, TMP_FontAsset? font) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_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) RectTransform obj = SafeTrashUiFactory.CreateRect("Header", (Transform)(object)backgroundRect); obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(1f, 1f); obj.pivot = new Vector2(0.5f, 1f); obj.sizeDelta = new Vector2(0f, 56f); obj.anchoredPosition = Vector2.zero; SafeTrashUiFactory.AddImage(obj, SafeTrashTheme.HeaderBackground, raycastTarget: true); WindowDragHandler windowDragHandler = ((Component)obj).gameObject.AddComponent<WindowDragHandler>(); windowDragHandler.Initialize(rootRect); CreateTitle(obj, font); CreateHeaderLine(obj); CreateSettingsButton(obj, font); CreateCloseButton(obj, font); return windowDragHandler; } private static void CreateSettingsButton(RectTransform headerRect, TMP_FontAsset? font) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown RectTransform val = SafeTrashUiFactory.CreateRect("SettingsButton", (Transform)(object)headerRect); val.anchorMin = new Vector2(1f, 0.5f); val.anchorMax = new Vector2(1f, 0.5f); val.pivot = new Vector2(1f, 0.5f); val.sizeDelta = new Vector2(36f, 32f); val.anchoredPosition = new Vector2(-46f, 0f); SafeTrashUiFactory.AddImage(val, SafeTrashTheme.CloseBorder, raycastTarget: true); RectTransform rect = SafeTrashUiFactory.CreateRect("Background", (Transform)(object)val); SafeTrashUiFactory.Stretch(rect, new Vector2(1f, 1f), new Vector2(-1f, -1f)); _strokeRegistry?.RegisterInset(rect); Image targetGraphic = SafeTrashUiFactory.AddImage(rect, SafeTrashTheme.CloseBackground, raycastTarget: true); Button obj = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)obj).targetGraphic = (Graphic)(object)targetGraphic; SafeTrashUiFactory.ApplyButtonColors(obj); ButtonClickedEvent onClick = obj.onClick; object obj2 = <>c.<>9__32_0; if (obj2 == null) { UnityAction val2 = delegate { if ((Object)(object)_inventoryGui != (Object)null) { SettingsUI.Toggle(_inventoryGui); } }; <>c.<>9__32_0 = val2; obj2 = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj2); TextMeshProUGUI obj3 = SafeTrashUiFactory.CreateText("Label", (Transform)(object)val, font); SafeTrashUiFactory.Stretch(((TMP_Text)obj3).rectTransform, Vector2.zero, Vector2.zero); ((TMP_Text)obj3).text = "UI"; ((TMP_Text)obj3).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj3).fontSize = 14f; ((TMP_Text)obj3).fontStyle = (FontStyles)1; ((Graphic)obj3).color = SafeTrashTheme.Gold; ((Graphic)obj3).raycastTarget = false; } private static void CreateTitle(RectTransform headerRect, TMP_FontAsset? font) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = SafeTrashUiFactory.CreateText("Title", (Transform)(object)headerRect, font); SafeTrashUiFactory.Stretch(((TMP_Text)obj).rectTransform, new Vector2(100f, 0f), new Vector2(-100f, 0f)); ((TMP_Text)obj).text = "SAFE TRASH"; ((TMP_Text)obj).enableWordWrapping = false; ((TMP_Text)obj).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj).fontSize = 25f; ((TMP_Text)obj).fontStyle = (FontStyles)1; ((Graphic)obj).color = SafeTrashTheme.Gold; ((Graphic)obj).raycastTarget = false; } private static void CreateHeaderLine(RectTransform headerRect) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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) RectTransform val = SafeTrashUiFactory.CreateRect("HeaderBottomLine", (Transform)(object)headerRect); val.anchorMin = new Vector2(0f, 0f); val.anchorMax = new Vector2(1f, 0f); val.pivot = new Vector2(0.5f, 0.5f); val.sizeDelta = new Vector2(0f, 1f); val.anchoredPosition = new Vector2(0f, 0.5f); SafeTrashUiFactory.AddImage(val, SafeTrashTheme.Accent, raycastTarget: false); _strokeRegistry?.RegisterHorizontal(val, 1f); } private static void CreateCloseButton(RectTransform headerRect, TMP_FontAsset? font) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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) RectTransform val = SafeTrashUiFactory.CreateRect("CloseButton", (Transform)(object)headerRect); val.anchorMin = new Vector2(1f, 0.5f); val.anchorMax = new Vector2(1f, 0.5f); val.pivot = new Vector2(1f, 0.5f); val.sizeDelta = new Vector2(32f, 32f); val.anchoredPosition = new Vector2(-10f, 0f); SafeTrashUiFactory.AddImage(val, SafeTrashTheme.CloseBorder, raycastTarget: true); RectTransform rect = SafeTrashUiFactory.CreateRect("Background", (Transform)(object)val); SafeTrashUiFactory.St