using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Project too-many-emotes")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Project too-many-emotes")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a36e8062-eaaf-433e-bd67-e49ec781b591")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.1.0.0")] namespace ATLYSSEmoteDeck; [BepInPlugin("com.eleen.atlyss.emotedeck", "Emote Deck", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("ATLYSS.exe")] [DefaultExecutionOrder(-9000)] public class EmoteDeckPlugin : BaseUnityPlugin { public const string PluginGuid = "com.eleen.atlyss.emotedeck"; public const string PluginName = "Emote Deck"; public const string PluginVersion = "1.1.0"; public const int MaxPages = 10; public const int MaxSlots = 100; internal static EmoteDeckPlugin Instance; internal static ManualLogSource Log; internal static ConfigEntry CfgMainWindowKey; internal static ConfigEntry CfgGridWindowKey; internal static ConfigEntry CfgMainX; internal static ConfigEntry CfgMainY; internal static ConfigEntry CfgMainW; internal static ConfigEntry CfgMainH; internal static ConfigEntry CfgMainOpacity; internal static ConfigEntry CfgGridX; internal static ConfigEntry CfgGridY; internal static ConfigEntry CfgGridW; internal static ConfigEntry CfgGridH; internal static ConfigEntry CfgGridOpacity; internal static ConfigEntry CfgGridColumns; internal static ConfigEntry CfgGridIconAspect; internal static ConfigEntry CfgGridAutoColumns; internal static ConfigEntry CfgGridAutoIconAspect; internal static ConfigEntry CfgCloseGridAfterEmote; internal static ConfigEntry CfgGridViewMode; internal static ConfigEntry CfgGridMouseMode; internal static ConfigEntry CfgGridShowHeaderControls; internal static ConfigEntry CfgActiveSlotCount; internal static ConfigEntry CfgBlockGameInputWhileMainWindowOpen; internal static ConfigEntry CfgBlockGameInputWhileGridWindowOpen; internal static ConfigEntry CfgDebugLogging; internal static ConfigEntry CfgIncludeNativeVanillaWhenWheelBaseExists; internal static ConfigEntry CfgHiddenPackages; internal static ConfigEntry CfgEnablePages; internal static ConfigEntry CfgPageCount; internal static ConfigEntry CfgCurrentPage; internal static ConfigEntry[] CfgPageSlotKeys = new ConfigEntry[10]; internal static ConfigEntry CfgEnableRecent; internal static ConfigEntry CfgRecentLimit; internal static ConfigEntry CfgRecentKeys; internal static ConfigEntry CfgEnableFavorites; internal static ConfigEntry CfgFavoriteKeys; internal static ConfigEntry CfgAutoRescanEnabled; internal static ConfigEntry CfgPickerAutoAdvanceSlot; internal static ConfigEntry CfgPickerHideAssigned; internal static ConfigEntry CfgMigratedAutoAdvanceDefaultOff; internal static readonly ConfigEntry[] CfgSlotEmoteKeys = new ConfigEntry[100]; private KeyCode _mainWindowKey = (KeyCode)121; private KeyCode _gridWindowKey = (KeyCode)116; private EmoteDeckWindow _window; private Harmony _harmony; private float _nextAutoRefreshTime; private bool _forceNextAutoRefresh; private bool _configSaveQueued; private float _configSaveAt; private readonly HashSet _suppressedHotkeyActivations = new HashSet(); private int _suppressHotkeysUntilFrame; internal readonly List AllEmotes = new List(); internal readonly Dictionary EmotesByKey = new Dictionary(StringComparer.OrdinalIgnoreCase); internal readonly List PackageIds = new List(); internal readonly HashSet HiddenPackages = new HashSet(StringComparer.OrdinalIgnoreCase); internal readonly string[][] PageSlotKeys = new string[10][]; internal readonly List RecentKeys = new List(); internal readonly List FavoriteKeys = new List(); private int _lastRegistryFingerprint; private static FieldInfo _chatEmoteBufferField; internal bool EmoteWheelBridgeAvailable { get; private set; } internal int LastWheelEmoteCount { get; private set; } internal int LastNativeEmoteCount { get; private set; } internal float LastRegistryRefreshTime { get; private set; } internal int RegistryRevision { get; private set; } internal int FilterRevision { get; private set; } internal int RecentRevision { get; private set; } internal int FavoriteRevision { get; private set; } internal KeyCode MainWindowKey => _mainWindowKey; internal KeyCode GridWindowKey => _gridWindowKey; private void Awake() { Instance = this; Log = ((BaseUnityPlugin)this).Logger; BindConfig(); ReloadHotkeysFromConfig(); LoadHiddenPackagesFromConfig(); LoadPageSlotsFromConfig(); LoadRecentAndFavoritesFromConfig(); RefreshEmoteRegistry(); ScheduleAutoRescan(1f, force: false); TryPatchHarmonyHooks(); _window = new EmoteDeckWindow(this); TrySetupEasySettingsBridge(); Log.LogInfo((object)("[EmoteDeck] Loaded 1.1.0 mainKey=" + ((object)(KeyCode)(ref _mainWindowKey)).ToString() + " gridKey=" + ((object)(KeyCode)(ref _gridWindowKey)).ToString() + " emotes=" + AllEmotes.Count)); } private void BindConfig() { CfgMainWindowKey = ((BaseUnityPlugin)this).Config.Bind("Input", "MainWindowKey", "Y", "Open/close the Emote Deck main window. This key cannot be cleared from the UI."); CfgGridWindowKey = ((BaseUnityPlugin)this).Config.Bind("Input", "GridWindowKey", "T", "Open/close the Emote Grid window. Set to None to disable the global grid hotkey."); CfgMainX = ((BaseUnityPlugin)this).Config.Bind("MainWindow", "X", 240f, "Main window X position."); CfgMainY = ((BaseUnityPlugin)this).Config.Bind("MainWindow", "Y", 120f, "Main window Y position."); CfgMainW = ((BaseUnityPlugin)this).Config.Bind("MainWindow", "Width", 620f, "Main window width."); CfgMainH = ((BaseUnityPlugin)this).Config.Bind("MainWindow", "Height", 640f, "Main window height."); CfgMainOpacity = ((BaseUnityPlugin)this).Config.Bind("MainWindow", "ContentOpacity", 0.92f, "Opacity for main window content/background below the header. 0 = transparent, 1 = opaque."); CfgGridX = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "X", 260f, "Grid window X position."); CfgGridY = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "Y", 160f, "Grid window Y position."); CfgGridW = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "Width", 720f, "Grid window width."); CfgGridH = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "Height", 480f, "Grid window height."); CfgGridOpacity = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "Opacity", 0.88f, "Grid window content/background opacity. 0 = transparent, 1 = opaque."); CfgGridColumns = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "Columns", 8, "Column count when AutoColumns is off."); CfgGridIconAspect = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "IconAspectRatio", 1f, "Icon width/height ratio when AutoIconAspectRatio is off. 1.0 = square, 1.3 = wider, 0.8 = taller."); CfgGridAutoColumns = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "AutoColumns", true, "Choose columns from the current grid width. This prevents clipped columns and horizontal scrolling."); CfgGridAutoIconAspect = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "AutoIconAspectRatio", true, "Use icon cells that scale with the grid width."); CfgCloseGridAfterEmote = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "CloseAfterEmote", true, "Close the grid window after clicking an emote."); CfgGridViewMode = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "View", "Standard", "Grid view: Standard, Compact, Mini, or Names."); CfgGridViewMode.Value = NormalizeGridViewModeValue(CfgGridViewMode.Value); CfgGridMouseMode = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "MouseMode", "Auto", "Grid mouse mode: Auto, Always, or Off. Auto unlocks only when Close grid after emote is on."); CfgGridMouseMode.Value = NormalizeGridMouseModeValue(CfgGridMouseMode.Value); CfgGridShowHeaderControls = ((BaseUnityPlugin)this).Config.Bind("GridWindow", "ShowHeaderControls", true, "Show the second header row in the grid window."); CfgActiveSlotCount = ((BaseUnityPlugin)this).Config.Bind("Behavior", "ActiveSlotCount", 24, "Number of slots shown on each deck page. Range 1-100."); CfgBlockGameInputWhileMainWindowOpen = ((BaseUnityPlugin)this).Config.Bind("Behavior", "BlockGameInputWhileMainWindowOpen", false, "Block player movement, combat, hotbar, and interact input while the main window is open."); CfgBlockGameInputWhileGridWindowOpen = ((BaseUnityPlugin)this).Config.Bind("Behavior", "BlockGameInputWhileGridWindowOpen", false, "Block player movement, combat, hotbar, and interact input while the grid window is open."); CfgIncludeNativeVanillaWhenWheelBaseExists = ((BaseUnityPlugin)this).Config.Bind("Behavior", "IncludeNativeVanillaWhenWheelBaseExists", false, "Show native /emote commands even when Emote Wheel Base is available. Usually false avoids duplicates."); CfgHiddenPackages = ((BaseUnityPlugin)this).Config.Bind("Filters", "HiddenPackages", "", "Semicolon-separated package IDs hidden in Picker and Grid."); CfgEnablePages = ((BaseUnityPlugin)this).Config.Bind("Pages", "EnablePages", false, "Enable separate Emote Deck pages. Page 1 uses the normal Slots config."); CfgPageCount = ((BaseUnityPlugin)this).Config.Bind("Pages", "PageCount", 4, "Number of deck pages when pages are enabled. Range 1-10."); CfgCurrentPage = ((BaseUnityPlugin)this).Config.Bind("Pages", "CurrentPage", 1, "Current deck page. Range 1-10."); for (int i = 1; i < 10; i++) { CfgPageSlotKeys[i] = ((BaseUnityPlugin)this).Config.Bind("Pages", "Page" + (i + 1).ToString("D2", CultureInfo.InvariantCulture) + "Slots", "", "Packed slot keys for page " + (i + 1) + "."); } CfgEnableRecent = ((BaseUnityPlugin)this).Config.Bind("Recent", "EnableRecent", false, "Show a Recent grid mode."); CfgRecentLimit = ((BaseUnityPlugin)this).Config.Bind("Recent", "RecentLimit", 24, "Maximum recent emotes to keep. Range 1-100."); CfgRecentKeys = ((BaseUnityPlugin)this).Config.Bind("Recent", "RecentKeys", "", "Packed recent emote keys."); CfgEnableFavorites = ((BaseUnityPlugin)this).Config.Bind("Favorites", "EnableFavorites", false, "Show a Favorites grid mode and star buttons."); CfgFavoriteKeys = ((BaseUnityPlugin)this).Config.Bind("Favorites", "FavoriteKeys", "", "Packed favorite emote keys."); CfgAutoRescanEnabled = ((BaseUnityPlugin)this).Config.Bind("Behavior", "AutoRescan", true, "Rescan after windows open so new emotes can show up."); CfgPickerAutoAdvanceSlot = ((BaseUnityPlugin)this).Config.Bind("Behavior", "PickerAutoAdvanceSlot", false, "After setting an emote in Picker, move to the next slot automatically."); CfgPickerHideAssigned = ((BaseUnityPlugin)this).Config.Bind("Behavior", "PickerHideAssigned", false, "Hide emotes already assigned on the current page from Picker results."); CfgMigratedAutoAdvanceDefaultOff = ((BaseUnityPlugin)this).Config.Bind("Migrations", "AutoAdvanceDefaultOff_0110", false, "Internal migration flag. Do not edit."); if (!CfgMigratedAutoAdvanceDefaultOff.Value) { CfgPickerAutoAdvanceSlot.Value = false; CfgMigratedAutoAdvanceDefaultOff.Value = true; } CfgDebugLogging = ((BaseUnityPlugin)this).Config.Bind("Debug", "DebugLogging", false, "Enable debug logs."); for (int j = 0; j < 100; j++) { string text = string.Empty; switch (j) { case 0: text = "Base:Point"; break; case 1: text = "Base:Clap"; break; case 2: text = "Base:Think"; break; case 3: text = "Base:Shrug"; break; case 4: text = "Base:Dance"; break; case 5: text = "Base:Taunt"; break; } CfgSlotEmoteKeys[j] = ((BaseUnityPlugin)this).Config.Bind("Slots", "Slot" + (j + 1).ToString("D3", CultureInfo.InvariantCulture), text, "Emote key for slot " + (j + 1) + ". Empty = unassigned."); } } internal static string NormalizeGridViewModeValue(string value) { if (string.IsNullOrEmpty(value)) { return "Standard"; } if (string.Equals(value, "Standard", StringComparison.OrdinalIgnoreCase)) { return "Standard"; } if (string.Equals(value, "Compact", StringComparison.OrdinalIgnoreCase)) { return "Compact"; } if (string.Equals(value, "Mini", StringComparison.OrdinalIgnoreCase)) { return "Mini"; } if (string.Equals(value, "Names", StringComparison.OrdinalIgnoreCase)) { return "Names"; } if (string.Equals(value, "Names only", StringComparison.OrdinalIgnoreCase)) { return "Names"; } return "Standard"; } internal static string GridViewModeLabel(string value) { value = NormalizeGridViewModeValue(value); if (value == "Names") { return "Names only"; } return value; } internal static string NormalizeGridMouseModeValue(string value) { if (string.IsNullOrEmpty(value)) { return "Auto"; } if (string.Equals(value, "Auto", StringComparison.OrdinalIgnoreCase)) { return "Auto"; } if (string.Equals(value, "Always", StringComparison.OrdinalIgnoreCase)) { return "Always"; } if (string.Equals(value, "Off", StringComparison.OrdinalIgnoreCase)) { return "Off"; } if (string.Equals(value, "Never", StringComparison.OrdinalIgnoreCase)) { return "Off"; } return "Auto"; } internal static string GridMouseModeLabel(string value) { return NormalizeGridMouseModeValue(value); } internal static bool IsBlockedMouseBindKey(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 return (int)key == 323 || (int)key == 324; } internal static string KeyLabel(string value) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(value)) { return "None"; } if (!Enum.TryParse(value, ignoreCase: true, out KeyCode result)) { return value; } return KeyLabel(result); } internal static string KeyLabel(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Invalid comparison between Unknown and I4 //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Invalid comparison between Unknown and I4 if ((int)key == 0) { return "None"; } if ((int)key == 323) { return "Left Mouse"; } if ((int)key == 324) { return "Right Mouse"; } if ((int)key == 325) { return "Middle Mouse"; } if ((int)key == 326) { return "Mouse 4"; } if ((int)key == 327) { return "Mouse 5"; } if ((int)key == 328) { return "Mouse 6"; } if ((int)key == 329) { return "Mouse 7"; } return ((object)(KeyCode)(ref key)).ToString(); } internal void SavePluginConfig() { try { _configSaveQueued = false; ((BaseUnityPlugin)this).Config.Save(); } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Config save failed: " + ex.Message)); } } internal void QueueConfigSave(float delaySeconds) { if (delaySeconds < 0.05f) { delaySeconds = 0.05f; } _configSaveQueued = true; _configSaveAt = Time.unscaledTime + delaySeconds; } internal void QueueConfigSave() { QueueConfigSave(0.6f); } internal void ScheduleAutoRescan(float delaySeconds, bool force) { if (CfgAutoRescanEnabled != null && CfgAutoRescanEnabled.Value) { if (delaySeconds < 0.05f) { delaySeconds = 0.05f; } float num = Time.unscaledTime + delaySeconds; if (_nextAutoRefreshTime <= 0f || num < _nextAutoRefreshTime) { _nextAutoRefreshTime = num; } if (force) { _forceNextAutoRefresh = true; } } } private void FlushQueuedConfigSaveIfDue() { if (_configSaveQueued && Time.unscaledTime >= _configSaveAt) { SavePluginConfig(); } } private void OnDestroy() { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) EmoteDeckInputBlocker.SetWindowState(mainOpen: false, default(Rect), gridOpen: false, default(Rect), blockGameplayInput: false); try { if (_harmony != null) { _harmony.UnpatchSelf(); _harmony = null; } } catch { } if (_window != null) { _window.SaveOpenWindowRects(); } if (_configSaveQueued) { SavePluginConfig(); } } private void TryPatchHarmonyHooks() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown try { if (_harmony == null) { _harmony = new Harmony("com.eleen.atlyss.emotedeck"); } } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Harmony init failed. Guards were skipped: " + ex.Message)); return; } TryPatchScrollRectOnScroll(); TryPatchGameplayInputGuards(); } private void TryPatchScrollRectOnScroll() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown try { Type type = FindType("UnityEngine.UI.ScrollRect"); Type type2 = FindType("UnityEngine.EventSystems.PointerEventData"); if (type == null || type2 == null) { Log.LogWarning((object)"[EmoteDeck] ScrollRect.OnScroll guard skipped: Unity UI/EventSystems types were not found."); return; } MethodInfo methodInfo = AccessTools.Method(type, "OnScroll", new Type[1] { type2 }, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(EmoteDeckScrollRectOnScrollPatch), "Prefix", (Type[])null, (Type[])null); if (methodInfo == null || methodInfo2 == null) { Log.LogWarning((object)"[EmoteDeck] ScrollRect.OnScroll guard skipped: method lookup failed."); return; } _harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Log.LogInfo((object)"[EmoteDeck] ScrollRect.OnScroll guard patched."); } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] ScrollRect.OnScroll guard failed and was skipped: " + ex.Message)); } } private void TryPatchGameplayInputGuards() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown try { int patched = 0; MethodInfo prefix = AccessTools.Method(typeof(EmoteDeckGameplayInputPatch), "Prefix", (Type[])null, (Type[])null); MethodInfo methodInfo = AccessTools.Method(typeof(EmoteDeckPlayerLocalParamsPatch), "Postfix", (Type[])null, (Type[])null); TryPatchPrefix(typeof(PlayerMove), "Handle_MovementControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerMove), "Handle_DashControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerMove), "Handle_JumpControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerCasting), "Client_SkillControl", prefix, ref patched); TryPatchPrefix(typeof(ActionBarManager), "OnActionkeyPress", prefix, ref patched); TryPatchPrefix(typeof(PlayerCombat), "Client_Handle_WeaponSheatheControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerCombat), "Client_Handle_QuickSwapWeaponControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerCombat), "Client_Handle_CombatControl", prefix, ref patched); TryPatchPrefix(typeof(PlayerInteract), "Handle_InteractControl", prefix, ref patched); MethodInfo methodInfo2 = FindPlayerLocalParamsMethod(); if (methodInfo2 != null && methodInfo != null) { _harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); patched++; } else { Log.LogWarning((object)"[EmoteDeck] Player._inUI postfix guard skipped: method lookup failed."); } Log.LogInfo((object)("[EmoteDeck] Gameplay input guards patched: " + patched + ".")); } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Gameplay input guard patch failed and was skipped: " + ex.Message)); } } private void TryPatchPrefix(Type type, string methodName, MethodInfo prefix, ref int patched) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown try { if (!(type == null) && !(prefix == null)) { MethodInfo methodInfo = AccessTools.Method(type, methodName, (Type[])null, (Type[])null); if (methodInfo == null) { Log.LogWarning((object)("[EmoteDeck] Input guard skipped: " + type.Name + "." + methodName + " not found.")); } else { _harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(prefix), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); patched++; } } } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Input guard failed: " + type.Name + "." + methodName + ": " + ex.Message)); } } private static MethodInfo FindPlayerLocalParamsMethod() { try { MethodInfo[] methods = typeof(Player).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo == null)) { string text = methodInfo.Name ?? string.Empty; if (text.IndexOf("Handle_LocalParams", StringComparison.Ordinal) >= 0) { return methodInfo; } } } } catch { } return null; } internal void ReloadHotkeysFromConfig() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //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) _mainWindowKey = ParseRequiredKeyCode(CfgMainWindowKey.Value, (KeyCode)121, "MainWindowKey"); _gridWindowKey = ParseOptionalKeyCode(CfgGridWindowKey.Value, "GridWindowKey"); } private void TrySetupEasySettingsBridge() { EmoteDeckEasySettingsBridge.TryInstall(this); ((MonoBehaviour)this).StartCoroutine(EmoteDeckEasySettingsBridge.DelayedInstall(this)); } internal void SetMainWindowKeyFromEasySettings(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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) if ((int)key == 0 || IsBlockedMouseBindKey(key)) { EmoteDeckEasySettingsBridge.ResetMainKeyButton(this); return; } CfgMainWindowKey.Value = ((object)(KeyCode)(ref key)).ToString(); ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(this); SuppressHotkeyActivationUntilReleased(key); QueueConfigSave(0.15f); } internal void SetGridWindowKeyFromEasySettings(KeyCode key) { //IL_0001: 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_0046: Unknown result type (might be due to invalid IL or missing references) if (IsBlockedMouseBindKey(key)) { EmoteDeckEasySettingsBridge.ResetGridKeyButton(this); return; } CfgGridWindowKey.Value = (((int)key == 0) ? "None" : ((object)(KeyCode)(ref key)).ToString()); ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(this); SuppressHotkeyActivationUntilReleased(key); QueueConfigSave(0.15f); } internal static KeyCode ParseRequiredKeyCode(string value, KeyCode fallback, string name) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_002e: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrWhiteSpace(value) && Enum.TryParse(value, ignoreCase: true, out KeyCode result) && (int)result != 0 && !IsBlockedMouseBindKey(result)) { return result; } if (Log != null) { Log.LogWarning((object)("[EmoteDeck] Invalid or disabled required key " + name + "='" + value + "'. Falling back to " + ((object)(KeyCode)(ref fallback)).ToString() + ".")); } return fallback; } internal static KeyCode ParseOptionalKeyCode(string value, string name) { //IL_001d: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrWhiteSpace(value) || string.Equals(value, "None", StringComparison.OrdinalIgnoreCase)) { return (KeyCode)0; } if (Enum.TryParse(value, ignoreCase: true, out KeyCode result) && !IsBlockedMouseBindKey(result)) { return result; } if (Log != null) { Log.LogWarning((object)("[EmoteDeck] Invalid optional key " + name + "='" + value + "'. Disabling it.")); } return (KeyCode)0; } internal void SuppressHotkeyActivationUntilReleased(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if ((int)key != 0 && !IsBlockedMouseBindKey(key)) { _suppressedHotkeyActivations.Add(key); int num = Time.frameCount + 2; if (num > _suppressHotkeysUntilFrame) { _suppressHotkeysUntilFrame = num; } } } private void UpdateSuppressedHotkeyActivations() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (_suppressedHotkeyActivations.Count == 0 || Time.frameCount <= _suppressHotkeysUntilFrame) { return; } List list = null; foreach (KeyCode suppressedHotkeyActivation in _suppressedHotkeyActivations) { if (!IsKeyCurrentlyHeld(suppressedHotkeyActivation)) { if (list == null) { list = new List(); } list.Add(suppressedHotkeyActivation); } } if (list != null) { for (int i = 0; i < list.Count; i++) { _suppressedHotkeyActivations.Remove(list[i]); } } } private bool IsHotkeyActivationSuppressed(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) if ((int)key == 0) { return false; } return _suppressedHotkeyActivations.Contains(key); } private static bool IsKeyCurrentlyHeld(KeyCode key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) if ((int)key == 0) { return false; } try { return Input.GetKey(key); } catch { return false; } } private void Update() { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if (_window == null) { return; } UpdateSuppressedHotkeyActivations(); EmoteDeckEasySettingsBridge.PollSync(this); if (_window.IsCapturingKeyBind) { return; } if (CfgAutoRescanEnabled.Value && Time.unscaledTime >= _nextAutoRefreshTime) { bool flag = _forceNextAutoRefresh || AllEmotes.Count == 0; _forceNextAutoRefresh = false; if (flag) { RefreshEmoteRegistry(); } else { RefreshEmoteRegistryIfChanged(); } _nextAutoRefreshTime = Time.unscaledTime + ((AllEmotes.Count == 0) ? 3f : 10f); } if (!IsChatTyping()) { if ((int)_mainWindowKey != 0 && Input.GetKeyDown(_mainWindowKey) && !IsHotkeyActivationSuppressed(_mainWindowKey)) { _window.ToggleMainWindow(); return; } if ((int)_gridWindowKey != 0 && _gridWindowKey != _mainWindowKey && Input.GetKeyDown(_gridWindowKey) && !IsHotkeyActivationSuppressed(_gridWindowKey)) { _window.ToggleGridWindow(); return; } } FlushQueuedConfigSaveIfDue(); } private void LateUpdate() { if (_window != null) { _window.MaintainInputState(); } } private void OnGUI() { if (_window != null) { _window.OnGUI(); } } internal int GetActiveSlotCount() { int num = CfgActiveSlotCount.Value; if (num < 1) { num = 1; } if (num > 100) { num = 100; } return num; } internal int GetPageCount() { int num = CfgPageCount.Value; if (num < 1) { num = 1; } if (num > 10) { num = 10; } return num; } internal int GetCurrentPageIndex() { if (!CfgEnablePages.Value) { return 0; } int pageCount = GetPageCount(); int num = CfgCurrentPage.Value - 1; if (num < 0) { num = 0; } if (num >= pageCount) { num = pageCount - 1; } return num; } internal int GetEffectiveDeckPageCount() { return (!CfgEnablePages.Value) ? 1 : GetPageCount(); } internal int GetTotalDeckSlotCapacity() { return GetActiveSlotCount() * GetEffectiveDeckPageCount(); } internal string GetSlotKeyForPage(int pageIndex, int index) { if (index < 0 || index >= 100) { return string.Empty; } if (!CfgEnablePages.Value || pageIndex <= 0) { return CfgSlotEmoteKeys[index].Value ?? string.Empty; } if (pageIndex >= 10) { return string.Empty; } EnsurePageSlotArray(pageIndex); return PageSlotKeys[pageIndex][index] ?? string.Empty; } internal int CountAssignedSlotsInPage(int pageIndex) { int num = 0; int activeSlotCount = GetActiveSlotCount(); for (int i = 0; i < activeSlotCount; i++) { if (!string.IsNullOrEmpty(GetSlotKeyForPage(pageIndex, i))) { num++; } } return num; } internal int CountAssignedSlotsAcrossEnabledPages() { int num = 0; int effectiveDeckPageCount = GetEffectiveDeckPageCount(); for (int i = 0; i < effectiveDeckPageCount; i++) { num += CountAssignedSlotsInPage(i); } return num; } internal void SetCurrentPageIndex(int pageIndex) { int pageCount = GetPageCount(); if (pageIndex < 0) { pageIndex = 0; } if (pageIndex >= pageCount) { pageIndex = pageCount - 1; } CfgCurrentPage.Value = pageIndex + 1; QueueConfigSave(); } internal string GetSlotKey(int index) { return GetSlotKeyForPage(GetCurrentPageIndex(), index); } internal void SetSlotKey(int index, string key) { if (index >= 0 && index < 100) { int currentPageIndex = GetCurrentPageIndex(); if (!CfgEnablePages.Value || currentPageIndex <= 0) { CfgSlotEmoteKeys[index].Value = key ?? string.Empty; } else { EnsurePageSlotArray(currentPageIndex); PageSlotKeys[currentPageIndex][index] = key ?? string.Empty; SavePageSlotConfig(currentPageIndex); } SavePluginConfig(); } } internal bool TryGetSlotEmote(int index, out EmoteEntry entry) { entry = null; string slotKey = GetSlotKey(index); if (string.IsNullOrEmpty(slotKey)) { return false; } return EmotesByKey.TryGetValue(slotKey, out entry); } internal bool IsAssignedOnCurrentDeck(string key) { if (string.IsNullOrEmpty(key)) { return false; } int activeSlotCount = GetActiveSlotCount(); for (int i = 0; i < activeSlotCount; i++) { if (string.Equals(GetSlotKey(i), key, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private void LoadPageSlotsFromConfig() { for (int i = 1; i < 10; i++) { EnsurePageSlotArray(i); string text = ((CfgPageSlotKeys[i] != null) ? CfgPageSlotKeys[i].Value : string.Empty); string[] array = (text ?? string.Empty).Split(new char[1] { ';' }, StringSplitOptions.None); for (int j = 0; j < 100; j++) { PageSlotKeys[i][j] = ((j < array.Length) ? array[j] : string.Empty); } } } private void EnsurePageSlotArray(int page) { if (page >= 0 && page < 10 && (PageSlotKeys[page] == null || PageSlotKeys[page].Length != 100)) { PageSlotKeys[page] = new string[100]; } } private void SavePageSlotConfig(int page) { if (page > 0 && page < 10 && CfgPageSlotKeys[page] != null) { EnsurePageSlotArray(page); CfgPageSlotKeys[page].Value = string.Join(";", PageSlotKeys[page]); } } internal void MoveToNextPage() { if (CfgEnablePages.Value) { int pageCount = GetPageCount(); int currentPageIndex = GetCurrentPageIndex(); if (currentPageIndex + 1 < pageCount) { SetCurrentPageIndex(currentPageIndex + 1); } } } internal void MoveToPreviousPage() { if (CfgEnablePages.Value) { int currentPageIndex = GetCurrentPageIndex(); if (currentPageIndex > 0) { SetCurrentPageIndex(currentPageIndex - 1); } } } private static List ParseKeyList(string raw) { List list = new List(); string[] array = (raw ?? string.Empty).Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length > 0 && !ContainsString(list, text)) { list.Add(text); } } return list; } private static bool ContainsString(List list, string key) { for (int i = 0; i < list.Count; i++) { if (string.Equals(list[i], key, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private static void RemoveString(List list, string key) { for (int num = list.Count - 1; num >= 0; num--) { if (string.Equals(list[num], key, StringComparison.OrdinalIgnoreCase)) { list.RemoveAt(num); } } } private void LoadRecentAndFavoritesFromConfig() { RecentKeys.Clear(); FavoriteKeys.Clear(); RecentKeys.AddRange(ParseKeyList(CfgRecentKeys.Value)); FavoriteKeys.AddRange(ParseKeyList(CfgFavoriteKeys.Value)); } private void SaveRecentKeys() { CfgRecentKeys.Value = string.Join(";", RecentKeys.ToArray()); RecentRevision++; QueueConfigSave(); } private void SaveFavoriteKeys() { CfgFavoriteKeys.Value = string.Join(";", FavoriteKeys.ToArray()); FavoriteRevision++; QueueConfigSave(); } internal void NoteRecent(EmoteEntry entry) { if (entry != null && CfgEnableRecent.Value && !string.IsNullOrEmpty(entry.Key)) { RemoveString(RecentKeys, entry.Key); RecentKeys.Insert(0, entry.Key); int num = Mathf.Clamp(CfgRecentLimit.Value, 1, 100); while (RecentKeys.Count > num) { RecentKeys.RemoveAt(RecentKeys.Count - 1); } SaveRecentKeys(); } } internal bool IsFavorite(string key) { if (string.IsNullOrEmpty(key)) { return false; } return ContainsString(FavoriteKeys, key); } internal void ToggleFavorite(EmoteEntry entry) { if (entry != null && !string.IsNullOrEmpty(entry.Key)) { if (IsFavorite(entry.Key)) { RemoveString(FavoriteKeys, entry.Key); } else { FavoriteKeys.Add(entry.Key); } SaveFavoriteKeys(); } } internal void BuildEntryListFromKeys(List keys, List dest) { dest.Clear(); for (int i = 0; i < keys.Count; i++) { if (EmotesByKey.TryGetValue(keys[i], out var value) && value != null) { dest.Add(value); } } } internal List GetVisibleEmotes() { List list = new List(); for (int i = 0; i < AllEmotes.Count; i++) { EmoteEntry emoteEntry = AllEmotes[i]; if (emoteEntry != null && IsPackageVisible(emoteEntry.PackageId)) { list.Add(emoteEntry); } } return list; } internal bool IsPackageVisible(string packageId) { string item = (string.IsNullOrEmpty(packageId) ? "Unknown" : packageId); return !HiddenPackages.Contains(item); } internal void SetPackageVisible(string packageId, bool visible) { string item = (string.IsNullOrEmpty(packageId) ? "Unknown" : packageId); if (visible) { HiddenPackages.Remove(item); } else { HiddenPackages.Add(item); } SaveHiddenPackagesToConfig(); } internal void ShowAllPackages() { HiddenPackages.Clear(); SaveHiddenPackagesToConfig(); } internal void HideAllPackages() { HiddenPackages.Clear(); for (int i = 0; i < PackageIds.Count; i++) { HiddenPackages.Add(PackageIds[i]); } SaveHiddenPackagesToConfig(); } private void LoadHiddenPackagesFromConfig() { HiddenPackages.Clear(); string text = CfgHiddenPackages.Value ?? string.Empty; string[] array = text.Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string text2 = array[i].Trim(); if (text2.Length > 0) { HiddenPackages.Add(text2); } } } private void SaveHiddenPackagesToConfig() { List list = new List(HiddenPackages); list.Sort(StringComparer.OrdinalIgnoreCase); CfgHiddenPackages.Value = string.Join(";", list.ToArray()); FilterRevision++; SavePluginConfig(); } private bool IsChatTyping() { try { Player mainPlayer = Player._mainPlayer; if ((Object)(object)mainPlayer != (Object)null) { if (mainPlayer._inChat) { return true; } if ((Object)(object)mainPlayer._chatBehaviour != (Object)null && mainPlayer._chatBehaviour._focusedInChat) { return true; } } } catch { } try { ChatBehaviour current = ChatBehaviour._current; if ((Object)(object)current != (Object)null && current._focusedInChat) { return true; } } catch { } return IsUnityTextInputFocused(); } private static bool IsUnityTextInputFocused() { try { Type type = FindType("UnityEngine.EventSystems.EventSystem"); if (type == null) { return false; } PropertyInfo property = type.GetProperty("current", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj == null) { return false; } PropertyInfo property2 = type.GetProperty("currentSelectedGameObject", BindingFlags.Instance | BindingFlags.Public); GameObject val = (GameObject)((property2 != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val == (Object)null) { return false; } Type type2 = FindType("UnityEngine.UI.InputField"); if (type2 != null && (Object)(object)val.GetComponent(type2) != (Object)null) { return true; } Type type3 = FindType("TMPro.TMP_InputField"); if (type3 != null && (Object)(object)val.GetComponent(type3) != (Object)null) { return true; } } catch { } return false; } private void RefreshEmoteRegistryIfChanged() { int lastRegistryFingerprint = _lastRegistryFingerprint; int num = ComputeRegistryFingerprintCheap(); if (num != lastRegistryFingerprint) { RefreshEmoteRegistry(); } } private int ComputeRegistryFingerprintCheap() { int num = 17; try { Type type = FindType("AtlyssEmotes.EmoteManager"); if (type != null) { PropertyInfo property = type.GetProperty("allEmotes", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj is IDictionary dictionary) { num = num * 31 + dictionary.Count; } } } catch { } try { ScriptableEmoteList nativeScriptableEmoteList = GetNativeScriptableEmoteList(); if ((Object)(object)nativeScriptableEmoteList != (Object)null && nativeScriptableEmoteList._emoteCommandList != null) { num = num * 31 + nativeScriptableEmoteList._emoteCommandList.Length; } } catch { } return num; } internal void RefreshEmoteRegistry() { Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); EmoteWheelBridgeAvailable = FindType("AtlyssEmotes.EmoteManager") != null; int lastWheelEmoteCount = CollectEmoteWheelEntries(dictionary); bool flag = false; foreach (EmoteEntry value in dictionary.Values) { if (value != null && string.Equals(value.PackageId, "Base", StringComparison.OrdinalIgnoreCase)) { flag = true; break; } } int lastNativeEmoteCount = 0; if (!flag || CfgIncludeNativeVanillaWhenWheelBaseExists.Value) { lastNativeEmoteCount = CollectNativeVanillaEntries(dictionary); } AllEmotes.Clear(); foreach (EmoteEntry value2 in dictionary.Values) { if (value2 != null && !string.Equals(value2.Key, "None", StringComparison.OrdinalIgnoreCase)) { AllEmotes.Add(value2); } } AllEmotes.Sort(CompareEmotes); EmotesByKey.Clear(); PackageIds.Clear(); HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); for (int i = 0; i < AllEmotes.Count; i++) { EmoteEntry emoteEntry = AllEmotes[i]; if (!EmotesByKey.ContainsKey(emoteEntry.Key)) { EmotesByKey.Add(emoteEntry.Key, emoteEntry); } string item = (string.IsNullOrEmpty(emoteEntry.PackageId) ? "Unknown" : emoteEntry.PackageId); if (hashSet.Add(item)) { PackageIds.Add(item); } } PackageIds.Sort(StringComparer.OrdinalIgnoreCase); LastWheelEmoteCount = lastWheelEmoteCount; LastNativeEmoteCount = lastNativeEmoteCount; LastRegistryRefreshTime = Time.unscaledTime; RegistryRevision++; _lastRegistryFingerprint = ComputeRegistryFingerprintCheap(); if (CfgDebugLogging.Value) { Log.LogInfo((object)("[EmoteDeck] Registry refreshed. total=" + AllEmotes.Count + " wheel=" + lastWheelEmoteCount + " native=" + lastNativeEmoteCount + " packages=" + PackageIds.Count)); } } private static int CompareEmotes(EmoteEntry a, EmoteEntry b) { int num = string.Compare(a.PackageId, b.PackageId, StringComparison.OrdinalIgnoreCase); if (num != 0) { return num; } return string.Compare(a.DisplayName, b.DisplayName, StringComparison.OrdinalIgnoreCase); } private int CollectEmoteWheelEntries(Dictionary merged) { int num = 0; try { Type type = FindType("AtlyssEmotes.EmoteManager"); if (type == null) { return 0; } PropertyInfo property = type.GetProperty("allEmotes", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (!(obj is IDictionary dictionary)) { return 0; } foreach (DictionaryEntry item in dictionary) { string text = item.Key as string; object value = item.Value; if (!string.IsNullOrEmpty(text) && value != null && !string.Equals(text, "None", StringComparison.OrdinalIgnoreCase)) { Type type2 = value.GetType(); string text2 = ReadFieldString(type2, value, "emoteName"); string text3 = ReadFieldString(type2, value, "emoteID"); string text4 = ReadFieldString(type2, value, "packageName"); bool flag = ReadFieldBool(type2, value, "isVanilla"); Sprite icon = ReadFieldSprite(type2, value, "icon"); if (string.IsNullOrEmpty(text4)) { text4 = ExtractPackageFromKey(text); } if (string.IsNullOrEmpty(text2)) { text2 = ExtractNameFromKey(text); } EmoteEntry emoteEntry = new EmoteEntry(); emoteEntry.Key = text; emoteEntry.DisplayName = text2; emoteEntry.PackageId = text4; emoteEntry.Source = "Emote Wheel"; emoteEntry.AnimationTag = (flag ? text3 : text); emoteEntry.IsVanilla = flag; emoteEntry.Icon = icon; emoteEntry.SortName = text4 + ":" + text2; if (!string.IsNullOrEmpty(emoteEntry.AnimationTag) && !merged.ContainsKey(emoteEntry.Key)) { merged.Add(emoteEntry.Key, emoteEntry); num++; } } } } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Emote Wheel reflection failed: " + ex.GetType().Name + ": " + ex.Message)); } return num; } private int CollectNativeVanillaEntries(Dictionary merged) { int num = 0; try { ScriptableEmoteList nativeScriptableEmoteList = GetNativeScriptableEmoteList(); if ((Object)(object)nativeScriptableEmoteList == (Object)null || nativeScriptableEmoteList._emoteCommandList == null) { return 0; } for (int i = 0; i < nativeScriptableEmoteList._emoteCommandList.Length; i++) { EmoteCommand val = nativeScriptableEmoteList._emoteCommandList[i]; if (val != null && !string.IsNullOrEmpty(val._emoteChatCommand) && !string.IsNullOrEmpty(val._emoteAnimationTag)) { string key = "Vanilla:" + val._emoteChatCommand; if (!merged.ContainsKey(key)) { EmoteEntry emoteEntry = new EmoteEntry(); emoteEntry.Key = key; emoteEntry.DisplayName = PrettyCommandName(val._emoteChatCommand); emoteEntry.PackageId = "Vanilla"; emoteEntry.Source = "Game"; emoteEntry.AnimationTag = val._emoteAnimationTag; emoteEntry.IsVanilla = true; emoteEntry.Icon = null; emoteEntry.SortName = "Vanilla:" + emoteEntry.DisplayName; merged.Add(key, emoteEntry); num++; } } } } catch (Exception ex) { Log.LogWarning((object)("[EmoteDeck] Native emote reflection failed: " + ex.GetType().Name + ": " + ex.Message)); } return num; } private static ScriptableEmoteList GetNativeScriptableEmoteList() { ChatBehaviour current = ChatBehaviour._current; if ((Object)(object)current == (Object)null) { return null; } FieldInfo field = typeof(ChatBehaviour).GetField("_scriptableEmoteList", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { return null; } object? value = field.GetValue(current); return (ScriptableEmoteList)((value is ScriptableEmoteList) ? value : null); } private static Type FindType(string fullName) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = null; try { type = assemblies[i].GetType(fullName, throwOnError: false); } catch { } if (type != null) { return type; } } return null; } private static string ReadFieldString(Type t, object obj, string fieldName) { try { FieldInfo field = t.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return string.Empty; } object value = field.GetValue(obj); return (value as string) ?? string.Empty; } catch { return string.Empty; } } private static bool ReadFieldBool(Type t, object obj, string fieldName) { try { FieldInfo field = t.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return false; } object value = field.GetValue(obj); return value is bool && (bool)value; } catch { return false; } } private static Sprite ReadFieldSprite(Type t, object obj, string fieldName) { try { FieldInfo field = t.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return null; } object? value = field.GetValue(obj); return (Sprite)((value is Sprite) ? value : null); } catch { return null; } } private static string ExtractPackageFromKey(string key) { int num = key.IndexOf(':'); if (num > 0) { return key.Substring(0, num); } return "Unknown"; } private static string ExtractNameFromKey(string key) { int num = key.IndexOf(':'); if (num >= 0 && num + 1 < key.Length) { return key.Substring(num + 1); } return key; } private static string PrettyCommandName(string cmd) { if (string.IsNullOrEmpty(cmd)) { return "Emote"; } string text = cmd.Trim(); if (text.StartsWith("/")) { text = text.Substring(1); } if (text.Length == 0) { return cmd; } return char.ToUpperInvariant(text[0]) + ((text.Length > 1) ? text.Substring(1) : string.Empty); } internal bool TryPlayEmote(EmoteEntry entry, out string status) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 status = string.Empty; if (entry == null) { status = "No emote selected."; return false; } if (string.IsNullOrEmpty(entry.AnimationTag)) { status = "Selected emote has no animation tag."; return false; } try { Player mainPlayer = Player._mainPlayer; if ((Object)(object)mainPlayer == (Object)null || (Object)(object)mainPlayer._pVisual == (Object)null) { status = "No local player/visual found."; return false; } if ((int)mainPlayer._currentPlayerCondition != 2) { status = "Player is not active."; return false; } ChatBehaviour current = ChatBehaviour._current; if ((Object)(object)current != (Object)null) { float num = ReadChatEmoteBuffer(current); if (num > 0f) { status = "Emote buffer is still cooling down."; return false; } } mainPlayer._pVisual.Cmd_CrossFadeAnim(entry.AnimationTag, 0.1f, 11); mainPlayer._pVisual.Local_CrossFadeAnim(entry.AnimationTag, 0.1f, 11); if ((Object)(object)current != (Object)null) { WriteChatEmoteBuffer(current, 0.85f); } NoteRecent(entry); status = "Played " + entry.DisplayName + "."; if (CfgDebugLogging.Value) { Log.LogInfo((object)("[EmoteDeck] Play " + entry.Key + " tag=" + entry.AnimationTag + " source=" + entry.Source)); } return true; } catch (Exception ex) { status = "Play failed: " + ex.GetType().Name + ": " + ex.Message; Log.LogWarning((object)("[EmoteDeck] " + status)); return false; } } private static float ReadChatEmoteBuffer(ChatBehaviour chat) { try { if (_chatEmoteBufferField == null) { _chatEmoteBufferField = typeof(ChatBehaviour).GetField("_emoteBuffer", BindingFlags.Instance | BindingFlags.NonPublic); } if (_chatEmoteBufferField == null) { return 0f; } object value = _chatEmoteBufferField.GetValue(chat); if (value is float) { return (float)value; } } catch { } return 0f; } private static void WriteChatEmoteBuffer(ChatBehaviour chat, float value) { try { if (_chatEmoteBufferField == null) { _chatEmoteBufferField = typeof(ChatBehaviour).GetField("_emoteBuffer", BindingFlags.Instance | BindingFlags.NonPublic); } if (_chatEmoteBufferField != null) { _chatEmoteBufferField.SetValue(chat, value); } } catch { } } } internal sealed class EmoteEntry { public string Key; public string DisplayName; public string PackageId; public string Source; public string AnimationTag; public bool IsVanilla; public Sprite Icon; public string SortName; } internal enum BindTarget { None, MainWindow, GridWindow } internal enum GridMode { Deck, Recent, Favorites } internal static class EmoteDeckEasySettingsBridge { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__12_0; internal void b__12_0() { TryRegisterIfReady(EmoteDeckPlugin.Instance); } } [CompilerGenerated] private sealed class d__11 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public EmoteDeckPlugin plugin; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: <>1__state = -1; TryInstall(plugin); <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 2; return true; case 2: <>1__state = -1; TryRegisterIfReady(plugin); <>2__current = (object)new WaitForSeconds(4f); <>1__state = 3; return true; case 3: <>1__state = -1; TryRegisterIfReady(plugin); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string EasySettingsTypeName = "Nessie.ATLYSS.EasySettings.Settings"; private static bool _subscribed; private static bool _registered; private static bool _registering; private static bool _loggedMissing; private static bool _syncingButtons; private static KeyCode _lastSyncedMainKey; private static KeyCode _lastSyncedGridKey; private static object _mainKeyButton; private static object _gridKeyButton; internal static void TryInstall(EmoteDeckPlugin plugin) { if (!((Object)(object)plugin == (Object)null)) { TrySubscribe(plugin); TryRegisterIfReady(plugin); } } [IteratorStateMachine(typeof(d__11))] internal static IEnumerator DelayedInstall(EmoteDeckPlugin plugin) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__11(0) { plugin = plugin }; } private static void TrySubscribe(EmoteDeckPlugin plugin) { //IL_00b5: 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_00c0: Expected O, but got Unknown if (_subscribed) { return; } Type type = FindType("Nessie.ATLYSS.EasySettings.Settings"); if (type == null) { LogMissingOnce(plugin); return; } try { PropertyInfo property = type.GetProperty("OnInitialized", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj == null) { return; } MethodInfo method = obj.GetType().GetMethod("AddListener", new Type[1] { typeof(UnityAction) }); if (method == null) { return; } object obj2 = <>c.<>9__12_0; if (obj2 == null) { UnityAction val = delegate { TryRegisterIfReady(EmoteDeckPlugin.Instance); }; <>c.<>9__12_0 = val; obj2 = (object)val; } UnityAction val2 = (UnityAction)obj2; method.Invoke(obj, new object[1] { val2 }); _subscribed = true; } catch (Exception ex) { if (EmoteDeckPlugin.CfgDebugLogging != null && EmoteDeckPlugin.CfgDebugLogging.Value && EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogWarning((object)("[EmoteDeck] EasySettings hook failed: " + ex.GetType().Name + ": " + ex.Message)); } } } private static void TryRegisterIfReady(EmoteDeckPlugin plugin) { //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)plugin == (Object)null || _registered || _registering) { return; } Type type = FindType("Nessie.ATLYSS.EasySettings.Settings"); if (type == null) { LogMissingOnce(plugin); } else { if (!IsEasySettingsReady(type)) { return; } _registering = true; try { MethodInfo method = type.GetMethod("GetOrAddCustomTab", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); if (method == null) { return; } object obj = method.Invoke(null, new object[1] { "Eleen's Lab" }); if (obj == null) { return; } Type type2 = obj.GetType(); MethodInfo method2 = type2.GetMethod("AddHeader", BindingFlags.Instance | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); MethodInfo method3 = type2.GetMethod("AddKeyButton", BindingFlags.Instance | BindingFlags.Public, null, new Type[2] { typeof(string), typeof(KeyCode) }, null); if (!(method3 == null)) { if (method2 != null) { method2.Invoke(obj, new object[1] { "Emote Deck" }); } _mainKeyButton = method3.Invoke(obj, new object[2] { "Main window", plugin.MainWindowKey }); _gridKeyButton = method3.Invoke(obj, new object[2] { "Emote grid", plugin.GridWindowKey }); HookKeyButton(_mainKeyButton, main: true); HookKeyButton(_gridKeyButton, main: false); _registered = true; SyncButtonsFromConfig(plugin); TryUpdateEasySettingsVisibility(type); if (EmoteDeckPlugin.CfgDebugLogging != null && EmoteDeckPlugin.CfgDebugLogging.Value && EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogInfo((object)"[EmoteDeck] EasySettings keys registered."); } } } catch (Exception ex) { if (EmoteDeckPlugin.CfgDebugLogging != null && EmoteDeckPlugin.CfgDebugLogging.Value && EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogWarning((object)("[EmoteDeck] EasySettings registration failed: " + ex.GetType().Name + ": " + ex.Message)); } } finally { _registering = false; } } } private static bool IsEasySettingsReady(Type settingsType) { try { if ((Object)(object)SettingsManager._current == (Object)null) { return false; } PropertyInfo property = settingsType.GetProperty("ModTab", BindingFlags.Static | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(null, null) : null); if (obj == null) { return false; } FieldInfo field = obj.GetType().GetField("Content", BindingFlags.Instance | BindingFlags.Public); object obj2 = ((field != null) ? field.GetValue(obj) : null); if (obj2 == null) { return false; } Type type = FindType("Nessie.ATLYSS.EasySettings.TemplateManager"); if (type != null) { FieldInfo field2 = type.GetField("_keyButtonTemplate", BindingFlags.Static | BindingFlags.NonPublic); if (field2 != null && field2.GetValue(null) == null) { return false; } } return true; } catch { return false; } } private static void TryUpdateEasySettingsVisibility(Type settingsType) { try { MethodInfo method = settingsType.GetMethod("UpdateTabVisibility", BindingFlags.Static | BindingFlags.NonPublic); if (method != null) { method.Invoke(null, null); } } catch { } } private static void HookKeyButton(object keyButton, bool main) { if (keyButton == null) { return; } try { PropertyInfo property = keyButton.GetType().GetProperty("OnValueChanged", BindingFlags.Instance | BindingFlags.Public); object obj = ((property != null) ? property.GetValue(keyButton, null) : null); if (obj != null) { MethodInfo method = obj.GetType().GetMethod("AddListener", new Type[1] { typeof(UnityAction) }); if (!(method == null)) { UnityAction val = (main ? new UnityAction(OnMainKeyChanged) : new UnityAction(OnGridKeyChanged)); method.Invoke(obj, new object[1] { val }); } } } catch (Exception ex) { if (EmoteDeckPlugin.CfgDebugLogging != null && EmoteDeckPlugin.CfgDebugLogging.Value && EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogWarning((object)("[EmoteDeck] EasySettings key hook failed: " + ex.GetType().Name + ": " + ex.Message)); } } } private static void OnMainKeyChanged(KeyCode key) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (!_syncingButtons) { EmoteDeckPlugin instance = EmoteDeckPlugin.Instance; if (!((Object)(object)instance == (Object)null)) { instance.SetMainWindowKeyFromEasySettings(key); } } } private static void OnGridKeyChanged(KeyCode key) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (!_syncingButtons) { EmoteDeckPlugin instance = EmoteDeckPlugin.Instance; if (!((Object)(object)instance == (Object)null)) { instance.SetGridWindowKeyFromEasySettings(key); } } } internal static void ResetMainKeyButton(EmoteDeckPlugin plugin) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)plugin == (Object)null)) { SetButtonValueSilent(_mainKeyButton, plugin.MainWindowKey); _lastSyncedMainKey = plugin.MainWindowKey; } } internal static void ResetGridKeyButton(EmoteDeckPlugin plugin) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)plugin == (Object)null)) { SetButtonValueSilent(_gridKeyButton, plugin.GridWindowKey); _lastSyncedGridKey = plugin.GridWindowKey; } } internal static void PollSync(EmoteDeckPlugin plugin) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (_registered && !((Object)(object)plugin == (Object)null) && !_registering && (plugin.MainWindowKey != _lastSyncedMainKey || plugin.GridWindowKey != _lastSyncedGridKey)) { SyncButtonsFromConfig(plugin); } } internal static void SyncButtonsFromConfig(EmoteDeckPlugin plugin) { //IL_0025: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!_registered || (Object)(object)plugin == (Object)null) { return; } _syncingButtons = true; try { SetButtonValueSilent(_mainKeyButton, plugin.MainWindowKey); SetButtonValueSilent(_gridKeyButton, plugin.GridWindowKey); _lastSyncedMainKey = plugin.MainWindowKey; _lastSyncedGridKey = plugin.GridWindowKey; } finally { _syncingButtons = false; } } private static void SetButtonValueSilent(object keyButton, KeyCode key) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (keyButton == null) { return; } try { Type type = keyButton.GetType(); FieldInfo field = type.GetField("_value", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(keyButton, key); } FieldInfo field2 = type.GetField("k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(keyButton, key); } object fieldValue = GetFieldValue(type, keyButton, "ButtonLabel"); SetTextObject(fieldValue, ((object)(KeyCode)(ref key)).ToString()); SyncRegisteredEasySettingsKeyBind(keyButton, fieldValue, key); } catch { } } private static object GetFieldValue(Type t, object obj, string name) { try { FieldInfo field = t.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return null; } return field.GetValue(obj); } catch { return null; } } private static void SetTextObject(object textObject, string text) { if (textObject == null) { return; } try { PropertyInfo property = textObject.GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Public); if (property != null && property.CanWrite) { property.SetValue(textObject, text, null); } } catch { } } private static void SyncRegisteredEasySettingsKeyBind(object keyButton, object buttonLabel, KeyCode key) { try { SettingsManager current = SettingsManager._current; if ((Object)(object)current == (Object)null) { return; } FieldInfo field = typeof(SettingsManager).GetField("keyBindButtons", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); Array array = ((field != null) ? (field.GetValue(current) as Array) : null); if (array == null) { return; } string text = ((object)(KeyCode)(ref key)).ToString(); object fieldValue = GetFieldValue(keyButton.GetType(), keyButton, "Button"); for (int i = 0; i < array.Length; i++) { object value = array.GetValue(i); if (value == null) { continue; } Type type = value.GetType(); object fieldValue2 = GetFieldValue(type, value, "_buttonLabel"); object fieldValue3 = GetFieldValue(type, value, "_button"); if (fieldValue2 == buttonLabel || fieldValue3 == fieldValue) { FieldInfo field2 = type.GetField("_keyBind", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(value, text); } SetTextObject(fieldValue2, text); break; } } } catch { } } private static void LogMissingOnce(EmoteDeckPlugin plugin) { if (!_loggedMissing) { _loggedMissing = true; if ((Object)(object)plugin != (Object)null && EmoteDeckPlugin.CfgDebugLogging != null && EmoteDeckPlugin.CfgDebugLogging.Value && EmoteDeckPlugin.Log != null) { EmoteDeckPlugin.Log.LogInfo((object)"[EmoteDeck] EasySettings not found. Native settings tab integration skipped."); } } } private static Type FindType(string fullName) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = null; try { type = assemblies[i].GetType(fullName, throwOnError: false); } catch { } if (type != null) { return type; } } return null; } } internal static class EmoteDeckInputBlocker { private static bool _mainOpen; private static bool _gridOpen; private static Rect _mainRect; private static Rect _gridRect; private static bool _blockGameplayInput; public static void SetWindowState(bool mainOpen, Rect mainRect, bool gridOpen, Rect gridRect, bool blockGameplayInput) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) _mainOpen = mainOpen; _mainRect = mainRect; _gridOpen = gridOpen; _gridRect = gridRect; _blockGameplayInput = blockGameplayInput && (_mainOpen || _gridOpen); } public static bool ShouldBlockGameplayInput() { return _blockGameplayInput; } public static bool IsMouseOverEmoteDeckWindow() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) Vector3 mousePosition = Input.mousePosition; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(mousePosition.x, (float)Screen.height - mousePosition.y); if (_mainOpen && ((Rect)(ref _mainRect)).Contains(val)) { return true; } if (_gridOpen && ((Rect)(ref _gridRect)).Contains(val)) { return true; } return false; } public static bool HasNonZeroScrollDelta(object pointerEventData) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (pointerEventData == null) { return false; } try { Type type = pointerEventData.GetType(); object obj = null; PropertyInfo property = type.GetProperty("scrollDelta", BindingFlags.Instance | BindingFlags.Public); if (property != null) { obj = property.GetValue(pointerEventData, null); } else { FieldInfo field = type.GetField("scrollDelta", BindingFlags.Instance | BindingFlags.Public); if (field != null) { obj = field.GetValue(pointerEventData); } } if (obj is Vector2) { Vector2 val = (Vector2)obj; return ((Vector2)(ref val)).sqrMagnitude > 0.0001f; } } catch { } return false; } } internal static class EmoteDeckScrollRectOnScrollPatch { private static bool Prefix(object __0) { if (EmoteDeckInputBlocker.HasNonZeroScrollDelta(__0) && EmoteDeckInputBlocker.IsMouseOverEmoteDeckWindow()) { return false; } return true; } } internal static class EmoteDeckGameplayInputPatch { private static bool Prefix(object __instance) { if (!EmoteDeckInputBlocker.ShouldBlockGameplayInput()) { return true; } TryNeutralizeInstance(__instance); return false; } private static void TryNeutralizeInstance(object instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) try { PlayerMove val = (PlayerMove)((instance is PlayerMove) ? instance : null); if ((Object)(object)val != (Object)null) { val.inputIn = Vector3.zero; val._worldSpaceInput = Vector3.zero; return; } PlayerCombat val2 = (PlayerCombat)((instance is PlayerCombat) ? instance : null); if ((Object)(object)val2 != (Object)null) { val2._localBlockingInput = false; } } catch { } } } internal static class EmoteDeckPlayerLocalParamsPatch { private static void Postfix(Player __instance) { if (!EmoteDeckInputBlocker.ShouldBlockGameplayInput()) { return; } try { if ((Object)(object)__instance != (Object)null && (Object)(object)__instance == (Object)(object)Player._mainPlayer) { __instance._inUI = true; } } catch { } } } internal sealed class EmoteDeckWindow { private struct GridMetrics { public int Columns; public int Rows; public float CellW; public float CellH; public float LabelH; public float Spacing; public float RowH; public float TotalContentH; public bool NamesOnly; public bool ShowIcon; public bool ShowLabel; } private const int MainWindowId = 1162104113; private const int GridWindowId = 1162102577; private const float MinMainW = 520f; private const float MinMainH = 380f; private const float MinGridW = 260f; private const float MinGridH = 160f; private readonly EmoteDeckPlugin _plugin; private Rect _mainRect; private Rect _gridRect; private bool _mainOpen; private bool _gridOpen; private bool _mainResizing; private bool _gridResizing; private Vector2 _resizeStart; private Rect _resizeOrig; private CursorLockMode _savedCursorLock; private bool _savedCursorVisible; private bool _hasSavedCursor; private bool _playerInUiForced; private bool _savedCameraUnlocked; private bool _hasSavedCamera; private int _tab; private Vector2 _slotsScroll; private Vector2 _pickerScroll; private Vector2 _pickerSlotScroll; private Vector2 _filterScroll; private Vector2 _settingsScroll; private Vector2 _gridScroll; private string _slotCountText; private string _searchText = string.Empty; private int _editingSlot = -1; private string _statusText = string.Empty; private float _statusUntil; private readonly List _pickerCache = new List(); private readonly List _specialGridEntries = new List(); private GridMode _gridMode = GridMode.Deck; private bool _gridViewDropdownOpen; private bool _gridMouseModeDropdownOpen; private bool _settingsGridViewDropdownOpen; private bool _settingsGridMouseModeDropdownOpen; private string _pickerCacheSearch = null; private int _pickerCacheRegistryRevision = -1; private int _pickerCacheFilterRevision = -1; private bool _pickerCacheHideAssigned; private int _pickerCachePage = -1; private BindTarget _bindTarget = BindTarget.None; private int _bindStartedFrame = -1; private string _bindStatus = string.Empty; private GUIStyle _transparentWindowStyle; private GUIStyle _headerStyle; private GUIStyle _smallLabelStyle; private GUIStyle _centerLabelStyle; private GUIStyle _miniButtonStyle; internal bool IsCapturingKeyBind => _bindTarget != BindTarget.None; internal bool IsMainOpen => _mainOpen; internal bool IsGridOpen => _gridOpen; internal EmoteDeckWindow(EmoteDeckPlugin plugin) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) _plugin = plugin; _mainRect = new Rect(EmoteDeckPlugin.CfgMainX.Value, EmoteDeckPlugin.CfgMainY.Value, EmoteDeckPlugin.CfgMainW.Value, EmoteDeckPlugin.CfgMainH.Value); _gridRect = new Rect(EmoteDeckPlugin.CfgGridX.Value, EmoteDeckPlugin.CfgGridY.Value, EmoteDeckPlugin.CfgGridW.Value, EmoteDeckPlugin.CfgGridH.Value); _slotCountText = EmoteDeckPlugin.CfgActiveSlotCount.Value.ToString(CultureInfo.InvariantCulture); } internal void ToggleMainWindow() { if (_mainOpen) { CloseMainWindow(); } else { OpenMainWindow(); } } internal void ToggleGridWindow() { if (_gridOpen) { CloseGridWindow(); } else { OpenGridWindow(); } } internal void OpenMainWindow() { if (!_mainOpen) { _mainOpen = true; SaveCursorIfNeeded(); Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; ApplyPlayerInUIIfNeeded(); UpdateInputBlockerState(); _plugin.ScheduleAutoRescan(0.25f, force: true); ClampToScreen(ref _mainRect, 520f, 380f); } } internal void CloseMainWindow() { if (_mainOpen) { _mainOpen = false; _bindTarget = BindTarget.None; _editingSlot = -1; SaveMainRect(); UpdateInputBlockerState(); _plugin.SavePluginConfig(); ReleaseInputStateIfUnused(); } } internal void OpenGridWindow() { if (!_gridOpen) { _gridOpen = true; ApplyPlayerInUIIfNeeded(); if (ShouldUnlockMouseForGridWindow()) { ApplyGridMouseUnlockIfNeeded(); } UpdateInputBlockerState(); _plugin.ScheduleAutoRescan(0.25f, force: true); ClampToScreen(ref _gridRect, 260f, 160f); } } internal void CloseGridWindow() { if (_gridOpen) { _gridOpen = false; _gridViewDropdownOpen = false; _gridMouseModeDropdownOpen = false; SaveGridRect(); UpdateInputBlockerState(); _plugin.SavePluginConfig(); ReleaseInputStateIfUnused(); } } internal void SaveOpenWindowRects() { if (_mainOpen) { SaveMainRect(); } if (_gridOpen) { SaveGridRect(); } } internal void MaintainInputState() { UpdateInputBlockerState(); if (_mainOpen || _gridOpen) { if (ShouldBlockGameplayInputForOpenWindows()) { ApplyPlayerInUIIfNeeded(); } else { ReleasePlayerInUIState(); } if (_gridOpen && ShouldUnlockMouseForGridWindow()) { ApplyGridMouseUnlockIfNeeded(); } else { ReleaseGridMouseUnlockIfSafe(); } } else { ReleaseInputStateIfUnused(); } } private void SaveCursorIfNeeded() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!_hasSavedCursor) { _savedCursorLock = Cursor.lockState; _savedCursorVisible = Cursor.visible; _hasSavedCursor = true; } } private void ApplyPlayerInUIIfNeeded() { if (!ShouldBlockGameplayInputForOpenWindows()) { return; } try { Player mainPlayer = Player._mainPlayer; if (!((Object)(object)mainPlayer == (Object)null)) { mainPlayer._inUI = true; _playerInUiForced = true; } } catch { } } private bool ShouldUnlockMouseForGridWindow() { if (!_gridOpen) { return false; } string gridMouseMode = GetGridMouseMode(); if (gridMouseMode == "Always") { return true; } if (gridMouseMode == "Off") { return false; } return EmoteDeckPlugin.CfgCloseGridAfterEmote.Value; } private void ApplyGridMouseUnlockIfNeeded() { if (ShouldUnlockMouseForGridWindow()) { SaveCursorIfNeeded(); try { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } catch { } ApplyCameraUnlockIfNeeded(); } } private void ApplyCameraUnlockIfNeeded() { try { if (!((Object)(object)CameraFunction._current == (Object)null)) { if (!_hasSavedCamera) { _savedCameraUnlocked = CameraFunction._current._unlockedCamera; _hasSavedCamera = true; } CameraFunction._current._unlockedCamera = true; } } catch { } } private void ReleaseGridMouseUnlockIfSafe() { if (_hasSavedCamera) { try { if ((Object)(object)CameraFunction._current != (Object)null) { CameraFunction._current._unlockedCamera = _savedCameraUnlocked; } } catch { } _hasSavedCamera = false; } ReleaseCursorStateIfSafe(); } private void ReleasePlayerInUIState() { if (!_playerInUiForced || IsGameUiOrChatActive()) { return; } try { Player mainPlayer = Player._mainPlayer; if ((Object)(object)mainPlayer != (Object)null) { mainPlayer._inUI = false; } } catch { } _playerInUiForced = false; } private bool IsGameUiOrChatActive() { try { Player mainPlayer = Player._mainPlayer; if ((Object)(object)mainPlayer != (Object)null) { if (mainPlayer._inChat) { return true; } if ((Object)(object)mainPlayer._chatBehaviour != (Object)null && mainPlayer._chatBehaviour._focusedInChat) { return true; } } } catch { } try { ChatBehaviour current = ChatBehaviour._current; if ((Object)(object)current != (Object)null && current._focusedInChat) { return true; } } catch { } try { if ((Object)(object)TabMenu._current != (Object)null && TabMenu._current._isOpen) { return true; } } catch { } try { if ((Object)(object)SettingsManager._current != (Object)null && SettingsManager._current._isOpen) { return true; } } catch { } try { if ((Object)(object)DialogManager._current != (Object)null && DialogManager._current._isDialogEnabled) { return true; } } catch { } return false; } private void ReleaseInputStateIfUnused() { if (_mainOpen || _gridOpen) { return; } if (_hasSavedCamera) { try { if ((Object)(object)CameraFunction._current != (Object)null) { CameraFunction._current._unlockedCamera = _savedCameraUnlocked; } } catch { } _hasSavedCamera = false; } ReleasePlayerInUIState(); ReleaseCursorStateIfSafe(); } private void ReleaseCursorStateIfSafe() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) if (_hasSavedCursor && !_mainOpen && (!_gridOpen || !ShouldUnlockMouseForGridWindow()) && !IsGameUiOrChatActive()) { try { Cursor.lockState = _savedCursorLock; Cursor.visible = _savedCursorVisible; } catch { } _hasSavedCursor = false; } } internal void OnGUI() { EnsureStyles(); Event current = Event.current; UpdateInputBlockerState(); if (IsCapturingKeyBind && HandleKeyBindCapture(current)) { UpdateInputBlockerState(); return; } if (_mainOpen) { DrawMainOnGUI(); } if (_gridOpen) { DrawGridOnGUI(); } UpdateInputBlockerState(); } private void DrawMainOnGUI() { //IL_0023: 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_0044: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (_mainResizing) { HandleResizeEvent(current, main: true); } _mainRect = GUI.Window(1162104113, _mainRect, new WindowFunction(DrawMainWindow), GUIContent.none, GetTransparentWindowStyle()); ClampToScreen(ref _mainRect, 520f, 380f); } private void DrawGridOnGUI() { //IL_0023: 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_0044: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (_gridResizing) { HandleResizeEvent(current, main: false); } _gridRect = GUI.Window(1162102577, _gridRect, new WindowFunction(DrawGridWindow), GUIContent.none, GetTransparentWindowStyle()); ClampToScreen(ref _gridRect, 260f, 160f); } private void HandleResizeEvent(Event e, bool main) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) if (e == null) { return; } if ((int)e.rawType == 1 || (int)e.type == 1 || !Input.GetMouseButton(0)) { if (main) { _mainResizing = false; SaveMainRect(); } else { _gridResizing = false; SaveGridRect(); } _plugin.SavePluginConfig(); UseEventIfSafe(e); } else if ((int)e.type == 3 || (int)e.type == 2) { Vector2 guiMouseScreenPos = GetGuiMouseScreenPos(); Vector2 val = guiMouseScreenPos - _resizeStart; if (main) { ((Rect)(ref _mainRect)).width = Mathf.Max(520f, ((Rect)(ref _resizeOrig)).width + val.x); ((Rect)(ref _mainRect)).height = Mathf.Max(380f, ((Rect)(ref _resizeOrig)).height + val.y); ClampToScreen(ref _mainRect, 520f, 380f); } else { ((Rect)(ref _gridRect)).width = Mathf.Max(260f, ((Rect)(ref _resizeOrig)).width + val.x); ((Rect)(ref _gridRect)).height = Mathf.Max(160f, ((Rect)(ref _resizeOrig)).height + val.y); ClampToScreen(ref _gridRect, 260f, 160f); } GUI.changed = true; UseEventIfSafe(e); } } private void DrawMainWindow(int id) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: 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_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, ((Rect)(ref _mainRect)).width, ((Rect)(ref _mainRect)).height); Rect rect = default(Rect); ((Rect)(ref rect))..ctor(0f, 0f, ((Rect)(ref _mainRect)).width, 26f); Rect rect2 = default(Rect); ((Rect)(ref rect2))..ctor(0f, 26f, ((Rect)(ref _mainRect)).width, ((Rect)(ref _mainRect)).height - 26f); DrawSolid(val, new Color(0f, 0f, 0f, 0.02f)); DrawSolid(rect, new Color(0.05f, 0.05f, 0.05f, 0.98f)); DrawSolid(rect2, new Color(0f, 0f, 0f, Mathf.Clamp01(EmoteDeckPlugin.CfgMainOpacity.Value))); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref _mainRect)).width - 26f, 3f, 22f, 20f); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(((Rect)(ref val2)).x - 38f, 5f, 34f, 18f); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(((Rect)(ref val3)).x - 92f, 7f, 88f, 14f); Rect val5 = default(Rect); ((Rect)(ref val5))..ctor(((Rect)(ref val4)).x - 56f, 4f, 54f, 18f); Rect val6 = new Rect(8f, 4f, Mathf.Max(0f, ((Rect)(ref val5)).x - 10f), 18f); KeyCode mainWindowKey = _plugin.MainWindowKey; GUI.Label(val6, "ATLYSS Emote Deck [" + ((object)(KeyCode)(ref mainWindowKey)).ToString() + "]", _headerStyle); GUI.Label(val5, "Opacity", _smallLabelStyle); float value = EmoteDeckPlugin.CfgMainOpacity.Value; float num = GUI.HorizontalSlider(val4, value, 0f, 1f); GUI.Label(val3, Mathf.RoundToInt(num * 100f).ToString(CultureInfo.InvariantCulture) + "%", _smallLabelStyle); if (Mathf.Abs(num - value) > 0.001f) { EmoteDeckPlugin.CfgMainOpacity.Value = num; _plugin.QueueConfigSave(); } if (GUI.Button(val2, "X", _miniButtonStyle)) { CloseMainWindow(); return; } Rect windowContentRect = GetWindowContentRect(_mainRect, 26f, reserveResizeCorner: true); Rect rect3 = default(Rect); ((Rect)(ref rect3))..ctor(((Rect)(ref windowContentRect)).x, Mathf.Max(((Rect)(ref windowContentRect)).y, ((Rect)(ref windowContentRect)).yMax - 28f), ((Rect)(ref windowContentRect)).width, 28f); ((Rect)(ref windowContentRect)).height = Mathf.Max(40f, ((Rect)(ref windowContentRect)).height - 28f - 5f); ((Rect)(ref rect3)).y = ((Rect)(ref windowContentRect)).yMax + 5f; bool flag = false; Color color = GUI.color; try { GUILayout.BeginArea(windowContentRect); flag = true; GUI.color = new Color(color.r, color.g, color.b, Mathf.Clamp01(EmoteDeckPlugin.CfgMainOpacity.Value)); DrawTabs(); DrawBindBannerIfNeeded(); switch (_tab) { case 0: DrawSlotsTab(); break; case 1: DrawPickerTab(); break; case 2: DrawFiltersTab(); break; case 3: DrawSettingsTab(); break; default: DrawHelpTab(); break; } } finally { GUI.color = color; if (flag) { GUILayout.EndArea(); } } DrawMainFooter(rect3); ConsumeScrollWheelInsideLocalWindow(val); GUI.DragWindow(new Rect(0f, 0f, Mathf.Max(0f, ((Rect)(ref val5)).x - 8f), 26f)); DrawResizeHandle(new Rect(((Rect)(ref _mainRect)).width - 16f - 3f, ((Rect)(ref _mainRect)).height - 16f - 3f, 16f, 16f), main: true); } private void DrawGridWindow(int id) { //IL_075a: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: 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_034a: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06cc: Unknown result type (might be due to invalid IL or missing references) //IL_06d1: Unknown result type (might be due to invalid IL or missing references) //IL_06f2: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_0711: Unknown result type (might be due to invalid IL or missing references) //IL_0718: Unknown result type (might be due to invalid IL or missing references) //IL_071f: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_0790: Unknown result type (might be due to invalid IL or missing references) //IL_07bc: Unknown result type (might be due to invalid IL or missing references) //IL_07e4: 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_07a7: Unknown result type (might be due to invalid IL or missing references) //IL_07b1: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) bool flag = EmoteDeckPlugin.CfgGridShowHeaderControls.Value; float num = (flag ? 50f : 25f); Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, ((Rect)(ref _gridRect)).width, ((Rect)(ref _gridRect)).height); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, ((Rect)(ref _gridRect)).width, num); Rect rect = default(Rect); ((Rect)(ref rect))..ctor(0f, 0f, ((Rect)(ref _gridRect)).width, 25f); Rect rect2 = default(Rect); ((Rect)(ref rect2))..ctor(0f, 25f, ((Rect)(ref _gridRect)).width, 25f); Rect rect3 = default(Rect); ((Rect)(ref rect3))..ctor(0f, num, ((Rect)(ref _gridRect)).width, ((Rect)(ref _gridRect)).height - num); DrawSolid(val, new Color(0f, 0f, 0f, 0.02f)); DrawSolid(rect, new Color(0.05f, 0.05f, 0.05f, 0.98f)); if (flag) { DrawSolid(rect2, new Color(0.035f, 0.035f, 0.035f, 0.98f)); } DrawSolid(rect3, new Color(0f, 0f, 0f, Mathf.Clamp01(EmoteDeckPlugin.CfgGridOpacity.Value))); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(((Rect)(ref _gridRect)).width - 26f, 3f, 22f, 19f); bool flag2 = ((Rect)(ref _gridRect)).width >= 520f; bool flag3 = ((Rect)(ref _gridRect)).width < 440f; bool flag4 = ((Rect)(ref _gridRect)).width < 350f; float num2 = ((((Rect)(ref _gridRect)).width < 340f) ? 60f : ((((Rect)(ref _gridRect)).width < 400f) ? 70f : 84f)); float num3 = ((((Rect)(ref _gridRect)).width < 340f) ? 30f : 34f); float num4 = (flag3 ? 38f : 76f); string text = (flag3 ? "Ctrl" : "Controls"); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(((Rect)(ref val3)).x - num3 - 4f, 5f, num3, 16f); Rect val5 = default(Rect); ((Rect)(ref val5))..ctor(((Rect)(ref val4)).x - num2 - 4f, 7f, num2, 14f); Rect val6 = (flag2 ? new Rect(((Rect)(ref val5)).x - 54f, 4f, 50f, 16f) : new Rect(0f, 0f, 0f, 0f)); float num5 = (flag2 ? (((Rect)(ref val6)).x - 10f) : (((Rect)(ref val5)).x - 10f)); Rect val7 = default(Rect); ((Rect)(ref val7))..ctor(num5 - num4, 3f, num4, 19f); bool flag5 = ((Rect)(ref val7)).x >= 82f; float num6 = (flag5 ? ((Rect)(ref val7)).x : (flag2 ? ((Rect)(ref val6)).x : ((Rect)(ref val5)).x)); object obj; if (!flag4) { KeyCode gridWindowKey = _plugin.GridWindowKey; obj = "Emote Grid [" + ((object)(KeyCode)(ref gridWindowKey)).ToString() + "]"; } else { obj = "Emote Grid"; } string text2 = (string)obj; GUI.Label(new Rect(8f, 4f, Mathf.Max(0f, num6 - 10f), 18f), text2, _headerStyle); if (flag5) { bool flag6 = GUI.Toggle(val7, flag, text, GUI.skin.button); if (flag6 != flag) { EmoteDeckPlugin.CfgGridShowHeaderControls.Value = flag6; _plugin.SavePluginConfig(); flag = flag6; if (!flag) { _gridViewDropdownOpen = false; _gridMouseModeDropdownOpen = false; } num = (flag ? 50f : 25f); ((Rect)(ref rect3))..ctor(0f, num, ((Rect)(ref _gridRect)).width, ((Rect)(ref _gridRect)).height - num); } } if (flag2) { GUI.Label(val6, "Opacity", _smallLabelStyle); } float value = EmoteDeckPlugin.CfgGridOpacity.Value; float num7 = GUI.HorizontalSlider(val5, value, 0f, 1f); GUI.Label(val4, Mathf.RoundToInt(num7 * 100f).ToString(CultureInfo.InvariantCulture) + "%", _smallLabelStyle); if (Mathf.Abs(num7 - value) > 0.001f) { EmoteDeckPlugin.CfgGridOpacity.Value = num7; _plugin.QueueConfigSave(); } if (GUI.Button(val3, "X", _miniButtonStyle)) { CloseGridWindow(); return; } Rect val8 = default(Rect); Rect rect4 = default(Rect); Rect val9 = default(Rect); Rect rect5 = default(Rect); bool flag7 = false; if (flag) { float num8 = 8f; float num9 = 29f; bool flag8 = ((Rect)(ref _gridRect)).width < 340f; float num10 = (flag8 ? 28f : 32f); float num11 = ((((Rect)(ref _gridRect)).width < 300f) ? 82f : ((((Rect)(ref _gridRect)).width < 360f) ? 96f : 112f)); float num12 = (flag8 ? 44f : 74f); float num13 = ((((Rect)(ref _gridRect)).width < 300f) ? 68f : ((((Rect)(ref _gridRect)).width < 360f) ? 76f : 92f)); string text3 = (flag8 ? "Mouse" : "Mouse mode"); ((Rect)(ref val8))..ctor(num8, num9 + 1f, num10, 16f); num8 += num10 + 4f; ((Rect)(ref rect4))..ctor(num8, num9, num11, 19f); num8 += num11 + 8f; ((Rect)(ref val9))..ctor(num8, num9 + 1f, num12, 16f); num8 += num12 + 4f; ((Rect)(ref rect5))..ctor(num8, num9, num13, 19f); flag7 = ((Rect)(ref rect5)).xMax <= ((Rect)(ref _gridRect)).width - 8f; if (flag7) { GUI.Label(val8, "View", _smallLabelStyle); GUI.Label(val9, text3, _smallLabelStyle); } } Rect windowContentRect = GetWindowContentRect(_gridRect, num, reserveResizeCorner: true); bool flag9 = flag && flag7 && (_gridViewDropdownOpen || _gridMouseModeDropdownOpen); bool flag10 = false; Color color = GUI.color; try { if (!flag9) { GUILayout.BeginArea(windowContentRect); flag10 = true; GUI.color = new Color(color.r, color.g, color.b, Mathf.Clamp01(EmoteDeckPlugin.CfgGridOpacity.Value)); DrawGridContents(((Rect)(ref windowContentRect)).width, ((Rect)(ref windowContentRect)).height); } } finally { GUI.color = color; if (flag10) { GUILayout.EndArea(); } } if (flag9) { DrawSolid(windowContentRect, new Color(0f, 0f, 0f, 0.84f)); } if (flag && flag7) { DrawGridViewDropdown(rect4, settings: false); DrawGridMouseModeDropdown(rect5, settings: false); } ConsumeScrollWheelInsideLocalWindow(val); GUI.DragWindow(new Rect(0f, 0f, Mathf.Max(0f, num6 - 8f), 25f)); DrawResizeHandle(new Rect(((Rect)(ref _gridRect)).width - 16f - 3f, ((Rect)(ref _gridRect)).height - 16f - 3f, 16f, 16f), main: false); } private void DrawTabs() { GUILayout.BeginHorizontal(Array.Empty()); DrawTabButton(0, "Slots", 70f); DrawTabButton(1, "Picker", 78f); DrawTabButton(2, "Packs", 72f); DrawTabButton(3, "Settings", 88f); DrawTabButton(4, "Help", 58f); GUILayout.FlexibleSpace(); if (GUILayout.Button(_gridOpen ? "Close Grid" : "Open Grid", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(96f) })) { ToggleGridWindow(); } GUILayout.EndHorizontal(); GUILayout.Space(4f); } private void DrawTabButton(int idx, string label, float width) { bool flag = _tab == idx; if (GUILayout.Toggle(flag, label, GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) }) && !flag) { _tab = idx; GUI.FocusControl((string)null); } } private void DrawBindBannerIfNeeded() { if (IsCapturingKeyBind) { GUILayout.Label(_bindStatus ?? "Press a key. Esc cancels. Backspace clears optional keys.", Array.Empty()); GUILayout.Space(2f); } else if (!string.IsNullOrEmpty(_bindStatus)) { GUILayout.Label(_bindStatus, Array.Empty()); GUILayout.Space(2f); } } private void DrawStatusIfNeeded() { if (!string.IsNullOrEmpty(_statusText) && Time.unscaledTime < _statusUntil) { GUILayout.Label(_statusText, Array.Empty()); GUILayout.Space(2f); } } private void DrawMainFooter(Rect rect) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) if (!(((Rect)(ref rect)).width <= 1f) && !(((Rect)(ref rect)).height <= 1f)) { Color color = GUI.color; DrawSolid(rect, new Color(0f, 0f, 0f, 0.22f * Mathf.Clamp01(EmoteDeckPlugin.CfgMainOpacity.Value))); string text = string.Empty; if (!string.IsNullOrEmpty(_statusText) && Time.unscaledTime < _statusUntil) { text = _statusText; } else if (IsCapturingKeyBind) { text = _bindStatus ?? string.Empty; } if (!string.IsNullOrEmpty(text)) { GUI.color = new Color(color.r, color.g, color.b, Mathf.Clamp01(EmoteDeckPlugin.CfgMainOpacity.Value)); GUI.Label(new Rect(((Rect)(ref rect)).x + 8f, ((Rect)(ref rect)).y + 5f, Mathf.Max(20f, ((Rect)(ref rect)).width - 16f), ((Rect)(ref rect)).height - 8f), Trim(text, Mathf.Max(12, Mathf.FloorToInt((((Rect)(ref rect)).width - 16f) / 6.5f))), _smallLabelStyle); } GUI.color = color; } } private string BuildSlotSummaryText() { int activeSlotCount = _plugin.GetActiveSlotCount(); int num = _plugin.CountAssignedSlotsInPage(_plugin.GetCurrentPageIndex()); if (EmoteDeckPlugin.CfgEnablePages.Value) { int pageCount = _plugin.GetPageCount(); int num2 = activeSlotCount * pageCount; int num3 = _plugin.CountAssignedSlotsAcrossEnabledPages(); return activeSlotCount + " slots on each page Pages: " + pageCount + " Across pages: " + num2 + " slots Filled: " + num + " here / " + num3 + " all"; } return "Slots: " + activeSlotCount + " / " + 100 + " Assigned: " + num; } private void DrawSlotsTab() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(BuildSlotSummaryText() + " Emotes: " + _plugin.AllEmotes.Count + " Packs: " + CountVisiblePackages() + " / " + _plugin.PackageIds.Count, Array.Empty()); GUILayout.Space(4f); DrawPageControlsGUILayout(); bool flag = false; try { _slotsScroll = GUILayout.BeginScrollView(_slotsScroll, Array.Empty()); flag = true; int activeSlotCount = _plugin.GetActiveSlotCount(); for (int i = 0; i < activeSlotCount; i++) { DrawSlotRow(i); } } finally { if (flag) { GUILayout.EndScrollView(); } } } private void DrawSlotRow(int index) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) EmoteEntry entry; bool flag = _plugin.TryGetSlotEmote(index, out entry); string text = (flag ? (entry.PackageId + " / " + entry.DisplayName) : ""); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); GUILayout.Label((index + 1).ToString("D2", CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }); Rect rect = GUILayoutUtility.GetRect(26f, 26f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(26f), GUILayout.Height(26f) }); GUI.Box(rect, GUIContent.none); if (flag) { DrawSprite(entry.Icon, rect); } GUILayout.Label(text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(190f) }); if (EmoteDeckPlugin.CfgEnableFavorites.Value && flag) { string text2 = (_plugin.IsFavorite(entry.Key) ? "★" : "☆"); if (GUILayout.Button(text2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { _plugin.ToggleFavorite(entry); SetStatus((_plugin.IsFavorite(entry.Key) ? "Favorited " : "Unfavorited ") + entry.DisplayName + "."); } } if (GUILayout.Button("Pick", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { _editingSlot = index; _tab = 1; GUI.FocusControl((string)null); } if (GUILayout.Button("Play", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { if (flag) { _plugin.TryPlayEmote(entry, out var status); SetStatus(status); } else { SetStatus("Slot " + (index + 1) + " is empty."); } } if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { _plugin.SetSlotKey(index, string.Empty); SetStatus("Cleared slot " + (index + 1) + "."); } GUILayout.EndHorizontal(); } private void DrawPageControlsGUILayout() { if (!EmoteDeckPlugin.CfgEnablePages.Value) { return; } int pageCount = _plugin.GetPageCount(); int currentPageIndex = _plugin.GetCurrentPageIndex(); GUILayout.BeginHorizontal(Array.Empty()); GUI.enabled = currentPageIndex > 0; if (GUILayout.Button("<", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) })) { _plugin.MoveToPreviousPage(); } GUI.enabled = true; GUILayout.Label("Page " + (currentPageIndex + 1) + " / " + pageCount, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(86f) }); GUI.enabled = currentPageIndex + 1 < pageCount; if (GUILayout.Button(">", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) })) { _plugin.MoveToNextPage(); } GUI.enabled = true; GUILayout.Space(8f); int num = Mathf.Min(pageCount, 10); for (int i = 0; i < num; i++) { bool flag = i == currentPageIndex; if (GUILayout.Toggle(flag, (i + 1).ToString(CultureInfo.InvariantCulture), GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f) }) && !flag) { _plugin.SetCurrentPageIndex(i); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(4f); } private void DrawPickerTab() { int activeSlotCount = _plugin.GetActiveSlotCount(); DrawPickerSlotSelector(activeSlotCount); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Search", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) }); _searchText = GUILayout.TextField(_searchText ?? string.Empty, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(160f) }); if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) })) { _searchText = string.Empty; } if (GUILayout.Button("Show All Packs", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(112f) })) { _plugin.ShowAllPackages(); } if (GUILayout.Button("Packs", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { _tab = 2; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); bool flag = GUILayout.Toggle(EmoteDeckPlugin.CfgPickerHideAssigned.Value, "Hide assigned", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(112f) }); if (flag != EmoteDeckPlugin.CfgPickerHideAssigned.Value) { EmoteDeckPlugin.CfgPickerHideAssigned.Value = flag; _plugin.QueueConfigSave(); _pickerCacheSearch = null; } if (GUILayout.Button("Next empty", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { MoveEditingSlotToNextEmpty(); } if (GUILayout.Button("Clear slot", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(78f) })) { _plugin.SetSlotKey(_editingSlot, string.Empty); SetStatus("Cleared slot " + (_editingSlot + 1) + "."); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(4f); List list = BuildPickerList(); GUILayout.Label("Showing: " + list.Count + " / " + _plugin.AllEmotes.Count + " Slot " + (_editingSlot + 1) + ": " + SlotSummary(_editingSlot), Array.Empty()); DrawVirtualizedPicker(list); } private void DrawPickerSlotSelector(int activeCount) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) if (activeCount < 1) { activeCount = 1; } if (_editingSlot < 0 || _editingSlot >= activeCount) { _editingSlot = 0; } Rect rect = GUILayoutUtility.GetRect(1f, 46f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 3f, 86f, 20f); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref rect)).x + 86f, ((Rect)(ref rect)).y, Mathf.Max(80f, ((Rect)(ref rect)).width - 86f), 46f); GUI.Label(val, "Editing slot:"); float num = Mathf.Max(((Rect)(ref val2)).width - 2f, (float)activeCount * 34f); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(0f, 0f, num, 24f); bool flag = false; try { _pickerSlotScroll = GUI.BeginScrollView(val2, _pickerSlotScroll, val3, false, false); flag = true; Color backgroundColor = GUI.backgroundColor; Rect val4 = default(Rect); for (int i = 0; i < activeCount; i++) { ((Rect)(ref val4))..ctor((float)i * 34f, 0f, 30f, 24f); bool flag2 = _editingSlot == i; bool flag3 = !string.IsNullOrEmpty(_plugin.GetSlotKey(i)); if (flag3) { GUI.backgroundColor = (flag2 ? new Color(0.72f, 0.86f, 1f, 1f) : new Color(0.42f, 0.62f, 0.82f, 1f)); } else { GUI.backgroundColor = backgroundColor; } bool flag4 = GUI.Toggle(val4, flag2, (i + 1).ToString(CultureInfo.InvariantCulture), GUI.skin.button); if (flag3) { Color color = (flag2 ? new Color(0.72f, 0.9f, 1f, 0.95f) : new Color(0.48f, 0.74f, 1f, 0.88f)); DrawSolid(new Rect(((Rect)(ref val4)).x + 4f, ((Rect)(ref val4)).y + ((Rect)(ref val4)).height - 4f, Mathf.Max(1f, ((Rect)(ref val4)).width - 8f), 2f), color); } if (flag4 && !flag2) { _editingSlot = i; GUI.FocusControl((string)null); } } GUI.backgroundColor = backgroundColor; } finally { if (flag) { GUI.EndScrollView(); } } } private void MoveEditingSlotToNextEmpty() { int activeSlotCount = _plugin.GetActiveSlotCount(); for (int i = 1; i <= activeSlotCount; i++) { int num = (_editingSlot + i) % activeSlotCount; if (string.IsNullOrEmpty(_plugin.GetSlotKey(num))) { _editingSlot = num; SetStatus("Slot " + (_editingSlot + 1) + " selected."); return; } } SetStatus("No empty slot here."); } private void AdvanceEditingSlotAfterSet() { if (EmoteDeckPlugin.CfgPickerAutoAdvanceSlot.Value) { int activeSlotCount = _plugin.GetActiveSlotCount(); if (activeSlotCount > 0 && _editingSlot + 1 < activeSlotCount) { _editingSlot++; } } } private List BuildPickerList() { string text = (_searchText ?? string.Empty).Trim(); bool value = EmoteDeckPlugin.CfgPickerHideAssigned.Value; int currentPageIndex = _plugin.GetCurrentPageIndex(); if (_pickerCacheRegistryRevision == _plugin.RegistryRevision && _pickerCacheFilterRevision == _plugin.FilterRevision && _pickerCacheHideAssigned == value && _pickerCachePage == currentPageIndex && string.Equals(_pickerCacheSearch ?? string.Empty, text, StringComparison.Ordinal)) { return _pickerCache; } _pickerCache.Clear(); for (int i = 0; i < _plugin.AllEmotes.Count; i++) { EmoteEntry emoteEntry = _plugin.AllEmotes[i]; if (emoteEntry != null && _plugin.IsPackageVisible(emoteEntry.PackageId) && (!value || !_plugin.IsAssignedOnCurrentDeck(emoteEntry.Key)) && (text.Length <= 0 || ContainsIgnoreCase(emoteEntry.DisplayName, text) || ContainsIgnoreCase(emoteEntry.PackageId, text) || ContainsIgnoreCase(emoteEntry.Key, text))) { _pickerCache.Add(emoteEntry); } } _pickerCacheSearch = text; _pickerCacheRegistryRevision = _plugin.RegistryRevision; _pickerCacheFilterRevision = _plugin.FilterRevision; _pickerCacheHideAssigned = value; _pickerCachePage = currentPageIndex; return _pickerCache; } private void DrawVirtualizedPicker(List entries) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(100f, ((Rect)(ref _mainRect)).height - 178f); int num2 = entries?.Count ?? 0; Rect rect = GUILayoutUtility.GetRect(1f, num, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); ((Rect)(ref rect)).height = Mathf.Max(80f, ((Rect)(ref rect)).height); float num3 = (((float)num2 * 32f > ((Rect)(ref rect)).height) ? 18f : 0f); float num4 = Mathf.Max(1f, ((Rect)(ref rect)).width - num3); float num5 = Mathf.Max(((Rect)(ref rect)).height, (float)num2 * 32f + 4f); Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, num4, num5); bool flag = false; try { _pickerScroll = GUI.BeginScrollView(rect, _pickerScroll, val, false, true); flag = true; int num6 = Mathf.Clamp(Mathf.FloorToInt(_pickerScroll.y / 32f) - 2, 0, Math.Max(0, num2 - 1)); int num7 = Mathf.CeilToInt(((Rect)(ref rect)).height / 32f) + 6; int num8 = Mathf.Min(num2, num6 + num7); Rect rowRect = default(Rect); for (int i = num6; i < num8; i++) { ((Rect)(ref rowRect))..ctor(0f, (float)i * 32f, num4, 30f); DrawPickerEntry(rowRect, entries[i], (i & 1) == 1); } } finally { if (flag) { GUI.EndScrollView(); } } } private void DrawPickerEntry(Rect rowRect, EmoteEntry entry, bool alternate) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_021f: 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_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) if (entry == null) { return; } if (alternate) { DrawSolid(rowRect, new Color(1f, 1f, 1f, 0.035f)); } float num = ((Rect)(ref rowRect)).x + 4f; float num2 = ((Rect)(ref rowRect)).y + 2f; float num3 = ((Rect)(ref rowRect)).height - 4f; float num4 = ((Rect)(ref rowRect)).xMax - 4f; Rect val = default(Rect); ((Rect)(ref val))..ctor(num, num2, num3, num3); GUI.Box(val, GUIContent.none); DrawSprite(entry.Icon, Inset(val, 2f)); num = ((Rect)(ref val)).xMax + 6f; float num5 = 50f; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num4 - num5, num2, num5, num3); num4 = ((Rect)(ref val2)).x - 4f; float num6 = 50f; Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(num4 - num6, num2, num6, num3); num4 = ((Rect)(ref val3)).x - 4f; Rect zero = Rect.zero; if (EmoteDeckPlugin.CfgEnableFavorites.Value) { ((Rect)(ref zero))..ctor(num4 - 28f, num2, 28f, num3); num4 = ((Rect)(ref zero)).x - 4f; } float num7 = Mathf.Min(76f, Mathf.Max(54f, (num4 - num) * 0.18f)); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(num4 - num7, num2, num7, num3); num4 = ((Rect)(ref val4)).x - 6f; float num8 = Mathf.Min(118f, Mathf.Max(78f, (num4 - num) * 0.34f)); Rect val5 = default(Rect); ((Rect)(ref val5))..ctor(num, num2, num8, num3); num = ((Rect)(ref val5)).xMax + 6f; Rect val6 = default(Rect); ((Rect)(ref val6))..ctor(num, num2, Mathf.Max(40f, num4 - num), num3); GUI.Label(val5, Trim(entry.PackageId, Mathf.Max(8, Mathf.FloorToInt(((Rect)(ref val5)).width / 6.5f))), _smallLabelStyle); GUI.Label(val6, Trim(entry.DisplayName, Mathf.Max(8, Mathf.FloorToInt(((Rect)(ref val6)).width / 6.5f))), _smallLabelStyle); GUI.Label(val4, Trim(entry.Source, Mathf.Max(6, Mathf.FloorToInt(((Rect)(ref val4)).width / 6.5f))), _smallLabelStyle); if (EmoteDeckPlugin.CfgEnableFavorites.Value) { string text = (_plugin.IsFavorite(entry.Key) ? "★" : "☆"); if (GUI.Button(zero, text)) { _plugin.ToggleFavorite(entry); SetStatus((_plugin.IsFavorite(entry.Key) ? "Favorited " : "Unfavorited ") + entry.DisplayName + "."); } } if (GUI.Button(val3, "Set")) { int editingSlot = _editingSlot; _plugin.SetSlotKey(editingSlot, entry.Key); SetStatus("Slot " + (editingSlot + 1) + " set to " + entry.DisplayName + "."); AdvanceEditingSlotAfterSet(); } if (GUI.Button(val2, "Play")) { _plugin.TryPlayEmote(entry, out var status); SetStatus(status); } } private string SlotSummary(int slot) { if (_plugin.TryGetSlotEmote(slot, out var entry)) { return entry.PackageId + ":" + entry.DisplayName; } string slotKey = _plugin.GetSlotKey(slot); if (string.IsNullOrEmpty(slotKey)) { return ""; } return "Missing: " + slotKey; } private void DrawFiltersTab() { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Show All", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { _plugin.ShowAllPackages(); } if (GUILayout.Button("Hide All", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { _plugin.HideAllPackages(); } if (GUILayout.Button("Rescan", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { _plugin.RefreshEmoteRegistry(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(4f); GUILayout.Label("Choose which packs appear in Picker and Grid. Hidden packs stay assigned in slots.", Array.Empty()); bool flag = false; try { _filterScroll = GUILayout.BeginScrollView(_filterScroll, Array.Empty()); flag = true; for (int i = 0; i < _plugin.PackageIds.Count; i++) { string text = _plugin.PackageIds[i]; bool flag2 = _plugin.IsPackageVisible(text); bool flag3 = GUILayout.Toggle(flag2, text + " (" + CountEmotesInPackage(text) + ")", Array.Empty()); if (flag3 != flag2) { _plugin.SetPackageVisible(text, flag3); } } } finally { if (flag) { GUILayout.EndScrollView(); } } } private void DrawSettingsTab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) bool flag = false; try { _settingsScroll = GUILayout.BeginScrollView(_settingsScroll, Array.Empty()); flag = true; bool value = EmoteDeckPlugin.CfgEnablePages.Value; GUILayout.Label(value ? "Slots on each page" : "Slots", Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(value ? "Each page" : "Count", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(72f) }); int activeSlotCount = _plugin.GetActiveSlotCount(); float num = GUILayout.HorizontalSlider((float)activeSlotCount, 1f, 100f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) }); int num2 = Mathf.Clamp(Mathf.RoundToInt(num), 1, 100); if (num2 != activeSlotCount) { EmoteDeckPlugin.CfgActiveSlotCount.Value = num2; _slotCountText = num2.ToString(CultureInfo.InvariantCulture); _plugin.QueueConfigSave(); } GUILayout.Label(num2.ToString(CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(34f) }); _slotCountText = GUILayout.TextField(_slotCountText ?? string.Empty, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(48f) }); if (GUILayout.Button("Apply", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) }) && int.TryParse(_slotCountText, out var result)) { result = Mathf.Clamp(result, 1, 100); EmoteDeckPlugin.CfgActiveSlotCount.Value = result; _slotCountText = result.ToString(CultureInfo.InvariantCulture); _plugin.SavePluginConfig(); SetStatus(EmoteDeckPlugin.CfgEnablePages.Value ? ("Slots per page set to " + result + ".") : ("Slot count set to " + result + ".")); } GUILayout.EndHorizontal(); if (EmoteDeckPlugin.CfgEnablePages.Value) { GUILayout.Label("Across pages: " + _plugin.GetTotalDeckSlotCapacity() + " slots (" + _plugin.GetActiveSlotCount() + " on each page x " + _plugin.GetPageCount() + " pages).", Array.Empty()); GUILayout.Label("Each page keeps its own slots. The 100 limit is per page.", Array.Empty()); } GUILayout.Space(8f); GUILayout.Label("Extra tools", Array.Empty()); bool flag2 = GUILayout.Toggle(EmoteDeckPlugin.CfgEnablePages.Value, "Enable pages", Array.Empty()); if (flag2 != EmoteDeckPlugin.CfgEnablePages.Value) { EmoteDeckPlugin.CfgEnablePages.Value = flag2; _plugin.SavePluginConfig(); _gridMode = GridMode.Deck; } if (EmoteDeckPlugin.CfgEnablePages.Value) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Page count", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); int pageCount = _plugin.GetPageCount(); int num3 = Mathf.Clamp(Mathf.RoundToInt(GUILayout.HorizontalSlider((float)pageCount, 1f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) })), 1, 10); GUILayout.Label(num3.ToString(CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f) }); if (num3 != pageCount) { EmoteDeckPlugin.CfgPageCount.Value = num3; if (_plugin.GetCurrentPageIndex() >= num3) { _plugin.SetCurrentPageIndex(num3 - 1); } _plugin.QueueConfigSave(); } GUILayout.EndHorizontal(); } bool flag3 = GUILayout.Toggle(EmoteDeckPlugin.CfgEnableRecent.Value, "Enable Recent", Array.Empty()); if (flag3 != EmoteDeckPlugin.CfgEnableRecent.Value) { EmoteDeckPlugin.CfgEnableRecent.Value = flag3; if (!flag3 && _gridMode == GridMode.Recent) { _gridMode = GridMode.Deck; } _plugin.SavePluginConfig(); } if (EmoteDeckPlugin.CfgEnableRecent.Value) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Recent limit", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); int num4 = Mathf.Clamp(EmoteDeckPlugin.CfgRecentLimit.Value, 1, 100); int num5 = Mathf.Clamp(Mathf.RoundToInt(GUILayout.HorizontalSlider((float)num4, 1f, 100f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) })), 1, 100); GUILayout.Label(num5.ToString(CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(36f) }); if (num5 != num4) { EmoteDeckPlugin.CfgRecentLimit.Value = num5; while (_plugin.RecentKeys.Count > num5) { _plugin.RecentKeys.RemoveAt(_plugin.RecentKeys.Count - 1); } EmoteDeckPlugin.CfgRecentKeys.Value = string.Join(";", _plugin.RecentKeys.ToArray()); _plugin.QueueConfigSave(); } GUILayout.EndHorizontal(); GUILayout.Label("Recent: " + _plugin.RecentKeys.Count, Array.Empty()); } bool flag4 = GUILayout.Toggle(EmoteDeckPlugin.CfgEnableFavorites.Value, "Enable Favorites", Array.Empty()); if (flag4 != EmoteDeckPlugin.CfgEnableFavorites.Value) { EmoteDeckPlugin.CfgEnableFavorites.Value = flag4; if (!flag4 && _gridMode == GridMode.Favorites) { _gridMode = GridMode.Deck; } _plugin.SavePluginConfig(); } if (EmoteDeckPlugin.CfgEnableFavorites.Value) { GUILayout.Label("Favorites: " + _plugin.FavoriteKeys.Count, Array.Empty()); } GUILayout.Space(8f); GUILayout.Label("Emotes", Array.Empty()); GUILayout.Label("Emote Wheel: " + (_plugin.EmoteWheelBridgeAvailable ? "Found" : "Not found") + " Wheel: " + _plugin.LastWheelEmoteCount + " Game: " + _plugin.LastNativeEmoteCount, Array.Empty()); GUILayout.Label("Total: " + _plugin.AllEmotes.Count + " Packs: " + _plugin.PackageIds.Count, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Rescan", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { _plugin.RefreshEmoteRegistry(); SetStatus("Rescan done. " + _plugin.AllEmotes.Count + " emotes found."); } bool flag5 = GUILayout.Toggle(EmoteDeckPlugin.CfgAutoRescanEnabled.Value, "Auto rescan", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); if (flag5 != EmoteDeckPlugin.CfgAutoRescanEnabled.Value) { EmoteDeckPlugin.CfgAutoRescanEnabled.Value = flag5; _plugin.SavePluginConfig(); } GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.Label("Grid", Array.Empty()); DrawGridViewDropdownGUILayout(); DrawGridMouseModeDropdownGUILayout(); DrawAutoIntSlider("Columns", EmoteDeckPlugin.CfgGridColumns, EmoteDeckPlugin.CfgGridAutoColumns, 1, 30); if (GetGridViewMode() != "Names") { DrawAutoFloatSlider("Icon Shape", EmoteDeckPlugin.CfgGridIconAspect, EmoteDeckPlugin.CfgGridAutoIconAspect, 0.5f, 2f, "F2"); } else { GUILayout.Label("Names only does not use icon shape.", Array.Empty()); } bool flag6 = GUILayout.Toggle(EmoteDeckPlugin.CfgCloseGridAfterEmote.Value, "Close grid after emote", Array.Empty()); if (flag6 != EmoteDeckPlugin.CfgCloseGridAfterEmote.Value) { EmoteDeckPlugin.CfgCloseGridAfterEmote.Value = flag6; MaintainInputState(); _plugin.SavePluginConfig(); } bool flag7 = GUILayout.Toggle(EmoteDeckPlugin.CfgIncludeNativeVanillaWhenWheelBaseExists.Value, "Also show game /emote commands with Emote Wheel Base", Array.Empty()); if (flag7 != EmoteDeckPlugin.CfgIncludeNativeVanillaWhenWheelBaseExists.Value) { EmoteDeckPlugin.CfgIncludeNativeVanillaWhenWheelBaseExists.Value = flag7; _plugin.RefreshEmoteRegistry(); _plugin.SavePluginConfig(); } GUILayout.Space(8f); GUILayout.Label("Picker", Array.Empty()); bool flag8 = GUILayout.Toggle(EmoteDeckPlugin.CfgPickerAutoAdvanceSlot.Value, "Move to next slot after Set", Array.Empty()); if (flag8 != EmoteDeckPlugin.CfgPickerAutoAdvanceSlot.Value) { EmoteDeckPlugin.CfgPickerAutoAdvanceSlot.Value = flag8; _plugin.SavePluginConfig(); } bool flag9 = GUILayout.Toggle(EmoteDeckPlugin.CfgPickerHideAssigned.Value, "Hide assigned emotes", Array.Empty()); if (flag9 != EmoteDeckPlugin.CfgPickerHideAssigned.Value) { EmoteDeckPlugin.CfgPickerHideAssigned.Value = flag9; _pickerCacheSearch = null; _plugin.SavePluginConfig(); } GUILayout.Space(8f); GUILayout.Label("Keybinds", Array.Empty()); DrawKeybindRow("Main window", EmoteDeckPlugin.CfgMainWindowKey, required: true, BindTarget.MainWindow, (KeyCode)121); DrawKeybindRow("Grid window", EmoteDeckPlugin.CfgGridWindowKey, required: false, BindTarget.GridWindow, (KeyCode)116); GUILayout.Space(8f); bool flag10 = GUILayout.Toggle(EmoteDeckPlugin.CfgBlockGameInputWhileMainWindowOpen.Value, "Block game input while main window is open", Array.Empty()); if (flag10 != EmoteDeckPlugin.CfgBlockGameInputWhileMainWindowOpen.Value) { EmoteDeckPlugin.CfgBlockGameInputWhileMainWindowOpen.Value = flag10; UpdateInputBlockerState(); MaintainInputState(); _plugin.SavePluginConfig(); } bool flag11 = GUILayout.Toggle(EmoteDeckPlugin.CfgBlockGameInputWhileGridWindowOpen.Value, "Block game input while grid window is open", Array.Empty()); if (flag11 != EmoteDeckPlugin.CfgBlockGameInputWhileGridWindowOpen.Value) { EmoteDeckPlugin.CfgBlockGameInputWhileGridWindowOpen.Value = flag11; UpdateInputBlockerState(); MaintainInputState(); _plugin.SavePluginConfig(); } bool flag12 = GUILayout.Toggle(EmoteDeckPlugin.CfgDebugLogging.Value, "Debug logging", Array.Empty()); if (flag12 != EmoteDeckPlugin.CfgDebugLogging.Value) { EmoteDeckPlugin.CfgDebugLogging.Value = flag12; _plugin.SavePluginConfig(); } } finally { if (flag) { GUILayout.EndScrollView(); } } } private void DrawHelpTab() { GUILayout.Label("About", Array.Empty()); GUILayout.Label("Open a larger emote grid, make pages, and keep favorites.", Array.Empty()); GUILayout.Space(6f); GUILayout.Label("Compat", Array.Empty()); GUILayout.Label("- Emote Wheel: custom packs show here when available.", Array.Empty()); GUILayout.Label("- No Emote Wheel: game emotes only.", Array.Empty()); GUILayout.Space(6f); GUILayout.Label("Controls", Array.Empty()); GUILayout.Label("- Y: main window by default.", Array.Empty()); GUILayout.Label("- T: grid window by default.", Array.Empty()); GUILayout.Label("- Pages, Recent, and Favorites can be turned on separately in Settings.", Array.Empty()); GUILayout.Label("- Grid view changes how dense the grid is: Standard, Compact, Mini, or Names only.", Array.Empty()); GUILayout.Label("- Pages keep their own slots. 24 slots with 3 pages means 72 places.", Array.Empty()); GUILayout.Label("- Binding: Esc cancels. Backspace clears optional keys. Main window key cannot be cleared.", Array.Empty()); GUILayout.Label("- Drag the header to move. Drag the lower-right corner to resize.", Array.Empty()); } private void DrawGridContents(float viewW, float viewH) { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) NormalizeGridMode(); List list = null; if (_gridMode == GridMode.Recent) { _plugin.BuildEntryListFromKeys(_plugin.RecentKeys, _specialGridEntries); list = _specialGridEntries; } else if (_gridMode == GridMode.Favorites) { _plugin.BuildEntryListFromKeys(_plugin.FavoriteKeys, _specialGridEntries); list = _specialGridEntries; } float num = DrawGridToolbar(viewW); float num2 = Mathf.Max(40f, viewH - num); int num3 = list?.Count ?? _plugin.GetActiveSlotCount(); GridMetrics metrics = CalculateGridMetrics(viewW, num2, num3); if (metrics.Columns < 1) { metrics.Columns = 1; } Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, num, viewW, num2); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, Mathf.Max(1f, viewW - 18f), Mathf.Max(num2, metrics.TotalContentH)); bool flag = false; try { _gridScroll = GUI.BeginScrollView(val, _gridScroll, val2, false, true); flag = true; int num4 = Mathf.Clamp(Mathf.FloorToInt(_gridScroll.y / metrics.RowH) - 1, 0, Math.Max(0, metrics.Rows - 1)); int num5 = Mathf.Clamp(Mathf.CeilToInt((_gridScroll.y + num2) / metrics.RowH) + 1, 0, Math.Max(0, metrics.Rows - 1)); Rect cellRect = default(Rect); for (int i = num4; i <= num5; i++) { for (int j = 0; j < metrics.Columns; j++) { int num6 = i * metrics.Columns + j; if (num6 >= num3) { break; } float num7 = (float)j * (metrics.CellW + metrics.Spacing); float num8 = (float)i * metrics.RowH; ((Rect)(ref cellRect))..ctor(num7, num8, metrics.CellW, metrics.CellH); DrawGridCell(num6, cellRect, metrics, list); } } } finally { if (flag) { GUI.EndScrollView(); } } } private void NormalizeGridMode() { if (_gridMode == GridMode.Recent && !EmoteDeckPlugin.CfgEnableRecent.Value) { _gridMode = GridMode.Deck; } if (_gridMode == GridMode.Favorites && !EmoteDeckPlugin.CfgEnableFavorites.Value) { _gridMode = GridMode.Deck; } } private float DrawGridToolbar(float viewW) { //IL_0057: 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_0108: 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_0298: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) if (!EmoteDeckPlugin.CfgEnableRecent.Value && !EmoteDeckPlugin.CfgEnableFavorites.Value && !EmoteDeckPlugin.CfgEnablePages.Value) { return 0f; } float result = 28f; float num = 0f; if (GUI.Toggle(new Rect(num, 2f, 58f, 22f), _gridMode == GridMode.Deck, "Deck", GUI.skin.button)) { _gridMode = GridMode.Deck; } num += 62f; if (EmoteDeckPlugin.CfgEnableRecent.Value) { if (GUI.Toggle(new Rect(num, 2f, 68f, 22f), _gridMode == GridMode.Recent, "Recent", GUI.skin.button)) { _gridMode = GridMode.Recent; } num += 72f; } if (EmoteDeckPlugin.CfgEnableFavorites.Value) { if (GUI.Toggle(new Rect(num, 2f, 82f, 22f), _gridMode == GridMode.Favorites, "Favorites", GUI.skin.button)) { _gridMode = GridMode.Favorites; } num += 86f; } if (_gridMode == GridMode.Deck && EmoteDeckPlugin.CfgEnablePages.Value) { int currentPageIndex = _plugin.GetCurrentPageIndex(); int pageCount = _plugin.GetPageCount(); GUI.enabled = currentPageIndex > 0; if (GUI.Button(new Rect(num, 2f, 26f, 22f), "<")) { _plugin.MoveToPreviousPage(); } GUI.enabled = true; num += 30f; GUI.Label(new Rect(num, 4f, 84f, 18f), "Page " + (currentPageIndex + 1) + " / " + pageCount, _smallLabelStyle); num += 86f; GUI.enabled = currentPageIndex + 1 < pageCount; if (GUI.Button(new Rect(num, 2f, 26f, 22f), ">")) { _plugin.MoveToNextPage(); } GUI.enabled = true; num += 32f; } else if (_gridMode == GridMode.Recent) { GUI.Label(new Rect(num + 4f, 4f, Mathf.Max(40f, viewW - num - 10f), 18f), _plugin.RecentKeys.Count + " recent", _smallLabelStyle); } else if (_gridMode == GridMode.Favorites) { GUI.Label(new Rect(num + 4f, 4f, Mathf.Max(40f, viewW - num - 10f), 18f), _plugin.FavoriteKeys.Count + " favorites", _smallLabelStyle); } return result; } private GridMetrics CalculateGridMetrics(float viewW, float viewH, int activeCount) { GridMetrics result = default(GridMetrics); string gridViewMode = GetGridViewMode(); result.NamesOnly = gridViewMode == "Names"; result.ShowIcon = !result.NamesOnly; result.ShowLabel = gridViewMode == "Standard" || gridViewMode == "Compact"; float num = 86f; int num2 = 12; float num3 = 34f; result.Spacing = 6f; result.LabelH = 18f; switch (gridViewMode) { case "Compact": num = 52f; num2 = 24; num3 = 30f; result.Spacing = 4f; result.LabelH = 15f; break; case "Mini": num = 38f; num2 = 30; num3 = 26f; result.Spacing = 4f; result.LabelH = 0f; break; case "Names": num = 92f; num2 = 24; num3 = 58f; result.Spacing = 4f; result.LabelH = 0f; break; } float num4 = Mathf.Max(80f, viewW - 18f); int columns = Mathf.Clamp(EmoteDeckPlugin.CfgGridColumns.Value, 1, 30); if (EmoteDeckPlugin.CfgGridAutoColumns.Value) { result.Columns = Mathf.Clamp(Mathf.FloorToInt((num4 + result.Spacing) / (num + result.Spacing)), 1, num2); if (activeCount > 0) { result.Columns = Mathf.Min(result.Columns, activeCount); } } else { result.Columns = columns; } if (result.Columns < 1) { result.Columns = 1; } result.CellW = Mathf.Max(num3, Mathf.Floor((num4 - result.Spacing * (float)(result.Columns - 1)) / (float)result.Columns)); if (result.NamesOnly) { result.CellH = 24f; } else { float num5 = (EmoteDeckPlugin.CfgGridAutoIconAspect.Value ? 1f : Mathf.Clamp(EmoteDeckPlugin.CfgGridIconAspect.Value, 0.5f, 2f)); result.CellH = Mathf.Max(num3, Mathf.Floor(result.CellW / Mathf.Max(0.05f, num5))); if (!EmoteDeckPlugin.CfgGridAutoIconAspect.Value) { result.CellH = Mathf.Min(result.CellH, Mathf.Max(42f, viewH * 0.65f)); } if (gridViewMode == "Mini") { result.CellH = Mathf.Min(result.CellH, 42f); } } result.RowH = result.CellH + result.LabelH + result.Spacing; result.Rows = ((activeCount > 0) ? Mathf.CeilToInt((float)activeCount / (float)result.Columns) : 0); result.TotalContentH = Mathf.Max(viewH, (float)result.Rows * result.RowH + 4f); return result; } private void DrawGridCell(int slotIndex, Rect cellRect, GridMetrics metrics, List specialEntries) { //IL_0177: 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: Expected O, but got Unknown //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) EmoteEntry entry = null; bool flag; if (specialEntries != null) { flag = slotIndex >= 0 && slotIndex < specialEntries.Count; if (flag) { entry = specialEntries[slotIndex]; } } else { flag = _plugin.TryGetSlotEmote(slotIndex, out entry); } bool flag2 = flag && entry != null; bool flag3 = flag2 && _plugin.IsPackageVisible(entry.PackageId); string s = (flag2 ? entry.DisplayName : "Empty"); string text = (flag2 ? (entry.PackageId + ":" + entry.DisplayName) : "Empty"); if (metrics.NamesOnly) { string text2 = (flag2 ? Trim(entry.DisplayName, Mathf.Max(6, Mathf.FloorToInt(((Rect)(ref cellRect)).width / 6.2f))) : "Empty"); bool enabled = GUI.enabled; if (!flag2) { GUI.enabled = false; } if (GUI.Button(cellRect, new GUIContent(text2, text))) { PlayGridCell(slotIndex, flag, entry); } GUI.enabled = enabled; if (!flag2) { DrawEmptyCellOverlay(cellRect); } else if (!flag3) { DrawSolid(cellRect, new Color(0.15f, 0.15f, 0.15f, 0.45f)); } return; } bool enabled2 = GUI.enabled; if (!flag2) { GUI.enabled = false; } if (GUI.Button(cellRect, new GUIContent("", text))) { PlayGridCell(slotIndex, flag, entry); } GUI.enabled = enabled2; if (flag2) { if (!flag3) { DrawSolid(cellRect, new Color(0.15f, 0.15f, 0.15f, 0.55f)); } DrawSprite(entry.Icon, Inset(cellRect, metrics.ShowLabel ? 4f : 3f)); if ((Object)(object)entry.Icon == (Object)null) { GUI.Label(Inset(cellRect, 4f), Trim(entry.DisplayName, Mathf.Max(4, Mathf.FloorToInt(((Rect)(ref cellRect)).width / 6.5f))), _centerLabelStyle); } if (EmoteDeckPlugin.CfgEnableFavorites.Value && _plugin.IsFavorite(entry.Key) && ((Rect)(ref cellRect)).width >= 34f) { GUI.Label(new Rect(((Rect)(ref cellRect)).xMax - 18f, ((Rect)(ref cellRect)).y + 2f, 16f, 16f), "★", _centerLabelStyle); } } else { DrawEmptyCellOverlay(cellRect); DrawDimLabel(cellRect, "Empty"); } if (metrics.ShowLabel && metrics.LabelH > 0f) { Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref cellRect)).x, ((Rect)(ref cellRect)).yMax + 1f, ((Rect)(ref cellRect)).width, metrics.LabelH); if (flag2) { GUI.Label(val, Trim(s, Mathf.Max(8, Mathf.FloorToInt(((Rect)(ref cellRect)).width / 6.5f))), _centerLabelStyle); } else { DrawDimLabel(val, "Empty"); } } } private void DrawEmptyCellOverlay(Rect rect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) DrawSolid(rect, new Color(0f, 0f, 0f, 0.32f)); } private void DrawDimLabel(Rect rect, string text) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(color.r, color.g, color.b, color.a * 0.55f); GUI.Label(rect, text, _centerLabelStyle); GUI.color = color; } private void PlayGridCell(int slotIndex, bool assigned, EmoteEntry entry) { if (assigned && entry != null) { _plugin.TryPlayEmote(entry, out var status); SetStatus(status); if (EmoteDeckPlugin.CfgCloseGridAfterEmote.Value) { CloseGridWindow(); } } else { SetStatus("Slot " + (slotIndex + 1) + " is empty."); } } private string GetGridViewMode() { string text = EmoteDeckPlugin.NormalizeGridViewModeValue(EmoteDeckPlugin.CfgGridViewMode.Value); if (text != EmoteDeckPlugin.CfgGridViewMode.Value) { EmoteDeckPlugin.CfgGridViewMode.Value = text; } return text; } private void SetGridViewMode(string mode) { //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) mode = EmoteDeckPlugin.NormalizeGridViewModeValue(mode); if (EmoteDeckPlugin.CfgGridViewMode.Value != mode) { EmoteDeckPlugin.CfgGridViewMode.Value = mode; _gridScroll = Vector2.zero; _plugin.SavePluginConfig(); } } private string GetGridMouseMode() { string text = EmoteDeckPlugin.NormalizeGridMouseModeValue(EmoteDeckPlugin.CfgGridMouseMode.Value); if (text != EmoteDeckPlugin.CfgGridMouseMode.Value) { EmoteDeckPlugin.CfgGridMouseMode.Value = text; } return text; } private void SetGridMouseMode(string mode) { mode = EmoteDeckPlugin.NormalizeGridMouseModeValue(mode); if (EmoteDeckPlugin.CfgGridMouseMode.Value != mode) { EmoteDeckPlugin.CfgGridMouseMode.Value = mode; _plugin.SavePluginConfig(); MaintainInputState(); } } private void DrawGridViewDropdownGUILayout() { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Grid view", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); if (GUILayout.Button(EmoteDeckPlugin.GridViewModeLabel(GetGridViewMode()) + " v", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { _settingsGridViewDropdownOpen = !_settingsGridViewDropdownOpen; } GUILayout.EndHorizontal(); if (_settingsGridViewDropdownOpen) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(100f); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); DrawGridViewOptionGUILayout("Standard"); DrawGridViewOptionGUILayout("Compact"); DrawGridViewOptionGUILayout("Mini"); DrawGridViewOptionGUILayout("Names"); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } } private void DrawGridViewOptionGUILayout(string mode) { string text = ((GetGridViewMode() == EmoteDeckPlugin.NormalizeGridViewModeValue(mode)) ? (EmoteDeckPlugin.GridViewModeLabel(mode) + " *") : EmoteDeckPlugin.GridViewModeLabel(mode)); if (GUILayout.Button(text, Array.Empty())) { SetGridViewMode(mode); _settingsGridViewDropdownOpen = false; } } private void DrawGridViewDropdown(Rect rect, bool settings) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) bool flag = (settings ? _settingsGridViewDropdownOpen : _gridViewDropdownOpen); if (GUI.Button(rect, EmoteDeckPlugin.GridViewModeLabel(GetGridViewMode()) + " v")) { flag = !flag; if (settings) { _settingsGridViewDropdownOpen = flag; if (flag) { _settingsGridMouseModeDropdownOpen = false; } } else { _gridViewDropdownOpen = flag; if (flag) { _gridMouseModeDropdownOpen = false; } } } if (flag) { float num = ((Rect)(ref rect)).yMax + 2f; DrawGridViewOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Standard", settings); num += 22f; DrawGridViewOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Compact", settings); num += 22f; DrawGridViewOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Mini", settings); num += 22f; DrawGridViewOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Names", settings); } } private void DrawGridViewOptionRect(Rect rect, string mode, bool settings) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) string text = ((GetGridViewMode() == EmoteDeckPlugin.NormalizeGridViewModeValue(mode)) ? (EmoteDeckPlugin.GridViewModeLabel(mode) + " *") : EmoteDeckPlugin.GridViewModeLabel(mode)); if (GUI.Button(rect, text)) { SetGridViewMode(mode); if (settings) { _settingsGridViewDropdownOpen = false; } else { _gridViewDropdownOpen = false; } } } private void DrawGridMouseModeDropdownGUILayout() { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Mouse mode", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); if (GUILayout.Button(EmoteDeckPlugin.GridMouseModeLabel(GetGridMouseMode()) + " v", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { _settingsGridMouseModeDropdownOpen = !_settingsGridMouseModeDropdownOpen; } GUILayout.EndHorizontal(); if (_settingsGridMouseModeDropdownOpen) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Space(100f); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); DrawGridMouseModeOptionGUILayout("Auto"); DrawGridMouseModeOptionGUILayout("Always"); DrawGridMouseModeOptionGUILayout("Off"); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } GUILayout.Label("Auto unlocks only when Close grid after emote is on.", Array.Empty()); } private void DrawGridMouseModeOptionGUILayout(string mode) { string text = ((GetGridMouseMode() == EmoteDeckPlugin.NormalizeGridMouseModeValue(mode)) ? (EmoteDeckPlugin.GridMouseModeLabel(mode) + " *") : EmoteDeckPlugin.GridMouseModeLabel(mode)); if (GUILayout.Button(text, Array.Empty())) { SetGridMouseMode(mode); _settingsGridMouseModeDropdownOpen = false; } } private void DrawGridMouseModeDropdown(Rect rect, bool settings) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) bool flag = (settings ? _settingsGridMouseModeDropdownOpen : _gridMouseModeDropdownOpen); if (GUI.Button(rect, EmoteDeckPlugin.GridMouseModeLabel(GetGridMouseMode()) + " v")) { flag = !flag; if (settings) { _settingsGridMouseModeDropdownOpen = flag; if (flag) { _settingsGridViewDropdownOpen = false; } } else { _gridMouseModeDropdownOpen = flag; if (flag) { _gridViewDropdownOpen = false; } } } if (flag) { float num = ((Rect)(ref rect)).yMax + 2f; DrawGridMouseModeOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Auto", settings); num += 22f; DrawGridMouseModeOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Always", settings); num += 22f; DrawGridMouseModeOptionRect(new Rect(((Rect)(ref rect)).x, num, ((Rect)(ref rect)).width, 22f), "Off", settings); } } private void DrawGridMouseModeOptionRect(Rect rect, string mode, bool settings) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) string text = ((GetGridMouseMode() == EmoteDeckPlugin.NormalizeGridMouseModeValue(mode)) ? (EmoteDeckPlugin.GridMouseModeLabel(mode) + " *") : EmoteDeckPlugin.GridMouseModeLabel(mode)); if (GUI.Button(rect, text)) { SetGridMouseMode(mode); if (settings) { _settingsGridMouseModeDropdownOpen = false; } else { _gridMouseModeDropdownOpen = false; } } } private void DrawAutoIntSlider(string label, ConfigEntry cfg, ConfigEntry autoCfg, int min, int max) { GUILayout.BeginHorizontal(Array.Empty()); bool value = autoCfg.Value; bool flag = GUILayout.Toggle(value, "Auto", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) }); if (flag != value) { autoCfg.Value = flag; _plugin.SavePluginConfig(); } GUI.enabled = !autoCfg.Value; GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(86f) }); int value2 = cfg.Value; int num = Mathf.Clamp(Mathf.RoundToInt(GUILayout.HorizontalSlider((float)value2, (float)min, (float)max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) })), min, max); GUILayout.Label(autoCfg.Value ? "auto" : num.ToString(CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) }); if (!autoCfg.Value && num != value2) { cfg.Value = num; _plugin.QueueConfigSave(); } GUI.enabled = true; GUILayout.EndHorizontal(); } private void DrawAutoFloatSlider(string label, ConfigEntry cfg, ConfigEntry autoCfg, float min, float max, string fmt) { GUILayout.BeginHorizontal(Array.Empty()); bool value = autoCfg.Value; bool flag = GUILayout.Toggle(value, "Auto", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) }); if (flag != value) { autoCfg.Value = flag; _plugin.SavePluginConfig(); } GUI.enabled = !autoCfg.Value; GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(86f) }); float value2 = cfg.Value; float num = GUILayout.HorizontalSlider(value2, min, max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) }); GUILayout.Label(autoCfg.Value ? "auto" : num.ToString(fmt, CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) }); if (!autoCfg.Value && Mathf.Abs(num - value2) > 0.001f) { cfg.Value = num; _plugin.QueueConfigSave(); } GUI.enabled = true; GUILayout.EndHorizontal(); } private void DrawIntSlider(string label, ConfigEntry cfg, int min, int max) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); int value = cfg.Value; int num = Mathf.Clamp(Mathf.RoundToInt(GUILayout.HorizontalSlider((float)value, (float)min, (float)max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) })), min, max); GUILayout.Label(num.ToString(CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) }); if (num != value) { cfg.Value = num; _plugin.QueueConfigSave(); } GUILayout.EndHorizontal(); } private void DrawFloatSlider(string label, ConfigEntry cfg, float min, float max, string fmt) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); float value = cfg.Value; float num = GUILayout.HorizontalSlider(value, min, max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); GUILayout.Label(num.ToString(fmt, CultureInfo.InvariantCulture), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) }); if (Mathf.Abs(num - value) > 0.001f) { cfg.Value = num; _plugin.QueueConfigSave(); } GUILayout.EndHorizontal(); } private void DrawKeybindRow(string label, ConfigEntry cfg, bool required, BindTarget target, KeyCode reset) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); GUILayout.Label(EmoteDeckPlugin.KeyLabel(cfg.Value), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(88f) }); if (GUILayout.Button((IsCapturingKeyBind && _bindTarget == target) ? "Press a key" : "Rebind", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { StartBind(target); } GUI.enabled = !required; if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }) && !required) { cfg.Value = "None"; _plugin.ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(_plugin); _plugin.SavePluginConfig(); _bindStatus = label + " cleared."; } GUI.enabled = true; if (GUILayout.Button("Reset", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) })) { cfg.Value = ((object)(KeyCode)(ref reset)).ToString(); _plugin.ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(_plugin); _plugin.SavePluginConfig(); _bindStatus = label + " reset to " + ((object)(KeyCode)(ref reset)).ToString() + "."; } GUILayout.EndHorizontal(); } private bool ShouldBlockGameplayInputForOpenWindows() { bool flag = EmoteDeckPlugin.CfgBlockGameInputWhileMainWindowOpen != null && EmoteDeckPlugin.CfgBlockGameInputWhileMainWindowOpen.Value; bool flag2 = EmoteDeckPlugin.CfgBlockGameInputWhileGridWindowOpen != null && EmoteDeckPlugin.CfgBlockGameInputWhileGridWindowOpen.Value; return (_mainOpen && flag) || (_gridOpen && flag2); } private void UpdateInputBlockerState() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) EmoteDeckInputBlocker.SetWindowState(_mainOpen, _mainRect, _gridOpen, _gridRect, ShouldBlockGameplayInputForOpenWindows()); } private void ConsumeScrollWheelInsideLocalWindow(Rect localWindowRect) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (current != null && (int)current.type == 6 && ((Rect)(ref localWindowRect)).Contains(current.mousePosition)) { UseEventIfSafe(current); } } private void ConsumeScrollWheelIfInsideWindow() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (current != null && (int)current.type == 6 && IsMouseOverOpenWindow(current.mousePosition)) { UseEventIfSafe(current); } } private bool IsMouseOverOpenWindow(Vector2 guiMouse) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (_mainOpen && ((Rect)(ref _mainRect)).Contains(guiMouse)) { return true; } if (_gridOpen && ((Rect)(ref _gridRect)).Contains(guiMouse)) { return true; } return false; } private static void UseEventIfSafe(Event e) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 if (e != null && (int)e.type != 7 && (int)e.type != 8 && (int)e.type != 12 && (int)e.type != 11) { e.Use(); } } private void StartBind(BindTarget target) { _bindTarget = target; _bindStartedFrame = Time.frameCount; _bindStatus = "Press a key or mouse button. Esc cancels. Backspace clears optional keys."; GUI.FocusControl((string)null); } private bool HandleKeyBindCapture(Event e) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Invalid comparison between Unknown and I4 //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Invalid comparison between Unknown and I4 //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) if (!IsCapturingKeyBind) { return false; } if (e == null) { return false; } if (Time.frameCount == _bindStartedFrame) { return false; } KeyCode val = (KeyCode)0; bool flag = false; if ((int)e.type == 4) { val = e.keyCode; flag = (int)val > 0; } else if ((int)e.type == 0) { if (e.button >= 2 && e.button <= 6) { val = (KeyCode)(323 + e.button); flag = true; } else if (e.button == 0 || e.button == 1) { _bindStatus = "Left and right mouse are not used for binds."; UseEventIfSafe(e); return true; } } if (!flag) { return false; } if ((int)val == 27) { _bindTarget = BindTarget.None; _bindStartedFrame = -1; _bindStatus = "Canceled."; UseEventIfSafe(e); return true; } if ((int)val == 8) { if (_bindTarget == BindTarget.GridWindow) { EmoteDeckPlugin.CfgGridWindowKey.Value = "None"; _plugin.ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(_plugin); _plugin.SavePluginConfig(); _bindStatus = "Grid window key cleared."; } else { _bindStatus = "Main window key cannot be cleared. Use Reset instead."; } _bindTarget = BindTarget.None; _bindStartedFrame = -1; UseEventIfSafe(e); return true; } if (EmoteDeckPlugin.IsBlockedMouseBindKey(val)) { _bindStatus = "Left and right mouse are not used for binds."; UseEventIfSafe(e); return true; } if (_bindTarget == BindTarget.MainWindow) { EmoteDeckPlugin.CfgMainWindowKey.Value = ((object)(KeyCode)(ref val)).ToString(); } else if (_bindTarget == BindTarget.GridWindow) { EmoteDeckPlugin.CfgGridWindowKey.Value = ((object)(KeyCode)(ref val)).ToString(); } _plugin.ReloadHotkeysFromConfig(); EmoteDeckEasySettingsBridge.SyncButtonsFromConfig(_plugin); _plugin.SuppressHotkeyActivationUntilReleased(val); _plugin.SavePluginConfig(); _bindStatus = "Set to " + EmoteDeckPlugin.KeyLabel(val) + "."; _bindTarget = BindTarget.None; _bindStartedFrame = -1; UseEventIfSafe(e); return true; } private void DrawResizeHandle(Rect r, bool main) { //IL_0001: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) GUI.Label(r, "↘", _centerLabelStyle); Event current = Event.current; if ((int)current.type == 0 && ((Rect)(ref r)).Contains(current.mousePosition)) { if (main) { _mainResizing = true; } else { _gridResizing = true; } _resizeStart = GetGuiMouseScreenPos(); _resizeOrig = (main ? _mainRect : _gridRect); Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; UseEventIfSafe(current); } } private void SaveMainRect() { ClampToScreen(ref _mainRect, 520f, 380f); EmoteDeckPlugin.CfgMainX.Value = ((Rect)(ref _mainRect)).x; EmoteDeckPlugin.CfgMainY.Value = ((Rect)(ref _mainRect)).y; EmoteDeckPlugin.CfgMainW.Value = ((Rect)(ref _mainRect)).width; EmoteDeckPlugin.CfgMainH.Value = ((Rect)(ref _mainRect)).height; } private void SaveGridRect() { ClampToScreen(ref _gridRect, 260f, 160f); EmoteDeckPlugin.CfgGridX.Value = ((Rect)(ref _gridRect)).x; EmoteDeckPlugin.CfgGridY.Value = ((Rect)(ref _gridRect)).y; EmoteDeckPlugin.CfgGridW.Value = ((Rect)(ref _gridRect)).width; EmoteDeckPlugin.CfgGridH.Value = ((Rect)(ref _gridRect)).height; } private int CountVisiblePackages() { int num = 0; for (int i = 0; i < _plugin.PackageIds.Count; i++) { if (_plugin.IsPackageVisible(_plugin.PackageIds[i])) { num++; } } return num; } private int CountEmotesInPackage(string pkg) { int num = 0; for (int i = 0; i < _plugin.AllEmotes.Count; i++) { EmoteEntry emoteEntry = _plugin.AllEmotes[i]; if (emoteEntry != null && string.Equals(emoteEntry.PackageId, pkg, StringComparison.OrdinalIgnoreCase)) { num++; } } return num; } private static bool ContainsIgnoreCase(string haystack, string needle) { if (haystack == null) { haystack = string.Empty; } if (needle == null) { needle = string.Empty; } return haystack.IndexOf(needle, StringComparison.OrdinalIgnoreCase) >= 0; } private static string Trim(string s, int max) { if (string.IsNullOrEmpty(s)) { return string.Empty; } if (s.Length <= max) { return s; } return s.Substring(0, Math.Max(0, max - 3)) + "..."; } private void SetStatus(string msg) { _statusText = msg ?? string.Empty; _statusUntil = Time.unscaledTime + 4f; } private static Rect GetWindowContentRect(Rect windowRect, float headerH, bool reserveResizeCorner) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) float num = (reserveResizeCorner ? 22f : 0f); float num2 = 8f; float num3 = headerH + 6f; float num4 = Mathf.Max(40f, ((Rect)(ref windowRect)).width - 16f - num); float num5 = Mathf.Max(40f, ((Rect)(ref windowRect)).height - headerH - 12f - num); return new Rect(num2, num3, num4, num5); } private static Vector2 GetGuiMouseScreenPos() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) return new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); } private static Rect Inset(Rect r, float pad) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) return new Rect(((Rect)(ref r)).x + pad, ((Rect)(ref r)).y + pad, Mathf.Max(1f, ((Rect)(ref r)).width - pad * 2f), Mathf.Max(1f, ((Rect)(ref r)).height - pad * 2f)); } private static void ClampToScreen(ref Rect r, float minW, float minH) { float num = Mathf.Max(1f, (float)Screen.width); float num2 = Mathf.Max(1f, (float)Screen.height); float num3 = Mathf.Min(minW, num); float num4 = Mathf.Min(minH, num2); ((Rect)(ref r)).width = Mathf.Clamp(((Rect)(ref r)).width, num3, num); ((Rect)(ref r)).height = Mathf.Clamp(((Rect)(ref r)).height, num4, num2); float num5 = Mathf.Max(0f, num - ((Rect)(ref r)).width); float num6 = Mathf.Max(0f, num2 - ((Rect)(ref r)).height); ((Rect)(ref r)).x = Mathf.Clamp(((Rect)(ref r)).x, 0f, num5); ((Rect)(ref r)).y = Mathf.Clamp(((Rect)(ref r)).y, 0f, num6); } private static void DrawSolid(Rect rect, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture); GUI.color = color2; } private static void DrawSprite(Sprite sprite, Rect rect) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)sprite == (Object)null) && !((Object)(object)sprite.texture == (Object)null)) { Rect textureRect = sprite.textureRect; Texture texture = (Texture)(object)sprite.texture; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref textureRect)).x / (float)texture.width, ((Rect)(ref textureRect)).y / (float)texture.height, ((Rect)(ref textureRect)).width / (float)texture.width, ((Rect)(ref textureRect)).height / (float)texture.height); GUI.DrawTextureWithTexCoords(rect, texture, val, true); } } private GUIStyle GetTransparentWindowStyle() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown if (_transparentWindowStyle == null) { _transparentWindowStyle = new GUIStyle(GUI.skin.window); _transparentWindowStyle.normal.background = null; _transparentWindowStyle.onNormal.background = null; _transparentWindowStyle.hover.background = null; _transparentWindowStyle.active.background = null; _transparentWindowStyle.focused.background = null; _transparentWindowStyle.border = new RectOffset(0, 0, 0, 0); _transparentWindowStyle.padding = new RectOffset(0, 0, 0, 0); } return _transparentWindowStyle; } private void EnsureStyles() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown if (_headerStyle == null) { _headerStyle = new GUIStyle(GUI.skin.label); _headerStyle.fontStyle = (FontStyle)1; _headerStyle.alignment = (TextAnchor)3; _headerStyle.normal.textColor = Color.white; } if (_smallLabelStyle == null) { _smallLabelStyle = new GUIStyle(GUI.skin.label); _smallLabelStyle.fontSize = 11; _smallLabelStyle.alignment = (TextAnchor)3; _smallLabelStyle.normal.textColor = Color.white; } if (_centerLabelStyle == null) { _centerLabelStyle = new GUIStyle(GUI.skin.label); _centerLabelStyle.fontSize = 11; _centerLabelStyle.alignment = (TextAnchor)4; _centerLabelStyle.wordWrap = true; _centerLabelStyle.normal.textColor = Color.white; } if (_miniButtonStyle == null) { _miniButtonStyle = new GUIStyle(GUI.skin.button); _miniButtonStyle.fontSize = 11; _miniButtonStyle.padding = new RectOffset(2, 2, 1, 1); } } }