Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RoomTools v0.0.1
BepInEx/plugins/RoomTools.dll
Decompiled 3 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using Photon.Voice.Unity; using RoomTools.Features.Display; using RoomTools.Features.Enemies; using RoomTools.Features.Items; using RoomTools.Features.Players; using RoomTools.Features.Rooms; using RoomTools.Features.Rounds; using RoomTools.Features.Saves; using RoomTools.Features.Settings; using RoomTools.Features.Spawning; using RoomTools.Features.Upgrades; using RoomTools.Features.Vehicles; using RoomTools.Game; using RoomTools.Localization; using RoomTools.Plugin; using RoomTools.UI.Controls; using RoomTools.UI.Controls.Fields; using RoomTools.UI.Menu; using RoomTools.UI.Styling; using Steamworks; using Steamworks.Data; using UnityEngine; using UnityEngine.Events; using UnityEngine.Localization; using UnityEngine.Localization.Settings; using UnityEngine.Localization.Tables; using UnityEngine.SceneManagement; using UnityEngine.TextCore; using UnityEngine.TextCore.Text; using UnityEngine.UIElements; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RoomTools")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a6ee9f8173b2b95e7b1d1feb147c962052b73e7f")] [assembly: AssemblyProduct("RoomTools")] [assembly: AssemblyTitle("RoomTools")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace RoomTools { [BepInPlugin("hongliyuu.roomtools", "RoomTools", "0.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class RoomToolsPlugin : BaseUnityPlugin { private const string PluginId = "hongliyuu.roomtools"; private RoomToolsRuntime? runtime; private void Awake() { runtime = RoomToolsRuntime.Start(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger, ((Component)this).transform, "hongliyuu.roomtools"); SceneManager.activeSceneChanged += OnSceneChanged; } private void LateUpdate() { runtime?.Tick(); } private void OnSceneChanged(Scene previous, Scene current) { runtime?.ResetScene(); } private void OnDestroy() { SceneManager.activeSceneChanged -= OnSceneChanged; runtime?.Dispose(); runtime = null; } } } namespace RoomTools.UI.Styling { internal static class UiStyle { internal const int SmallText = 11; internal const int BodyText = 12; internal const int SectionTitle = 15; internal const int PageTitle = 20; internal const int ControlHeight = 32; private const int ControlRadius = 8; internal static readonly Color Ink = Color32.op_Implicit(new Color32((byte)15, (byte)23, (byte)42, byte.MaxValue)); internal static readonly Color Muted = Color32.op_Implicit(new Color32((byte)71, (byte)85, (byte)105, byte.MaxValue)); internal static readonly Color Surface = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue)); internal static readonly Color WindowBackground = Color32.op_Implicit(new Color32((byte)248, (byte)250, (byte)252, byte.MaxValue)); internal static readonly Color SidebarBackground = Color32.op_Implicit(new Color32((byte)241, (byte)245, (byte)249, byte.MaxValue)); internal static readonly Color Divider = Color32.op_Implicit(new Color32((byte)226, (byte)232, (byte)240, byte.MaxValue)); internal static readonly Color PositiveBackground = Color32.op_Implicit(new Color32((byte)224, (byte)244, (byte)235, byte.MaxValue)); internal static readonly Color Positive = Color32.op_Implicit(new Color32((byte)17, (byte)105, (byte)81, byte.MaxValue)); internal static readonly Color Danger = Color32.op_Implicit(new Color32((byte)155, (byte)42, (byte)52, byte.MaxValue)); internal static readonly Color DangerBackground = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)239, (byte)240, byte.MaxValue)); internal static readonly Color Warning = Color32.op_Implicit(new Color32((byte)139, (byte)66, (byte)14, byte.MaxValue)); internal static readonly Color WarningBackground = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)241, (byte)220, byte.MaxValue)); internal static readonly Color DisabledInk = Color32.op_Implicit(new Color32((byte)100, (byte)116, (byte)139, byte.MaxValue)); internal static readonly Color RedFill = Color32.op_Implicit(new Color32((byte)220, (byte)38, (byte)38, byte.MaxValue)); internal static readonly Color RedHover = Color32.op_Implicit(new Color32((byte)185, (byte)28, (byte)28, byte.MaxValue)); internal static readonly Color RedPressed = Color32.op_Implicit(new Color32((byte)153, (byte)27, (byte)27, byte.MaxValue)); internal static UiTheme Theme { get; set; } = UiTheme.Default; internal static Color Accent => Theme.Accent; internal static Color AccentBackground => Theme.Selection; internal static Color SelectionOutline => Color.Lerp(Divider, Accent, 0.45f); internal static Color AccentHover => Color.Lerp(Theme.Tint, Theme.Accent, 0.16f); internal static Color AccentPressed => Color.Lerp(Theme.Tint, Theme.Accent, 0.27f); internal static Label MakeLabel(string value, int size, 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown Label val = new Label(value) { enableRichText = false, pickingMode = (PickingMode)1 }; ((VisualElement)val).style.fontSize = StyleLength.op_Implicit((float)size); ((VisualElement)val).style.color = StyleColor.op_Implicit(color); return val; } internal static Label MakeStatusBadge() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) Label val = MakeLabel(string.Empty, 11, Muted); Truncate((TextElement)(object)val); ((VisualElement)val).style.alignSelf = StyleEnum<Align>.op_Implicit((Align)1); ((VisualElement)val).style.maxWidth = StyleLength.op_Implicit(Length.Percent(100f)); IStyle style = ((VisualElement)val).style; StyleLength paddingLeft = (((VisualElement)val).style.paddingRight = StyleLength.op_Implicit(5f)); style.paddingLeft = paddingLeft; IStyle style2 = ((VisualElement)val).style; paddingLeft = (((VisualElement)val).style.paddingBottom = StyleLength.op_Implicit(2f)); style2.paddingTop = paddingLeft; Round((VisualElement)(object)val, 4); return val; } internal static Label MakeHeading(string caption, int size = 15) { //IL_0002: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Label obj = MakeLabel(caption, size, Ink); ((VisualElement)obj).style.marginBottom = StyleLength.op_Implicit(8f); ((VisualElement)obj).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1); ((VisualElement)obj).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)0); return obj; } internal static Label MakePageTitle(string caption) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) Label obj = MakeHeading(caption, 20); ((VisualElement)obj).style.flexShrink = StyleFloat.op_Implicit(0f); ((VisualElement)obj).style.marginBottom = StyleLength.op_Implicit(12f); return obj; } internal static VisualElement MakeActionRow() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown VisualElement val = new VisualElement(); val.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2); val.style.flexWrap = StyleEnum<Wrap>.op_Implicit((Wrap)1); val.style.alignItems = StyleEnum<Align>.op_Implicit((Align)2); return val; } internal static VisualElement MakeControlRow(VisualElement parent, string caption, bool first = false) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) VisualElement val = MakeActionRow(); val.style.justifyContent = StyleEnum<Justify>.op_Implicit((Justify)3); val.style.minHeight = StyleLength.op_Implicit(44f); val.style.flexShrink = StyleFloat.op_Implicit(0f); IStyle style = val.style; StyleLength paddingTop = (val.style.paddingBottom = StyleLength.op_Implicit(5f)); style.paddingTop = paddingTop; val.style.borderTopWidth = StyleFloat.op_Implicit((float)((!first) ? 1 : 0)); val.style.borderTopColor = StyleColor.op_Implicit(Divider); Label val3 = MakeLabel(caption, 12, Ink); Truncate((TextElement)(object)val3); ((VisualElement)val3).style.flexShrink = StyleFloat.op_Implicit(0f); ((VisualElement)val3).style.maxWidth = StyleLength.op_Implicit(Length.Percent(100f)); ((VisualElement)val3).style.paddingRight = StyleLength.op_Implicit(12f); ((VisualElement)val3).tooltip = caption; val.Add((VisualElement)(object)val3); parent.Add(val); return val; } internal static void Truncate(TextElement element) { //IL_000b: 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_002d: 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) ((VisualElement)element).style.minWidth = StyleLength.op_Implicit(0f); ((VisualElement)element).style.overflow = StyleEnum<Overflow>.op_Implicit((Overflow)1); ((VisualElement)element).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)1); ((VisualElement)element).style.textOverflow = StyleEnum<TextOverflow>.op_Implicit((TextOverflow)1); } internal static void SetControlEnabled(VisualElement control, bool enabled) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) control.SetEnabled(enabled); control.style.opacity = StyleFloat.op_Implicit(enabled ? 1f : 0.5f); } internal static void Outline(VisualElement element) { //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) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) IStyle style = element.style; StyleFloat val = (style.borderLeftWidth = StyleFloat.op_Implicit(1f)); StyleFloat val3 = (style.borderBottomWidth = val); StyleFloat borderTopWidth = (style.borderRightWidth = val3); style.borderTopWidth = borderTopWidth; SetOutlineColor(element, Divider); } internal static void SetOutlineColor(VisualElement element, Color color) { //IL_0009: 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_000f: 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) IStyle style = element.style; StyleColor val = (style.borderLeftColor = StyleColor.op_Implicit(color)); StyleColor val3 = (style.borderBottomColor = val); StyleColor borderTopColor = (style.borderRightColor = val3); style.borderTopColor = borderTopColor; } internal static void StyleControlFrame(VisualElement control, Color background) { //IL_000b: 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_001c: Unknown result type (might be due to invalid IL or missing references) control.style.height = StyleLength.op_Implicit(32f); control.style.backgroundColor = StyleColor.op_Implicit(background); Round(control, 8); Outline(control); } internal static VisualElement MakeCard() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_000c: 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_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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) VisualElement val = new VisualElement(); val.style.backgroundColor = StyleColor.op_Implicit(Surface); IStyle style = val.style; StyleLength paddingLeft = (val.style.paddingRight = StyleLength.op_Implicit(12f)); style.paddingLeft = paddingLeft; IStyle style2 = val.style; paddingLeft = (val.style.paddingBottom = StyleLength.op_Implicit(10f)); style2.paddingTop = paddingLeft; val.style.marginBottom = StyleLength.op_Implicit(8f); Round(val, 8); Outline(val); return val; } internal static void Round(VisualElement element, int radius) { //IL_0008: 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_002c: 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) element.style.borderTopLeftRadius = StyleLength.op_Implicit((float)radius); element.style.borderTopRightRadius = StyleLength.op_Implicit((float)radius); element.style.borderBottomLeftRadius = StyleLength.op_Implicit((float)radius); element.style.borderBottomRightRadius = StyleLength.op_Implicit((float)radius); } } internal sealed class UiTheme { internal static readonly UiTheme[] Options = new UiTheme[3] { new UiTheme("skyBlue", "themeSkyBlue", Color32.op_Implicit(new Color32((byte)0, (byte)155, (byte)226, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)0, (byte)98, (byte)149, byte.MaxValue))), new UiTheme("jadeGreen", "themeJadeGreen", Color32.op_Implicit(new Color32((byte)36, (byte)157, (byte)120, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)12, (byte)106, (byte)79, byte.MaxValue))), new UiTheme("irisPurple", "themeIrisPurple", Color32.op_Implicit(new Color32((byte)144, (byte)112, (byte)210, byte.MaxValue)), Color32.op_Implicit(new Color32((byte)94, (byte)62, (byte)159, byte.MaxValue))) }; internal static readonly string[] Keys = Options.Select((UiTheme theme) => theme.Key).ToArray(); internal static UiTheme Default => Options[0]; internal string Key { get; } internal string Caption { get; } internal Color Tint { get; } internal Color Accent { get; } internal Color Selection { get; } private UiTheme(string key, string caption, Color tint, Color accent) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Key = key; Caption = caption; Tint = tint; Accent = accent; Selection = Color.Lerp(Color.white, tint, 0.12f); } internal static int IndexOf(string key) { return Math.Max(0, Array.IndexOf(Keys, key)); } } } namespace RoomTools.UI.Menu { internal sealed class RoomToolsMenu : IDisposable { private readonly ConfigFile config; private readonly ManualLogSource logger; private readonly Transform parent; private readonly LoadingStatus loadingStatus; private readonly LateJoining lateJoining; private readonly LabelSettings labelSettings; private readonly EnemyHealthSync enemyHealthSync; private readonly ConfigEntry<KeyboardShortcut> toggleShortcut; private readonly ConfigEntry<KeyboardShortcut> rosterShortcut; private readonly ConfigEntry<bool> rosterShortcutEnabled; private readonly ConfigEntry<string> languagePreference; private readonly ConfigEntry<string> themePreference; private readonly ConfigEntry<int> interfaceScale; private readonly ConfigEntry<bool> showRoomStatus; private readonly List<Func<UiText, (string Caption, string Icon, VisualElement Page)>> pageFactories = new List<Func<UiText, (string, string, VisualElement)>>(); private readonly List<(VisualElement Element, Action? Refresh, Action? Reset, Action? Close)> watchedPages = new List<(VisualElement, Action, Action, Action)>(); private readonly List<PlayerSummary> roster = new List<PlayerSummary>(); private readonly Dictionary<int, string> knownPlayers = new Dictionary<int, string>(); private Room? knownRoom; private RoomToolsWindow? window; private ShortcutCapture shortcutCapture; private PlayersPage playersPage; private RoomPage roomPage; private EnemiesPage enemiesPage; private LoadingPanel loadingPanel; private RoomStatusOverlay roomStatusOverlay; private WorldLabels worldLabels; private MenuPage? menuPage; private float nextRefresh; private bool wasCursorVisible; private CursorLockMode previousCursorLock; private bool loadingCursor; private bool capturedInput; private string? settingsSaveFailure; internal UiText Text { get; private set; } internal bool IsOpen => window?.IsOpen ?? false; internal bool IsEnemyListVisible { get { if (IsOpen) { return ((VisualElement)enemiesPage).panel != null; } return false; } } internal RoomToolsMenu(ConfigFile config, ManualLogSource logger, Transform parent, LoadingStatus loadingStatus, LateJoining lateJoining, LabelSettings labelSettings, EnemyHealthSync enemyHealthSync) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown this.config = config; this.logger = logger; this.parent = parent; this.loadingStatus = loadingStatus; this.lateJoining = lateJoining; this.labelSettings = labelSettings; this.enemyHealthSync = enemyHealthSync; toggleShortcut = config.Bind<KeyboardShortcut>("Input", "ToggleMenu", new KeyboardShortcut((KeyCode)277, Array.Empty<KeyCode>()), "Keyboard shortcut to open or close RoomTools."); rosterShortcut = config.Bind<KeyboardShortcut>("Input", "RoomRoster", new KeyboardShortcut((KeyCode)308, Array.Empty<KeyCode>()), "Hold to show the loading and room player panel during gameplay."); rosterShortcutEnabled = config.Bind<bool>("Input", "RoomRosterEnabled", true, "Allow the shortcut to show the loading and room player panel during gameplay."); languagePreference = config.Bind<string>("Interface", "Language", "auto", new ConfigDescription("RoomTools display language.", (AcceptableValueBase)(object)new AcceptableValueList<string>(UiLanguage.PreferenceIds), Array.Empty<object>())); themePreference = config.Bind<string>("Interface", "Theme", UiTheme.Default.Key, new ConfigDescription("RoomTools interface color scheme.", (AcceptableValueBase)(object)new AcceptableValueList<string>(UiTheme.Keys), Array.Empty<object>())); interfaceScale = config.Bind<int>("Interface", "ScalePercent", 100, new ConfigDescription("RoomTools interface scale in percent.", (AcceptableValueBase)(object)new AcceptableValueList<int>(SettingsPage.ScalePresets), Array.Empty<object>())); showRoomStatus = config.Bind<bool>("Interface", "ShowRoomStatus", false, "Show room status and late join progress on screen."); } internal void AddRoom(ConfigEntry<bool> preventDeletion, ConfigEntry<bool> restartAfterWipe, RoomActivity activity) { AddPage("room", "home", delegate(UiText text, RoomPage? previous) { SaveSettingsPage saves = new SaveSettingsPage(text, preventDeletion, restartAfterWipe); roomPage = new RoomPage(text, logger, (VisualElement)(object)saves, lateJoining, activity, showRoomStatus.Value, SetRoomStatusDisplay, shortcutCapture, rosterShortcut, rosterShortcutEnabled, Notify); roomPage.Tabs.Select(previous?.Tabs.Selected ?? 0); return roomPage; }); } internal void AddPlayers(PlayerActions actions, ReviveRules rules, PlayerBans bans, RoomAdmins admins, RoomActivity activity, PlayerAbilities abilities) { AddPage("players", "user", delegate(UiText text, PageTabs? previous) { playersPage = new PlayersPage(text, actions, bans, activity, admins, abilities, shortcutCapture, Notify); ((CallbackEventHandler)playersPage).RegisterCallback<AttachToPanelEvent>((EventCallback<AttachToPanelEvent>)delegate { InvalidatePlayers(); }, (TrickleDown)0); PlayerAbilitiesPage playerAbilitiesPage = new PlayerAbilitiesPage(text, rules, actions, admins, Notify); BansPage bansPage = new BansPage(text, bans, admins, Notify); Watch((VisualElement)(object)playersPage, null, playersPage.ClearSelection); Watch((VisualElement)(object)playerAbilitiesPage, playerAbilitiesPage.Refresh, playerAbilitiesPage.ResetConfirmation); Watch((VisualElement)(object)bansPage, bansPage.Refresh); return Tabs(text, "players", previous, (text["playersOnline"], (VisualElement)(object)playersPage), (text["playerAbilities"], (VisualElement)(object)playerAbilitiesPage), (text["playersBans"], (VisualElement)(object)bansPage)); }); } internal void AddRound(ConfigEntry<int> stock, ShopDrawRules draw, ManualExtraction extraction, RoomActivity activity) { AddPage("round", "store", delegate(UiText text, RoundPage? previous) { RoundPage roundPage = new RoundPage(text, logger, new ShopPage(text, logger, stock, draw, activity, Notify), extraction, activity, Notify); roundPage.Tabs.Select(previous?.Tabs.Selected ?? 0); Watch((VisualElement)(object)roundPage, roundPage.Refresh, roundPage.Reset); return roundPage; }); } internal void AddEnemies(ConfigEntry<int> multiplier) { AddPage("spawnEnemies", "skull", delegate(UiText text, PageTabs? previous) { enemiesPage = new EnemiesPage(text, multiplier, enemyHealthSync, logger, Notify); SpawnPage spawn = new SpawnPage(text, SpawnCatalog.Kind.Enemies, logger, Notify); Watch((VisualElement)(object)enemiesPage, enemiesPage.Refresh); Watch((VisualElement)(object)spawn, delegate { spawn.Refresh(); }); return Tabs(text, "spawnEnemies", previous, (text["enemyList"], (VisualElement)(object)enemiesPage), (text["spawnMonsters"], (VisualElement)(object)spawn)); }); } internal void AddItems(SceneItemProtection protection, EnemyOrbRules orbs, BatteryRules battery, ChargingStationRules station) { AddPage("items", "treasure", delegate(UiText text, ItemsPage? previous) { ItemsPage page = new ItemsPage(text, config, protection, orbs, battery, station, logger, Notify, previous); Watch((VisualElement)(object)page.SceneList, page.SceneList.Refresh, page.SceneList.Reset); Watch((VisualElement)(object)page.Protection, page.Protection.Refresh); Watch((VisualElement)(object)page.Power, page.Power.Refresh); Watch((VisualElement)(object)page.Spawn, delegate { page.Spawn.Refresh(); }); return page; }); } internal void AddVehicles(VehicleRules vehicleRules, VehicleCargoRules cargoRules, BatteryRules battery, CartCargoScaling scaling) { AddPage("vehicles", "cart", delegate(UiText text, PageTabs? previous) { SceneObjectsList sceneObjectsList = new SceneObjectsList(text, logger, Notify); Watch((VisualElement)(object)sceneObjectsList, sceneObjectsList.Refresh, sceneObjectsList.Reset); SpawnPage spawn = new SpawnPage(text, SpawnCatalog.Kind.Vehicles, logger, Notify); Watch((VisualElement)(object)spawn, delegate { spawn.Refresh(); }); return Tabs(text, "vehicles", previous, (text["sceneVehicles"], (VisualElement)(object)sceneObjectsList), (text["spawnVehicles"], (VisualElement)(object)spawn), (text["vehicleSettings"], (VisualElement)(object)VehicleSettingsPages.Vehicles(text, vehicleRules, cargoRules, battery)), (text["itemCartSettings"], (VisualElement)(object)VehicleSettingsPages.Cart(text, scaling))); }); } internal void AddAppearance(ThirdPersonCamera camera, OutOfBodyCamera outOfBody) { AddPage("appearancePage", "shirt", (UiText text, AppearancePage? _) => new AppearancePage(text, camera, outOfBody, shortcutCapture)); } internal void AddLabels() { AddPage("labelsPage", "eye", delegate(UiText text, PageTabs? previous) { LabelPage labelPage = new LabelPage(text, labelSettings, shortcutCapture, scanning: false); LabelPage labelPage2 = new LabelPage(text, labelSettings, shortcutCapture, scanning: true); Watch((VisualElement)(object)labelPage, null, null, labelPage.CloseColorPickers); Watch((VisualElement)(object)labelPage2, null, null, labelPage2.CloseColorPickers); return Tabs(text, "labelsPage", previous, (text["labelsAlways"], (VisualElement)(object)labelPage), (text["labelsScan"], (VisualElement)(object)labelPage2)); }); } internal void AddUpgrades(TeamUpgrades upgrades, RoomStateSync roomSync, RoomActivity activity) { AddPage("upgrades", "arrow_up", delegate(UiText text, UpgradesPage? _) { UpgradesPage upgradesPage = new UpgradesPage(text, upgrades, roomSync, logger, activity, Notify); Watch((VisualElement)(object)upgradesPage, upgradesPage.Refresh); return upgradesPage; }); } internal void AddCarry() { AddPage("carryTitle", "bag", (UiText text, TeammateCarryPage? _) => new TeammateCarryPage(text)); } internal void AddSettings(ConfigEntry<bool> musicMode, RoomActivity activity) { AddPage("settings", "settings", delegate(UiText text, PageTabs? previous) { SettingsPage item = new SettingsPage(text, toggleShortcut, shortcutCapture, languagePreference, themePreference, interfaceScale, musicMode, delegate(int percent) { window?.SetScale(percent); }, delegate(string key) { settingsSaveFailure = key; }); ActivityPage activityPage = new ActivityPage(text, activity); Watch((VisualElement)(object)activityPage, activityPage.Refresh); return Tabs(text, "settings", previous, (text["settingsGeneral"], (VisualElement)(object)item), (text["activity"], (VisualElement)(object)activityPage)); }); } private void AddPage<T>(string caption, string icon, Func<UiText, T?, T> build) where T : VisualElement { T previous = default(T); pageFactories.Add((UiText text) => (Caption: text[caption], Icon: icon, Page: (VisualElement)(object)(previous = build(text, previous)))); } private void Watch(VisualElement element, Action? refresh = null, Action? reset = null, Action? close = null) { watchedPages.Add((element, refresh, reset, close)); } private static PageTabs Tabs(UiText text, string title, PageTabs? previous, params (string, VisualElement)[] tabs) { PageTabs pageTabs = new PageTabs(text[title], tabs); pageTabs.Select(previous?.Selected ?? 0); return pageTabs; } internal void Initialize() { BuildWindow(UiText.ResolveLanguage(languagePreference.Value), GetTheme()); NativeMenu.IsCapturingShortcut = () => IsOpen && shortcutCapture.IsCapturing; NativeMenu.IsOpeningShortcut = IsOpeningShortcut; } internal void Notify(string message, bool success) { Notify(message, success, duringGameplay: false); } internal void Notify(string message, bool success, bool duringGameplay) { window?.Notify(message, success, duringGameplay); } internal void InvalidatePlayers() { nextRefresh = 0f; } internal void RefreshAppearance() { UiLanguage uiLanguage = UiText.ResolveLanguage(languagePreference.Value); UiTheme theme = GetTheme(); if (uiLanguage != Text.Language || theme != UiStyle.Theme) { BuildWindow(uiLanguage, theme); } string text = settingsSaveFailure; if (text != null) { settingsSaveFailure = null; Notify(Text[text], success: false); } } private UiTheme GetTheme() { return UiTheme.Options[UiTheme.IndexOf(themePreference.Value)]; } private void BuildWindow(UiLanguage language, UiTheme theme) { (Vector2, Vector2, int)? layout = window?.Layout; bool num = window?.IsOpen ?? false; window?.Close(); window?.Dispose(); watchedPages.Clear(); UiStyle.Theme = theme; UiText uiText = (Text = new UiText(language)); UiText text = uiText; shortcutCapture = new ShortcutCapture(text); loadingPanel = new LoadingPanel(text, loadingStatus, rosterShortcut); roomStatusOverlay = new RoomStatusOverlay(text); worldLabels = new WorldLabels(text, labelSettings, enemyHealthSync); window = new RoomToolsWindow(pages: pageFactories.Select((Func<UiText, (string Caption, string Icon, VisualElement Page)> build) => ((string Caption, string Icon, VisualElement Page))build(text)).ToArray(), parent: parent, text: text, loading: loadingPanel, roomStatusOverlay: (VisualElement)(object)roomStatusOverlay, worldLabels: (VisualElement)(object)worldLabels, layout: layout, scalePercent: interfaceScale.Value); window.Closed += OnWindowClosed; NativeMenu.Window = window; if (num) { OpenWindow(); } } internal void Refresh(Room? room) { RefreshRoomStatusOverlay(); if (IsOpen) { RefreshWindow(room); } } private void RefreshWindow(Room? room) { roomPage.Refresh(room); foreach (var watchedPage in watchedPages) { if (watchedPage.Element.panel != null) { watchedPage.Refresh?.Invoke(); } } window.SetRoomStatus(roomPage.StatusText); } internal (bool Gameplay, bool AcceptsGameplayInput) UpdateInput(MenuPage? page, bool refreshRoom) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Invalid comparison between Unknown and I4 RoomToolsWindow roomToolsWindow = window; if (roomToolsWindow.IsOpen && ((Object)(object)menuPage != (Object)(object)page || (NativeMenu.OwnsGameplayInput ? (!NativeMenu.CanOpenInRun()) : (!NativeMenu.IsAvailablePage(page))))) { roomToolsWindow.Close(); } menuPage = page; capturedInput = roomToolsWindow.IsOpen && shortcutCapture.Poll(); if (!capturedInput && !roomToolsWindow.IsEditingText) { KeyboardShortcut value = toggleShortcut.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { if (roomToolsWindow.IsOpen) { roomToolsWindow.Close(); } else if (CanOpenWindow(page)) { OpenWindow(); } } } bool flag = !roomToolsWindow.IsOpen && !Object.op_Implicit((Object)(object)page) && Object.op_Implicit((Object)(object)GameDirector.instance); if (flag) { gameState currentState = GameDirector.instance.currentState; bool flag2 = (((int)currentState == 2 || (int)currentState == 7) ? true : false); flag = flag2; } bool num = flag; bool flag3 = !roomToolsWindow.IsOpen && !Object.op_Implicit((Object)(object)page) && RoomControls.HostRoom != null && lateJoining.Progress.Exists(((Player Player, string Stage, int Seconds) entry) => entry.Stage == "midRunAwaitOutro"); bool expanded = (num || flag3) && rosterShortcutEnabled.Value && loadingPanel.ShortcutHeld() && Object.op_Implicit((Object)(object)RunManager.instance) && Object.op_Implicit((Object)(object)RunManager.instance.levelCurrent) && !SemiFunc.MenuLevel() && SemiFunc.NoTextInputsActive(); loadingPanel.Refresh(RoomControls.CurrentRoom, lateJoining, expanded, Application.isFocused && !roomToolsWindow.IsOpen && !Object.op_Implicit((Object)(object)page), refreshRoom); UpdateLoadingCursor(loadingPanel.Interactive); bool item = num && !loadingCursor && !NativeMenu.BlocksGameInput && !capturedInput && SemiFunc.NoTextInputsActive(); return (Gameplay: num, AcceptsGameplayInput: item); } internal void RefreshWorldLabels(bool gameplay, bool scanPressed) { worldLabels.Refresh(gameplay, scanPressed); } internal void FinishFrame() { RoomToolsWindow roomToolsWindow = window; if (!roomToolsWindow.IsOpen) { if (roomToolsWindow.LoadingOwnsInput && UnityInput.Current.GetKeyDown((KeyCode)27)) { roomToolsWindow.DismissConfirmation(); } return; } roomToolsWindow.BlocksMouseInput(); NativeMenu.ShowRoomToolsCursor(); if (!capturedInput && UnityInput.Current.GetKeyDown((KeyCode)27)) { if (!roomToolsWindow.DismissConfirmation()) { roomToolsWindow.Close(); } } else if (((VisualElement)playersPage).panel != null && !(Time.unscaledTime < nextRefresh)) { RefreshPlayers(); } } internal void OnRoomChanged(Room? room) { ResetScenePages(); roomPage.Tabs.Select(0); if (room != null) { window?.ShowPage(0); } nextRefresh = 0f; } internal void OnSceneChanged() { menuPage = null; ResetScenePages(); loadingPanel.Hide(); UpdateLoadingCursor(visible: false); window?.Close(); } private void ResetScenePages() { foreach (var watchedPage in watchedPages) { watchedPage.Reset?.Invoke(); } roster.Clear(); playersPage.SetPlayers(roster); worldLabels.Reset(); } private void SetRoomStatusDisplay(bool shown) { showRoomStatus.Value = shown; RefreshRoomStatusOverlay(); } private void RefreshRoomStatusOverlay() { Room currentRoom = RoomControls.CurrentRoom; roomStatusOverlay.Refresh(currentRoom, showRoomStatus.Value); UpdatePlayerPresence(currentRoom); } private void UpdatePlayerPresence(Room? current) { if (current != knownRoom) { knownRoom = current; knownPlayers.Clear(); if (current == null) { return; } { foreach (Player value2 in current.Players.Values) { knownPlayers[value2.ActorNumber] = value2.NickName ?? string.Empty; } return; } } if (current == null) { return; } HashSet<int> present = new HashSet<int>(); foreach (Player value3 in current.Players.Values) { present.Add(value3.ActorNumber); string text = value3.NickName ?? string.Empty; if (!knownPlayers.TryGetValue(value3.ActorNumber, out string value)) { knownPlayers[value3.ActorNumber] = text; roomStatusOverlay.ShowPlayerJoined(text); } else if (value != text) { knownPlayers[value3.ActorNumber] = text; } } int[] array = knownPlayers.Keys.Where((int actor) => !present.Contains(actor)).ToArray(); foreach (int key in array) { roomStatusOverlay.ShowPlayerLeft(knownPlayers[key]); knownPlayers.Remove(key); } } private void UpdateLoadingCursor(bool visible) { //IL_0045: 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_001c: Unknown result type (might be due to invalid IL or missing references) if (visible) { if (!loadingCursor) { wasCursorVisible = Cursor.visible; previousCursorLock = Cursor.lockState; loadingCursor = true; } NativeMenu.ShowRoomToolsCursor(duringLoading: true); } else if (loadingCursor) { loadingCursor = false; NativeMenu.RestoreGameCursor(wasCursorVisible, previousCursorLock); NativeMenu.LastCloseFrame = Time.frameCount; } } private void RefreshPlayers() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) nextRefresh = Time.unscaledTime + 0.5f; if (Object.op_Implicit((Object)(object)menuPage) && (int)menuPage.menuPageIndex == 0) { roster.Clear(); } else { PlayerRoster.ReadInto(roster); } playersPage.SetPlayers(roster); } private bool IsOpeningShortcut() { //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 (!IsOpen) { KeyboardShortcut value = toggleShortcut.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { return CanOpenWindow(NativeMenu.GetCurrentPage()); } } return false; } private static bool CanOpenWindow(MenuPage? page) { if (NativeMenu.LastCloseFrame != Time.frameCount && (NativeMenu.IsAvailablePage(page) || NativeMenu.CanOpenInRun())) { return SemiFunc.NoTextInputsActive(); } return false; } private void OpenWindow() { //IL_0029: 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) UpdateLoadingCursor(visible: false); shortcutCapture.Reset(); RefreshWindow(RoomControls.CurrentRoom); wasCursorVisible = Cursor.visible; previousCursorLock = Cursor.lockState; NativeMenu.OwnsGameplayInput = !Object.op_Implicit((Object)(object)menuPage); window.Open(); logger.LogDebug((object)("RoomTools opened from " + (Object.op_Implicit((Object)(object)menuPage) ? ((object)Unsafe.As<MenuPageIndex, MenuPageIndex>(ref menuPage.menuPageIndex)/*cast due to .constrained prefix*/).ToString() : "gameplay") + ".")); } private void OnWindowClosed() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) foreach (var watchedPage in watchedPages) { watchedPage.Close?.Invoke(); } NativeMenu.OwnsGameplayInput = false; NativeMenu.RestoreGameCursor(wasCursorVisible, previousCursorLock); shortcutCapture.Reset(); NativeMenu.LastCloseFrame = Time.frameCount; nextRefresh = 0f; } public void Dispose() { UpdateLoadingCursor(visible: false); window?.Close(); window?.Dispose(); if (window != null && NativeMenu.Window == window) { NativeMenu.Window = null; NativeMenu.IsCapturingShortcut = null; NativeMenu.IsOpeningShortcut = null; } window = null; watchedPages.Clear(); pageFactories.Clear(); } } internal sealed class RoomToolsWindow : IDisposable { internal const float BaseInterfaceScale = 0.81f; private readonly GameObject documentObject; private readonly PanelSettings panelSettings; private readonly ThemeStyleSheet theme; private const string FontAssetName = "hongliyuu.roomtools.UIFont"; private static readonly Dictionary<string, FontAsset> SharedFonts = new Dictionary<string, FontAsset>(StringComparer.OrdinalIgnoreCase); private readonly VisualElement root; private readonly VisualElement panel; private readonly LoadingPanel loading; private readonly Button close; private readonly SidebarNavigation navigation; private readonly VisualElement body; private readonly VisualElement[] routes; private readonly Label roomStatus; private readonly Label notification; private readonly ConfirmationOverlay confirmation; private IVisualElementScheduledItem? hideNotification; private Vector2 position; private Vector2 size = new Vector2(1080f, 660f); private Vector2 visibleSize; private bool positioned; private int mouseSampleFrame = -1; private int buttonsPressedInWindow; private bool blocksMouseThisFrame; private int currentPage; public bool IsOpen { get; private set; } internal (Vector2 Position, Vector2 Size, int Page)? Layout { get { //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) if (!positioned) { return null; } return (position, size, currentPage); } } internal bool IsEditingText { get { FocusController focusController = ((Focusable)root).focusController; Focusable obj = ((focusController != null) ? focusController.focusedElement : null); VisualElement val = (VisualElement)(object)((obj is VisualElement) ? obj : null); if (val != null) { if (!(val is TextField)) { return val.GetFirstAncestorOfType<TextField>() != null; } return true; } return false; } } internal bool LoadingOwnsInput => loading.Interactive; public event Action? Closed; public RoomToolsWindow(Transform parent, UiText text, LoadingPanel loading, VisualElement roomStatusOverlay, VisualElement worldLabels, (Vector2 Position, Vector2 Size, int Page)? layout, int scalePercent, params (string Caption, string Icon, VisualElement Page)[] pages) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Expected O, but got Unknown //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: 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_0192: 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_0467: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Expected O, but got Unknown //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Unknown result type (might be due to invalid IL or missing references) //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Unknown result type (might be due to invalid IL or missing references) //IL_06d7: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0741: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_076f: Expected O, but got Unknown //IL_0777: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_07aa: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_07b0: Unknown result type (might be due to invalid IL or missing references) //IL_07b7: Unknown result type (might be due to invalid IL or missing references) //IL_07c6: Unknown result type (might be due to invalid IL or missing references) //IL_07e5: Unknown result type (might be due to invalid IL or missing references) //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_0815: Unknown result type (might be due to invalid IL or missing references) //IL_081c: Unknown result type (might be due to invalid IL or missing references) //IL_083e: Unknown result type (might be due to invalid IL or missing references) //IL_0843: Unknown result type (might be due to invalid IL or missing references) //IL_0844: Unknown result type (might be due to invalid IL or missing references) //IL_084b: Unknown result type (might be due to invalid IL or missing references) //IL_0862: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_0893: Unknown result type (might be due to invalid IL or missing references) //IL_090c: Unknown result type (might be due to invalid IL or missing references) this.loading = loading; if (layout.HasValue) { (Vector2, Vector2, int) valueOrDefault = layout.GetValueOrDefault(); position = valueOrDefault.Item1; size = valueOrDefault.Item2; positioned = true; } panelSettings = ScriptableObject.CreateInstance<PanelSettings>(); ((Object)panelSettings).name = "RoomTools"; theme = ScriptableObject.CreateInstance<ThemeStyleSheet>(); panelSettings.themeStyleSheet = theme; panelSettings.sortingOrder = 1000f; panelSettings.scaleMode = (PanelScaleMode)2; panelSettings.scale = 0.81f * (float)scalePercent / 100f; panelSettings.referenceResolution = new Vector2Int(1600, 900); panelSettings.screenMatchMode = (PanelScreenMatchMode)0; panelSettings.match = 1f; FontAsset sharedFont = GetSharedFont(text.Language); documentObject = new GameObject("RoomTools UI"); documentObject.SetActive(false); documentObject.transform.SetParent(parent, false); UIDocument val = documentObject.AddComponent<UIDocument>(); val.panelSettings = panelSettings; documentObject.SetActive(true); root = val.rootVisualElement; root.pickingMode = (PickingMode)1; VisualElementExtensions.StretchToParentSize(root); if ((Object)(object)sharedFont != (Object)null) { root.style.unityFontDefinition = StyleFontDefinition.op_Implicit(FontDefinition.FromSDFFont(sharedFont)); } root.style.color = StyleColor.op_Implicit(UiStyle.Ink); root.style.fontSize = StyleLength.op_Implicit(12f); root.Add(worldLabels); root.Add(roomStatusOverlay); panel = new VisualElement(); panel.style.position = StyleEnum<Position>.op_Implicit((Position)1); panel.style.backgroundColor = StyleColor.op_Implicit(UiStyle.WindowBackground); panel.style.overflow = StyleEnum<Overflow>.op_Implicit((Overflow)1); UiStyle.Round(panel, 12); UiStyle.Outline(panel); root.Add(panel); root.Add((VisualElement)(object)loading); VisualElement val2 = new VisualElement(); val2.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2); val2.style.alignItems = StyleEnum<Align>.op_Implicit((Align)2); val2.style.justifyContent = StyleEnum<Justify>.op_Implicit((Justify)3); val2.style.height = StyleLength.op_Implicit(50f); val2.style.flexShrink = StyleFloat.op_Implicit(0f); val2.style.paddingLeft = StyleLength.op_Implicit(16f); val2.style.paddingRight = StyleLength.op_Implicit(12f); val2.style.backgroundColor = StyleColor.op_Implicit(UiStyle.Surface); val2.style.borderBottomWidth = StyleFloat.op_Implicit(1f); val2.style.borderBottomColor = StyleColor.op_Implicit(UiStyle.Divider); panel.Add(val2); Label val3 = UiStyle.MakeLabel("RoomTools", 16, UiStyle.Ink); val2.Add((VisualElement)(object)val3); close = Buttons.MakeButton(text["close"], Close, UiStyle.Surface, UiStyle.Muted); ((VisualElement)close).name = "close-window"; val2.Add((VisualElement)(object)close); EnableDrag(val2, resize: false); VisualElement val4 = new VisualElement(); val4.style.flexGrow = StyleFloat.op_Implicit(1f); val4.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2); val4.style.minHeight = StyleLength.op_Implicit(0f); val4.style.alignItems = StyleEnum<Align>.op_Implicit((Align)4); panel.Add(val4); navigation = new SidebarNavigation(Array.ConvertAll(pages, ((string Caption, string Icon, VisualElement Page) page) => (Caption: page.Caption, Icon: page.Icon)), ShowPage); val4.Add((VisualElement)(object)navigation); body = new VisualElement(); routes = Array.ConvertAll(pages, ((string Caption, string Icon, VisualElement Page) page) => page.Page); body.style.flexGrow = StyleFloat.op_Implicit(1f); body.style.flexBasis = StyleLength.op_Implicit(0f); body.style.alignItems = StyleEnum<Align>.op_Implicit((Align)4); body.style.minHeight = StyleLength.op_Implicit(0f); body.style.minWidth = StyleLength.op_Implicit(0f); body.style.paddingLeft = (body.style.paddingRight = StyleLength.op_Implicit(16f)); body.style.paddingTop = StyleLength.op_Implicit(14f); body.style.paddingBottom = StyleLength.op_Implicit(12f); val4.Add(body); ShowPage(layout?.Page ?? 0); roomStatus = UiStyle.MakeLabel(string.Empty, 11, UiStyle.Muted); UiStyle.Truncate((TextElement)(object)roomStatus); ((VisualElement)roomStatus).style.height = StyleLength.op_Implicit(30f); ((VisualElement)roomStatus).style.paddingLeft = StyleLength.op_Implicit(16f); ((VisualElement)roomStatus).style.paddingRight = StyleLength.op_Implicit(28f); ((VisualElement)roomStatus).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit((TextAnchor)3); ((VisualElement)roomStatus).style.flexShrink = StyleFloat.op_Implicit(0f); ((VisualElement)roomStatus).style.backgroundColor = StyleColor.op_Implicit(UiStyle.Surface); ((VisualElement)roomStatus).style.borderTopWidth = StyleFloat.op_Implicit(1f); ((VisualElement)roomStatus).style.borderTopColor = StyleColor.op_Implicit(UiStyle.Divider); panel.Add((VisualElement)(object)roomStatus); Label val6 = UiStyle.MakeLabel("◢", 15, UiStyle.Muted); ((VisualElement)val6).name = "resize-window"; ((VisualElement)val6).pickingMode = (PickingMode)0; ((VisualElement)val6).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit((TextAnchor)8); ((VisualElement)val6).style.position = StyleEnum<Position>.op_Implicit((Position)1); ((VisualElement)val6).style.right = StyleLength.op_Implicit(4f); ((VisualElement)val6).style.bottom = StyleLength.op_Implicit(3f); ((VisualElement)val6).style.width = StyleLength.op_Implicit(22f); ((VisualElement)val6).style.height = StyleLength.op_Implicit(22f); panel.Add((VisualElement)(object)val6); EnableDrag((VisualElement)(object)val6, resize: true); VisualElement val7 = new VisualElement { pickingMode = (PickingMode)1 }; val7.style.position = StyleEnum<Position>.op_Implicit((Position)1); val7.style.top = StyleLength.op_Implicit(18f); val7.style.left = (val7.style.right = StyleLength.op_Implicit(12f)); val7.style.alignItems = StyleEnum<Align>.op_Implicit((Align)2); root.Add(val7); notification = UiStyle.MakeLabel(string.Empty, 12, UiStyle.Positive); ((VisualElement)notification).style.paddingLeft = (((VisualElement)notification).style.paddingRight = StyleLength.op_Implicit(16f)); ((VisualElement)notification).style.paddingTop = (((VisualElement)notification).style.paddingBottom = StyleLength.op_Implicit(9f)); ((VisualElement)notification).style.maxWidth = StyleLength.op_Implicit(Length.Percent(100f)); ((VisualElement)notification).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)0); ((VisualElement)notification).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1); UiStyle.Round((VisualElement)(object)notification, 8); UiStyle.Outline((VisualElement)(object)notification); val7.Add((VisualElement)(object)notification); confirmation = new ConfirmationOverlay(text["cancel"]); root.Add((VisualElement)(object)confirmation); ((CallbackEventHandler)root).RegisterCallback<GeometryChangedEvent>((EventCallback<GeometryChangedEvent>)delegate { Arrange(); }, (TrickleDown)0); panel.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1); } internal void ShowPage(int selected) { VisualElement val = routes[selected]; if (val.parent != body) { currentPage = selected; navigation.Select(selected); body.Clear(); body.Add(val); } } internal void SetRoomStatus(string status) { ((TextElement)roomStatus).text = status; } internal bool DismissConfirmation() { return confirmation.Dismiss(); } internal void Notify(string message, bool success, bool duringGameplay = false) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if (!IsOpen && !duringGameplay) { return; } ((TextElement)notification).text = message; ((VisualElement)notification).style.color = StyleColor.op_Implicit(success ? UiStyle.Positive : UiStyle.Danger); ((VisualElement)notification).style.backgroundColor = StyleColor.op_Implicit(success ? UiStyle.AccentBackground : UiStyle.DangerBackground); ((VisualElement)notification).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)0); if (hideNotification == null) { hideNotification = ((VisualElement)notification).schedule.Execute((Action)delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ((VisualElement)notification).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1); }); } hideNotification.ExecuteLater(2500L); } internal void SetScale(int percent) { //IL_0027: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) float num = 0.81f * (float)percent / 100f; if (num != panelSettings.scale) { if (positioned) { Vector2 val = position + visibleSize / 2f; position = val * (panelSettings.scale / num) - size / 2f; } panelSettings.scale = num; } } public void Open() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) confirmation.Dismiss(); IsOpen = true; panel.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)0); Arrange(); ((Focusable)close).Focus(); } public void Close() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!IsOpen) { return; } IsOpen = false; confirmation.Dismiss(); FocusController focusController = ((Focusable)root).focusController; if (focusController != null) { Focusable focusedElement = focusController.focusedElement; if (focusedElement != null) { focusedElement.Blur(); } } IPanel obj = root.panel; if (obj != null) { VisualElement obj2 = UQueryExtensions.Q(obj.visualTree, (string)null, GenericDropdownMenu.ussClassName); if (obj2 != null) { obj2.RemoveFromHierarchy(); } } panel.style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1); IVisualElementScheduledItem? obj3 = hideNotification; if (obj3 != null) { obj3.Pause(); } ((VisualElement)notification).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1); this.Closed?.Invoke(); } internal bool BlocksMouseInput() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) bool loadingOwnsInput = LoadingOwnsInput; if (!IsOpen && !loadingOwnsInput && buttonsPressedInWindow == 0 && !blocksMouseThisFrame) { return false; } int frameCount = Time.frameCount; if (mouseSampleFrame == frameCount) { return blocksMouseThisFrame; } mouseSampleFrame = frameCount; bool flag = false; if (IsOpen || loadingOwnsInput) { IPanel val = root.panel; if (val != null) { Vector2 val2 = Vector2.op_Implicit(Input.mousePosition); Vector2 val3 = RuntimePanelUtils.ScreenToPanel(val, new Vector2(val2.x, (float)Screen.height - val2.y)); Rect worldBound; int num; if (!confirmation.ContainsPointer(val3)) { if (loadingOwnsInput) { worldBound = ((VisualElement)loading).worldBound; num = (((Rect)(ref worldBound)).Contains(val3) ? 1 : 0); } else { num = 0; } } else { num = 1; } flag = (byte)num != 0; if (IsOpen && !flag) { VisualElement val4 = UQueryExtensions.Q(val.visualTree, (string)null, GenericDropdownMenu.containerOuterUssClassName); worldBound = panel.worldBound; int num2; if (!((Rect)(ref worldBound)).Contains(val3)) { if (val4 == null) { num2 = 0; } else { worldBound = val4.worldBound; num2 = (((Rect)(ref worldBound)).Contains(val3) ? 1 : 0); } } else { num2 = 1; } flag = (byte)num2 != 0; } } } blocksMouseThisFrame = flag || buttonsPressedInWindow != 0; if (blocksMouseThisFrame) { for (int i = 0; i < 3; i++) { int num3 = 1 << i; if (flag && Input.GetMouseButtonDown(i)) { buttonsPressedInWindow |= num3; } if (!Input.GetMouseButton(i)) { buttonsPressedInWindow &= ~num3; } } } return blocksMouseThisFrame; } private void Arrange() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) Rect layout = root.layout; float width = ((Rect)(ref layout)).width; layout = root.layout; float height = ((Rect)(ref layout)).height; if (!float.IsNaN(width) && !float.IsNaN(height) && !(width <= 0f) && !(height <= 0f)) { visibleSize.x = Mathf.Clamp(size.x, Mathf.Min(400f, width), width); visibleSize.y = Mathf.Clamp(size.y, Mathf.Min(330f, height), height); if (!positioned) { position = new Vector2((width - visibleSize.x) / 2f, (height - visibleSize.y) / 2f); positioned = true; } position.x = Mathf.Clamp(position.x, 0f, width - visibleSize.x); position.y = Mathf.Clamp(position.y, 0f, height - visibleSize.y); panel.style.left = StyleLength.op_Implicit(position.x); panel.style.top = StyleLength.op_Implicit(position.y); panel.style.width = StyleLength.op_Implicit(visibleSize.x); panel.style.height = StyleLength.op_Implicit(visibleSize.y); navigation.SetCompact(visibleSize.x < 650f); } } private void EnableDrag(VisualElement handle, bool resize) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) Vector2 startPointer = default(Vector2); Vector2 startValue = default(Vector2); ((CallbackEventHandler)handle).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent evt) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (((PointerEventBase<PointerDownEvent>)(object)evt).button == 0 && (object)((EventBase)evt).target != close) { startPointer = Vector2.op_Implicit(((PointerEventBase<PointerDownEvent>)(object)evt).position); startValue = (resize ? visibleSize : position); PointerCaptureHelper.CapturePointer((IEventHandler)(object)handle, ((PointerEventBase<PointerDownEvent>)(object)evt).pointerId); ((EventBase)evt).StopPropagation(); } }, (TrickleDown)0); ((CallbackEventHandler)handle).RegisterCallback<PointerMoveEvent>((EventCallback<PointerMoveEvent>)delegate(PointerMoveEvent evt) { //IL_0015: 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_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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if (PointerCaptureHelper.HasPointerCapture((IEventHandler)(object)handle, ((PointerEventBase<PointerMoveEvent>)(object)evt).pointerId)) { Vector2 val = startValue + Vector2.op_Implicit(((PointerEventBase<PointerMoveEvent>)(object)evt).position) - startPointer; if (resize) { ref Vector2 reference = ref size; float x = val.x; Rect layout = root.layout; reference.x = Mathf.Clamp(x, 400f, Mathf.Max(400f, ((Rect)(ref layout)).width - position.x)); ref Vector2 reference2 = ref size; float y = val.y; layout = root.layout; reference2.y = Mathf.Clamp(y, 330f, Mathf.Max(330f, ((Rect)(ref layout)).height - position.y)); } else { position = val; } Arrange(); ((EventBase)evt).StopPropagation(); } }, (TrickleDown)0); ((CallbackEventHandler)handle).RegisterCallback<PointerUpEvent>((EventCallback<PointerUpEvent>)delegate(PointerUpEvent evt) { EndDrag(((PointerEventBase<PointerUpEvent>)(object)evt).pointerId); }, (TrickleDown)0); ((CallbackEventHandler)handle).RegisterCallback<PointerCancelEvent>((EventCallback<PointerCancelEvent>)delegate(PointerCancelEvent evt) { EndDrag(((PointerEventBase<PointerCancelEvent>)(object)evt).pointerId); }, (TrickleDown)0); void EndDrag(int pointerId) { if (PointerCaptureHelper.HasPointerCapture((IEventHandler)(object)handle, pointerId)) { PointerCaptureHelper.ReleasePointer((IEventHandler)(object)handle, pointerId); } } } private static FontAsset? GetSharedFont(UiLanguage language) { //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) string[] array = language.FontFamilies.Concat(UiLanguage.Options.SelectMany((UiLanguage option) => option.FontFamilies)).Distinct<string>(StringComparer.OrdinalIgnoreCase).ToArray(); string text = string.Join("|", array); if (SharedFonts.TryGetValue(text, out FontAsset value) && Object.op_Implicit((Object)(object)value)) { return value; } FontAsset[] existing = Resources.FindObjectsOfTypeAll<FontAsset>(); List<FontAsset> list = new List<FontAsset>(); string[] array2 = array; foreach (string text2 in array2) { string text3 = "hongliyuu.roomtools.UIFont." + text + "." + text2; FontAsset val = GetOrCreate(text2, "Regular", text3); if (!Object.op_Implicit((Object)(object)val)) { continue; } FontAsset val2 = GetOrCreate(text2, "Bold", text3 + ".Bold"); float boldStyleWeight = (val.boldStyleSpacing = 0f); val.boldStyleWeight = boldStyleWeight; if (Object.op_Implicit((Object)(object)val2)) { FaceInfo faceInfo = val2.faceInfo; if (((FaceInfo)(ref faceInfo)).styleName.Contains("Bold", StringComparison.OrdinalIgnoreCase)) { val.fontWeightTable[7].regularTypeface = val2; val.ReadFontAssetDefinition(); } } list.Add(val); } if (list.Count == 0) { return null; } FontAsset val3 = list[0]; list.RemoveAt(0); val3.fallbackFontAssetTable = list; return SharedFonts[text] = val3; FontAsset? GetOrCreate(string family, string face, string name) { return Array.Find(existing, (FontAsset font) => ((Object)font).name == name) ?? CreateFont(family, face, name); } } private static FontAsset? CreateFont(string family, string face, string assetName) { FontAsset val = FontAsset.CreateFontAsset(family, face, 36); if ((Object)(object)val == (Object)null) { return null; } ((Object)val).name = assetName; ((Object)val).hideFlags = (HideFlags)61; return val; } public void Dispose() { confirmation.Dismiss(); documentObject.SetActive(false); navigation.Dispose(); Object.Destroy((Object)(object)documentObject); Object.Destroy((Object)(object)panelSettings); Object.Destroy((Object)(object)theme); } } } namespace RoomTools.UI.Controls { internal static class Buttons { internal enum ButtonTone { Standard, Primary, Caution, Destructive } private const string SelectedClass = "roomtools-selected"; internal static Button MakeButton(string caption, Action? action, ButtonTone tone = ButtonTone.Standard) { //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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_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) var (background, foreground) = tone switch { ButtonTone.Primary => (UiStyle.Accent, UiStyle.Surface), ButtonTone.Caution => (UiStyle.WarningBackground, UiStyle.Warning), ButtonTone.Destructive => (UiStyle.DangerBackground, UiStyle.Danger), _ => (UiStyle.Surface, UiStyle.Ink), }; return MakeButton(caption, action, background, foreground); } internal static Button MakeButton(string caption, Action? action, Color background, Color foreground) { //IL_0008: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00cc: Unknown result type (might be due to invalid IL or missing references) Button button = new Button(action) { text = caption, enableRichText = false }; UiStyle.StyleControlFrame((VisualElement)(object)button, background); ((VisualElement)button).style.color = StyleColor.op_Implicit(foreground); ((VisualElement)button).style.fontSize = StyleLength.op_Implicit(12f); ((VisualElement)button).style.minWidth = StyleLength.op_Implicit(60f); ((VisualElement)button).style.paddingLeft = StyleLength.op_Implicit(12f); ((VisualElement)button).style.paddingRight = StyleLength.op_Implicit(12f); ((VisualElement)button).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)1); ((VisualElement)button).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit((TextAnchor)4); bool hovered = false; ((CallbackEventHandler)button).RegisterCallback<PointerEnterEvent>((EventCallback<PointerEnterEvent>)delegate { UpdateHover(value: true); }, (TrickleDown)0); ((CallbackEventHandler)button).RegisterCallback<PointerLeaveEvent>((EventCallback<PointerLeaveEvent>)delegate { UpdateHover(value: false); }, (TrickleDown)0); Button obj = button; ((VisualElement)obj).generateVisualContent = (Action<MeshGenerationContext>)Delegate.Combine(((VisualElement)obj).generateVisualContent, (Action<MeshGenerationContext>)delegate(MeshGenerationContext context) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (((VisualElement)button).enabledInHierarchy && (hovered || ((VisualElement)button).ClassListContains("roomtools-selected"))) { Painter2D painter2D = context.painter2D; Rect layout = ((VisualElement)button).layout; DrawShadow(painter2D, ((Rect)(ref layout)).size); } }); return button; void UpdateHover(bool value) { hovered = value; ((VisualElement)button).MarkDirtyRepaint(); } } internal static void SetButtonSelected(Button button, bool selected, Color? idle = null, Color? active = null) { //IL_0044: 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_0029: 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_0049: Unknown result type (might be due to invalid IL or missing references) ((VisualElement)button).EnableInClassList("roomtools-selected", selected); ((VisualElement)button).style.backgroundColor = StyleColor.op_Implicit((Color)((!selected) ? (((??)idle) ?? Color.clear) : (((??)active) ?? UiStyle.Surface))); ((VisualElement)button).MarkDirtyRepaint(); } private static void DrawShadow(Painter2D painter, Vector2 size) { //IL_0008: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (!(size.x < 14f) && !(size.y < 14f)) { for (int num = 3; num >= 1; num--) { painter.fillColor = new Color(0.06f, 0.09f, 0.16f, 0.025f); painter.BeginPath(); RoundedPath(-num, 0f, size.x + (float)num, size.y + (float)num + 1f, 6 + num); RoundedPath(0f, 0f, size.x, size.y, 6f); painter.Fill((FillRule)1); } } void RoundedPath(float left, float top, float right, float bottom, float radius) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0042: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) painter.MoveTo(new Vector2(left + radius, top)); painter.ArcTo(new Vector2(right, top), new Vector2(right, bottom), radius); painter.ArcTo(new Vector2(right, bottom), new Vector2(left, bottom), radius); painter.ArcTo(new Vector2(left, bottom), new Vector2(left, top), radius); painter.ArcTo(new Vector2(left, top), new Vector2(right, top), radius); painter.ClosePath(); } } internal static Button MakeFlatButton(string caption, Action? action, Color fill, Color ink, Color edge, Color? hover = null, Color? pressed = null) { //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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) Button button = new Button(action) { text = caption, enableRichText = false }; StyleFlatButton((TextElement)(object)button, fill, ink, edge); Color hoverFill = (Color)(((??)hover) ?? Shade(fill, 0.08f)); Color pressedFill = (Color)(((??)pressed) ?? Shade(fill, 0.16f)); ((CallbackEventHandler)button).RegisterCallback<PointerEnterEvent>((EventCallback<PointerEnterEvent>)delegate { //IL_000c: 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) ((VisualElement)button).style.backgroundColor = StyleColor.op_Implicit(hoverFill); }, (TrickleDown)0); ((CallbackEventHandler)button).RegisterCallback<PointerLeaveEvent>((EventCallback<PointerLeaveEvent>)delegate { //IL_000c: 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) ((VisualElement)button).style.backgroundColor = StyleColor.op_Implicit(fill); }, (TrickleDown)0); ((CallbackEventHandler)button).RegisterCallback<PointerDownEvent>((EventCallback<PointerDownEvent>)delegate(PointerDownEvent change) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (((PointerEventBase<PointerDownEvent>)(object)change).button == 0) { ((VisualElement)button).style.backgroundColor = StyleColor.op_Implicit(pressedFill); } }, (TrickleDown)1); ((CallbackEventHandler)button).RegisterCallback<PointerUpEvent>((EventCallback<PointerUpEvent>)delegate(PointerUpEvent change) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) IStyle style = ((VisualElement)button).style; Rect worldBound = ((VisualElement)button).worldBound; style.backgroundColor = StyleColor.op_Implicit(((Rect)(ref worldBound)).Contains(((PointerEventBase<PointerUpEvent>)(object)change).position) ? hoverFill : fill); }, (TrickleDown)1); return button; } internal static void StyleFlatButton(TextElement element, Color fill, Color ink, Color edge) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_008e: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) ((VisualElement)element).style.height = StyleLength.op_Implicit(30f); ((VisualElement)element).style.minWidth = StyleLength.op_Implicit(60f); IStyle style = ((VisualElement)element).style; StyleLength marginTop = (((VisualElement)element).style.marginBottom = StyleLength.op_Implicit(1f)); style.marginTop = marginTop; ((VisualElement)element).style.marginLeft = StyleLength.op_Implicit(0f); ((VisualElement)element).style.marginRight = StyleLength.op_Implicit(5f); IStyle style2 = ((VisualElement)element).style; marginTop = (((VisualElement)element).style.paddingRight = StyleLength.op_Implicit(6f)); style2.paddingLeft = marginTop; IStyle style3 = ((VisualElement)element).style; marginTop = (((VisualElement)element).style.paddingBottom = StyleLength.op_Implicit(0f)); style3.paddingTop = marginTop; ((VisualElement)element).style.backgroundColor = StyleColor.op_Implicit(fill); ((VisualElement)element).style.color = StyleColor.op_Implicit(ink); ((VisualElement)element).style.fontSize = StyleLength.op_Implicit(12f); ((VisualElement)element).style.unityTextAlign = StyleEnum<TextAnchor>.op_Implicit((TextAnchor)4); ((VisualElement)element).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)0); UiStyle.Outline((VisualElement)(object)element); IStyle style4 = ((VisualElement)element).style; IStyle style5 = ((VisualElement)element).style; IStyle style6 = ((VisualElement)element).style; StyleColor val4 = (((VisualElement)element).style.borderRightColor = StyleColor.op_Implicit(edge)); StyleColor val6 = (style6.borderLeftColor = val4); StyleColor borderTopColor = (style5.borderBottomColor = val6); style4.borderTopColor = borderTopColor; UiStyle.Round((VisualElement)(object)element, 8); } internal static Color Shade(Color color, float amount) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Color.Lerp(color, UiStyle.Ink, amount); } } internal sealed class ConfirmationOverlay : VisualElement { private readonly VisualElement card; private readonly Label title; private readonly Label detail; private readonly Button cancel; private readonly Button confirm; private Button? trigger; private Action? execute; internal ConfirmationOverlay(string cancelCaption) { //IL_001a: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) ((VisualElement)this).pickingMode = (PickingMode)1; VisualElementExtensions.StretchToParentSize((VisualElement)(object)this); ((VisualElement)this).style.alignItems = StyleEnum<Align>.op_Implicit((Align)2); ((VisualElement)this).style.justifyContent = StyleEnum<Justify>.op_Implicit((Justify)1); IStyle style = ((VisualElement)this).style; StyleLength paddingLeft = (((VisualElement)this).style.paddingRight = StyleLength.op_Implicit(12f)); style.paddingLeft = paddingLeft; ((VisualElement)this).style.display = StyleEnum<DisplayStyle>.op_Implicit((DisplayStyle)1); card = UiStyle.MakeCard(); card.style.width = StyleLength.op_Implicit(460f); card.style.maxWidth = StyleLength.op_Implicit(Length.Percent(100f)); card.style.marginBottom = StyleLength.op_Implicit(0f); ((VisualElement)this).Add(card); title = UiStyle.MakeHeading(string.Empty); card.Add((VisualElement)(object)title); detail = UiStyle.MakeLabel(string.Empty, 12, UiStyle.Muted); ((VisualElement)detail).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)0); ((VisualElement)detail).style.marginBottom = StyleLength.op_Implicit(8f); card.Add((VisualElement)(object)detail); VisualElement val2 = UiStyle.MakeActionRow(); val2.style.justifyContent = StyleEnum<Justify>.op_Implicit((Justify)2); cancel = Buttons.MakeButton(cancelCaption, delegate { Dismiss(); }); confirm = Buttons.MakeButton(string.Empty, Confirm); val2.Add((VisualElement)(object)cancel); val2.Add((VisualElement)(object)confirm); card.Add(val2); } internal static void Show(Button source, string caption, Action action, string? message = null, bool caution = false) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00be: 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_00d4: Unknown result type (might be due to invalid IL or missing references) if (((VisualElement)source).enabledInHierarchy) { IPanel panel = ((VisualElement)source).panel; ConfirmationOverlay confirmationOverlay = ((panel != null) ? UQueryExtensi