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 WardMeBruh v1.0.0
plugins/WardMeBruh.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; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Net.Http; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using APIManager; using AdventureBackpacks.API.Client; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BepInEx.Preloader; using BepInEx.Preloader.Patching; using HarmonyLib; using ItemManager; using JetBrains.Annotations; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using Mono.Collections.Generic; using Splatform; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Networking; using UnityEngine.UI; using Valheim.SettingsGui; using Vapok.Common.Abstractions; using Vapok.Common.Managers; using Vapok.Common.Managers.Configuration; using Vapok.Common.Managers.Creature; using Vapok.Common.Managers.LocalizationManager; using Vapok.Common.Managers.Location; using Vapok.Common.Managers.PieceManager; using Vapok.Common.Managers.Skill; using Vapok.Common.Managers.Splash; using Vapok.Common.Managers.StatusEffects; using Vapok.Common.Managers.Telemetry; using Vapok.Common.Shared; using Vapok.Common.Tools; using WardMeBruh.Components; using WardMeBruh.Configuration; using WardMeBruh.Items; using WardMeBruh.Logging; using WardMeBruh.Models; using WardMeBruh.Networking; using WardMeBruh.Patches; using WardMeBruh.Services; using WardMeBruh.UI; using WardMeBruh.UI.Elements; using WardMeBruh.UI.Tabs; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("WardMeBruh")] [assembly: AssemblyDescription("A Valheim Quality of Life Mod for ward interaction and management. Ward me Bruh!")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Vapok Gaming")] [assembly: AssemblyProduct("WardMeBruh")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("12526F66-A849-4F8B-8643-A201318C99D1")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WardMeBruh { [BepInPlugin("vapok.mods.wardmebruh", "WardMeBruh", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("Azumatt.WardIsLove")] [BepInIncompatibility("shudnal.ProtectiveWards")] public class WardMeBruh : BaseUnityPlugin, IPluginInfo { public class Waiting { public event EventHandler StatusChanged; public void ValheimIsAwake(bool awakeFlag) { if (awakeFlag) { this.StatusChanged?.Invoke(this, EventArgs.Empty); } } } private const string _pluginId = "vapok.mods.wardmebruh"; private const string _displayName = "WardMeBruh"; private const string _version = "1.0.0"; public const int NexusId = 4434; public static bool ValheimAwake; public static Waiting Waiter; private static WardMeBruh _instance; private static ConfigSyncBase _config; private static ILogIt _log; private Harmony _harmony; public static ILogIt Log => _log; public string PluginId => "vapok.mods.wardmebruh"; public string DisplayName => "WardMeBruh"; public string Version => "1.0.0"; public BaseUnityPlugin Instance => (BaseUnityPlugin)(object)_instance; [UsedImplicitly] private void Awake() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown _instance = this; Waiter = new Waiting(); CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); LogManager.Init(PluginId, out ILogIt logger); _log = new DeduplicatingLog(logger); Initializer.LoadManagers(localization); WardRoleManager.Initialize(); _config = new ConfigRegistry(_instance); KeystoneItemFactory.Initialize(); Localizer.Waiter.StatusChanged += InitializeModule; _harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); _harmony.PatchAll(Assembly.GetExecutingAssembly()); Patcher.Patch(new string[1] { "WardMeBruh.API" }); ModSplashManager.Register(new ModSplashDossier(_instance) { Tagline = "A quality-of-life mod for ward interaction and protection in Valheim.", ShowOnStartup = ConfigSyncBase.ShowSplashOnStartup }); if (GUIManager.IsHeadless()) { InitializeModule(this, EventArgs.Empty); } } private void OnDestroy() { _instance = null; } public void InitializeModule(object sender, EventArgs args) { if (!ValheimAwake) { ConfigRegistry.Waiter.ConfigurationComplete(configDone: true); ValheimAwake = true; } } } } namespace WardMeBruh.UI { public class EntityRenameDialog : MonoBehaviour { private enum ConfigEntityType { Door, Container, Portal } private static EntityRenameDialog _instance; private GameObject _panel; private InputField _nameInput; private TextMeshProUGUI _headerText; private Button _roleBtn; private TextMeshProUGUI _roleTxt; private Button _depotBtn; private TextMeshProUGUI _depotTxt; private Button _saveBtn; private Button _cancelBtn; private TextMeshProUGUI _saveBtnTxt; private TextMeshProUGUI _cancelBtnTxt; private GameObject _gamepadLegend; private GameObject _focusReticle; private Selectable _focusedSelectable; private int _lastSubmitFrame = -1; private ZDOID _activeEntityId; private ConfigEntityType _entityType; private bool _isInputBlocked; private PrivateArea _coveringWard; private bool _canManage; public static EntityRenameDialog Instance { get { //IL_0026: 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) if ((Object)(object)_instance == (Object)null && !GUIManager.IsHeadless() && (Object)(object)GUIManager.CustomGUIFront != (Object)null) { GameObject val = new GameObject("EntityRenameDialog_Host"); val.transform.SetParent(GUIManager.CustomGUIFront.transform, false); _instance = val.AddComponent<EntityRenameDialog>(); } return _instance; } } public bool IsOpen { get { if ((Object)(object)_panel != (Object)null) { return _panel.activeSelf; } return false; } } public static bool HasInstanceAndOpen { get { if ((Object)(object)_instance != (Object)null) { return _instance.IsOpen; } return false; } } public static int LastClosedFrame { get; private set; } = -1; private void Awake() { _instance = this; Build(); } private void OnDestroy() { if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } SetInputBlocked(block: false); } private void SetInputBlocked(bool block) { if (block) { if (!_isInputBlocked) { _isInputBlocked = true; GUIManager.BlockInput(true); } } else { _isInputBlocked = false; WardInputHelper.ForceUnblockInput(); } } private void Update() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!IsOpen) { return; } if ((Object)(object)Player.m_localPlayer != (Object)null) { Player.m_localPlayer.SetControls(Vector3.zero, false, false, false, false, false, false, false, false, false, false, false); } if (Input.GetKeyDown((KeyCode)27) || ZInput.GetKeyDown((KeyCode)27, true) || (Keyboard.current != null && ((ButtonControl)Keyboard.current.escapeKey).wasPressedThisFrame) || WardGamepadNavHelper.IsButtonDownB() || (ZInput.instance != null && (ZInput.GetButtonDown("JoyMenu") || ZInput.GetButtonDown("JoyRadialClose")))) { Close(); } else if (WardGamepadNavHelper.IsGamepadActive()) { if ((Object)(object)_focusedSelectable == (Object)null || !((Component)_focusedSelectable).gameObject.activeInHierarchy) { SetFocus((Selectable)(object)_roleBtn); } if (WardGamepadNavHelper.IsButtonDownX()) { OnSaveClicked(); } else { HandleGamepadNavigation(); } } else { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); } } private void SetFocus(Selectable target) { if ((Object)(object)target == (Object)null || !((Component)target).gameObject.activeInHierarchy) { return; } if ((Object)(object)_focusedSelectable != (Object)null && (Object)(object)_focusedSelectable != (Object)(object)target) { Selectable focusedSelectable = _focusedSelectable; InputField val = (InputField)(object)((focusedSelectable is InputField) ? focusedSelectable : null); if ((Object)(object)val != (Object)null) { val.DeactivateInputField(); } } _focusedSelectable = target; if ((Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)target).gameObject); } target.Select(); WardGamepadNavHelper.ApplyGamepadColorBlock(target); WardGamepadNavHelper.AttachFocusReticle(_focusReticle, target); } private void HandleGamepadNavigation() { if (WardGamepadNavHelper.IsButtonDownA() && Time.frameCount != _lastSubmitFrame) { _lastSubmitFrame = Time.frameCount; Selectable focusedSelectable = _focusedSelectable; InputField val = (InputField)(object)((focusedSelectable is InputField) ? focusedSelectable : null); if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)_nameInput && ((Selectable)_nameInput).interactable) { _nameInput.ActivateInputField(); return; } Selectable focusedSelectable2 = _focusedSelectable; Button val2 = (Button)(object)((focusedSelectable2 is Button) ? focusedSelectable2 : null); if ((Object)(object)val2 != (Object)null && ((Selectable)val2).interactable) { ButtonClickedEvent onClick = val2.onClick; if (onClick != null) { ((UnityEvent)onClick).Invoke(); } return; } } if (!WardGamepadNavHelper.GetDirectionInput(out var up, out var down, out var left, out var right)) { return; } bool flag = (Object)(object)_nameInput != (Object)null && ((Component)_nameInput).gameObject.activeInHierarchy; bool flag2 = (Object)(object)_depotBtn != (Object)null && ((Component)_depotBtn).gameObject.activeInHierarchy; Selectable val3 = _focusedSelectable; if ((Object)(object)_focusedSelectable == (Object)(object)_nameInput) { if (down) { val3 = (Selectable)(object)_roleBtn; } } else if ((Object)(object)_focusedSelectable == (Object)(object)_roleBtn) { if (up && flag) { val3 = (Selectable)(object)_nameInput; } else if (down) { val3 = (Selectable)(object)_saveBtn; } else if (right && flag2) { val3 = (Selectable)(object)_depotBtn; } } else if ((Object)(object)_focusedSelectable == (Object)(object)_depotBtn) { if (up && flag) { val3 = (Selectable)(object)_nameInput; } else if (down) { val3 = (Selectable)(object)_cancelBtn; } else if (left) { val3 = (Selectable)(object)_roleBtn; } } else if ((Object)(object)_focusedSelectable == (Object)(object)_saveBtn) { if (up) { val3 = (Selectable)(object)_roleBtn; } else if (right) { val3 = (Selectable)(object)_cancelBtn; } } else if ((Object)(object)_focusedSelectable == (Object)(object)_cancelBtn) { if (up) { val3 = (Selectable)(object)(flag2 ? _depotBtn : _roleBtn); } else if (left) { val3 = (Selectable)(object)_saveBtn; } } else { val3 = (Selectable)(object)_roleBtn; } if ((Object)(object)val3 != (Object)null && (Object)(object)val3 != (Object)(object)_focusedSelectable) { SetFocus(val3); } } private void RefreshKeyhints() { bool flag = ZInput.IsGamepadActive(); if ((Object)(object)_saveBtnTxt != (Object)null) { string gamepadGlyph = WardGamepadNavHelper.GetGamepadGlyph("X"); ((TMP_Text)_saveBtnTxt).text = (flag ? (gamepadGlyph + " " + "$wmb_save".Localize()) : "$wmb_save".Localize()); } if ((Object)(object)_cancelBtnTxt != (Object)null) { string gamepadGlyph2 = WardGamepadNavHelper.GetGamepadGlyph("B"); ((TMP_Text)_cancelBtnTxt).text = (flag ? (gamepadGlyph2 + " " + "$wmb_cancel".Localize()) : "$wmb_cancel".Localize()); } if (!((Object)(object)_gamepadLegend != (Object)null)) { return; } _gamepadLegend.SetActive(flag); if (flag) { TextMeshProUGUI component = _gamepadLegend.GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { string gamepadGlyph3 = WardGamepadNavHelper.GetGamepadGlyph("DPad"); string gamepadGlyph4 = WardGamepadNavHelper.GetGamepadGlyph("A"); string gamepadGlyph5 = WardGamepadNavHelper.GetGamepadGlyph("X"); string gamepadGlyph6 = WardGamepadNavHelper.GetGamepadGlyph("B"); ((TMP_Text)component).text = "<color=#e2d6b5>" + gamepadGlyph3 + " Navigate " + gamepadGlyph4 + " Select/Toggle " + gamepadGlyph5 + " Save " + gamepadGlyph6 + " Cancel</color>"; } } } private void Build() { //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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //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_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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Expected O, but got Unknown //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Expected O, but got Unknown //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Expected O, but got Unknown //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Expected O, but got Unknown //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) UIFonts.GetPrimaryFont(); _panel = GUIManager.Instance.CreateWoodpanel(((Component)this).transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 480f, 260f, true); ((Object)_panel).name = "EntityRenameDialog"; GameObject val = new GameObject("HeaderText", new Type[3] { typeof(RectTransform), typeof(TextMeshProUGUI), typeof(WardTextElement) }); val.transform.SetParent(_panel.transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 1f); component.anchorMax = new Vector2(0.5f, 1f); component.pivot = new Vector2(0.5f, 1f); component.anchoredPosition = new Vector2(0f, -22f); component.sizeDelta = new Vector2(420f, 28f); _headerText = val.GetComponent<TextMeshProUGUI>(); ((TMP_Text)_headerText).font = UIFonts.GetPrimaryFont(); ((TMP_Text)_headerText).text = "$wmb_dialog_configure".Localize(); ((TMP_Text)_headerText).fontSize = 18f; ((Graphic)_headerText).color = WardColorPalette.ValheimOrange; ((TMP_Text)_headerText).alignment = (TextAlignmentOptions)514; val.GetComponent<WardTextElement>().baseFontSize = 18; GameObject val2 = GUIManager.Instance.CreateInputField(_panel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 30f), (ContentType)0, "$wmb_enter_custom_name".Localize(), 16, 400f, 36f); _nameInput = val2.GetComponent<InputField>(); DisableNavigation((Selectable)(object)_nameInput); ((UnityEvent<string>)(object)_nameInput.onEndEdit).AddListener((UnityAction<string>)delegate { if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271)) { ZInput.ResetButtonStatus("Chat"); OnSaveClicked(); } }); GameObject val3 = GUIManager.Instance.CreateButton("$wmb_role_resident".Localize(), _panel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(-80f, -18f), 140f, 34f); _roleBtn = val3.GetComponent<Button>(); DisableNavigation((Selectable)(object)_roleBtn); ((UnityEvent)_roleBtn.onClick).AddListener(new UnityAction(OnRoleClicked)); _roleTxt = WardUIFactory.SetupButtonText(val3, "$wmb_role_resident".Localize(), 12f, WardColorPalette.IceBlue, (TextAlignmentOptions)514); GameObject val4 = GUIManager.Instance.CreateButton("$wmb_depot_no".Localize(), _panel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(80f, -18f), 140f, 34f); _depotBtn = val4.GetComponent<Button>(); DisableNavigation((Selectable)(object)_depotBtn); ((UnityEvent)_depotBtn.onClick).AddListener(new UnityAction(OnDepotClicked)); _depotTxt = WardUIFactory.SetupButtonText(val4, "$wmb_depot_no".Localize(), 12f, WardColorPalette.TextMuted, (TextAlignmentOptions)514); GameObject val5 = GUIManager.Instance.CreateButton("$wmb_save".Localize(), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(-80f, 32f), 130f, 36f); _saveBtn = val5.GetComponent<Button>(); DisableNavigation((Selectable)(object)_saveBtn); _saveBtnTxt = WardUIFactory.SetupButtonText(val5, "$wmb_save".Localize(), 13f, WardColorPalette.ValheimOrange, (TextAlignmentOptions)514); ((UnityEvent)_saveBtn.onClick).AddListener(new UnityAction(OnSaveClicked)); GameObject val6 = GUIManager.Instance.CreateButton("$wmb_cancel".Localize(), _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(80f, 32f), 130f, 36f); _cancelBtn = val6.GetComponent<Button>(); DisableNavigation((Selectable)(object)_cancelBtn); _cancelBtnTxt = WardUIFactory.SetupButtonText(val6, "$wmb_cancel".Localize(), 13f, WardColorPalette.TextMuted, (TextAlignmentOptions)514); ((UnityEvent)_cancelBtn.onClick).AddListener(new UnityAction(Close)); _gamepadLegend = new GameObject("GamepadLegend", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); _gamepadLegend.transform.SetParent(_panel.transform, false); RectTransform component2 = _gamepadLegend.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0f); component2.anchorMax = new Vector2(1f, 0f); component2.pivot = new Vector2(0.5f, 1f); component2.anchoredPosition = new Vector2(0f, -6f); component2.sizeDelta = new Vector2(440f, 20f); TextMeshProUGUI component3 = _gamepadLegend.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component3).font = UIFonts.GetPrimaryFont(); ((TMP_Text)component3).text = "<color=#e2d6b5><b>[D-Pad]</b> Navigate <b>[A]</b> Toggle <b>[X]</b> Save <b>[B]</b> Cancel</color>"; ((TMP_Text)component3).fontSize = 11f; ((TMP_Text)component3).alignment = (TextAlignmentOptions)514; ((Graphic)component3).color = WardColorPalette.ValheimBeige; _focusReticle = WardGamepadNavHelper.CreateFocusReticle(_panel.transform); _panel.SetActive(false); } private static void DisableNavigation(Selectable selectable) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)selectable == (Object)null)) { Navigation navigation = selectable.navigation; ((Navigation)(ref navigation)).mode = (Mode)0; selectable.navigation = navigation; } } public void OpenForDoor(Door door) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)door == (Object)null) && !((Object)(object)door.m_nview == (Object)null) && door.m_nview.IsValid()) { _activeEntityId = door.m_nview.GetZDO().m_uid; _entityType = ConfigEntityType.Door; ((TMP_Text)_headerText).text = "$wmb_configure_door".Localize().ToUpperInvariant(); long num = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerID() : 0); _coveringWard = WardQueryService.GetCoveringWard(((Component)door).transform.position); if ((Object)(object)_coveringWard != (Object)null && (Object)(object)_coveringWard.m_nview != (Object)null && _coveringWard.m_nview.IsValid()) { _canManage = WardPermissions.CanManageWard(_coveringWard.m_nview.GetZDO(), num); } else { Piece component = ((Component)door).GetComponent<Piece>(); _canManage = (Object)(object)component != (Object)null && (component.IsCreator() || component.GetCreator() == num || component.GetCreator() == 0); } string text = ((!string.IsNullOrEmpty(door.m_name)) ? Localization.instance.Localize(door.m_name) : (((Object)(object)((Component)door).GetComponent<Piece>() != (Object)null) ? Localization.instance.Localize(((Component)door).GetComponent<Piece>().m_name) : "$wmb_door".Localize())); if (string.IsNullOrEmpty(text)) { text = "$wmb_door".Localize(); } ZDO zDO = door.m_nview.GetZDO(); string text2 = zDO.GetString(WardZdoKeys.DoorName, string.Empty); ((Component)_nameInput).gameObject.SetActive(true); _nameInput.text = ((!string.IsNullOrEmpty(text2) && !text2.Equals("Door", StringComparison.OrdinalIgnoreCase)) ? text2 : text); ((Component)_depotBtn).gameObject.SetActive(false); RectTransform component2 = ((Component)_roleBtn).GetComponent<RectTransform>(); component2.anchoredPosition = new Vector2(0f, -18f); component2.sizeDelta = new Vector2(160f, 34f); int roleId = zDO.GetInt(WardZdoKeys.DoorMinRole, 1); UpdateRoleButton(roleId); ApplyCurrentFontSize(); _panel.SetActive(true); RefreshKeyhints(); if (WardGamepadNavHelper.IsGamepadActive()) { SetFocus((Selectable)(object)_roleBtn); } else { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); _nameInput.ActivateInputField(); ((Selectable)_nameInput).Select(); } SetInputBlocked(block: true); } } public void OpenForPortal(TeleportWorld portal) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)portal == (Object)null) && !((Object)(object)portal.m_nview == (Object)null) && portal.m_nview.IsValid()) { _activeEntityId = portal.m_nview.GetZDO().m_uid; _entityType = ConfigEntityType.Portal; string text = portal.GetText(); ((TMP_Text)_headerText).text = ((!string.IsNullOrEmpty(text)) ? ("$wmb_configure_portal".Localize().ToUpperInvariant() + ": \"" + text + "\"") : "$wmb_configure_portal".Localize().ToUpperInvariant()); long num = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerID() : 0); _coveringWard = WardQueryService.GetCoveringWard(((Component)portal).transform.position); if ((Object)(object)_coveringWard != (Object)null && (Object)(object)_coveringWard.m_nview != (Object)null && _coveringWard.m_nview.IsValid()) { _canManage = WardPermissions.HasRequiredRole(_coveringWard.m_nview.GetZDO(), num, WardRole.Resident); } else { Piece component = ((Component)portal).GetComponent<Piece>(); _canManage = (Object)(object)component != (Object)null && (component.IsCreator() || component.GetCreator() == num || component.GetCreator() == 0); } ((Component)_nameInput).gameObject.SetActive(false); ((Component)_depotBtn).gameObject.SetActive(false); RectTransform component2 = ((Component)_roleBtn).GetComponent<RectTransform>(); component2.anchoredPosition = new Vector2(0f, 15f); component2.sizeDelta = new Vector2(200f, 38f); int roleId = portal.m_nview.GetZDO().GetInt(WardZdoKeys.PortalMinRole, 1); UpdateRoleButton(roleId); ApplyCurrentFontSize(); _panel.SetActive(true); RefreshKeyhints(); if (WardGamepadNavHelper.IsGamepadActive()) { SetFocus((Selectable)(object)_roleBtn); } else { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); } SetInputBlocked(block: true); } } public void OpenForContainer(Container container) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)container == (Object)null) && !((Object)(object)container.m_nview == (Object)null) && container.m_nview.IsValid()) { _activeEntityId = container.m_nview.GetZDO().m_uid; _entityType = ConfigEntityType.Container; ((TMP_Text)_headerText).text = "$wmb_configure_chest".Localize().ToUpperInvariant(); long num = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerID() : 0); _coveringWard = WardQueryService.GetCoveringWard(((Component)container).transform.position); if ((Object)(object)_coveringWard != (Object)null && (Object)(object)_coveringWard.m_nview != (Object)null && _coveringWard.m_nview.IsValid()) { _canManage = WardPermissions.CanManageWard(_coveringWard.m_nview.GetZDO(), num); } else { Piece component = ((Component)container).GetComponent<Piece>(); _canManage = (Object)(object)component != (Object)null && (component.IsCreator() || component.GetCreator() == num || component.GetCreator() == 0); } string text = ((!string.IsNullOrEmpty(container.m_name)) ? Localization.instance.Localize(container.m_name) : (((Object)(object)((Component)container).GetComponent<Piece>() != (Object)null) ? Localization.instance.Localize(((Component)container).GetComponent<Piece>().m_name) : "$wmb_chest".Localize())); if (string.IsNullOrEmpty(text)) { text = "$wmb_chest".Localize(); } ZDO zDO = container.m_nview.GetZDO(); string text2 = zDO.GetString(WardZdoKeys.ContainerName, string.Empty); ((Component)_nameInput).gameObject.SetActive(true); _nameInput.text = ((!string.IsNullOrEmpty(text2) && !text2.Equals("Container", StringComparison.OrdinalIgnoreCase)) ? text2 : text); ((Component)_depotBtn).gameObject.SetActive(true); RectTransform component2 = ((Component)_roleBtn).GetComponent<RectTransform>(); component2.anchoredPosition = new Vector2(-80f, -18f); component2.sizeDelta = new Vector2(140f, 34f); RectTransform component3 = ((Component)_depotBtn).GetComponent<RectTransform>(); component3.anchoredPosition = new Vector2(80f, -18f); component3.sizeDelta = new Vector2(140f, 34f); int roleId = zDO.GetInt(WardZdoKeys.ContainerMinRole, 1); UpdateRoleButton(roleId); bool isFuel = zDO.GetBool(WardZdoKeys.ContainerIsFuel, false); UpdateDepotButton(isFuel); ApplyCurrentFontSize(); _panel.SetActive(true); RefreshKeyhints(); if (WardGamepadNavHelper.IsGamepadActive()) { SetFocus((Selectable)(object)_roleBtn); } else { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); _nameInput.ActivateInputField(); ((Selectable)_nameInput).Select(); } SetInputBlocked(block: true); } } public void ApplyFontSize(WardFontSizeMode mode) { if (!((Object)(object)_panel == (Object)null)) { WardMainWindow.ApplyFontSizeToHierarchy(_panel, mode); } } private void ApplyCurrentFontSize() { WardFontSizeMode mode = ((ConfigRegistry.GuiFontSize != null) ? ConfigRegistry.GuiFontSize.Value : WardFontSizeMode.Small); ApplyFontSize(mode); } private void UpdateRoleButton(int roleId) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) ((Selectable)_roleBtn).interactable = _canManage; if ((Object)(object)_roleTxt != (Object)null) { ZDO wardZdo = (((Object)(object)_coveringWard != (Object)null && (Object)(object)_coveringWard.m_nview != (Object)null && _coveringWard.m_nview.IsValid()) ? _coveringWard.m_nview.GetZDO() : null); string roleDisplayName = WardRoleManager.GetRoleDisplayName(wardZdo, roleId); Color roleColor = WardRoleManager.GetRoleColor(wardZdo, roleId); ((TMP_Text)_roleTxt).text = roleDisplayName; ((Graphic)_roleTxt).color = roleColor; } } private void UpdateDepotButton(bool isFuel) { //IL_0064: 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) ((Selectable)_depotBtn).interactable = _canManage && (Object)(object)_coveringWard != (Object)null; if ((Object)(object)_depotTxt != (Object)null) { ((TMP_Text)_depotTxt).text = (isFuel ? "$wmb_depot_yes".Localize() : "$wmb_depot_no".Localize()); ((Graphic)_depotTxt).color = (isFuel ? WardColorPalette.GoldAmber : WardColorPalette.TextMuted); } } private void OnRoleClicked() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) if (!_canManage || Time.frameCount == _lastSubmitFrame) { return; } _lastSubmitFrame = Time.frameCount; ZDOMan instance = ZDOMan.instance; ZDO val = ((instance != null) ? instance.GetZDO(_activeEntityId) : null); if (val == null) { return; } ZDO wardZdo = (((Object)(object)_coveringWard != (Object)null && (Object)(object)_coveringWard.m_nview != (Object)null && _coveringWard.m_nview.IsValid()) ? _coveringWard.m_nview.GetZDO() : null); int nextRoleId = WardRoleManager.GetNextRoleId(wardZdo, _entityType switch { ConfigEntityType.Door => val.GetInt(WardZdoKeys.DoorMinRole, 0), ConfigEntityType.Container => val.GetInt(WardZdoKeys.ContainerMinRole, 1), ConfigEntityType.Portal => val.GetInt(WardZdoKeys.PortalMinRole, 1), _ => 1, }); if (ZDOMan.instance != null) { val.SetOwner(ZDOMan.GetSessionID()); } if (_entityType == ConfigEntityType.Door) { val.Set(WardZdoKeys.DoorMinRole, nextRoleId, false); WardNetworkRouter.SendSetRoleLock(_activeEntityId, (WardRole)nextRoleId, isDoor: true); } else if (_entityType == ConfigEntityType.Container) { val.Set(WardZdoKeys.ContainerMinRole, nextRoleId, false); WardNetworkRouter.SendSetRoleLock(_activeEntityId, (WardRole)nextRoleId, isDoor: false); } else if (_entityType == ConfigEntityType.Portal) { val.Set(WardZdoKeys.PortalMinRole, nextRoleId, false); if (ZDOMan.instance != null) { ZDOMan.instance.SetDirtyPortals(); } WardNetworkRouter.SendPortalRole(_activeEntityId, nextRoleId); } UpdateRoleButton(nextRoleId); WardMeBruh.Log.Debug($"[Dialog] Set clearance role for {_entityType} {_activeEntityId} to {nextRoleId}"); } private void OnDepotClicked() { //IL_003d: 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_0098: Unknown result type (might be due to invalid IL or missing references) if (!_canManage || (Object)(object)_coveringWard == (Object)null || Time.frameCount == _lastSubmitFrame) { return; } _lastSubmitFrame = Time.frameCount; ZDOMan instance = ZDOMan.instance; ZDO val = ((instance != null) ? instance.GetZDO(_activeEntityId) : null); if (val != null) { bool flag = !val.GetBool(WardZdoKeys.ContainerIsFuel, false); if (ZDOMan.instance != null) { val.SetOwner(ZDOMan.GetSessionID()); } val.Set(WardZdoKeys.ContainerIsFuel, flag); WardNetworkRouter.SendToggleFuelDepot(_activeEntityId, flag); UpdateDepotButton(flag); WardMeBruh.Log.Debug($"[Dialog] Toggled Fuel Depot for Chest {_activeEntityId} to {flag}"); } } public void Close() { LastClosedFrame = Time.frameCount; Selectable focusedSelectable = _focusedSelectable; InputField val = (InputField)(object)((focusedSelectable is InputField) ? focusedSelectable : null); if ((Object)(object)val != (Object)null) { val.DeactivateInputField(); } _focusedSelectable = null; WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); if ((Object)(object)_panel != (Object)null) { _panel.SetActive(false); } if ((Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject((GameObject)null); } ZInput.ResetButtonStatus("Chat"); ZInput.ResetButtonStatus("JoySit"); ZInput.ResetButtonStatus("Sit"); ZInput.ResetButtonStatus("JoyRadial"); ZInput.ResetButtonStatus("JoyButtonX"); ((MonoBehaviour)this).StartCoroutine(DeferredUnblockInput()); } private IEnumerator DeferredUnblockInput() { yield return null; ZInput.ResetButtonStatus("Chat"); ZInput.ResetButtonStatus("JoySit"); ZInput.ResetButtonStatus("Sit"); ZInput.ResetButtonStatus("JoyRadial"); ZInput.ResetButtonStatus("JoyButtonX"); SetInputBlocked(block: false); PlayerController.SetTakeInputDelay(0.25f); } private void OnSaveClicked() { //IL_0052: 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) if (Time.frameCount == _lastSubmitFrame) { return; } _lastSubmitFrame = Time.frameCount; if (_entityType != ConfigEntityType.Portal) { string text = _nameInput.text.Trim(); if (!string.IsNullOrEmpty(text)) { if (_entityType == ConfigEntityType.Door) { WardNetworkRouter.SendRenameDoor(_activeEntityId, text); } else { WardNetworkRouter.SendRenameContainer(_activeEntityId, text); } } } Close(); } } public class RemoteWardSelectorModal { private GameObject _panel; private Transform _listContainer; private readonly List<GameObject> _itemCards = new List<GameObject>(); private Action<KnownWard> _onWardSelected; private PrivateArea _activeWard; private PrivateArea _physicalWard; private ScrollRect _scrollRect; private GameObject _closeBtn; private TextMeshProUGUI _closeBtnText; private GameObject _gamepadLegend; private readonly List<Selectable> _selectableButtons = new List<Selectable>(); private Selectable _currentSelected; private GameObject _focusReticle; private int _lastSubmitFrame = -1; public static int LastClosedFrame { get; private set; } = -1; public bool IsOpen { get { if ((Object)(object)_panel != (Object)null) { return _panel.activeSelf; } return false; } } public void Build(Transform parent, Action<KnownWard> onWardSelected) { //IL_001e: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Expected O, but got Unknown //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) UIFonts.GetPrimaryFont(); _onWardSelected = onWardSelected; _panel = GUIManager.Instance.CreateWoodpanel(parent, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 680f, 500f, true); ((Object)_panel).name = "RemoteWardSelectorModal"; GameObject val = new GameObject("TitleText", new Type[3] { typeof(RectTransform), typeof(TextMeshProUGUI), typeof(WardTextElement) }); val.transform.SetParent(_panel.transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(0f, 1f); component.pivot = new Vector2(0f, 1f); component.anchoredPosition = new Vector2(30f, -20f); component.sizeDelta = new Vector2(450f, 32f); TextMeshProUGUI component2 = val.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component2).text = "$wmb_modal_territory_registry".Localize(); ((TMP_Text)component2).font = UIFonts.GetPrimaryFont(); ((TMP_Text)component2).fontSize = 18f; ((Graphic)component2).color = WardColorPalette.ValheimOrange; ((TMP_Text)component2).alignment = (TextAlignmentOptions)4097; val.GetComponent<WardTextElement>().baseFontSize = 18; _closeBtn = GUIManager.Instance.CreateButton("X", _panel.transform, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-48f, -34f), 38f, 32f); _closeBtn.GetComponent<RectTransform>().sizeDelta = new Vector2(38f, 32f); WardUIFactory.SetupButtonText(_closeBtn, "X", 14f, WardColorPalette.DangerRed, (TextAlignmentOptions)514); _closeBtnText = _closeBtn.GetComponentInChildren<TextMeshProUGUI>(); ((UnityEvent)_closeBtn.GetComponent<Button>().onClick).AddListener(new UnityAction(Close)); GameObject val2 = WardUIFactory.CreateScrollArea(_panel.transform, out _listContainer); _scrollRect = val2.GetComponent<ScrollRect>(); RectTransform component3 = val2.GetComponent<RectTransform>(); component3.offsetMin = new Vector2(25f, 25f); component3.offsetMax = new Vector2(-25f, -60f); _gamepadLegend = new GameObject("GamepadLegend", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); _gamepadLegend.transform.SetParent(_panel.transform, false); RectTransform component4 = _gamepadLegend.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(0f, 0f); component4.anchorMax = new Vector2(1f, 0f); component4.pivot = new Vector2(0.5f, 1f); component4.offsetMin = new Vector2(30f, -26f); component4.offsetMax = new Vector2(-30f, -6f); TextMeshProUGUI component5 = _gamepadLegend.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component5).font = UIFonts.GetPrimaryFont(); ((TMP_Text)component5).text = "<color=#e2d6b5><b>[D-Pad]</b> Navigate <b>[A]</b> Select Ward <b>[B]</b> Back <b>[R-Stick]</b> Scroll</color>"; ((TMP_Text)component5).fontSize = 11f; ((TMP_Text)component5).alignment = (TextAlignmentOptions)514; ((Graphic)component5).color = WardColorPalette.ValheimBeige; _focusReticle = WardGamepadNavHelper.CreateFocusReticle(_panel.transform); _panel.SetActive(false); } public void Open(PrivateArea activeWard = null, PrivateArea physicalWard = null) { if (!((Object)(object)_panel == (Object)null)) { _activeWard = activeWard; _physicalWard = physicalWard; _panel.SetActive(true); Refresh(); UpdateKeyhints(WardGamepadNavHelper.IsGamepadActive()); } } public void Close() { LastClosedFrame = Time.frameCount; WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); if ((Object)(object)_panel != (Object)null) { _panel.SetActive(false); } } public void Refresh() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Expected O, but got Unknown //IL_0815: Unknown result type (might be due to invalid IL or missing references) //IL_081a: Unknown result type (might be due to invalid IL or missing references) //IL_0828: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) //IL_0842: Unknown result type (might be due to invalid IL or missing references) //IL_085c: Expected O, but got Unknown //IL_085d: Unknown result type (might be due to invalid IL or missing references) //IL_08cd: Unknown result type (might be due to invalid IL or missing references) //IL_08c6: Unknown result type (might be due to invalid IL or missing references) //IL_0928: Unknown result type (might be due to invalid IL or missing references) //IL_092d: Unknown result type (might be due to invalid IL or missing references) //IL_093b: Unknown result type (might be due to invalid IL or missing references) //IL_094b: Unknown result type (might be due to invalid IL or missing references) //IL_096e: Expected O, but got Unknown //IL_0985: Unknown result type (might be due to invalid IL or missing references) //IL_098a: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_09b3: Unknown result type (might be due to invalid IL or missing references) //IL_09e8: Unknown result type (might be due to invalid IL or missing references) //IL_0a28: Unknown result type (might be due to invalid IL or missing references) //IL_0a32: Expected O, but got Unknown for (int i = 0; i < _itemCards.Count; i++) { if ((Object)(object)_itemCards[i] != (Object)null) { Object.Destroy((Object)(object)_itemCards[i]); } } _itemCards.Clear(); _selectableButtons.Clear(); _currentSelected = null; if ((Object)(object)_listContainer != (Object)null) { RectTransform component = ((Component)_listContainer).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.anchoredPosition = Vector2.zero; } } long playerId = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerID() : 0); List<KnownWard> playerOwnedWards = WardRegistryManager.Instance.GetPlayerOwnedWards(playerId); Transform val = WardUIFactory.CreateCard(_listContainer, string.Format("{0} ({1})", "$wmb_modal_registered_territories".Localize(), playerOwnedWards.Count)); _itemCards.Add(((Component)val.parent.parent).gameObject); int num = (((Object)(object)WardMainWindow.Instance != (Object)null) ? (WardMainWindow.Instance.CurrentFontSizeMode switch { WardFontSizeMode.Medium => 2, WardFontSizeMode.Large => 4, _ => 0, }) : 0); int num2 = num; int num3 = 11 + num2; float rowHeight = 44f + (float)num2 * 3f; if (playerOwnedWards.Count == 0) { WardUIFactory.CreateBadgeRow(val, "$wmb_modal_no_owned_wards".Localize(), "-", WardColorPalette.TextMuted, out var _); if ((Object)(object)WardMainWindow.Instance != (Object)null && (Object)(object)_panel != (Object)null) { WardMainWindow.ApplyFontSizeToHierarchy(_panel, WardMainWindow.Instance.CurrentFontSizeMode); } return; } Vector3 playerPos = (((Object)(object)Player.m_localPlayer != (Object)null) ? ((Component)Player.m_localPlayer).transform.position : Vector3.zero); ZDOID activeWardId = (((Object)(object)_activeWard != (Object)null && (Object)(object)_activeWard.m_nview != (Object)null && _activeWard.m_nview.IsValid()) ? _activeWard.m_nview.GetZDO().m_uid : (((Object)(object)WardMainWindow.Instance != (Object)null) ? WardMainWindow.Instance.ActiveWardId : ZDOID.None)); ZDOID physicalWardId = ZDOID.None; if ((Object)(object)_physicalWard != (Object)null && (Object)(object)_physicalWard.m_nview != (Object)null && _physicalWard.m_nview.IsValid()) { physicalWardId = _physicalWard.m_nview.GetZDO().m_uid; } else if ((Object)(object)WardMainWindow.Instance != (Object)null && WardMainWindow.Instance.PhysicalWardId != ZDOID.None) { physicalWardId = WardMainWindow.Instance.PhysicalWardId; } else if ((Object)(object)Player.m_localPlayer != (Object)null) { KnownWard wardCoveringPoint = WardRegistryManager.Instance.GetWardCoveringPoint(playerPos); if (wardCoveringPoint != null) { physicalWardId = wardCoveringPoint.Id; } } List<KnownWard> list = new List<KnownWard>(); Dictionary<ZDOID, List<KnownWard>> dictionary = new Dictionary<ZDOID, List<KnownWard>>(); HashSet<ZDOID> hashSet = new HashSet<ZDOID>(); for (int j = 0; j < playerOwnedWards.Count; j++) { KnownWard knownWard = playerOwnedWards[j]; if (knownWard.Type == WardType.Main || knownWard.ParentId == ZDOID.None || knownWard.ParentId == knownWard.Id) { list.Add(knownWard); hashSet.Add(knownWard.Id); continue; } if (!dictionary.TryGetValue(knownWard.ParentId, out var value)) { value = new List<KnownWard>(); dictionary[knownWard.ParentId] = value; } value.Add(knownWard); } List<KnownWard> list2 = null; foreach (KeyValuePair<ZDOID, List<KnownWard>> item3 in dictionary) { if (!hashSet.Contains(item3.Key)) { if (list2 == null) { list2 = new List<KnownWard>(); } list2.AddRange(item3.Value); } } if (list2 != null) { for (int k = 0; k < list2.Count; k++) { KnownWard knownWard2 = list2[k]; list.Add(knownWard2); hashSet.Add(knownWard2.Id); if (dictionary.TryGetValue(knownWard2.ParentId, out var value2)) { value2.Remove(knownWard2); } } } list.Sort(delegate(KnownWard a, KnownWard b) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0069: 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_007b: Unknown result type (might be due to invalid IL or missing references) bool flag3 = a.Id == physicalWardId || a.Id == activeWardId; bool flag4 = b.Id == physicalWardId || b.Id == activeWardId; if (flag3 && !flag4) { return -1; } if (!flag3 && flag4) { return 1; } float num9 = Utils.DistanceXZ(playerPos, a.Position); float value4 = Utils.DistanceXZ(playerPos, b.Position); return num9.CompareTo(value4); }); List<(KnownWard, bool, bool)> list3 = new List<(KnownWard, bool, bool)>(); for (int num4 = 0; num4 < list.Count; num4++) { KnownWard knownWard3 = list[num4]; list3.Add((knownWard3, false, false)); if (dictionary.TryGetValue(knownWard3.Id, out var value3) && value3.Count > 0) { value3.Sort(delegate(KnownWard a, KnownWard b) { int num9 = a.Type.CompareTo(b.Type); return (num9 != 0) ? num9 : string.Compare(a.CustomName, b.CustomName, StringComparison.OrdinalIgnoreCase); }); for (int num5 = 0; num5 < value3.Count; num5++) { bool item = num5 == value3.Count - 1; list3.Add((value3[num5], true, item)); } } } for (int num6 = 0; num6 < list3.Count; num6++) { (KnownWard, bool, bool) tuple = list3[num6]; KnownWard ward = tuple.Item1; bool item2 = tuple.Item2; bool flag = ward.Id == activeWardId; bool num7 = ward.Id == physicalWardId; bool flag2 = CanPlayerManageWard(ward, playerId); float num8 = Utils.DistanceXZ(playerPos, ward.Position); string text = ((num8 < 1000f) ? string.Format("{0}{1}", Mathf.RoundToInt(num8), "$wmb_meters_away".Localize()) : string.Format("{0:F1}{1}", num8 / 1000f, "$wmb_km_away".Localize())); if (num7) { text = "$wmb_modal_current_location".Localize(); } string text2 = ((ward.Type == WardType.SubWard) ? "<color=#93c5fd><b>[Sub-Ward]</b></color> " : ((ward.Type == WardType.Extension) ? "<color=#fcd34d><b>[Extension]</b></color> " : string.Empty)); string labelText = string.Format("{0}<b>{1}</b> <color=#fcd34d>[r: {2}{3}]</color>\n<size={4}><color=#9ca3af>{5} {6} • {7}</color></size>", text2, ward.CustomName, Mathf.RoundToInt(ward.Radius), "$wmb_meters".Localize(), num3, "$wmb_owner_label".Localize(), ward.CreatorName, text); Transform controlContainer; GameObject val2 = WardUIFactory.CreateSettingRow(val, labelText, out controlContainer, rowHeight); if (item2) { HorizontalLayoutGroup component2 = val2.GetComponent<HorizontalLayoutGroup>(); if ((Object)(object)component2 != (Object)null) { ((LayoutGroup)component2).padding = new RectOffset(36, 10, 2, 2); } } Transform val3 = val2.transform.Find("Label"); if ((Object)(object)val3 != (Object)null) { LayoutElement component3 = ((Component)val3).GetComponent<LayoutElement>(); if ((Object)(object)component3 != (Object)null) { component3.minWidth = 340f; component3.preferredWidth = 390f; component3.flexibleWidth = 1f; } TextMeshProUGUI component4 = ((Component)val3).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component4 != (Object)null) { ((TMP_Text)component4).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)component4).overflowMode = (TextOverflowModes)1; } } LayoutElement component5 = ((Component)controlContainer).GetComponent<LayoutElement>(); if ((Object)(object)component5 != (Object)null) { component5.minWidth = 210f; component5.preferredWidth = 210f; component5.flexibleWidth = 0f; } GameObject val4 = new GameObject("StatusBadge", new Type[4] { typeof(RectTransform), typeof(TextMeshProUGUI), typeof(LayoutElement), typeof(WardTextElement) }); val4.transform.SetParent(controlContainer, false); val4.GetComponent<RectTransform>().sizeDelta = new Vector2(100f, 28f); WardUIExtensions.SetLayoutDimensions(val4, 100f, 28f); TextMeshProUGUI component6 = val4.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component6).text = (ward.IsEnabled ? ("● " + "$wmb_active".Localize()) : ("○ " + "$wmb_inactive".Localize())); ((TMP_Text)component6).font = UIFonts.GetPrimaryFont(); ((TMP_Text)component6).fontSize = 12f; ((Graphic)component6).color = (ward.IsEnabled ? WardColorPalette.RunicGreen : WardColorPalette.TextMuted); ((TMP_Text)component6).alignment = (TextAlignmentOptions)4100; ((TMP_Text)component6).overflowMode = (TextOverflowModes)0; ((TMP_Text)component6).textWrappingMode = (TextWrappingModes)0; val4.GetComponent<WardTextElement>().baseFontSize = 12; if (flag || !flag2) { GameObject val5 = new GameObject("Spacer", new Type[2] { typeof(RectTransform), typeof(LayoutElement) }); val5.transform.SetParent(controlContainer, false); val5.GetComponent<RectTransform>().sizeDelta = new Vector2(100f, 28f); WardUIExtensions.SetLayoutDimensions(val5, 100f, 28f); continue; } GameObject obj = GUIManager.Instance.CreateButton("$wmb_modal_manage_btn".Localize(), controlContainer, Vector2.zero, Vector2.zero, Vector2.zero, 100f, 28f); obj.GetComponent<RectTransform>().sizeDelta = new Vector2(100f, 28f); obj.SetLayoutDimensions(100f, 28f); WardUIFactory.SetupButtonText(obj, "$wmb_modal_manage_btn".Localize(), 12f, WardColorPalette.ValheimBeige, (TextAlignmentOptions)514); Button component7 = obj.GetComponent<Button>(); WardGamepadNavHelper.ApplyGamepadColorBlock((Selectable)(object)component7); _selectableButtons.Add((Selectable)(object)component7); ((UnityEvent)component7.onClick).AddListener((UnityAction)delegate { Close(); _onWardSelected?.Invoke(ward); }); } if ((Object)(object)WardMainWindow.Instance != (Object)null && (Object)(object)_panel != (Object)null) { WardMainWindow.ApplyFontSizeToHierarchy(_panel, WardMainWindow.Instance.CurrentFontSizeMode); } if (WardGamepadNavHelper.IsGamepadActive() && _selectableButtons.Count > 0) { _currentSelected = _selectableButtons[0]; _currentSelected.Select(); WardGamepadNavHelper.AttachFocusReticle(_focusReticle, _currentSelected); } else { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); } } public void UpdateKeyhints(bool isGamepad) { if ((Object)(object)_closeBtnText != (Object)null) { string gamepadGlyph = WardGamepadNavHelper.GetGamepadGlyph("X"); ((TMP_Text)_closeBtnText).text = (isGamepad ? gamepadGlyph : "X"); } if (!((Object)(object)_gamepadLegend != (Object)null)) { return; } _gamepadLegend.SetActive(isGamepad); if (isGamepad) { TextMeshProUGUI component = _gamepadLegend.GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { string gamepadGlyph2 = WardGamepadNavHelper.GetGamepadGlyph("DPad"); string gamepadGlyph3 = WardGamepadNavHelper.GetGamepadGlyph("A"); string gamepadGlyph4 = WardGamepadNavHelper.GetGamepadGlyph("X"); string gamepadGlyph5 = WardGamepadNavHelper.GetGamepadGlyph("RStick"); ((TMP_Text)component).text = "<color=#e2d6b5>" + gamepadGlyph2 + " Navigate " + gamepadGlyph3 + " Select Ward " + gamepadGlyph4 + " Close " + gamepadGlyph5 + " Scroll</color>"; } } } public void UpdateNavigation() { bool flag = WardGamepadNavHelper.IsGamepadActive(); UpdateKeyhints(flag); if (!flag || !IsOpen) { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); return; } if (WardGamepadNavHelper.IsButtonDownB() || WardGamepadNavHelper.IsButtonDownX() || Input.GetKeyDown((KeyCode)27)) { Close(); if ((Object)(object)WardMainWindow.Instance != (Object)null && WardMainWindow.Instance.GamepadController != null) { WardMainWindow.Instance.GamepadController.RestoreFocusOrSelectFirst(); } return; } if (WardGamepadNavHelper.GetDirectionInput(out var _, out var navY) && navY != 0 && _selectableButtons.Count > 0) { StepSelection(-navY); } if (WardGamepadNavHelper.IsButtonDownA() && (Object)(object)_currentSelected != (Object)null && Time.frameCount != _lastSubmitFrame) { Selectable currentSelected = _currentSelected; Button val = (Button)(object)((currentSelected is Button) ? currentSelected : null); if (val != null && ((Selectable)val).interactable) { _lastSubmitFrame = Time.frameCount; ((UnityEvent)val.onClick).Invoke(); } } float rightStickScrollDelta = WardGamepadNavHelper.GetRightStickScrollDelta(); if (Mathf.Abs(rightStickScrollDelta) > 0.15f && (Object)(object)_scrollRect != (Object)null) { float num = rightStickScrollDelta * 2.5f * Time.unscaledDeltaTime; _scrollRect.verticalNormalizedPosition = Mathf.Clamp01(_scrollRect.verticalNormalizedPosition + num); } if ((Object)(object)_currentSelected != (Object)null && ((Component)_currentSelected).gameObject.activeInHierarchy) { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, _currentSelected); } else { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); } } private void StepSelection(int direction) { if (_selectableButtons.Count == 0) { return; } int num = _selectableButtons.IndexOf(_currentSelected); int num2 = num + direction; num2 = ((num >= 0) ? Mathf.Clamp(num2, 0, _selectableButtons.Count - 1) : ((direction <= 0) ? (_selectableButtons.Count - 1) : 0)); Selectable val = _selectableButtons[num2]; if ((Object)(object)val != (Object)null && val.interactable) { _currentSelected = val; val.Select(); WardGamepadNavHelper.AttachFocusReticle(_focusReticle, _currentSelected); Transform transform = ((Component)val).transform; RectTransform val2 = (RectTransform)(object)((transform is RectTransform) ? transform : null); if ((Object)(object)val2 != (Object)null && (Object)(object)_scrollRect != (Object)null) { WardGamepadNavHelper.EnsureVisible(_scrollRect, val2); } } } private static bool CanPlayerManageWard(KnownWard ward, long playerId) { //IL_002d: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if (ward == null || playerId == 0L) { return false; } if (WardPermissions.IsAdmin(playerId)) { return true; } if (ward.CreatorId == playerId) { return true; } if (ZDOMan.instance != null) { ZDO zDO = ZDOMan.instance.GetZDO(ward.Id); if (zDO != null) { if (zDO.GetLong(ZDOVars.s_creator, ward.CreatorId) == playerId) { return true; } if (WardRoleManager.CanPerform(zDO, playerId, "core.view_gui")) { return true; } } if (ward.ParentId != ZDOID.None) { ZDO zDO2 = ZDOMan.instance.GetZDO(ward.ParentId); if (zDO2 != null) { if (zDO2.GetLong(ZDOVars.s_creator, 0L) == playerId) { return true; } if (WardRoleManager.CanPerform(zDO2, playerId, "core.view_gui")) { return true; } } } } return false; } } public static class UIFonts { private static TMP_FontAsset _primaryFont; public static TMP_FontAsset GetPrimaryFont() { if ((Object)(object)_primaryFont != (Object)null) { return _primaryFont; } if ((Object)(object)Hud.instance != (Object)null && (Object)(object)Hud.instance.m_hoverName != (Object)null && (Object)(object)((TMP_Text)Hud.instance.m_hoverName).font != (Object)null) { _primaryFont = ((TMP_Text)Hud.instance.m_hoverName).font; } if ((Object)(object)_primaryFont == (Object)null) { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); foreach (TMP_FontAsset val in array) { if ((Object)(object)val != (Object)null && ((Object)val).name.Contains("Valheim-Averia-Serif-Bold")) { _primaryFont = val; break; } } } if ((Object)(object)_primaryFont == (Object)null) { TMP_FontAsset[] array2 = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); foreach (TMP_FontAsset val2 in array2) { if ((Object)(object)val2 != (Object)null && ((Object)val2).name.Contains("Averia")) { _primaryFont = val2; break; } } } if ((Object)(object)_primaryFont == (Object)null && GUIManager.Instance != null && (Object)(object)GUIManager.Instance.TMP_AveriaSansLibre != (Object)null) { _primaryFont = GUIManager.Instance.TMP_AveriaSansLibre; } if ((Object)(object)_primaryFont == (Object)null) { _primaryFont = TMP_Settings.defaultFontAsset; } if ((Object)(object)_primaryFont != (Object)null) { TMP_Settings.defaultFontAsset = _primaryFont; } return _primaryFont; } } public class WardButtonAutoResizer : MonoBehaviour { private RectTransform _rectTransform; private LayoutElement _layoutElement; private TextMeshProUGUI _tmp; private float _minWidth; private float _padding = 24f; private string _lastText; private float _lastFontSize; public float MinWidth { get { return _minWidth; } set { _minWidth = value; RefreshWidth(); } } public float Padding { get { return _padding; } set { _padding = value; RefreshWidth(); } } public void Initialize(RectTransform rt, TextMeshProUGUI tmp, float minWidth, float padding = 24f) { _rectTransform = rt; _tmp = tmp; _minWidth = minWidth; _padding = padding; if ((Object)(object)_tmp != (Object)null) { _lastText = ((TMP_Text)_tmp).text; _lastFontSize = ((TMP_Text)_tmp).fontSize; } RefreshWidth(); } public void RefreshWidth() { //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_rectTransform == (Object)null) { _rectTransform = ((Component)this).GetComponent<RectTransform>(); if ((Object)(object)_rectTransform == (Object)null) { return; } } if ((Object)(object)_tmp == (Object)null) { _tmp = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(true); if ((Object)(object)_tmp == (Object)null) { return; } } if ((Object)(object)_layoutElement == (Object)null) { _layoutElement = ((Component)this).GetComponent<LayoutElement>(); if ((Object)(object)_layoutElement == (Object)null && (Object)(object)((Component)this).transform.parent != (Object)null && (Object)(object)((Component)((Component)this).transform.parent).GetComponent<LayoutGroup>() != (Object)null) { _layoutElement = ((Component)this).gameObject.AddComponent<LayoutElement>(); _layoutElement.flexibleWidth = 0f; _layoutElement.flexibleHeight = 0f; _layoutElement.preferredHeight = _rectTransform.sizeDelta.y; _layoutElement.minHeight = _rectTransform.sizeDelta.y; } } float num = Mathf.Ceil(((TMP_Text)_tmp).GetPreferredValues(((TMP_Text)_tmp).text, float.PositiveInfinity, float.PositiveInfinity).x + _padding); float num2 = Mathf.Max(_minWidth, num); bool flag = false; if (Mathf.Abs(_rectTransform.sizeDelta.x - num2) > 0.5f) { _rectTransform.sizeDelta = new Vector2(num2, _rectTransform.sizeDelta.y); flag = true; } if ((Object)(object)_layoutElement != (Object)null && (Mathf.Abs(_layoutElement.preferredWidth - num2) > 0.5f || Mathf.Abs(_layoutElement.minWidth - num2) > 0.5f)) { _layoutElement.preferredWidth = num2; _layoutElement.minWidth = num2; flag = true; } if (flag && (Object)(object)((Component)this).transform.parent != (Object)null) { RectTransform component = ((Component)((Component)this).transform.parent).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { LayoutRebuilder.MarkLayoutForRebuild(component); } } } private void LateUpdate() { if (!((Object)(object)_tmp == (Object)null) && !((Object)(object)_rectTransform == (Object)null) && (((TMP_Text)_tmp).text != _lastText || !Mathf.Approximately(((TMP_Text)_tmp).fontSize, _lastFontSize))) { _lastText = ((TMP_Text)_tmp).text; _lastFontSize = ((TMP_Text)_tmp).fontSize; RefreshWidth(); } } } public static class WardColorPalette { public static readonly Color WoodpanelDark = new Color(0.08f, 0.08f, 0.09f, 0.95f); public static readonly Color SlateBorder = new Color(0.25f, 0.28f, 0.32f, 1f); public static readonly Color ValheimOrange = new Color(1f, 0.65f, 0f, 1f); public static readonly Color ValheimBeige = new Color(0.92f, 0.88f, 0.8f, 1f); public static readonly Color IceBlue = new Color(0.22f, 0.74f, 0.97f, 1f); public static readonly Color GoldAmber = new Color(0.98f, 0.75f, 0.14f, 1f); public static readonly Color RunicGreen = new Color(0.4f, 0.85f, 0.4f, 1f); public static readonly Color DangerRed = new Color(0.95f, 0.3f, 0.3f, 1f); public static readonly Color TextMuted = new Color(0.6f, 0.62f, 0.65f, 1f); public static readonly Color TabActive = new Color(0.35f, 0.45f, 0.6f, 1f); public static readonly Color TabInactive = new Color(0.18f, 0.2f, 0.24f, 1f); public static readonly Color CardBackground = new Color(0.06f, 0.05f, 0.04f, 0.88f); public static readonly Color CardBorder = new Color(0.28f, 0.2f, 0.12f, 0.9f); public static readonly Color CardHeader = new Color(0.12f, 0.09f, 0.06f, 0.95f); public static readonly Color RowHover = new Color(0.18f, 0.13f, 0.08f, 0.5f); public static readonly Color RowEven = new Color(0.08f, 0.07f, 0.05f, 0.35f); public static readonly Color RowOdd = new Color(0.14f, 0.11f, 0.08f, 0.65f); public static readonly Color ButtonDark = new Color(0.14f, 0.11f, 0.08f, 0.95f); public static readonly Color ButtonBorder = new Color(0.38f, 0.28f, 0.16f, 1f); public static readonly Color AetherIce = new Color(0.28f, 0.65f, 0.96f, 0.85f); public static readonly Color AetherIceGlow = new Color(0.35f, 0.75f, 1.2f, 1f); public static readonly Color AetherIceTeal = new Color(0.18f, 0.85f, 0.88f, 0.85f); public static readonly Color AetherIcePurple = new Color(0.42f, 0.38f, 0.95f, 0.85f); public static readonly Color ValheimGreen = new Color(0.06f, 0.72f, 0.51f, 1f); public static readonly Color TextNormal = new Color(0.92f, 0.88f, 0.8f, 1f); public static string ColorHex(Color c) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return "#" + ColorUtility.ToHtmlStringRGBA(c); } } public class WardDialogGamepadController { private readonly WardMainWindow _window; private readonly GameObject _panel; private GameObject _tabBumperLeft; private GameObject _tabBumperRight; private GameObject _gamepadLegend; private TextMeshProUGUI _legendText; private GameObject _focusReticle; private Selectable _currentSelected; private bool _wasGamepadActive; private int _lastFocusedIndex; private int _lastSubmitFrame; private float _lastSubmitTime; public WardDialogGamepadController(WardMainWindow window, GameObject panel) { _window = window; _panel = panel; } public void InitializeElements(GameObject tabBar, RectTransform panelRt, TextMeshProUGUI otherWardsText, TextMeshProUGUI closeText) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) _focusReticle = WardGamepadNavHelper.CreateFocusReticle(_panel.transform); if ((Object)(object)tabBar != (Object)null) { _tabBumperLeft = new GameObject("TabBumperLeft", new Type[3] { typeof(RectTransform), typeof(TextMeshProUGUI), typeof(LayoutElement) }); _tabBumperLeft.transform.SetParent(tabBar.transform, false); _tabBumperLeft.transform.SetSiblingIndex(0); LayoutElement component = _tabBumperLeft.GetComponent<LayoutElement>(); component.minWidth = 36f; component.preferredWidth = 36f; component.minHeight = 36f; component.preferredHeight = 36f; component.flexibleWidth = 0f; TextMeshProUGUI component2 = _tabBumperLeft.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component2).font = UIFonts.GetPrimaryFont(); ((TMP_Text)component2).fontSize = 18f; ((TMP_Text)component2).alignment = (TextAlignmentOptions)514; ((TMP_Text)component2).overflowMode = (TextOverflowModes)0; ((TMP_Text)component2).textWrappingMode = (TextWrappingModes)0; ((Graphic)component2).raycastTarget = false; _tabBumperRight = new GameObject("TabBumperRight", new Type[3] { typeof(RectTransform), typeof(TextMeshProUGUI), typeof(LayoutElement) }); _tabBumperRight.transform.SetParent(tabBar.transform, false); _tabBumperRight.transform.SetAsLastSibling(); LayoutElement component3 = _tabBumperRight.GetComponent<LayoutElement>(); component3.minWidth = 36f; component3.preferredWidth = 36f; component3.minHeight = 36f; component3.preferredHeight = 36f; component3.flexibleWidth = 0f; TextMeshProUGUI component4 = _tabBumperRight.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component4).font = UIFonts.GetPrimaryFont(); ((TMP_Text)component4).fontSize = 18f; ((TMP_Text)component4).alignment = (TextAlignmentOptions)514; ((TMP_Text)component4).overflowMode = (TextOverflowModes)0; ((TMP_Text)component4).textWrappingMode = (TextWrappingModes)0; ((Graphic)component4).raycastTarget = false; } if (_window.TabButtons != null) { for (int i = 0; i < _window.TabButtons.Length; i++) { Button val = _window.TabButtons[i]; if ((Object)(object)val != (Object)null) { Navigation navigation = ((Selectable)val).navigation; ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)val).navigation = navigation; } } } _gamepadLegend = new GameObject("GamepadLegend", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); _gamepadLegend.transform.SetParent(_panel.transform, false); RectTransform component5 = _gamepadLegend.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0f, 0f); component5.anchorMax = new Vector2(1f, 0f); component5.pivot = new Vector2(0.5f, 1f); component5.offsetMin = new Vector2(30f, -28f); component5.offsetMax = new Vector2(-30f, -6f); _legendText = _gamepadLegend.GetComponent<TextMeshProUGUI>(); ((TMP_Text)_legendText).font = UIFonts.GetPrimaryFont(); ((TMP_Text)_legendText).fontSize = 12f; ((TMP_Text)_legendText).alignment = (TextAlignmentOptions)514; ((Graphic)_legendText).color = WardColorPalette.ValheimBeige; UpdateKeyhints(WardGamepadNavHelper.IsGamepadActive()); } public void OnWindowOpened() { _currentSelected = null; _lastFocusedIndex = 0; bool flag = WardGamepadNavHelper.IsGamepadActive(); UpdateKeyhints(flag); if (flag) { FocusFirstElement(); } else { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); } } public void OnTabChanged() { _currentSelected = null; _lastFocusedIndex = 0; if ((Object)(object)_window != (Object)null && _window.TabManagement != null) { _window.TabManagement.HideHoverTooltip(); } if (WardGamepadNavHelper.IsGamepadActive()) { FocusFirstElement(); } else { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); } } public void UpdateKeyhints(bool isGamepad) { _wasGamepadActive = isGamepad; if ((Object)(object)_tabBumperLeft != (Object)null) { _tabBumperLeft.SetActive(isGamepad); if (isGamepad) { TextMeshProUGUI component = _tabBumperLeft.GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).text = WardGamepadNavHelper.GetGamepadGlyph("LB"); } } } if ((Object)(object)_tabBumperRight != (Object)null) { _tabBumperRight.SetActive(isGamepad); if (isGamepad) { TextMeshProUGUI component2 = _tabBumperRight.GetComponent<TextMeshProUGUI>(); if ((Object)(object)component2 != (Object)null) { ((TMP_Text)component2).text = WardGamepadNavHelper.GetGamepadGlyph("RB"); } } } if ((Object)(object)_gamepadLegend != (Object)null) { _gamepadLegend.SetActive(isGamepad); if (isGamepad && (Object)(object)_legendText != (Object)null) { string gamepadGlyph = WardGamepadNavHelper.GetGamepadGlyph("DPad"); string gamepadGlyph2 = WardGamepadNavHelper.GetGamepadGlyph("LT"); string gamepadGlyph3 = WardGamepadNavHelper.GetGamepadGlyph("RT"); string gamepadGlyph4 = WardGamepadNavHelper.GetGamepadGlyph("A"); string gamepadGlyph5 = WardGamepadNavHelper.GetGamepadGlyph("RStick"); string gamepadGlyph6 = WardGamepadNavHelper.GetGamepadGlyph("B"); ((TMP_Text)_legendText).text = "<color=#e2d6b5>" + gamepadGlyph + " Navigate " + gamepadGlyph2 + gamepadGlyph3 + " Sections " + gamepadGlyph4 + " Select/Toggle " + gamepadGlyph5 + " Scroll " + gamepadGlyph6 + " Close</color>"; } } _window.UpdateTabButtonDimensions(); } public void UpdateNavigation() { bool flag = WardGamepadNavHelper.IsGamepadActive(); if (flag != _wasGamepadActive) { UpdateKeyhints(flag); _window.RefreshCurrentKeyhints(); } if (!flag) { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); return; } if (_window.IsRemoteSelectorOpen) { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); if (_window.RemoteSelector != null) { _window.RemoteSelector.UpdateNavigation(); } return; } if (IsDropdownOpen(out var dropdownList)) { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); if (!((Object)(object)EventSystem.current != (Object)null) || !((Object)(object)EventSystem.current.currentSelectedGameObject != (Object)null)) { return; } Selectable component = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>(); if (!((Object)(object)component != (Object)null) || !((Object)(object)dropdownList != (Object)null) || !((Component)component).transform.IsChildOf(dropdownList.transform)) { return; } ScrollRect componentInChildren = dropdownList.GetComponentInChildren<ScrollRect>(true); Transform transform = ((Component)component).transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)val != (Object)null) { WardGamepadNavHelper.EnsureVisible(componentInChildren, val); float rightStickScrollDelta = WardGamepadNavHelper.GetRightStickScrollDelta(); if (Mathf.Abs(rightStickScrollDelta) > 0.15f) { float num = rightStickScrollDelta * 2.5f * Time.unscaledDeltaTime; componentInChildren.verticalNormalizedPosition = Mathf.Clamp01(componentInChildren.verticalNormalizedPosition + num); } } return; } if ((Object)(object)_focusReticle != (Object)null && (Object)(object)_panel != (Object)null && (Object)(object)_focusReticle.transform.parent != (Object)(object)_panel.transform) { _focusReticle.transform.SetParent(_panel.transform, false); } if ((Object)(object)EventSystem.current != (Object)null && (Object)(object)EventSystem.current.currentSelectedGameObject != (Object)null) { Selectable component2 = EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>(); GameObject activeTabRoot = _window.GetActiveTabRoot(); if ((Object)(object)component2 != (Object)null && (Object)(object)component2 != (Object)(object)_currentSelected && !(component2 is Scrollbar) && ((Component)component2).gameObject.activeInHierarchy && (Object)(object)activeTabRoot != (Object)null && ((Component)component2).transform.IsChildOf(activeTabRoot.transform)) { _currentSelected = component2; WardGamepadNavHelper.AttachFocusReticle(_focusReticle, _currentSelected); } } if ((Object)(object)_currentSelected == (Object)null || !((Component)_currentSelected).gameObject.activeInHierarchy) { RestoreFocusOrSelectFirst(); } HandleTabSwitching(); HandleSectionJumping(); HandleDirectShortcuts(); HandleDirectionalNavigation(); HandleRightStickScrolling(); if ((Object)(object)_currentSelected != (Object)null && ((Component)_currentSelected).gameObject.activeInHierarchy) { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, _currentSelected); } else { WardGamepadNavHelper.AttachFocusReticle(_focusReticle, null); } } private void HandleTabSwitching() { if (WardGamepadNavHelper.IsButtonDownLB()) { _window.NavigateTabPrevious(); } else if (WardGamepadNavHelper.IsButtonDownRB()) { _window.NavigateTabNext(); } } private void HandleDirectShortcuts() { if (WardGamepadNavHelper.IsButtonDownY()) { if (ConfigRegistry.EnableProgressionSystem != null && ConfigRegistry.EnableProgressionSystem.Value) { _window.OnFooterAttunementClicked(); } } else if (WardGamepadNavHelper.IsButtonDownX()) { _window.OnOtherWardsClicked(); } else if (WardGamepadNavHelper.IsButtonDownLS()) { _window.OnCycleFontSizeClicked(); } } private void HandleSectionJumping() { if (!WardGamepadNavHelper.GetTriggerInput(out var leftTrigger, out var rightTrigger)) { return; } GameObject activeTabRoot = _window.GetActiveTabRoot(); if ((Object)(object)activeTabRoot == (Object)null) { return; } ScrollRect componentInChildren = activeTabRoot.GetComponentInChildren<ScrollRect>(true); List<Transform> list = WardGamepadNavHelper.FindCards((Transform)(((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.content != (Object)null) ? ((object)componentInChildren.content) : ((object)activeTabRoot.transform))); if (list.Count == 0) { return; } int num = -1; if ((Object)(object)_currentSelected != (Object)null) { for (int i = 0; i < list.Count; i++) { if (((Component)_currentSelected).transform.IsChildOf(list[i])) { num = i; break; } } } int num2 = num; if (rightTrigger) { num2 = (num + 1) % list.Count; } else if (leftTrigger) { num2 = (num - 1 + list.Count) % list.Count; } for (int j = 0; j < list.Count; j++) { Transform val = list[num2]; List<Selectable> list2 = WardGamepadNavHelper.FindSelectables(((Component)val).gameObject); if (list2.Count > 0) { SetFocus(list2[0], componentInChildren); RectTransform val2 = (RectTransform)(object)((val is RectTransform) ? val : null); if ((Object)(object)val2 != (Object)null && (Object)(object)componentInChildren != (Object)null) { WardGamepadNavHelper.EnsureVisible(componentInChildren, val2); } break; } num2 = (rightTrigger ? ((num2 + 1) % list.Count) : ((num2 - 1 + list.Count) % list.Count)); } } public List<Selectable> GetContentSelectables() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) List<Selectable> list = new List<Selectable>(); GameObject activeTabRoot = _window.GetActiveTabRoot(); if ((Object)(object)activeTabRoot != (Object)null) { List<Selectable> collection = WardGamepadNavHelper.FindSelectables(activeTabRoot); list.AddRange(collection); } if ((Object)(object)_window.FooterAttunementBtn != (Object)null && ((Component)_window.FooterAttunementBtn).gameObject.activeInHierarchy && ((Selectable)_window.FooterAttunementBtn).interactable) { Navigation navigation = ((Selectable)_window.FooterAttunementBtn).navigation; ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)_window.FooterAttunementBtn).navigation = navigation; list.Add((Selectable)(object)_window.FooterAttunementBtn); WardGamepadNavHelper.ApplyGamepadColorBlock((Selectable)(object)_window.FooterAttunementBtn); } return list; } private void HandleDirectionalNavigation() { //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) if (WardGamepadNavHelper.IsButtonDownA()) { SubmitCurrent(); } else { if (!WardGamepadNavHelper.GetDirectionInput(out var up, out var down, out var left, out var right)) { return; } List<Selectable> contentSelectables = GetContentSelectables(); if (contentSelectables.Count == 0) { return; } GameObject activeTabRoot = _window.GetActiveTabRoot(); if ((Object)(object)activeTabRoot == (Object)null) { return; } Transform val = activeTabRoot.transform.Find("LeftPanel"); Transform val2 = activeTabRoot.transform.Find("RightPanel"); if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null) { List<Selectable> list = WardGamepadNavHelper.FindSelectables(((Component)val).gameObject); List<Selectable> list2 = WardGamepadNavHelper.FindSelectables(((Component)val2).gameObject); bool num = (Object)(object)_currentSelected != (Object)null && ((Component)_currentSelected).transform.IsChildOf(val); bool flag = (Object)(object)_currentSelected != (Object)null && ((Component)_currentSelected).transform.IsChildOf(val2); if (num) { if (right && list2.Count > 0) { SetFocus(list2[0]); } else if (down && list.Count > 0) { int num2 = list.IndexOf(_currentSelected); int index = ((num2 >= 0) ? ((num2 + 1) % list.Count) : 0); SetFocus(list[index]); } else if (up && list.Count > 0) { int num3 = list.IndexOf(_currentSelected); int index2 = ((num3 < 0) ? (list.Count - 1) : ((num3 - 1 + list.Count) % list.Count)); SetFocus(list[index2]); } return; } if (flag) { if (left && list.Count > 0) { int index3 = 0; for (int i = 0; i < list.Count; i++) { Image val3 = (((Object)(object)list[i] != (Object)null) ? ((Component)list[i]).GetComponent<Image>() : null); if ((Object)(object)val3 != (Object)null && ((Graphic)val3).color == WardColorPalette.ValheimOrange) { index3 = i; break; } } SetFocus(list[index3]); } else if (down && list2.Count > 0) { int num4 = list2.IndexOf(_currentSelected); int index4 = ((num4 >= 0) ? ((num4 + 1) % list2.Count) : 0); SetFocus(list2[index4]); } else if (up && list2.Count > 0) { int num5 = list2.IndexOf(_currentSelected); int index5 = ((num5 < 0) ? (list2.Count - 1) : ((num5 - 1 + list2.Count) % list2.Count)); SetFocus(list2[index5]); } return; } } int num6 = (((Object)(object)_currentSelected != (Object)null) ? contentSelectables.IndexOf(_currentSelected) : (-1)); if (left || right) { if ((Object)(object)_currentSelected != (Object)null) { Selectable currentSelected = _currentSelected; Slider val4 = (Slider)(object)((currentSelected is Slider) ? currentSelected : null); if ((Object)(object)val4 != (Object)null && ((Selectable)val4).interactable) { float num7 = (val4.wholeNumbers ? 1f : 5f); float num8 = (right ? (val4.value + num7) : (val4.value - num7)); val4.value = Mathf.Clamp(num8, val4.minValue, val4.maxValue); return; } Transform parent = ((Component)_currentSelected).transform.parent; if ((Object)(object)parent != (Object)null) { List<Selectable> list3 = WardGamepadNavHelper.FindSelectables(((Component)parent).gameObject); if (list3.Count > 1) { int num9 = list3.IndexOf(_currentSelected); if (num9 >= 0) { int index6 = (right ? ((num9 + 1) % list3.Count) : ((num9 - 1 + list3.Count) % list3.Count)); SetFocus(list3[index6]); return; } } } } int index7 = num6; if (right) { index7 = ((num6 >= 0) ? ((num6 + 1) % contentSelectables.Count) : 0); } else if (left) { index7 = ((num6 < 0) ? (contentSelectables.Count - 1) : ((num6 - 1 + contentSelectables.Count) % contentSelectables.Count)); } SetFocus(contentSelectables[index7]); } else if (down) { int index8 = ((num6 >= 0) ? ((num6 + 1) % contentSelectables.Count) : 0); SetFocus(contentSelectables[index8]); } else if (up) { int index9 = ((num6 < 0) ? (contentSelectables.Count - 1) : ((num6 - 1 + contentSelectables.Count) % contentSelectables.Count)); SetFocus(contentSelectables[index9]); } } } private void HandleRightStickScrolling() { //IL_00a3: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) float rightStickScrollDelta = WardGamepadNavHelper.GetRightStickScrollDelta(); if (!(Mathf.Abs(rightStickScrollDelta) > 0.15f)) { return; } GameObject activeTabRoot = _window.GetActiveTabRoot(); if ((Object)(object)activeTabRoot == (Object)null) { return; } ScrollRect val = null; if ((Object)(object)_currentSelected != (Object)null) { val = ((Component)_currentSelected).GetComponentInParent<ScrollRect>(); } Transform val2 = activeTabRoot.transform.Find("RightPanel"); if ((Object)(object)val2 != (Object)null) { ScrollRect componentInChildren = ((Component)val2).GetComponentInChildren<ScrollRect>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.content != (Object)null) { RectTransform val3 = (RectTransform)(((Object)(object)componentInChildren.viewport != (Object)null) ? ((object)componentInChildren.viewport) : ((object)(RectTransform)((Component)componentInChildren).transform)); Rect rect = componentInChildren.content.rect; float height = ((Rect)(ref rect)).height; rect = val3.rect; bool flag = height > ((Rect)(ref rect)).height; if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)componentInChildren) { val = componentInChildren; } else { RectTransform val4 = (RectTransform)(((Object)(object)val.viewport != (Object)null) ? ((object)val.viewport) : ((object)(RectTransform)((Component)val).transform)); int num; if ((Object)(object)val.content != (Object)null) { rect = val.content.rect; float height2 = ((Rect)(ref rect)).height; rect = val4.rect; num = ((height2 > ((Rect)(ref rect)).height) ? 1 : 0); } else { num = 0; } if (num == 0 && flag) { val = componentInChildren; } } } } if ((Object)(object)val == (Object)null) { val = activeTabRoot.GetComponentInChildren<ScrollRect>(true); } if ((Object)(object)val != (Object)null) { float num2 = rightStickScrollDelta * 2.5f * Time.unscaledDeltaTime; val.verticalNormalizedPosition = Mathf.Clamp01(val.verticalNormalizedPosition + num2); if ((Object)(object)_window != (Object)null && _window.CurrentTabIndex == 5 && _window.TabManagement != null) { _window.TabManagement.UpdateHoverTooltipPosition(); } } } public bool IsDropdownOpen(out GameObject dropdownList) { dropdownList = null; if ((Object)(object)_panel != (Object)null) { Canvas componentInParent = _panel.GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent != (Object)null) { Transform val = ((Component)componentInParent).transform.Find("Dropdown List"); if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy) { dropdownList = ((Component)val).gameObject; return true; } } Transform val2 = _panel.transform.Find("Dropdown List"); if ((Object)(object)val2 != (Object)null && ((Component)val2).gameObject.activeInHierarchy) { dropdownList = ((Component)val2).gameObject; return true; } } if ((Object)(object)EventSystem.current != (Object)null && (Object)(object)EventSystem.current.currentSelectedGameObject != (Object)null) { Transform val3 = EventSystem.current.currentSelectedGameObject.transform; while ((Object)(object)val3 != (Object)null) { if (((Object)val3).name == "Dropdown List") { dropdownList = ((Component)val3).gameObject; return true; } val3 = val3.parent; } } return false; } public bool IsDropdownOpen() { GameObject dropdownList; return IsDropdownOpen(out dropdownList); } private void SubmitCurrent() { //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown if ((Object)(object)_currentSelected == (Object)null || !_currentSelected.interactable || !((Component)_currentSelected).gameObject.activeInHierarchy || Time.frameCount == _lastSubmitFrame || Time.unscaledTime - _lastSubmitTime < 0.25f) { return; } _lastSubmitFrame = Time.frameCount; _lastSubmitTime = Time.unscaledTime; Selectable currentSelected = _currentSelected; InputField val = (InputField)(object)((currentSelected is InputField) ? currentSelected : null); if ((Object)(object)val != (Object)null) { if ((Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)val).gameObject); } val.ActivateInputField(); return; } Selectable currentSelected2 = _currentSelected; TMP_InputField val2 = (TMP_InputField)(object)((currentSelected2 is TMP_InputField) ? currentSelected2 : null); if ((Object)(object)val2 != (Object)null) { if ((Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)val2).gameObject); } val2.ActivateInputField(); } else { if ((Object)(object)EventSystem.current != (Object)null && (Object)(object)EventSystem.current.currentSelectedGameObject == (Object)(object)((Component)_currentSelected).gameObject) { return; } if ((Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject(((Component)_currentSelected).gameObject); BaseEventData val3 = new BaseEventData(EventSystem.current); ExecuteEvents.Execute<ISubmitHandler>(((Component)_currentSelected).gameObject, val3, ExecuteEvents.submitHandler); return; } Selectable currentSelected3 = _currentSelected; Button val4 = (Button)(object)((currentSelected3 is Button) ? currentSelected3 : null); if ((Object)(object)val4 != (Object)null) { ButtonClickedEvent onClick = val4.onClick; if (onClick != null) { ((UnityEvent)onClick).Invoke(); } return; } Selectable currentSelected4 = _currentSelected; Toggle val5 = (Toggle)(object)((currentSelected4 is Toggle) ? currentSelected4 : null); if ((