using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using P.E.A.K_MENU.Constants; using P.E.A.K_MENU.Features.Flight; using P.E.A.K_MENU.Features.ItemSpawn; using P.E.A.K_MENU.Features.Status; using P.E.A.K_MENU.Features.Teleport; using P.E.A.K_MENU.Input; using P.E.A.K_MENU.Patches; using P.E.A.K_MENU.UI; using P.E.A.K_MENU.UI.Pages; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ruangfafa.peakmenu")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("PEAK 游戏内实用菜单,包含物品生成、玩家传送、坐标飞行、状态控制、主题与可调整界面。")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1+055a278dc3fdb4c275b77cec7283531932304f97")] [assembly: AssemblyProduct("ruangfafa.peakmenu")] [assembly: AssemblyTitle("P.E.A.K_MENU")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Ruangfafa/P.E.A.K_MENU")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Embedded] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace P.E.A.K_MENU { [BepInPlugin("ruangfafa.peakmenu", "P.E.A.K_MENU", "0.1.1")] public class Plugin : BaseUnityPlugin { private PeakMenuWindow _menuWindow; private MenuInputController _inputController; private Harmony _harmony; public const string Id = "ruangfafa.peakmenu"; internal static ManualLogSource Log { get; private set; } public static string Name => "P.E.A.K_MENU"; public static string Version => "0.1.1"; private void Awake() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"P.E.A.K_MENU Awake started."); MenuSettings.Initialize(((BaseUnityPlugin)this).Config); MenuIcons.Initialize(); InitializeFeature("ItemSpawn", delegate { ItemSpawnRuntime.Initialize(((BaseUnityPlugin)this).Config); }); InitializeFeature("Teleport", TeleportRuntime.Initialize); InitializeFeature("Status", StatusRuntime.Initialize); InitializeFeature("Flight", FlightRuntime.Initialize); _menuWindow = new PeakMenuWindow(); _inputController = new MenuInputController(_menuWindow); _harmony = new Harmony("ruangfafa.peakmenu"); _harmony.PatchAll(); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } private void Update() { _inputController.Update(); _menuWindow.Update(); TeleportRuntime.Update(); StatusRuntime.Update(); FlightRuntime.Update(); } private void FixedUpdate() { FlightRuntime.FixedUpdate(); } private void OnGUI() { _menuWindow.Draw(); } private void OnDisable() { MenuState.IsOpen = false; MenuState.IsRebinding = false; _menuWindow?.Close(); } private void OnDestroy() { MenuState.IsOpen = false; MenuState.IsRebinding = false; _menuWindow?.Dispose(); MenuIcons.Dispose(); FlightRuntime.Dispose(); ItemSpawnRuntime.Dispose(); TeleportRuntime.Dispose(); StatusRuntime.Dispose(); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private static void InitializeFeature(string name, Action initializer) { try { initializer(); Log.LogInfo((object)(name + " initialized.")); } catch (Exception arg) { Log.LogError((object)(name + " initialization failed: " + $"{arg}")); } } } } namespace P.E.A.K_MENU.UI { internal sealed class CursorController { private bool _previousVisible; private CursorLockMode _previousLockMode; private bool _stateSaved; internal void Release() { //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 (!_stateSaved) { _previousVisible = Cursor.visible; _previousLockMode = Cursor.lockState; _stateSaved = true; } MaintainReleased(); } internal void MaintainReleased() { Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } internal void Restore() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (_stateSaved) { Cursor.visible = _previousVisible; Cursor.lockState = _previousLockMode; _stateSaved = false; } } } internal interface IMenuPage { string Title { get; } void Draw(MenuStyles styles); } internal enum MenuCategory { ItemSpawner, Teleport, Flight, Status, Settings } internal static class MenuIcons { private static readonly Dictionary Icons = new Dictionary(); internal static Texture2D? Item => Get("item"); internal static Texture2D? Teleport => Get("teleport"); internal static Texture2D? Flight => Get("flight"); internal static Texture2D? Status => Get("status"); internal static void Initialize() { Dispose(); Assembly assembly = typeof(MenuIcons).Assembly; string[] manifestResourceNames = assembly.GetManifestResourceNames(); Plugin.Log.LogInfo((object)("Embedded resources: " + string.Join(", ", manifestResourceNames))); Load(assembly, "item", "item.png"); Load(assembly, "teleport", "teleport.png"); Load(assembly, "flight", "flight.png"); Load(assembly, "status", "status.png"); Plugin.Log.LogInfo((object)$"Loaded {Icons.Count} menu icons."); } internal static void Dispose() { foreach (Texture2D value in Icons.Values) { if (value != null) { Object.Destroy((Object)(object)value); } } Icons.Clear(); } private static Texture2D? Get(string key) { if (!Icons.TryGetValue(key, out Texture2D value)) { return null; } return value; } private static void Load(Assembly assembly, string key, string fileName) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown try { string text = assembly.GetManifestResourceNames().FirstOrDefault((string name) => name.EndsWith(fileName, StringComparison.OrdinalIgnoreCase)); if (text == null) { Plugin.Log.LogWarning((object)("Menu icon resource not found: " + fileName)); return; } using Stream stream = assembly.GetManifestResourceStream(text); if (stream == null) { Plugin.Log.LogWarning((object)("Unable to open menu icon: " + text)); return; } byte[] array; using (MemoryStream memoryStream = new MemoryStream()) { stream.CopyTo(memoryStream); array = memoryStream.ToArray(); } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { name = "P.E.A.K_MENU_" + key + "_Icon", filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; if (!ImageConversion.LoadImage(val, array, false)) { Object.Destroy((Object)(object)val); Plugin.Log.LogWarning((object)("Failed to decode menu icon: " + text)); return; } Icons[key] = val; Plugin.Log.LogInfo((object)("Loaded menu icon '" + key + "': " + text + ", " + $"{((Texture)val).width}x{((Texture)val).height}.")); } catch (Exception arg) { Plugin.Log.LogError((object)("Failed to load menu icon " + $"'{fileName}': {arg}")); } } } internal static class MenuSettings { private static ConfigEntry? _toggleKey; private static ConfigEntry? _windowWidth; private static ConfigEntry? _windowHeight; private static ConfigEntry? _theme; internal static KeyCode ToggleKey => _toggleKey?.Value ?? ModConstants.DefaultToggleMenuKey; internal static float WindowWidth => Mathf.Clamp(_windowWidth?.Value ?? 575f, 520f, 1100f); internal static float WindowHeight => Mathf.Clamp(_windowHeight?.Value ?? 850f, 360f, 850f); internal static MenuTheme Theme => _theme?.Value ?? MenuTheme.Iris; internal static void Initialize(ConfigFile config) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) _toggleKey = config.Bind("Menu", "ToggleKey", ModConstants.DefaultToggleMenuKey, "打开或关闭 P.E.A.K_MENU 的快捷键。"); _windowWidth = config.Bind("Menu", "WindowWidth", 575f, "菜单窗口宽度。"); _windowHeight = config.Bind("Menu", "WindowHeight", 850f, "菜单窗口高度。"); _theme = config.Bind("Appearance", "Theme", MenuTheme.Iris, "菜单主题颜色。"); ClampConfiguredSize(); } internal static void SetToggleKey(KeyCode keyCode) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (_toggleKey != null) { _toggleKey.Value = keyCode; Plugin.Log.LogInfo((object)$"Menu toggle key changed to: {keyCode}"); } } internal static void SetWindowSize(float width, float height) { float value = Mathf.Clamp(width, 520f, 1100f); float value2 = Mathf.Clamp(height, 360f, 850f); if (_windowWidth != null) { _windowWidth.Value = value; } if (_windowHeight != null) { _windowHeight.Value = value2; } } internal static void SetTheme(MenuTheme theme) { if (_theme != null && _theme.Value != theme) { _theme.Value = theme; Plugin.Log.LogInfo((object)$"Menu theme changed to: {theme}"); } } internal static void ResetWindowSize() { SetWindowSize(575f, 850f); } internal static void ResetToggleKey() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SetToggleKey(ModConstants.DefaultToggleMenuKey); } internal static void ResetTheme() { SetTheme(MenuTheme.Iris); } private static void ClampConfiguredSize() { SetWindowSize(WindowWidth, WindowHeight); } } internal static class MenuState { internal static bool IsOpen { get; set; } internal static bool IsRebinding { get; set; } } internal sealed class MenuStyles { private readonly struct ThemePalette { internal Color Window { get; init; } internal Color Sidebar { get; init; } internal Color Content { get; init; } internal Color Button { get; init; } internal Color ButtonHover { get; init; } internal Color ButtonActive { get; init; } internal Color Accent { get; init; } internal Color AccentHover { get; init; } internal Color ToggleOff { get; init; } internal Color ToggleHover { get; init; } internal Color Resize { get; init; } internal Color Separator { get; init; } internal static ThemePalette Create(MenuTheme theme) { return theme switch { MenuTheme.Ocean => CreateOcean(), MenuTheme.Emerald => CreateEmerald(), MenuTheme.Rose => CreateRose(), MenuTheme.Amber => CreateAmber(), _ => CreateIris(), }; } private static ThemePalette CreateIris() { //IL_0014: 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_0046: Unknown result type (might be due to invalid IL or missing references) return CreateBase(new Color(0.42f, 0.34f, 0.78f, 1f), new Color(0.52f, 0.43f, 0.92f, 1f), new Color(0.16f, 0.13f, 0.22f, 1f)); } private static ThemePalette CreateOcean() { //IL_0014: 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_0046: Unknown result type (might be due to invalid IL or missing references) return CreateBase(new Color(0.12f, 0.46f, 0.76f, 1f), new Color(0.18f, 0.58f, 0.92f, 1f), new Color(0.09f, 0.16f, 0.22f, 1f)); } private static ThemePalette CreateEmerald() { //IL_0014: 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_0046: Unknown result type (might be due to invalid IL or missing references) return CreateBase(new Color(0.1f, 0.52f, 0.38f, 1f), new Color(0.14f, 0.66f, 0.48f, 1f), new Color(0.08f, 0.18f, 0.15f, 1f)); } private static ThemePalette CreateRose() { //IL_0014: 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_0046: Unknown result type (might be due to invalid IL or missing references) return CreateBase(new Color(0.68f, 0.24f, 0.42f, 1f), new Color(0.82f, 0.31f, 0.51f, 1f), new Color(0.21f, 0.1f, 0.15f, 1f)); } private static ThemePalette CreateAmber() { //IL_0014: 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_0046: Unknown result type (might be due to invalid IL or missing references) return CreateBase(new Color(0.78f, 0.46f, 0.1f, 1f), new Color(0.94f, 0.59f, 0.14f, 1f), new Color(0.22f, 0.15f, 0.07f, 1f)); } private static ThemePalette CreateBase(Color accent, Color accentHover, Color tint) { //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_0029: 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_004e: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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) return new ThemePalette { Window = Color.Lerp(new Color(0.07f, 0.08f, 0.1f, 0.98f), tint, 0.18f), Sidebar = Color.Lerp(new Color(0.045f, 0.05f, 0.065f, 1f), tint, 0.2f), Content = Color.Lerp(new Color(0.1f, 0.11f, 0.14f, 1f), tint, 0.14f), Button = Color.Lerp(new Color(0.12f, 0.13f, 0.16f, 1f), tint, 0.15f), ButtonHover = Color.Lerp(new Color(0.18f, 0.2f, 0.25f, 1f), accent, 0.16f), ButtonActive = Color.Lerp(new Color(0.22f, 0.24f, 0.3f, 1f), accent, 0.24f), Accent = accent, AccentHover = accentHover, ToggleOff = Color.Lerp(new Color(0.13f, 0.14f, 0.17f, 1f), tint, 0.15f), ToggleHover = Color.Lerp(new Color(0.19f, 0.21f, 0.26f, 1f), accent, 0.16f), Resize = new Color(accent.r, accent.g, accent.b, 0.2f), Separator = new Color(accent.r, accent.g, accent.b, 0.3f) }; } } private readonly Texture2D _windowBackground; private readonly Texture2D _sidebarBackground; private readonly Texture2D _contentBackground; private readonly Texture2D _buttonBackground; private readonly Texture2D _buttonHoverBackground; private readonly Texture2D _buttonActiveBackground; private readonly Texture2D _accentBackground; private readonly Texture2D _accentHoverBackground; private readonly Texture2D _toggleOffBackground; private readonly Texture2D _toggleHoverBackground; private readonly Texture2D _resizeBackground; private readonly Texture2D _resizeHoverBackground; internal GUIStyle Window { get; } internal GUIStyle Sidebar { get; } internal GUIStyle Content { get; } internal GUIStyle CategoryButton { get; } internal GUIStyle CategoryButtonSelected { get; } internal GUIStyle ActionButton { get; } internal GUIStyle Toggle { get; } internal GUIStyle ThemeButton { get; } internal GUIStyle ThemeButtonSelected { get; } internal GUIStyle Title { get; } internal GUIStyle SidebarTitle { get; } internal GUIStyle Label { get; } internal GUIStyle MutedLabel { get; } internal GUIStyle ResizeHandle { get; } internal GUIStyle WindowTitleBold { get; } internal GUIStyle WindowTitleNormal { get; } internal Texture2D SeparatorTexture { get; } internal MenuStyles(MenuTheme theme) { //IL_0010: 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_0034: 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_0058: 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_007c: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00e8: Unknown result type (might be due to invalid IL or missing references) ThemePalette themePalette = ThemePalette.Create(theme); _windowBackground = CreateTexture(themePalette.Window); _sidebarBackground = CreateTexture(themePalette.Sidebar); _contentBackground = CreateTexture(themePalette.Content); _buttonBackground = CreateTexture(themePalette.Button); _buttonHoverBackground = CreateTexture(themePalette.ButtonHover); _buttonActiveBackground = CreateTexture(themePalette.ButtonActive); _accentBackground = CreateTexture(themePalette.Accent); _accentHoverBackground = CreateTexture(themePalette.AccentHover); _toggleOffBackground = CreateTexture(themePalette.ToggleOff); _toggleHoverBackground = CreateTexture(themePalette.ToggleHover); _resizeBackground = CreateTexture(themePalette.Resize); _resizeHoverBackground = CreateTexture(themePalette.AccentHover); SeparatorTexture = CreateTexture(themePalette.Separator); Window = CreateWindowStyle(); Sidebar = CreateSidebarStyle(); Content = CreateContentStyle(); CategoryButton = CreateCategoryButtonStyle(); CategoryButtonSelected = CreateSelectedCategoryButtonStyle(); ActionButton = CreateActionButtonStyle(); Toggle = CreateToggleStyle(); ThemeButton = CreateThemeButtonStyle(); ThemeButtonSelected = CreateSelectedThemeButtonStyle(); Title = CreateTitleStyle(); SidebarTitle = CreateSidebarTitleStyle(); Label = CreateLabelStyle(); MutedLabel = CreateMutedLabelStyle(); ResizeHandle = CreateResizeHandleStyle(); WindowTitleBold = CreateWindowTitleBoldStyle(); WindowTitleNormal = CreateWindowTitleNormalStyle(); } private GUIStyle CreateWindowStyle() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //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_005e: Expected O, but got Unknown //IL_005f: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.window) { fontSize = 14, alignment = (TextAnchor)1, border = new RectOffset(0, 0, 0, 0), padding = new RectOffset(12, 12, 30, 12), margin = new RectOffset(0, 0, 0, 0), overflow = new RectOffset(0, 0, 0, 0) }; ApplyBackgroundToAllStates(val, _windowBackground, Color.white); return val; } private GUIStyle CreateSidebarStyle() { //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_001e: 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_0031: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0050: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.box) { border = new RectOffset(0, 0, 0, 0), padding = new RectOffset(10, 10, 10, 10), margin = new RectOffset(0, 8, 0, 0), overflow = new RectOffset(0, 0, 0, 0) }; ApplyBackgroundToAllStates(val, _sidebarBackground, Color.white); return val; } private GUIStyle CreateContentStyle() { //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_001e: 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_0031: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0050: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.box) { border = new RectOffset(0, 0, 0, 0), padding = new RectOffset(16, 16, 14, 14), margin = new RectOffset(0, 0, 0, 0), overflow = new RectOffset(0, 0, 0, 0) }; ApplyBackgroundToAllStates(val, _contentBackground, Color.white); return val; } private GUIStyle CreateCategoryButtonStyle() { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_003d: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_005b: 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_006b: Expected O, but got Unknown //IL_008d: 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_00b5: 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) //IL_00dd: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.button) { alignment = (TextAnchor)3, imagePosition = (ImagePosition)3, padding = new RectOffset(44, 10, 5, 5), margin = new RectOffset(0, 0, 3, 3), border = new RectOffset(0, 0, 0, 0), overflow = new RectOffset(0, 0, 0, 0), fontSize = 14, fontStyle = (FontStyle)0 }; Color textColor = default(Color); ((Color)(ref textColor))..ctor(0.84f, 0.86f, 0.9f); SetState(val.normal, _buttonBackground, textColor); SetState(val.hover, _buttonHoverBackground, Color.white); SetState(val.active, _buttonActiveBackground, Color.white); SetState(val.focused, _buttonBackground, textColor); SetState(val.onNormal, _buttonBackground, textColor); SetState(val.onHover, _buttonHoverBackground, Color.white); SetState(val.onActive, _buttonActiveBackground, Color.white); SetState(val.onFocused, _buttonBackground, textColor); return val; } private GUIStyle CreateSelectedCategoryButtonStyle() { //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_0013: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(CategoryButton) { fontStyle = (FontStyle)1 }; ApplyBackgroundToAllStates(val, _accentBackground, Color.white); return val; } private GUIStyle CreateActionButtonStyle() { //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_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: Expected O, but got Unknown //IL_0027: 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_0036: Expected O, but got Unknown //IL_0036: 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_0045: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0054: 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_0064: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00d6: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.button) { alignment = (TextAnchor)4, padding = new RectOffset(14, 14, 8, 8), margin = new RectOffset(0, 0, 4, 4), border = new RectOffset(0, 0, 0, 0), overflow = new RectOffset(0, 0, 0, 0), fontSize = 14, fontStyle = (FontStyle)0 }; Color textColor = default(Color); ((Color)(ref textColor))..ctor(0.88f, 0.9f, 0.94f); SetState(val.normal, _buttonBackground, textColor); SetState(val.hover, _buttonHoverBackground, Color.white); SetState(val.active, _buttonActiveBackground, Color.white); SetState(val.focused, _buttonBackground, textColor); SetState(val.onNormal, _buttonBackground, textColor); SetState(val.onHover, _buttonHoverBackground, Color.white); SetState(val.onActive, _buttonActiveBackground, Color.white); SetState(val.onFocused, _buttonBackground, textColor); return val; } private GUIStyle CreateToggleStyle() { //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_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: Expected O, but got Unknown //IL_0027: 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_0036: Expected O, but got Unknown //IL_0036: 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_0045: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_007f: 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_00a7: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.toggle) { alignment = (TextAnchor)3, padding = new RectOffset(40, 12, 8, 8), margin = new RectOffset(0, 0, 4, 4), border = new RectOffset(0, 0, 0, 0), overflow = new RectOffset(0, 0, 0, 0), fontSize = 14 }; Color textColor = default(Color); ((Color)(ref textColor))..ctor(0.86f, 0.88f, 0.92f); SetState(val.normal, _toggleOffBackground, textColor); SetState(val.hover, _toggleHoverBackground, Color.white); SetState(val.active, _toggleHoverBackground, Color.white); SetState(val.focused, _toggleOffBackground, textColor); SetState(val.onNormal, _accentBackground, Color.white); SetState(val.onHover, _accentHoverBackground, Color.white); SetState(val.onActive, _accentHoverBackground, Color.white); SetState(val.onFocused, _accentBackground, Color.white); return val; } private GUIStyle CreateThemeButtonStyle() { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown return new GUIStyle(ActionButton) { alignment = (TextAnchor)4, fontSize = 13 }; } private GUIStyle CreateSelectedThemeButtonStyle() { //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_0013: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(ThemeButton) { fontStyle = (FontStyle)1 }; ApplyBackgroundToAllStates(val, _accentBackground, Color.white); return val; } private static GUIStyle CreateTitleStyle() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0034: Expected O, but got Unknown //IL_0035: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 20, fontStyle = (FontStyle)1, alignment = (TextAnchor)3, margin = new RectOffset(0, 0, 0, 8) }; ClearAllStateBackgrounds(val); ApplyTextColorToAllStates(val, Color.white); return val; } private static GUIStyle CreateSidebarTitleStyle() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0034: Expected O, but got Unknown //IL_0035: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 15, fontStyle = (FontStyle)1, alignment = (TextAnchor)3, margin = new RectOffset(4, 0, 0, 6) }; ClearAllStateBackgrounds(val); ApplyTextColorToAllStates(val, new Color(0.78f, 0.81f, 0.87f)); return val; } private static GUIStyle CreateLabelStyle() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 14, wordWrap = true, alignment = (TextAnchor)3 }; ClearAllStateBackgrounds(val); ApplyTextColorToAllStates(val, new Color(0.86f, 0.88f, 0.92f)); return val; } private static GUIStyle CreateMutedLabelStyle() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 13, wordWrap = true, alignment = (TextAnchor)3 }; ClearAllStateBackgrounds(val); ApplyTextColorToAllStates(val, new Color(0.58f, 0.61f, 0.68f)); return val; } private GUIStyle CreateResizeHandleStyle() { //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_0016: 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_0025: 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_0034: Expected O, but got Unknown //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_0043: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //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_0061: Expected O, but got Unknown //IL_0062: Expected O, but got Unknown //IL_0084: 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_00ac: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_0112: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.box) { alignment = (TextAnchor)4, fontSize = 18, fontStyle = (FontStyle)1, border = new RectOffset(0, 0, 0, 0), padding = new RectOffset(0, 0, 0, 0), margin = new RectOffset(0, 0, 0, 0), overflow = new RectOffset(0, 0, 0, 0) }; Color textColor = default(Color); ((Color)(ref textColor))..ctor(0.75f, 0.78f, 0.84f); SetState(val.normal, _resizeBackground, textColor); SetState(val.hover, _resizeHoverBackground, Color.white); SetState(val.active, _resizeHoverBackground, Color.white); SetState(val.focused, _resizeBackground, textColor); SetState(val.onNormal, _resizeBackground, textColor); SetState(val.onHover, _resizeHoverBackground, Color.white); SetState(val.onActive, _resizeHoverBackground, Color.white); SetState(val.onFocused, _resizeBackground, textColor); return val; } private static GUIStyle CreateWindowTitleBoldStyle() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0033: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_006a: 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_0079: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_0089: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 14, fontStyle = (FontStyle)1, alignment = (TextAnchor)3, wordWrap = false, clipping = (TextClipping)1, stretchWidth = false, stretchHeight = false, fixedHeight = 20f, padding = new RectOffset(0, 0, 0, 0), margin = new RectOffset(0, 0, 0, 0), border = new RectOffset(0, 0, 0, 0), overflow = new RectOffset(0, 0, 0, 0) }; ClearAllStateBackgrounds(val); ApplyTextColorToAllStates(val, Color.white); return val; } private static GUIStyle CreateWindowTitleNormalStyle() { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0033: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_006a: 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_0079: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_0089: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 13, fontStyle = (FontStyle)0, alignment = (TextAnchor)3, wordWrap = false, clipping = (TextClipping)1, stretchWidth = false, stretchHeight = false, fixedHeight = 20f, padding = new RectOffset(0, 0, 0, 0), margin = new RectOffset(0, 0, 0, 0), border = new RectOffset(0, 0, 0, 0), overflow = new RectOffset(0, 0, 0, 0) }; ClearAllStateBackgrounds(val); ApplyTextColorToAllStates(val, new Color(0.72f, 0.74f, 0.8f)); return val; } internal void Dispose() { DestroyTexture(_windowBackground); DestroyTexture(_sidebarBackground); DestroyTexture(_contentBackground); DestroyTexture(_buttonBackground); DestroyTexture(_buttonHoverBackground); DestroyTexture(_buttonActiveBackground); DestroyTexture(_accentBackground); DestroyTexture(_accentHoverBackground); DestroyTexture(_toggleOffBackground); DestroyTexture(_toggleHoverBackground); DestroyTexture(_resizeBackground); DestroyTexture(_resizeHoverBackground); DestroyTexture(SeparatorTexture); } private static void ApplyBackgroundToAllStates(GUIStyle style, Texture2D background, Color textColor) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_003b: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) SetState(style.normal, background, textColor); SetState(style.hover, background, textColor); SetState(style.active, background, textColor); SetState(style.focused, background, textColor); SetState(style.onNormal, background, textColor); SetState(style.onHover, background, textColor); SetState(style.onActive, background, textColor); SetState(style.onFocused, background, textColor); } private static void ApplyTextColorToAllStates(GUIStyle style, Color textColor) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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) style.normal.textColor = textColor; style.hover.textColor = textColor; style.active.textColor = textColor; style.focused.textColor = textColor; style.onNormal.textColor = textColor; style.onHover.textColor = textColor; style.onActive.textColor = textColor; style.onFocused.textColor = textColor; } private static void ClearAllStateBackgrounds(GUIStyle style) { style.normal.background = null; style.hover.background = null; style.active.background = null; style.focused.background = null; style.onNormal.background = null; style.onHover.background = null; style.onActive.background = null; style.onFocused.background = null; } private static void SetState(GUIStyleState state, Texture2D background, Color textColor) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) state.background = background; state.textColor = textColor; } private static Texture2D CreateTexture(Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); ((Object)val).name = "P.E.A.K_MENU Style Texture"; ((Object)val).hideFlags = (HideFlags)61; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)0; val.SetPixel(0, 0, color); val.Apply(false, false); return val; } private static void DestroyTexture(Texture2D texture) { if ((Object)(object)texture != (Object)null) { Object.Destroy((Object)(object)texture); } } } internal enum MenuTheme { Iris, Ocean, Emerald, Rose, Amber } internal sealed class PeakMenuWindow { private const float TitleBarHeight = 38f; private const float ResizeHandleMargin = 4f; private const float CategoryIconSize = 24f; private const float CategoryIconLeftPadding = 10f; private readonly CursorController _cursorController = new CursorController(); private readonly Dictionary _pages; private MenuStyles? _styles; private MenuTheme _loadedTheme; private bool _isOpen; private bool _positionInitialized; private bool _closeAfterMouseRelease; private bool _disposed; private bool _isDragging; private bool _isResizing; private Vector2 _dragStartMouse; private Vector2 _dragStartPosition; private Vector2 _resizeStartMouse; private Vector2 _resizeStartSize; private Rect _windowRect; private MenuCategory _selectedCategory; internal bool IsOpen => _isOpen; private MenuStyles Styles { get { EnsureCurrentTheme(); return _styles; } } internal PeakMenuWindow() { _loadedTheme = MenuSettings.Theme; _pages = new Dictionary { { MenuCategory.ItemSpawner, new ItemSpawnerPage() }, { MenuCategory.Teleport, new TeleportPage() }, { MenuCategory.Flight, new FlightPage() }, { MenuCategory.Status, new StatusPage() }, { MenuCategory.Settings, new SettingsPage() } }; } internal void Toggle() { if (_isOpen) { Close(); } else { Open(); } } internal void Open() { if (!_disposed && !_isOpen) { _isOpen = true; _closeAfterMouseRelease = false; _isDragging = false; _isResizing = false; MenuState.IsOpen = true; _cursorController.Release(); ApplyConfiguredWindowSize(); EnsureCurrentTheme(); Plugin.Log.LogInfo((object)"P.E.A.K_MENU opened."); } } internal void Close() { if (_isOpen || _closeAfterMouseRelease) { FinishClose(); } } internal void Update() { if (_closeAfterMouseRelease && !Input.GetMouseButton(0) && !Input.GetMouseButton(1) && !Input.GetMouseButton(2)) { FinishClose(); } else if (_isOpen) { _cursorController.MaintainReleased(); RecoverLostPointerRelease(); } } internal void Draw() { //IL_0035: 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_005b: Expected O, but got Unknown //IL_0056: 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) if (_disposed || !_isOpen) { return; } _cursorController.MaintainReleased(); InitializePosition(); EnsureCurrentTheme(); try { HandleWindowPointerInput(); _windowRect = GUI.Window(938421, _windowRect, new WindowFunction(DrawWindowContents), "", Styles.Window); ClampToScreen(); HandleClickOutside(); } catch (Exception arg) { Plugin.Log.LogError((object)("Failed to draw P.E.A.K_MENU: " + $"{arg}")); Close(); } } internal void Dispose() { if (!_disposed) { Close(); _styles?.Dispose(); _styles = null; _disposed = true; } } private void EnsureCurrentTheme() { MenuTheme theme = MenuSettings.Theme; if (_styles == null || _loadedTheme != theme) { _styles?.Dispose(); _loadedTheme = theme; _styles = new MenuStyles(theme); Plugin.Log.LogInfo((object)$"Applied menu theme: {theme}"); } } private void BeginCloseAfterMouseRelease() { if (_isOpen && !_isDragging && !_isResizing) { _closeAfterMouseRelease = true; MenuState.IsOpen = true; _cursorController.MaintainReleased(); } } private void FinishClose() { _isOpen = false; _closeAfterMouseRelease = false; _isDragging = false; _isResizing = false; MenuState.IsOpen = false; MenuState.IsRebinding = false; _cursorController.Restore(); Plugin.Log.LogInfo((object)"P.E.A.K_MENU closed."); } private void DrawWindowContents(int windowId) { DrawCustomTitleBar(); GUILayout.Space(20f); try { GUILayout.BeginHorizontal(Array.Empty()); DrawSidebar(); DrawCurrentPage(); GUILayout.EndHorizontal(); } catch (Exception ex) { Plugin.Log.LogError((object)$"Failed to draw menu contents: {ex}"); try { GUILayout.EndHorizontal(); } catch { } DrawPageError(ex); } DrawResizeHandle(); } private void DrawCustomTitleBar() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0053: 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_0065: 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_0073: 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_00b8: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(12f, 0f, Mathf.Max(0f, ((Rect)(ref _windowRect)).width - 24f), 38f); GUIContent val2 = new GUIContent("P.E.A.K MENU"); GUIContent val3 = new GUIContent(" by Ruangfafa"); Vector2 val4 = Styles.WindowTitleBold.CalcSize(val2); Vector2 val5 = Styles.WindowTitleNormal.CalcSize(val3); float num = 14f; float num2 = val4.x + num + val5.x; float num3 = Mathf.Max(0f, ((Rect)(ref val)).x + (((Rect)(ref val)).width - num2) * 0.5f); float num4 = ((Rect)(ref val)).y + (((Rect)(ref val)).height - val4.y) * 0.5f; float num5 = ((Rect)(ref val)).y + (((Rect)(ref val)).height - val5.y) * 0.5f; GUI.Label(new Rect(num3, num4, val4.x + 2f, val4.y), val2, Styles.WindowTitleBold); GUI.Label(new Rect(num3 + val4.x + num, num5, val5.x + 2f, val5.y), val3, Styles.WindowTitleNormal); } private void DrawSidebar() { GUILayout.BeginVertical(Styles.Sidebar, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(150f), GUILayout.ExpandHeight(true) }); GUILayout.Label("分类", Styles.SidebarTitle, Array.Empty()); GUILayout.Space(6f); DrawCategoryButton(MenuCategory.ItemSpawner, "物品生成"); DrawCategoryButton(MenuCategory.Teleport, "传送"); DrawCategoryButton(MenuCategory.Flight, "飞行"); DrawCategoryButton(MenuCategory.Status, "状态"); GUILayout.FlexibleSpace(); DrawCategoryButton(MenuCategory.Settings, "设置"); GUILayout.EndVertical(); } private void DrawCategoryButton(MenuCategory category, string label) { //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_009f: Unknown result type (might be due to invalid IL or missing references) bool flag = _selectedCategory == category; GUIStyle val = (flag ? Styles.CategoryButtonSelected : Styles.CategoryButton); Texture2D categoryIcon = GetCategoryIcon(category); Rect rect = GUILayoutUtility.GetRect(GUIContent.none, val, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(42f), GUILayout.ExpandWidth(true) }); bool flag2 = GUI.Button(rect, label, val); if (categoryIcon != null) { float num = ((Rect)(ref rect)).y + (((Rect)(ref rect)).height - 24f) * 0.5f; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref rect)).x + 10f, num, 24f, 24f); GUI.DrawTexture(val2, (Texture)(object)categoryIcon, (ScaleMode)2, true); } if (flag2 && (!flag || category == MenuCategory.Teleport) && CanSelectCategory(category)) { _selectedCategory = category; Plugin.Log.LogInfo((object)$"Selected menu category: {category}"); } } private static Texture2D? GetCategoryIcon(MenuCategory category) { return (Texture2D?)(category switch { MenuCategory.ItemSpawner => MenuIcons.Item, MenuCategory.Teleport => MenuIcons.Teleport, MenuCategory.Flight => MenuIcons.Flight, MenuCategory.Status => MenuIcons.Status, _ => null, }); } private static bool CanSelectCategory(MenuCategory category) { if (category != MenuCategory.Teleport) { return true; } if (!TeleportRuntime.IsInitialized) { Plugin.Log.LogWarning((object)"Teleport menu blocked: TeleportRuntime is not initialized."); return false; } if (TeleportRuntime.Service.CanOpenMenu()) { return true; } Plugin.Log.LogInfo((object)"Teleport menu blocked: no other players were found."); return false; } private void DrawCurrentPage() { GUILayout.BeginVertical(Styles.Content, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); if (!_pages.TryGetValue(_selectedCategory, out IMenuPage value)) { GUILayout.Label("页面不存在。", Styles.Label, Array.Empty()); GUILayout.EndVertical(); return; } GUILayout.Label(value.Title, Styles.Title, Array.Empty()); DrawSeparator(); GUILayout.Space(12f); value.Draw(Styles); GUILayout.EndVertical(); } private void DrawSeparator() { //IL_0019: 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) Rect rect = GUILayoutUtility.GetRect(1f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUI.DrawTexture(rect, (Texture)(object)Styles.SeparatorTexture, (ScaleMode)0); } private void DrawResizeHandle() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) float num = 24f; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref _windowRect)).width - num - 4f, ((Rect)(ref _windowRect)).height - num - 4f, num, num); GUI.Box(val, "◢", Styles.ResizeHandle); } private void HandleWindowPointerInput() { //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_0012: 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_0019: 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_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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected I4, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (current != null) { Vector2 mousePosition = current.mousePosition; Rect titleBarScreenRect = GetTitleBarScreenRect(); Rect resizeHandleScreenRect = GetResizeHandleScreenRect(); EventType type = current.type; switch ((int)type) { case 0: HandlePointerDown(current, mousePosition, titleBarScreenRect, resizeHandleScreenRect); break; case 3: HandlePointerDrag(current, mousePosition); break; case 1: HandlePointerUp(current); break; case 2: break; } } } private void HandlePointerDown(Event currentEvent, Vector2 mousePosition, Rect titleBarRect, Rect resizeHandleRect) { //IL_000b: 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_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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (currentEvent.button == 0) { if (((Rect)(ref resizeHandleRect)).Contains(mousePosition)) { _isResizing = true; _isDragging = false; _resizeStartMouse = mousePosition; _resizeStartSize = new Vector2(((Rect)(ref _windowRect)).width, ((Rect)(ref _windowRect)).height); currentEvent.Use(); } else if (((Rect)(ref titleBarRect)).Contains(mousePosition)) { _isDragging = true; _isResizing = false; _dragStartMouse = mousePosition; _dragStartPosition = new Vector2(((Rect)(ref _windowRect)).x, ((Rect)(ref _windowRect)).y); currentEvent.Use(); } } } private void HandlePointerDrag(Event currentEvent, Vector2 mousePosition) { //IL_0012: 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) if (currentEvent.button == 0) { if (_isResizing) { ResizeWindow(mousePosition); currentEvent.Use(); } else if (_isDragging) { MoveWindow(mousePosition); currentEvent.Use(); } } } private void HandlePointerUp(Event currentEvent) { if (currentEvent.button == 0) { if (_isResizing) { _isResizing = false; SaveCurrentWindowSize(); currentEvent.Use(); } else if (_isDragging) { _isDragging = false; currentEvent.Use(); } } } private void MoveWindow(Vector2 mousePosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_002b: Unknown result type (might be due to invalid IL or missing references) Vector2 val = mousePosition - _dragStartMouse; float num = _dragStartPosition.x + val.x; float num2 = _dragStartPosition.y + val.y; ((Rect)(ref _windowRect)).x = Mathf.Clamp(num, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref _windowRect)).width)); ((Rect)(ref _windowRect)).y = Mathf.Clamp(num2, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref _windowRect)).height)); } private void ResizeWindow(Vector2 mousePosition) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) Vector2 val = mousePosition - _resizeStartMouse; float num = Mathf.Min(1100f, (float)Screen.width - ((Rect)(ref _windowRect)).x); float num2 = Mathf.Min(850f, (float)Screen.height - ((Rect)(ref _windowRect)).y); float num3 = Mathf.Min(520f, num); float num4 = Mathf.Min(360f, num2); ((Rect)(ref _windowRect)).width = Mathf.Clamp(_resizeStartSize.x + val.x, num3, num); ((Rect)(ref _windowRect)).height = Mathf.Clamp(_resizeStartSize.y + val.y, num4, num2); } private Rect GetTitleBarScreenRect() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) return new Rect(((Rect)(ref _windowRect)).x, ((Rect)(ref _windowRect)).y, ((Rect)(ref _windowRect)).width, 38f); } private Rect GetResizeHandleScreenRect() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) float num = 24f; return new Rect(((Rect)(ref _windowRect)).x + ((Rect)(ref _windowRect)).width - num - 4f, ((Rect)(ref _windowRect)).y + ((Rect)(ref _windowRect)).height - num - 4f, num, num); } private void RecoverLostPointerRelease() { if ((_isDragging || _isResizing) && !Input.GetMouseButton(0)) { if (_isResizing) { SaveCurrentWindowSize(); } _isDragging = false; _isResizing = false; } } private void SaveCurrentWindowSize() { MenuSettings.SetWindowSize(((Rect)(ref _windowRect)).width, ((Rect)(ref _windowRect)).height); Plugin.Log.LogInfo((object)("Menu resized to " + $"{((Rect)(ref _windowRect)).width:0} x " + $"{((Rect)(ref _windowRect)).height:0}.")); } private void InitializePosition() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) if (!_positionInitialized) { float num = Mathf.Clamp(MenuSettings.WindowWidth, Mathf.Min(520f, (float)Screen.width), Mathf.Min(1100f, (float)Screen.width)); float num2 = Mathf.Clamp(MenuSettings.WindowHeight, Mathf.Min(360f, (float)Screen.height), Mathf.Min(850f, (float)Screen.height)); float num3 = (float)Screen.width - num - 20f; float num4 = 80f; _windowRect = new Rect(Mathf.Max(0f, num3), Mathf.Max(0f, num4), num, num2); _positionInitialized = true; } } private void ApplyConfiguredWindowSize() { if (_positionInitialized) { float num = Mathf.Min(1100f, (float)Screen.width - ((Rect)(ref _windowRect)).x); float num2 = Mathf.Min(850f, (float)Screen.height - ((Rect)(ref _windowRect)).y); float num3 = Mathf.Min(520f, num); float num4 = Mathf.Min(360f, num2); ((Rect)(ref _windowRect)).width = Mathf.Clamp(MenuSettings.WindowWidth, num3, num); ((Rect)(ref _windowRect)).height = Mathf.Clamp(MenuSettings.WindowHeight, num4, num2); ClampToScreen(); } } private void ClampToScreen() { float num = Mathf.Min(1100f, (float)Screen.width); float num2 = Mathf.Min(850f, (float)Screen.height); float num3 = Mathf.Min(520f, num); float num4 = Mathf.Min(360f, num2); ((Rect)(ref _windowRect)).width = Mathf.Clamp(((Rect)(ref _windowRect)).width, num3, num); ((Rect)(ref _windowRect)).height = Mathf.Clamp(((Rect)(ref _windowRect)).height, num4, num2); ((Rect)(ref _windowRect)).x = Mathf.Clamp(((Rect)(ref _windowRect)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref _windowRect)).width)); ((Rect)(ref _windowRect)).y = Mathf.Clamp(((Rect)(ref _windowRect)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref _windowRect)).height)); } private void HandleClickOutside() { //IL_0023: 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) if (!_isDragging && !_isResizing && !_closeAfterMouseRelease) { Event current = Event.current; if (current != null && (int)current.type == 0 && current.button == 0 && !((Rect)(ref _windowRect)).Contains(current.mousePosition)) { BeginCloseAfterMouseRelease(); current.Use(); } } } private void DrawPageError(Exception exception) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(20f, 50f, Mathf.Max(100f, ((Rect)(ref _windowRect)).width - 40f), Mathf.Max(100f, ((Rect)(ref _windowRect)).height - 38f - 32f)); GUI.Label(val, "菜单页面绘制失败。\n\n" + exception.GetType().Name + "\n" + exception.Message + "\n\n请查看 BepInEx/LogOutput.log。", Styles.Label); } } } namespace P.E.A.K_MENU.UI.Pages { internal sealed class FlightPage : IMenuPage { private string _speedInput = "16"; public string Title => "飞行"; public void Draw(MenuStyles styles) { if (!FlightRuntime.IsInitialized) { GUILayout.Label("飞行功能尚未初始化。", styles.MutedLabel, Array.Empty()); return; } FlightService service = FlightRuntime.Service; GUILayout.Label("开启飞行总开关后,无敌与防击退会被强制开启并锁定。", styles.MutedLabel, Array.Empty()); GUILayout.Space(12f); bool flag = GUILayout.Toggle(service.Enabled, "启用飞行总开关", styles.Toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }); if (flag != service.Enabled) { service.SetEnabled(flag); } GUILayout.Space(8f); bool flag2 = GUILayout.Toggle(service.DoubleTapMode, "双击空格切换实际飞行", styles.Toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }); if (flag2 != service.DoubleTapMode) { service.SetDoubleTapMode(flag2); } bool flag3 = GUILayout.Toggle(service.ScrollSpeedEnabled, "实际飞行中使用滚轮调整速度", styles.Toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }); if (flag3 != service.ScrollSpeedEnabled) { service.SetScrollSpeedEnabled(flag3); } bool flag4 = GUILayout.Toggle(service.SlowFallEnabled, "每次坐标同步后续期五秒缓降", styles.Toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }); if (flag4 != service.SlowFallEnabled) { service.SetSlowFallEnabled(flag4); } GUILayout.Space(12f); GUILayout.Label("飞行速度", styles.Label, Array.Empty()); GUILayout.Space(4f); GUILayout.BeginHorizontal(Array.Empty()); _speedInput = GUILayout.TextField(_speedInput, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(36f), GUILayout.ExpandWidth(true) }); if (GUILayout.Button("确定", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(76f), GUILayout.Height(36f) })) { ApplySpeed(service); } GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.Label($"当前速度:{service.FlightSpeed:0.##}", styles.MutedLabel, Array.Empty()); GUILayout.Label("滚轮向上提高 5 点速度,滚轮向下降低 5 点速度。", styles.MutedLabel, Array.Empty()); GUILayout.Space(12f); GUILayout.Label("实际飞行状态", styles.Label, Array.Empty()); GUILayout.Space(4f); GUILayout.Label(service.ActivelyFlying ? "正在飞行" : (service.Enabled ? "正常状态 / 等待双击空格" : "飞行总开关未开启"), service.ActivelyFlying ? styles.Label : styles.MutedLabel, Array.Empty()); GUI.enabled = service.Enabled; if (GUILayout.Button(service.ActivelyFlying ? "退出实际飞行" : "进入实际飞行", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f) })) { service.ToggleActiveFlight(); } GUI.enabled = true; GUILayout.Space(12f); GUILayout.Label("操作:WASD 移动,空格上升,Ctrl 下降,Shift 两倍加速。", styles.MutedLabel, Array.Empty()); GUILayout.Label("关闭实际飞行后,最后一次同步给予的缓降最多继续五秒。", styles.MutedLabel, Array.Empty()); GUILayout.Space(8f); GUILayout.Label(service.LastStatus, service.LastSucceeded ? styles.Label : styles.MutedLabel, Array.Empty()); } private void ApplySpeed(FlightService service) { if (!float.TryParse(_speedInput, NumberStyles.Float, CultureInfo.InvariantCulture, out var result) && !float.TryParse(_speedInput, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) { service.SetFlightSpeed(float.NaN); return; } service.SetFlightSpeed(result); _speedInput = service.FlightSpeed.ToString("0.##", CultureInfo.InvariantCulture); } } internal sealed class ItemSpawnerPage : IMenuPage { private const float ItemRowHeight = 56f; private const float IconSize = 40f; private const float VisibleItemsListHeight = 200f; private const float AddItemsListHeight = 180f; private const int MaximumSearchResults = 100; private Vector2 _spawnScroll; private Vector2 _manageScroll; private Vector2 _addItemsScroll; private string _managementStatus = string.Empty; private bool _managementOpen; private string _searchText = string.Empty; public string Title { get { if (!_managementOpen) { return "物品生成"; } return "物品管理"; } } public void Draw(MenuStyles styles) { try { if (!ItemSpawnRuntime.IsInitialized) { GUILayout.Label("ItemSpawn 尚未初始化。", styles.MutedLabel, Array.Empty()); GUILayout.Space(8f); GUILayout.Label("请确认当前 Profile 已部署最新 DLL,并检查 LogOutput.log 中的初始化错误。", styles.MutedLabel, Array.Empty()); return; } ItemSpawnRuntime.Catalog.RefreshIfNeeded(); if (_managementOpen) { DrawManagement(styles); } else { DrawSpawnList(styles); } } catch (Exception ex) { Plugin.Log.LogError((object)$"Failed to draw ItemSpawnerPage: {ex}"); GUILayout.Label("物品页面加载失败。", styles.Label, Array.Empty()); GUILayout.Space(8f); GUILayout.Label(ex.GetType().Name + "\n" + ex.Message, styles.MutedLabel, Array.Empty()); } } private void DrawSpawnList(MenuStyles styles) { //IL_002c: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0139: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("点击物品后,将通过 PEAK 原生网络流程生成并交给本地玩家。", styles.MutedLabel, Array.Empty()); GUILayout.Space(8f); IReadOnlyList visibleItems = ItemSpawnRuntime.Catalog.GetVisibleItems(); _spawnScroll = GUILayout.BeginScrollView(_spawnScroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); if (visibleItems.Count == 0) { GUILayout.Label("物品数据库尚未准备好。请进入关卡后重新打开菜单。", styles.MutedLabel, Array.Empty()); } else { foreach (ItemSpawnEntry item in visibleItems) { DrawSpawnButton(item, styles); } } GUILayout.EndScrollView(); GUILayout.Space(6f); GUILayout.Label(ItemSpawnRuntime.Spawner.LastStatus, ItemSpawnRuntime.Spawner.LastSucceeded ? styles.Label : styles.MutedLabel, Array.Empty()); GUILayout.Space(4f); if (GUILayout.Button("物品管理", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f) })) { _managementOpen = true; _searchText = string.Empty; _managementStatus = string.Empty; _manageScroll = Vector2.zero; _addItemsScroll = Vector2.zero; } } private static void DrawSpawnButton(ItemSpawnEntry entry, MenuStyles styles) { //IL_0019: 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_0077: 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) Rect rect = GUILayoutUtility.GetRect(1f, 56f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); if (GUI.Button(rect, GUIContent.none, styles.ActionButton)) { ItemSpawnRuntime.Spawner.Spawn(entry); } Rect iconRect = default(Rect); ((Rect)(ref iconRect))..ctor(((Rect)(ref rect)).x + 8f, ((Rect)(ref rect)).y + (((Rect)(ref rect)).height - 40f) * 0.5f, 40f, 40f); DrawItemIcon(entry, iconRect, styles); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref iconRect)).xMax + 10f, ((Rect)(ref rect)).y, Mathf.Max(0f, ((Rect)(ref rect)).width - 40f - 30f), ((Rect)(ref rect)).height); GUI.Label(val, entry.DisplayName, styles.Label); } private static void DrawItemIcon(ItemSpawnEntry entry, Rect iconRect, MenuStyles styles) { //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_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_0008: Unknown result type (might be due to invalid IL or missing references) if (entry.Icon == null) { GUI.Label(iconRect, "□", styles.Label); return; } Rect val = CalculateSpriteUv(entry.Icon); GUI.DrawTextureWithTexCoords(iconRect, (Texture)(object)entry.Icon.texture, val, true); } private void DrawManagement(MenuStyles styles) { //IL_0040: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: 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_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("添加、删除或调整主列表的显示顺序。", styles.MutedLabel, Array.Empty()); GUILayout.Space(8f); GUILayout.Label("已显示物品", styles.Label, Array.Empty()); GUILayout.Space(4f); _manageScroll = GUILayout.BeginScrollView(_manageScroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(200f), GUILayout.ExpandWidth(true) }); IReadOnlyList visibleItems = ItemSpawnRuntime.Catalog.GetVisibleItems(); if (visibleItems.Count == 0) { GUILayout.Label("当前没有显示任何物品。", styles.MutedLabel, Array.Empty()); } else { ItemSpawnEntry[] array = visibleItems.ToArray(); ItemSpawnEntry[] array2 = array; foreach (ItemSpawnEntry entry in array2) { DrawManagedItemRow(entry, styles); } } GUILayout.EndScrollView(); GUILayout.Space(10f); GUILayout.Label("添加物品", styles.Label, Array.Empty()); GUILayout.Space(4f); _searchText = GUILayout.TextField(_searchText, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(32f), GUILayout.ExpandWidth(true) }); GUILayout.Space(6f); _addItemsScroll = GUILayout.BeginScrollView(_addItemsScroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(180f), GUILayout.ExpandWidth(true) }); DrawSearchResults(styles); GUILayout.EndScrollView(); GUILayout.Space(6f); if (!string.IsNullOrWhiteSpace(_managementStatus)) { GUILayout.Label(_managementStatus, styles.MutedLabel, Array.Empty()); GUILayout.Space(4f); } if (GUILayout.Button("重新扫描游戏物品", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) })) { ItemSpawnRuntime.Catalog.ForceRefresh(); _manageScroll = Vector2.zero; _addItemsScroll = Vector2.zero; _managementStatus = "已重新扫描游戏物品。"; } if (GUILayout.Button("恢复默认物品和排序", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) })) { ItemSpawnRuntime.Catalog.RestoreDefaults(); _manageScroll = Vector2.zero; _addItemsScroll = Vector2.zero; _managementStatus = "已恢复默认物品和默认排序。"; } if (GUILayout.Button("返回物品列表", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f) })) { _managementOpen = false; _searchText = string.Empty; _managementStatus = string.Empty; _manageScroll = Vector2.zero; _addItemsScroll = Vector2.zero; } } private static void DrawManagedItemRow(ItemSpawnEntry entry, MenuStyles styles) { //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_0066: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty()); Rect rect = GUILayoutUtility.GetRect(30f, 34f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(30f), GUILayout.Height(34f) }); Rect iconRect = default(Rect); ((Rect)(ref iconRect))..ctor(((Rect)(ref rect)).x + 2f, ((Rect)(ref rect)).y + 4f, 26f, 26f); DrawItemIcon(entry, iconRect, styles); GUILayout.Label(entry.DisplayName, styles.Label, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(34f) }); if (GUILayout.Button("↑", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(38f), GUILayout.Height(34f) })) { ItemSpawnRuntime.Catalog.Move(entry.PrefabName, -1); } if (GUILayout.Button("↓", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(38f), GUILayout.Height(34f) })) { ItemSpawnRuntime.Catalog.Move(entry.PrefabName, 1); } if (GUILayout.Button("删除", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(58f), GUILayout.Height(34f) })) { ItemSpawnRuntime.Catalog.Remove(entry.PrefabName); } GUILayout.EndHorizontal(); } private void DrawSearchResults(MenuStyles styles) { string query = _searchText.Trim(); IEnumerable source = (from entry2 in ItemSpawnRuntime.Catalog.AllItems where !ItemSpawnRuntime.Catalog.ContainsVisible(entry2.PrefabName) where MatchesSearch(entry2, query) select entry2).Take(100); ItemSpawnEntry[] array = source.ToArray(); if (array.Length == 0) { GUILayout.Label(string.IsNullOrWhiteSpace(query) ? "所有已发现物品都已添加,或当前没有可添加物品。" : "没有找到匹配的物品。", styles.MutedLabel, Array.Empty()); return; } ItemSpawnEntry[] array2 = array; foreach (ItemSpawnEntry entry in array2) { DrawAddItemRow(entry, styles); } } private void DrawAddItemRow(ItemSpawnEntry entry, MenuStyles styles) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(42f) }); Rect rect = GUILayoutUtility.GetRect(32f, 42f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(32f), GUILayout.Height(42f) }); Rect iconRect = default(Rect); ((Rect)(ref iconRect))..ctor(((Rect)(ref rect)).x + 2f, ((Rect)(ref rect)).y + 7f, 28f, 28f); DrawItemIcon(entry, iconRect, styles); GUILayout.Space(6f); GUILayout.Label(entry.DisplayName, styles.Label, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(42f) }); if (GUILayout.Button("添加", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(64f), GUILayout.Height(34f) })) { ItemSpawnRuntime.Catalog.Add(entry.PrefabName); _managementStatus = "已添加:" + entry.DisplayName; _manageScroll = new Vector2(0f, float.MaxValue); } GUILayout.EndHorizontal(); } private static bool MatchesSearch(ItemSpawnEntry entry, string query) { if (string.IsNullOrWhiteSpace(query)) { return true; } if (!entry.DisplayName.Contains(query, StringComparison.OrdinalIgnoreCase)) { return entry.PrefabName.Contains(query, StringComparison.OrdinalIgnoreCase); } return true; } private static Rect CalculateSpriteUv(Sprite sprite) { //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_004a: Unknown result type (might be due to invalid IL or missing references) Texture2D texture = sprite.texture; Rect textureRect = sprite.textureRect; return new Rect(((Rect)(ref textureRect)).x / (float)((Texture)texture).width, ((Rect)(ref textureRect)).y / (float)((Texture)texture).height, ((Rect)(ref textureRect)).width / (float)((Texture)texture).width, ((Rect)(ref textureRect)).height / (float)((Texture)texture).height); } } internal sealed class SettingsPage : IMenuPage { private bool _waitingForKey; public string Title => "设置"; public void Draw(MenuStyles styles) { GUILayout.Label("菜单外观、尺寸与快捷键设置。", styles.MutedLabel, Array.Empty()); GUILayout.Space(14f); DrawThemeSection(styles); GUILayout.Space(18f); DrawShortcutSection(styles); GUILayout.Space(18f); DrawWindowSizeSection(styles); } private static void DrawThemeSection(MenuStyles styles) { GUILayout.Label("主题色", styles.Label, Array.Empty()); GUILayout.Space(6f); GUILayout.Label("当前主题:" + GetThemeDisplayName(MenuSettings.Theme), styles.MutedLabel, Array.Empty()); GUILayout.Space(8f); GUILayout.BeginHorizontal(Array.Empty()); DrawThemeButton(styles, MenuTheme.Iris, "鸢尾花"); DrawThemeButton(styles, MenuTheme.Ocean, "海洋"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); DrawThemeButton(styles, MenuTheme.Emerald, "翡翠"); DrawThemeButton(styles, MenuTheme.Rose, "玫瑰"); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty()); DrawThemeButton(styles, MenuTheme.Amber, "琥珀"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(6f); if (GUILayout.Button("恢复默认主题(鸢尾花)", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) })) { MenuSettings.ResetTheme(); } } private static void DrawThemeButton(MenuStyles styles, MenuTheme theme, string label) { GUIStyle val = ((MenuSettings.Theme == theme) ? styles.ThemeButtonSelected : styles.ThemeButton); if (GUILayout.Button(label, val, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(38f), GUILayout.ExpandWidth(true) })) { MenuSettings.SetTheme(theme); } } private void DrawShortcutSection(MenuStyles styles) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("菜单快捷键", styles.Label, Array.Empty()); GUILayout.Space(6f); string text = (_waitingForKey ? "请按下新的快捷键..." : $"当前快捷键:{MenuSettings.ToggleKey}"); if (GUILayout.Button(text, styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) })) { BeginRebind(); } if (_waitingForKey) { GUILayout.Label("按下任意按键完成绑定,按 Esc 取消。", styles.MutedLabel, Array.Empty()); CaptureKeyEvent(); } if (GUILayout.Button($"恢复默认快捷键({ModConstants.DefaultToggleMenuKey})", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) })) { CancelRebind(); MenuSettings.ResetToggleKey(); } } private static void DrawWindowSizeSection(MenuStyles styles) { GUILayout.Label("窗口尺寸", styles.Label, Array.Empty()); GUILayout.Space(6f); GUILayout.Label($"当前大小:{MenuSettings.WindowWidth:0} × " + $"{MenuSettings.WindowHeight:0}", styles.MutedLabel, Array.Empty()); GUILayout.Label("拖动窗口右下角的小三角可以调整大小。", styles.MutedLabel, Array.Empty()); GUILayout.Space(6f); if (GUILayout.Button("恢复默认窗口大小", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) })) { MenuSettings.ResetWindowSize(); } } private void BeginRebind() { _waitingForKey = true; MenuState.IsRebinding = true; Plugin.Log.LogInfo((object)"Waiting for a new menu shortcut key."); } private void CancelRebind() { _waitingForKey = false; MenuState.IsRebinding = false; } private void CaptureKeyEvent() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //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) //IL_001a: 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_0021: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) Event current = Event.current; if (current == null || (int)current.type != 4) { return; } KeyCode keyCode = current.keyCode; if ((int)keyCode != 0) { if ((int)keyCode == 27) { CancelRebind(); current.Use(); } else { MenuSettings.SetToggleKey(keyCode); CancelRebind(); current.Use(); } } } private static string GetThemeDisplayName(MenuTheme theme) { return theme switch { MenuTheme.Iris => "鸢尾花", MenuTheme.Ocean => "海洋", MenuTheme.Emerald => "翡翠", MenuTheme.Rose => "玫瑰", MenuTheme.Amber => "琥珀", _ => "鸢尾花", }; } } internal sealed class StatusPage : IMenuPage { private const float SpecialEffectsHeight = 400f; private readonly Dictionary _amountInputs = new Dictionary(); private readonly Dictionary _durationInputs = new Dictionary(); private Vector2 _pageScroll; private Vector2 _specialEffectsScroll; private string _weightInput = "0"; public string Title => "状态"; public void Draw(MenuStyles styles) { //IL_002c: 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_0050: Unknown result type (might be due to invalid IL or missing references) if (!StatusRuntime.IsInitialized) { GUILayout.Label("状态功能尚未初始化。", styles.MutedLabel, Array.Empty()); return; } StatusService service = StatusRuntime.Service; EnsureInputsExist(service); _pageScroll = GUILayout.BeginScrollView(_pageScroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); DrawInvincibility(service, styles); GUILayout.Space(14f); DrawInfiniteStamina(service, styles); GUILayout.Space(14f); DrawClearEffects(service, styles); GUILayout.Space(14f); DrawWeight(service, styles); GUILayout.Space(16f); DrawSpecialEffects(service, styles); GUILayout.Space(12f); GUILayout.Label(service.LastStatus, service.LastSucceeded ? styles.Label : styles.MutedLabel, Array.Empty()); GUILayout.EndScrollView(); } private static void DrawInvincibility(StatusService service, MenuStyles styles) { GUILayout.Label("无敌", styles.Label, Array.Empty()); GUILayout.Space(4f); GUI.enabled = !service.FlightProtectionLock; bool flag = GUILayout.Toggle(service.Invincible, "启用无敌", styles.Toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }); GUI.enabled = true; if (!service.FlightProtectionLock && flag != service.Invincible) { service.SetInvincible(flag); } GUI.enabled = service.Invincible && !service.FlightProtectionLock; bool flag2 = GUILayout.Toggle(service.AntiKnockback, "阻止击退、摔倒与外力", styles.Toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }); GUI.enabled = true; if (!service.FlightProtectionLock && flag2 != service.AntiKnockback) { service.SetAntiKnockback(flag2); } if (service.FlightProtectionLock) { GUILayout.Label("飞行总开关开启期间,无敌与防击退已被强制开启并锁定。", styles.MutedLabel, Array.Empty()); } else { GUILayout.Label("附加保护默认开启,关闭后仍保留死亡保护。", styles.MutedLabel, Array.Empty()); } } private static void DrawInfiniteStamina(StatusService service, MenuStyles styles) { GUILayout.Label("体力", styles.Label, Array.Empty()); GUILayout.Space(4f); bool flag = GUILayout.Toggle(service.InfiniteStamina, "无限体力", styles.Toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }); if (flag != service.InfiniteStamina) { service.SetInfiniteStamina(flag); } } private static void DrawClearEffects(StatusService service, MenuStyles styles) { GUILayout.Label("状态清理", styles.Label, Array.Empty()); GUILayout.Space(4f); if (GUILayout.Button("清除所有负面效果", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) })) { service.ClearNegativeEffects(); } } private void DrawWeight(StatusService service, MenuStyles styles) { GUILayout.Label("负重重量", styles.Label, Array.Empty()); GUILayout.Space(4f); bool flag = GUILayout.Toggle(service.WeightOverrideEnabled, "启用负重覆盖", styles.Toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f) }); if (flag != service.WeightOverrideEnabled) { service.SetWeightOverride(flag); } GUILayout.BeginHorizontal(Array.Empty()); _weightInput = GUILayout.TextField(_weightInput, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(36f), GUILayout.ExpandWidth(true) }); if (GUILayout.Button("确定", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(76f), GUILayout.Height(36f) }) && TryParseNumber(_weightInput, "负重", out var value)) { service.SetWeight(value); } GUILayout.EndHorizontal(); GUILayout.Label("输入 0 可实现无负重。", styles.MutedLabel, Array.Empty()); } private void DrawSpecialEffects(StatusService service, MenuStyles styles) { //IL_0040: 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_0068: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("特殊状态合集", styles.Label, Array.Empty()); GUILayout.Space(4f); GUILayout.Label("每种状态会根据自身机制显示持有量、持续时间或两者。", styles.MutedLabel, Array.Empty()); GUILayout.Space(6f); _specialEffectsScroll = GUILayout.BeginScrollView(_specialEffectsScroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(400f), GUILayout.ExpandWidth(true) }); foreach (StatusEffectDefinition specialEffect in service.SpecialEffects) { DrawEffectPanel(service, specialEffect, styles); GUILayout.Space(10f); } GUILayout.EndScrollView(); } private void DrawEffectPanel(StatusService service, StatusEffectDefinition effect, MenuStyles styles) { GUILayout.BeginVertical(Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(effect.DisplayName, styles.Label, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(30f) }); if (effect.StatusType.HasValue && service.TryReadStatus(effect, out var value)) { GUILayout.Label($"当前:{value:0.###}", styles.MutedLabel, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(110f), GUILayout.Height(30f) }); } GUILayout.EndHorizontal(); GUILayout.Label(effect.Description, styles.MutedLabel, Array.Empty()); GUILayout.Space(5f); if (effect.ShowAmount) { DrawAmountInput(effect, styles); GUILayout.Space(4f); } if (effect.ShowDuration) { DrawDurationInput(effect, styles); GUILayout.Space(4f); } if (effect.Kind == StatusEffectKind.GameStatus) { DrawApplyModeButtons(service, effect, styles); } GUILayout.EndVertical(); } private void DrawAmountInput(StatusEffectDefinition effect, MenuStyles styles) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("持有量", styles.MutedLabel, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(72f), GUILayout.Height(34f) }); _amountInputs[effect.Id] = GUILayout.TextField(_amountInputs[effect.Id], (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(34f), GUILayout.ExpandWidth(true) }); GUILayout.EndHorizontal(); } private void DrawDurationInput(StatusEffectDefinition effect, MenuStyles styles) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("持续秒数", styles.MutedLabel, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(72f), GUILayout.Height(34f) }); _durationInputs[effect.Id] = GUILayout.TextField(_durationInputs[effect.Id], (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(34f), GUILayout.ExpandWidth(true) }); GUILayout.EndHorizontal(); } private void DrawApplyModeButtons(StatusService service, StatusEffectDefinition effect, MenuStyles styles) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("操作", styles.MutedLabel, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(72f), GUILayout.Height(34f) }); DrawApplyModeButton(service, effect, StatusApplyMode.Add, "增加", styles); DrawApplyModeButton(service, effect, StatusApplyMode.Subtract, "减少", styles); DrawApplyModeButton(service, effect, StatusApplyMode.Set, "设为", styles); DrawApplyModeButton(service, effect, StatusApplyMode.Clear, "清零", styles); GUILayout.EndHorizontal(); } private void DrawApplyModeButton(StatusService service, StatusEffectDefinition effect, StatusApplyMode mode, string text, MenuStyles styles) { if (GUILayout.Button(text, styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(34f), GUILayout.ExpandWidth(true) })) { ApplyEffect(service, effect, mode); } } private void ApplyEffect(StatusService service, StatusEffectDefinition effect, StatusApplyMode applyMode) { float value = effect.DefaultAmount; float value2 = effect.DefaultDuration; if (effect.ShowAmount && applyMode != StatusApplyMode.Clear && !TryParseNumber(_amountInputs[effect.Id], effect.DisplayName + "持有量", out value)) { return; } if (effect.ShowDuration && applyMode != StatusApplyMode.Clear) { if (!TryParseNumber(_durationInputs[effect.Id], effect.DisplayName + "持续时间", out value2)) { return; } if (value2 <= 0f) { service.SetInputError("持续时间必须大于 0 秒。"); return; } } if (applyMode == StatusApplyMode.Clear) { value = 0f; value2 = 0f; } service.ApplySpecialEffect(effect, value, value2, applyMode); } private void EnsureInputsExist(StatusService service) { foreach (StatusEffectDefinition specialEffect in service.SpecialEffects) { if (!_amountInputs.ContainsKey(specialEffect.Id)) { _amountInputs[specialEffect.Id] = specialEffect.DefaultAmount.ToString("0.###", CultureInfo.InvariantCulture); } if (!_durationInputs.ContainsKey(specialEffect.Id)) { _durationInputs[specialEffect.Id] = specialEffect.DefaultDuration.ToString("0.###", CultureInfo.InvariantCulture); } } } private bool TryParseNumber(string text, string fieldName, out float value) { if (!float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out value) && !float.TryParse(text, NumberStyles.Float, CultureInfo.CurrentCulture, out value)) { StatusRuntime.Service.SetInputError(fieldName + "格式无效。"); return false; } return true; } } internal sealed class TeleportPage : IMenuPage { private const float PlayerRowHeight = 46f; private const float ActionButtonWidth = 58f; private Vector2 _playerScroll; public string Title => "传送"; public void Draw(MenuStyles styles) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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) if (!TeleportRuntime.IsInitialized) { GUILayout.Label("传送功能尚未初始化。", styles.MutedLabel, Array.Empty()); return; } TeleportService service = TeleportRuntime.Service; if (!service.HasOtherPlayers) { GUILayout.Label("当前没有自己以外的玩家。", styles.MutedLabel, Array.Empty()); GUILayout.Space(8f); GUILayout.Label("传送菜单暂不可用。", styles.MutedLabel, Array.Empty()); GUILayout.Space(10f); if (GUILayout.Button("重新扫描房间玩家", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f) })) { service.RefreshPlayers(); _playerScroll = Vector2.zero; } return; } GUILayout.Label("点击“去”传送到对方,点击“来”将对方传送到自己附近。", styles.MutedLabel, Array.Empty()); GUILayout.Space(10f); DrawPlayerList(service, styles); GUILayout.Space(8f); GUILayout.Label(service.LastStatus, service.LastSucceeded ? styles.Label : styles.MutedLabel, Array.Empty()); GUILayout.Space(6f); if (GUILayout.Button("刷新房间玩家", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f) })) { service.RefreshPlayers(); _playerScroll = Vector2.zero; } } private void DrawPlayerList(TeleportService service, MenuStyles styles) { //IL_0009: 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) IReadOnlyList players = service.Players; _playerScroll = GUILayout.BeginScrollView(_playerScroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) }); TeleportPlayerEntry[] array = new TeleportPlayerEntry[players.Count]; for (int i = 0; i < players.Count; i++) { array[i] = players[i]; } TeleportPlayerEntry[] array2 = array; foreach (TeleportPlayerEntry player in array2) { DrawPlayerRow(player, service, styles); } GUILayout.EndScrollView(); } private static void DrawPlayerRow(TeleportPlayerEntry player, TeleportService service, MenuStyles styles) { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(46f) }); GUILayout.Label(player.DisplayName, styles.Label, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.ExpandWidth(true), GUILayout.Height(46f) }); if (GUILayout.Button("去", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(58f), GUILayout.Height(36f) })) { service.TeleportLocalTo(player); } if (GUILayout.Button("来", styles.ActionButton, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(58f), GUILayout.Height(36f) })) { service.BringPlayerToLocal(player); } GUILayout.EndHorizontal(); } } } namespace P.E.A.K_MENU.Patches { [HarmonyPatch] internal static class CharacterInputPatch { private static MethodInfo? _resetInputMethod; private static IEnumerable TargetMethods() { Type characterInputType = AccessTools.TypeByName("CharacterInput"); if ((object)characterInputType == null) { Plugin.Log.LogError((object)"CharacterInput type was not found. Game input blocking will not work."); yield break; } _resetInputMethod = AccessTools.Method(characterInputType, "ResetInput", (Type[])null, (Type[])null); MethodInfo methodInfo = AccessTools.Method(characterInputType, "Sample", (Type[])null, (Type[])null); if ((object)methodInfo != null) { Plugin.Log.LogInfo((object)"Patching CharacterInput.Sample."); yield return methodInfo; } else { Plugin.Log.LogWarning((object)"CharacterInput.Sample was not found."); } MethodInfo methodInfo2 = AccessTools.Method(characterInputType, "SampleAlways", (Type[])null, (Type[])null); if ((object)methodInfo2 != null) { Plugin.Log.LogInfo((object)"Patching CharacterInput.SampleAlways."); yield return methodInfo2; } else { Plugin.Log.LogWarning((object)"CharacterInput.SampleAlways was not found."); } } private static bool Prefix(object __instance) { if (!MenuState.IsOpen) { return true; } ClearCachedInput(__instance); return false; } private static void ClearCachedInput(object instance) { if ((object)_resetInputMethod == null) { return; } try { _resetInputMethod.Invoke(instance, null); } catch (Exception arg) { Plugin.Log.LogError((object)$"Failed to reset CharacterInput: {arg}"); } } } [HarmonyPatch] internal static class StatusProtectionPatch { internal static bool InvincibleEnabled { get; set; } internal static bool AntiKnockbackEnabled { get; set; } = true; internal static bool WeightOverrideEnabled { get; set; } internal static float WeightOverrideValue { get; set; } private static IEnumerable TargetMethods() { string[] array = new string[10] { "DieInstantly", "RPCA_Die", "Fall", "RPCA_Fall", "RPCA_FallWithScreenShake", "AddForce", "AddForceAtPosition", "RPCA_AddForceAtPosition", "AddForceToBodyPart", "RPCA_AddForceToBodyPart" }; MethodInfo[] characterMethods = AccessTools.GetDeclaredMethods(typeof(Character)).ToArray(); string[] array2 = array; foreach (string methodName in array2) { MethodInfo[] array3 = characterMethods.Where((MethodInfo method) => method.Name.Equals(methodName, StringComparison.Ordinal)).ToArray(); MethodInfo[] array4 = array3; foreach (MethodInfo methodInfo in array4) { Plugin.Log.LogInfo((object)("Status protection patch target: Character." + methodInfo.Name + "(" + string.Join(", ", from parameter in methodInfo.GetParameters() select parameter.ParameterType.Name) + ")")); yield return methodInfo; } } } private static bool Prefix(object __instance, MethodBase __originalMethod) { if (!InvincibleEnabled) { return true; } Character val = (Character)((__instance is Character) ? __instance : null); if (val == null || !val.IsLocal) { return true; } string name = __originalMethod.Name; if (name == "DieInstantly" || name == "RPCA_Die") { Plugin.Log.LogInfo((object)("Blocked local death: " + name)); return false; } if (!AntiKnockbackEnabled) { return true; } switch (name) { default: if (!(name == "RPCA_AddForceToBodyPart")) { return true; } break; case "Fall": case "RPCA_Fall": case "RPCA_FallWithScreenShake": case "AddForce": case "AddForceAtPosition": case "RPCA_AddForceAtPosition": case "AddForceToBodyPart": break; } Plugin.Log.LogInfo((object)("Blocked local force/fall: " + name)); return false; } } [HarmonyPatch(typeof(CharacterAfflictions), "UpdateWeight")] internal static class WeightOverridePatch { private static void Postfix(CharacterAfflictions __instance) { if (!StatusProtectionPatch.WeightOverrideEnabled) { return; } Character localCharacter = Character.localCharacter; if (localCharacter != null) { CharacterAfflictions val = ((Component)localCharacter).GetComponent() ?? ((Component)localCharacter).GetComponentInChildren(true); if (val != null && __instance == val) { __instance.SetStatus((STATUSTYPE)7, StatusProtectionPatch.WeightOverrideValue, true); } } } } } namespace P.E.A.K_MENU.Input { internal sealed class MenuInputController { private readonly PeakMenuWindow _menuWindow; internal MenuInputController(PeakMenuWindow menuWindow) { _menuWindow = menuWindow; } internal void Update() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (MenuState.IsRebinding) { return; } if (_menuWindow.IsOpen) { if (ShouldCloseMenu()) { _menuWindow.Close(); } } else if (Input.GetKeyDown(MenuSettings.ToggleKey)) { _menuWindow.Open(); } } private static bool ShouldCloseMenu() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (!Input.GetKeyDown(MenuSettings.ToggleKey) && !Input.GetKeyDown((KeyCode)27) && !Input.GetKeyDown((KeyCode)9) && !Input.GetKeyDown((KeyCode)119) && !Input.GetKeyDown((KeyCode)97) && !Input.GetKeyDown((KeyCode)115) && !Input.GetKeyDown((KeyCode)100) && !Input.GetKeyDown((KeyCode)304) && !Input.GetKeyDown((KeyCode)303)) { return Input.GetKeyDown((KeyCode)32); } return true; } } } namespace P.E.A.K_MENU.Features.Teleport { internal sealed class TeleportPlayerEntry { internal Character Character { get; } internal int ActorNumber { get; } internal string DisplayName { get; } internal bool IsValid { get { if ((Object)(object)Character != (Object)null && (Object)(object)((Component)Character).gameObject != (Object)null) { return ((Component)Character).gameObject.activeInHierarchy; } return false; } } internal TeleportPlayerEntry(Character character, int actorNumber, string displayName) { Character = character; ActorNumber = actorNumber; DisplayName = displayName; } public override string ToString() { return $"{DisplayName} ({ActorNumber})"; } } internal static class TeleportRuntime { private static TeleportService? _service; internal static bool IsInitialized => _service != null; internal static TeleportService Service { get { if (_service == null) { throw new InvalidOperationException("TeleportRuntime 尚未初始化。"); } return _service; } } internal static void Initialize() { if (_service == null) { _service = new TeleportService(); Plugin.Log.LogInfo((object)"Teleport runtime initialized."); } } internal static void Update() { _service?.Update(); } internal static void Dispose() { _service?.Clear(); _service = null; Plugin.Log.LogInfo((object)"Teleport runtime disposed."); } } internal sealed class TeleportService { private const float AutomaticRefreshInterval = 1f; private const float HorizontalArrivalOffset = 1.1f; private const float VerticalArrivalOffset = 0.15f; private readonly List _players = new List(); private float _nextRefreshTime; internal IReadOnlyList Players => _players; internal bool HasOtherPlayers => _players.Count > 0; internal string LastStatus { get; private set; } = "正在扫描房间玩家……"; internal bool LastSucceeded { get; private set; } internal void Update() { if (!(Time.unscaledTime < _nextRefreshTime)) { RefreshPlayers(); _nextRefreshTime = Time.unscaledTime + 1f; } } internal bool RefreshPlayers() { _nextRefreshTime = Time.unscaledTime + 1f; Character localCharacter = Character.localCharacter; Character[] array = Resources.FindObjectsOfTypeAll(); List list = new List(); Character[] array2 = array; foreach (Character val in array2) { if (!IsUsableCharacter(val) || (localCharacter != null && (Object)(object)val == (Object)(object)localCharacter)) { continue; } PhotonView photonView = ((MonoBehaviourPun)val).photonView; if (photonView != null) { int actorNumber = ResolveActorNumber(photonView, val); if (!list.Any((TeleportPlayerEntry player) => player.ActorNumber == actorNumber)) { string displayName = ResolveDisplayName(photonView, val, actorNumber); list.Add(new TeleportPlayerEntry(val, actorNumber, displayName)); } } } list.Sort((TeleportPlayerEntry left, TeleportPlayerEntry right) => string.Compare(left.DisplayName, right.DisplayName, StringComparison.OrdinalIgnoreCase)); _players.Clear(); _players.AddRange(list); if (localCharacter == null) { LastSucceeded = false; LastStatus = "尚未找到本地玩家,请先进入关卡。"; return false; } if (_players.Count == 0) { LastSucceeded = false; LastStatus = "当前没有自己以外的玩家。"; return false; } LastSucceeded = true; LastStatus = $"已扫描到 {_players.Count} 名其他玩家。"; return true; } internal bool CanOpenMenu() { bool flag = RefreshPlayers(); if (!flag) { LastSucceeded = false; LastStatus = "当前没有其他玩家,无法进入传送菜单。"; } return flag; } internal void TeleportLocalTo(TeleportPlayerEntry selectedTarget) { //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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) LastSucceeded = false; Character localCharacter = Character.localCharacter; TeleportPlayerEntry freshTarget; if (localCharacter == null) { LastStatus = "未找到本地玩家,请先进入关卡。"; } else if (TryResolveFreshTarget(selectedTarget, out freshTarget)) { TeleportPlayerEntry teleportPlayerEntry = freshTarget; Vector3 val = ResolveCharacterWorldPosition(teleportPlayerEntry.Character); Vector3 val2 = CalculateArrivalPosition(teleportPlayerEntry.Character, localCharacter); Plugin.Log.LogInfo((object)("TeleportLocalTo target root=" + $"{((Component)teleportPlayerEntry.Character).transform.position}, " + $"body={val}, " + $"destination={val2}.")); if (!TryWarpCharacter(localCharacter, val2, out string error)) { LastStatus = "传送失败:" + error; return; } LastSucceeded = true; LastStatus = "已传送到 " + teleportPlayerEntry.DisplayName + " 附近。"; Plugin.Log.LogInfo((object)("Teleported local player to " + teleportPlayerEntry.DisplayName + " " + $"({teleportPlayerEntry.ActorNumber}).")); } } internal void BringPlayerToLocal(TeleportPlayerEntry selectedTarget) { //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) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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) LastSucceeded = false; Character localCharacter = Character.localCharacter; TeleportPlayerEntry freshTarget; if (localCharacter == null) { LastStatus = "未找到本地玩家,请先进入关卡。"; } else if (TryResolveFreshTarget(selectedTarget, out freshTarget)) { Vector3 val = ResolveCharacterWorldPosition(localCharacter); TeleportPlayerEntry teleportPlayerEntry = freshTarget; Vector3 val2 = CalculateArrivalPosition(localCharacter, teleportPlayerEntry.Character); Plugin.Log.LogInfo((object)("BringPlayerToLocal local root=" + $"{((Component)localCharacter).transform.position}, " + $"body={val}, " + $"destination={val2}.")); if (!TryWarpCharacter(teleportPlayerEntry.Character, val2, out string error)) { LastStatus = "传送失败:" + error; return; } LastSucceeded = true; LastStatus = "已将 " + teleportPlayerEntry.DisplayName + " 传送到你附近。"; Plugin.Log.LogInfo((object)("Brought player " + teleportPlayerEntry.DisplayName + " " + $"({teleportPlayerEntry.ActorNumber}) " + "to the local player.")); } } internal void Clear() { _players.Clear(); _nextRefreshTime = 0f; LastSucceeded = false; LastStatus = "正在扫描房间玩家……"; } private bool TryResolveFreshTarget(TeleportPlayerEntry selectedTarget, out TeleportPlayerEntry? freshTarget) { freshTarget = null; if (selectedTarget == null) { LastSucceeded = false; LastStatus = "目标玩家无效。"; return false; } int actorNumber = selectedTarget.ActorNumber; if (!RefreshPlayers()) { LastSucceeded = false; LastStatus = "房间中已没有其他玩家。"; return false; } freshTarget = _players.FirstOrDefault((TeleportPlayerEntry player) => player.ActorNumber == actorNumber); if (freshTarget == null) { LastSucceeded = false; LastStatus = "目标玩家已经离开房间。"; return false; } if (!freshTarget.IsValid) { LastSucceeded = false; LastStatus = "目标玩家角色已经失效。"; RefreshPlayers(); freshTarget = null; return false; } if ((Object)(object)freshTarget.Character == (Object)(object)Character.localCharacter) { LastSucceeded = false; LastStatus = "不能选择本地玩家自己。"; freshTarget = null; return false; } if (((MonoBehaviourPun)freshTarget.Character).photonView == null) { LastSucceeded = false; LastStatus = "目标玩家没有可用的 PhotonView。"; freshTarget = null; return false; } return true; } private static bool TryWarpCharacter(Character character, Vector3 destination, out string error) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) error = string.Empty; if (character == null) { error = "角色对象为空。"; return false; } PhotonView photonView = ((MonoBehaviourPun)character).photonView; if (photonView == null) { error = "角色 PhotonView 不存在。"; return false; } try { photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { destination, false }); return true; } catch (Exception ex) { error = ex.Message; Plugin.Log.LogError((object)("WarpPlayerRPC failed for '" + ((Object)character).name + "': " + $"{ex}")); return false; } } private static Vector3 CalculateArrivalPosition(Character anchor, Character movingCharacter) { //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_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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ResolveCharacterWorldPosition(anchor); Vector3 val2 = ResolveCharacterSideDirection(anchor); int num = ResolveActorNumber(((MonoBehaviourPun)movingCharacter).photonView, movingCharacter); float num2 = ((num % 2 == 0) ? 1f : (-1f)); return val + val2 * 1.1f * num2 + Vector3.up * 0.15f; } private static Vector3 ResolveCharacterWorldPosition(Character character) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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) Rigidbody[] componentsInChildren = ((Component)character).GetComponentsInChildren(true); if (componentsInChildren.Length == 0) { return ((Component)character).transform.position; } string[] array = new string[6] { "hip", "hips", "pelvis", "torso", "chest", "body" }; string[] array2 = array; foreach (string value in array2) { Rigidbody[] array3 = componentsInChildren; foreach (Rigidbody val in array3) { if (IsUsableBodyRigidbody(val)) { string text = ((Object)val).name ?? string.Empty; if (text.Contains(value, StringComparison.OrdinalIgnoreCase)) { return val.worldCenterOfMass; } } } } Vector3 val2 = Vector3.zero; int num = 0; Rigidbody[] array4 = componentsInChildren; foreach (Rigidbody val3 in array4) { if (IsUsableBodyRigidbody(val3)) { val2 += val3.worldCenterOfMass; num++; } } if (num > 0) { return val2 / (float)num; } return ((Component)character).transform.position; } private static bool IsUsableBodyRigidbody(Rigidbody? rigidbody) { //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_0020: 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_0047: 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_0061: Unknown result type (might be due to invalid IL or missing references) if (rigidbody == null) { return false; } GameObject gameObject = ((Component)rigidbody).gameObject; if (gameObject == null || !gameObject.activeInHierarchy) { return false; } Vector3 worldCenterOfMass = rigidbody.worldCenterOfMass; if (!float.IsNaN(worldCenterOfMass.x) && !float.IsNaN(worldCenterOfMass.y) && !float.IsNaN(worldCenterOfMass.z) && !float.IsInfinity(worldCenterOfMass.x) && !float.IsInfinity(worldCenterOfMass.y)) { return !float.IsInfinity(worldCenterOfMass.z); } return false; } private static Vector3 ResolveCharacterSideDirection(Character character) { //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_00b8: 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_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) Vector3 right = ((Component)character).transform.right; Rigidbody[] componentsInChildren = ((Component)character).GetComponentsInChildren(true); Rigidbody[] array = componentsInChildren; foreach (Rigidbody val in array) { if (IsUsableBodyRigidbody(val)) { string text = ((Object)val).name ?? string.Empty; if (text.Contains("hip", StringComparison.OrdinalIgnoreCase) || text.Contains("pelvis", StringComparison.OrdinalIgnoreCase) || text.Contains("torso", StringComparison.OrdinalIgnoreCase) || text.Contains("chest", StringComparison.OrdinalIgnoreCase)) { right = ((Component)val).transform.right; break; } } } right.y = 0f; if (((Vector3)(ref right)).sqrMagnitude < 0.001f) { return Vector3.right; } return ((Vector3)(ref right)).normalized; } private static bool IsUsableCharacter(Character? character) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (character == null) { return false; } GameObject gameObject = ((Component)character).gameObject; if (gameObject != null) { Scene scene = gameObject.scene; if (((Scene)(ref scene)).IsValid()) { if (!gameObject.activeInHierarchy) { return false; } return ((MonoBehaviourPun)character).photonView != null; } } return false; } private static int ResolveActorNumber(PhotonView? photonView, Character character) { if (((photonView != null) ? photonView.Owner : null) != null) { return photonView.Owner.ActorNumber; } if (photonView != null && photonView.ViewID != 0) { return photonView.ViewID; } return ((Object)character).GetInstanceID(); } private static string ResolveDisplayName(PhotonView photonView, Character character, int actorNumber) { Player owner = photonView.Owner; string text = ((owner != null) ? owner.NickName : null); if (!string.IsNullOrWhiteSpace(text)) { return text; } if (!string.IsNullOrWhiteSpace(((Object)character).name)) { return ((Object)character).name; } return $"玩家 {actorNumber}"; } } } namespace P.E.A.K_MENU.Features.Status { internal sealed class StatusEffectDefinition { internal string Id { get; } internal string DisplayName { get; } internal string Description { get; } internal StatusEffectKind Kind { get; } internal StatusValueMode ValueMode { get; } internal bool ShowAmount { get; } internal bool ShowDuration { get; } internal STATUSTYPE? StatusType { get; } internal float DefaultAmount { get; } internal float DefaultDuration { get; } internal StatusEffectDefinition(string id, string displayName, string description, StatusEffectKind kind, StatusValueMode valueMode, bool showAmount, bool showDuration, STATUSTYPE? statusType = null, float defaultAmount = 0.1f, float defaultDuration = 3f) { Id = id; DisplayName = displayName; Description = description; Kind = kind; ValueMode = valueMode; ShowAmount = showAmount; ShowDuration = showDuration; StatusType = statusType; DefaultAmount = defaultAmount; DefaultDuration = defaultDuration; } } internal enum StatusEffectKind { GameStatus } internal enum StatusValueMode { AmountOnly, NativeDecay, TimedConstant, TimedDecay } internal enum StatusApplyMode { Add, Subtract, Set, Clear } internal static class StatusRuntime { private static StatusService? _service; internal static bool IsInitialized => _service != null; internal static StatusService Service { get { if (_service == null) { throw new InvalidOperationException("StatusRuntime 尚未初始化。"); } return _service; } } internal static void Initialize() { if (_service == null) { _service = new StatusService(); Plugin.Log.LogInfo((object)"Status runtime initialized."); } } internal static void Update() { _service?.Update(); } internal static void Dispose() { _service?.Dispose(); _service = null; Plugin.Log.LogInfo((object)"Status runtime disposed."); } } internal sealed class StatusService : IDisposable { private sealed class ActiveTimedStatus { internal STATUSTYPE StatusType { get; } internal StatusValueMode ValueMode { get; } internal float StartAmount { get; } internal float StartTime { get; } internal float EndTime { get; } internal ActiveTimedStatus(STATUSTYPE statusType, StatusValueMode valueMode, float startAmount, float startTime, float endTime) { //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) StatusType = statusType; ValueMode = valueMode; StartAmount = startAmount; StartTime = startTime; EndTime = endTime; } } private const float MaintenanceInterval = 0.05f; private static readonly PropertyInfo? InfiniteStaminaProperty = typeof(Character).GetProperty("infiniteStam", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo? InfiniteStaminaField = typeof(Character).GetField("infiniteStam", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly PropertyInfo? StatusesLockedProperty = typeof(Character).GetProperty("statusesLocked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo? StatusesLockedField = typeof(Character).GetField("statusesLocked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo? GetStatusMethod = FindGetStatusMethod(); private readonly Dictionary _timedStatuses = new Dictionary(); private readonly List _specialEffects = new List(); private float _nextMaintenanceTime; private bool _invincible; private bool _antiKnockback = true; private bool _infiniteStamina; private bool _flightProtectionLock; private bool _weightOverrideEnabled; private float _customWeight; private Character? _lastCharacter; internal bool Invincible => _invincible; internal bool AntiKnockback => _antiKnockback; internal bool InfiniteStamina => _infiniteStamina; internal bool FlightProtectionLock => _flightProtectionLock; internal bool WeightOverrideEnabled => _weightOverrideEnabled; internal float CustomWeight => _customWeight; internal IReadOnlyList SpecialEffects => _specialEffects; internal string LastStatus { get; private set; } = "等待操作。"; internal bool LastSucceeded { get; private set; } internal StatusService() { BuildStatusEffectList(); LogRuntimeMembers(); } internal void Update() { if (Time.unscaledTime < _nextMaintenanceTime) { return; } _nextMaintenanceTime = Time.unscaledTime + 0.05f; Character localCharacter = Character.localCharacter; if (localCharacter == null) { _lastCharacter = null; return; } if (_lastCharacter != localCharacter) { _lastCharacter = localCharacter; ApplyPersistentSettings(localCharacter); } if (_infiniteStamina) { SetCharacterBoolean(localCharacter, InfiniteStaminaProperty, InfiniteStaminaField, value: true); } if (_invincible) { MaintainInvincibility(localCharacter); } MaintainTimedStatuses(localCharacter); if (_weightOverrideEnabled) { ApplyWeight(localCharacter, _customWeight); } } internal void SetInvincible(bool enabled, bool force = false) { if (_flightProtectionLock && !force && !enabled) { LastSucceeded = false; LastStatus = "飞行总开关开启期间,无敌已被锁定。"; return; } _invincible = enabled; StatusProtectionPatch.InvincibleEnabled = enabled; Character localCharacter = Character.localCharacter; if (!enabled) { if (localCharacter != null) { SetCharacterBoolean(localCharacter, StatusesLockedProperty, StatusesLockedField, value: false); } LastSucceeded = true; LastStatus = "无敌已关闭。"; return; } if (localCharacter == null) { Fail("未找到本地玩家,请先进入关卡。"); return; } bool flag = SetCharacterBoolean(localCharacter, StatusesLockedProperty, StatusesLockedField, value: true); ClearNegativeEffectsInternal(localCharacter, preserveWeight: true, preserveTimedStatuses: true, showResult: false); LastSucceeded = true; if (_antiKnockback) { LastStatus = (flag ? "无敌已开启:锁定状态,并阻止死亡、击退与摔倒。" : "无敌已开启:阻止死亡、击退与摔倒。"); } else { LastStatus = (flag ? "无敌已开启:锁定状态并阻止死亡。" : "无敌已开启:阻止死亡。"); } } internal void SetAntiKnockback(bool enabled, bool force = false) { if (_flightProtectionLock && !force && !enabled) { LastSucceeded = false; LastStatus = "飞行总开关开启期间,防击退已被锁定。"; return; } _antiKnockback = enabled; StatusProtectionPatch.AntiKnockbackEnabled = enabled; LastSucceeded = true; LastStatus = (enabled ? "附加保护已开启:阻止击退、摔倒与外力。" : "附加保护已关闭:恢复原版击退与摔倒。"); } internal void SetFlightProtectionLock(bool locked) { _flightProtectionLock = locked; if (locked) { LastSucceeded = true; LastStatus = "飞行功能已锁定无敌与防击退。"; } else { LastSucceeded = true; LastStatus = "飞行保护锁定已解除。"; } } internal void SetInfiniteStamina(bool enabled) { _infiniteStamina = enabled; Character localCharacter = Character.localCharacter; if (localCharacter == null) { Fail("未找到本地玩家,请先进入关卡。"); return; } bool flag = (LastSucceeded = SetCharacterBoolean(localCharacter, InfiniteStaminaProperty, InfiniteStaminaField, enabled)); LastStatus = ((!flag) ? "没有找到 infiniteStam 成员。" : (enabled ? "无限体力已开启。" : "无限体力已关闭。")); Plugin.Log.LogInfo((object)($"SetInfiniteStamina({enabled}): " + $"changed={flag}.")); } internal void ClearNegativeEffects() { Character localCharacter = Character.localCharacter; if (localCharacter == null) { Fail("未找到本地玩家,请先进入关卡。"); } else { ClearNegativeEffectsInternal(localCharacter, preserveWeight: true, preserveTimedStatuses: false, showResult: true); } } internal void SetWeightOverride(bool enabled) { _weightOverrideEnabled = enabled; StatusProtectionPatch.WeightOverrideEnabled = enabled; if (!enabled) { LastSucceeded = true; LastStatus = "负重覆盖已关闭,游戏将恢复计算真实负重。"; return; } Character localCharacter = Character.localCharacter; if (localCharacter == null) { Fail("未找到本地玩家,请先进入关卡。"); return; } bool flag = (LastSucceeded = ApplyWeight(localCharacter, _customWeight)); LastStatus = (flag ? $"负重覆盖已开启:{_customWeight:0.##}。" : "没有找到 CharacterAfflictions。"); } internal void SetWeight(float weight) { if (!IsFiniteNumber(weight)) { Fail("负重数值无效。"); return; } weight = Mathf.Clamp(weight, 0f, 1000f); _customWeight = weight; _weightOverrideEnabled = true; StatusProtectionPatch.WeightOverrideEnabled = true; StatusProtectionPatch.WeightOverrideValue = weight; Character localCharacter = Character.localCharacter; if (localCharacter == null) { Fail("未找到本地玩家,请先进入关卡。"); return; } bool flag = (LastSucceeded = ApplyWeight(localCharacter, weight)); LastStatus = (flag ? $"负重已覆盖为 {weight:0.##}。" : "没有找到 CharacterAfflictions。"); } internal void ApplySpecialEffect(StatusEffectDefinition effect, float amount, float duration, StatusApplyMode applyMode) { if (effect == null) { Fail("特殊效果为空。"); return; } Character localCharacter = Character.localCharacter; if (localCharacter == null) { Fail("未找到本地玩家,请先进入关卡。"); return; } if (effect.ShowAmount && !IsFiniteNumber(amount)) { Fail("持有量数值无效。"); return; } if (effect.ShowDuration && (!IsFiniteNumber(duration) || duration <= 0f)) { Fail("持续时间必须大于 0 秒。"); return; } amount = Mathf.Clamp(amount, -10000f, 10000f); duration = Mathf.Clamp(duration, 0.1f, 36000f); if (!(LastSucceeded = effect.Kind == StatusEffectKind.GameStatus && ApplyGameStatus(localCharacter, effect, amount, duration, applyMode))) { LastStatus = "无法施加“" + effect.DisplayName + "”。"; return; } LastStatus = BuildAppliedStatusMessage(effect, amount, duration, applyMode); Plugin.Log.LogInfo((object)("ApplySpecialEffect: id=" + effect.Id + ", " + $"amount={amount}, " + $"duration={duration}, " + $"mode={applyMode}, " + $"valueMode={effect.ValueMode}.")); } internal bool TryReadStatus(StatusEffectDefinition effect, out float value) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) value = 0f; if (!effect.StatusType.HasValue) { return false; } Character localCharacter = Character.localCharacter; if (localCharacter == null) { return false; } CharacterAfflictions val = FindAfflictions(localCharacter); if (val == null) { return false; } return TryGetStatusValue(val, effect.StatusType.Value, out value); } internal void SetInputError(string message) { Fail(message); } public void Dispose() { Character localCharacter = Character.localCharacter; if (localCharacter != null) { SetCharacterBoolean(localCharacter, InfiniteStaminaProperty, InfiniteStaminaField, value: false); SetCharacterBoolean(localCharacter, StatusesLockedProperty, StatusesLockedField, value: false); ClearTimedStatuses(localCharacter); } _invincible = false; _antiKnockback = true; _infiniteStamina = false; _flightProtectionLock = false; _weightOverrideEnabled = false; _customWeight = 0f; StatusProtectionPatch.InvincibleEnabled = false; StatusProtectionPatch.AntiKnockbackEnabled = true; StatusProtectionPatch.WeightOverrideEnabled = false; StatusProtectionPatch.WeightOverrideValue = 0f; _timedStatuses.Clear(); _lastCharacter = null; } private void ApplyPersistentSettings(Character character) { SetCharacterBoolean(character, InfiniteStaminaProperty, InfiniteStaminaField, _infiniteStamina); SetCharacterBoolean(character, StatusesLockedProperty, StatusesLockedField, _invincible); if (_weightOverrideEnabled) { ApplyWeight(character, _customWeight); } } private void MaintainInvincibility(Character character) { //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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) SetCharacterBoolean(character, StatusesLockedProperty, StatusesLockedField, value: true); CharacterAfflictions val = FindAfflictions(character); if (val == null) { return; } foreach (STATUSTYPE value in Enum.GetValues(typeof(STATUSTYPE))) { string text = ((object)value/*cast due to .constrained prefix*/).ToString().ToLowerInvariant(); if ((text.Contains("injury") || text.Contains("poison") || text.Contains("curse")) && !_timedStatuses.ContainsKey(value)) { TrySetStatusValue(val, value, 0f); } } } private void ClearNegativeEffectsInternal(Character character, bool preserveWeight, bool preserveTimedStatuses, bool showResult) { //IL_0039: 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) //IL_0072: 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) CharacterAfflictions val = FindAfflictions(character); if (val == null) { if (showResult) { Fail("没有找到 CharacterAfflictions。"); } return; } int num = 0; foreach (STATUSTYPE value in Enum.GetValues(typeof(STATUSTYPE))) { string text = ((object)value/*cast due to .constrained prefix*/).ToString(); if ((!preserveWeight || !text.Equals("Weight", StringComparison.OrdinalIgnoreCase)) && (!preserveTimedStatuses || !_timedStatuses.ContainsKey(value)) && TrySetStatusValue(val, value, 0f)) { num++; } } if (!preserveTimedStatuses) { _timedStatuses.Clear(); } if (showResult) { LastSucceeded = num > 0; LastStatus = ((num > 0) ? $"已清除 {num} 项角色状态。" : "没有清除任何状态。"); } } private bool ApplyWeight(Character character, float weight) { CharacterAfflictions val = FindAfflictions(character); if (val == null) { return false; } bool flag = TrySetStatusValue(val, (STATUSTYPE)7, weight); if (flag) { StatusProtectionPatch.WeightOverrideValue = weight; } return flag; } private bool ApplyGameStatus(Character character, StatusEffectDefinition effect, float inputAmount, float duration, StatusApplyMode applyMode) { //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) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (!effect.StatusType.HasValue) { return false; } CharacterAfflictions val = FindAfflictions(character); if (val == null) { return false; } STATUSTYPE value = effect.StatusType.Value; float value2 = 0f; TryGetStatusValue(val, value, out value2); float num = CalculateFinalAmount(value2, inputAmount, applyMode); num = Mathf.Clamp(num, 0f, 10000f); switch (effect.ValueMode) { case StatusValueMode.AmountOnly: case StatusValueMode.NativeDecay: _timedStatuses.Remove(value); return TrySetStatusValue(val, value, num); case StatusValueMode.TimedConstant: case StatusValueMode.TimedDecay: if (!TrySetStatusValue(val, value, num)) { return false; } if (num <= 0f || applyMode == StatusApplyMode.Clear) { _timedStatuses.Remove(value); return true; } _timedStatuses[value] = new ActiveTimedStatus(value, effect.ValueMode, num, Time.unscaledTime, Time.unscaledTime + duration); return true; default: return false; } } private void MaintainTimedStatuses(Character character) { //IL_003e: 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_005a: 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_00b8: Unknown result type (might be due to invalid IL or missing references) if (_timedStatuses.Count == 0) { return; } CharacterAfflictions val = FindAfflictions(character); if (val == null) { return; } float unscaledTime = Time.unscaledTime; STATUSTYPE[] array = _timedStatuses.Keys.ToArray(); STATUSTYPE[] array2 = array; foreach (STATUSTYPE val2 in array2) { ActiveTimedStatus activeTimedStatus = _timedStatuses[val2]; if (unscaledTime >= activeTimedStatus.EndTime) { TrySetStatusValue(val, val2, 0f); _timedStatuses.Remove(val2); continue; } float value; if (activeTimedStatus.ValueMode == StatusValueMode.TimedDecay) { float num = Mathf.InverseLerp(activeTimedStatus.StartTime, activeTimedStatus.EndTime, unscaledTime); value = Mathf.Lerp(activeTimedStatus.StartAmount, 0f, num); } else { value = activeTimedStatus.StartAmount; } TrySetStatusValue(val, val2, value); } } private void ClearTimedStatuses(Character character) { //IL_001f: 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_0026: Unknown result type (might be due to invalid IL or missing references) CharacterAfflictions val = FindAfflictions(character); if (val != null) { foreach (STATUSTYPE key in _timedStatuses.Keys) { TrySetStatusValue(val, key, 0f); } } _timedStatuses.Clear(); } private void BuildStatusEffectList() { //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_009d: Unknown result type (might be due to invalid IL or missing references) _specialEffects.Clear(); foreach (STATUSTYPE value in Enum.GetValues(typeof(STATUSTYPE))) { string text = ((object)value/*cast due to .constrained prefix*/).ToString(); if (!text.Equals("Weight", StringComparison.OrdinalIgnoreCase) && !(NormalizeName(text) == "injury")) { StatusValueMode statusValueMode = ResolveStatusValueMode(text); bool showDuration = statusValueMode == StatusValueMode.TimedConstant || statusValueMode == StatusValueMode.TimedDecay; float defaultAmount = ResolveDefaultAmount(); _specialEffects.Add(new StatusEffectDefinition("status_" + text, TranslateStatusName(text), BuildStatusDescription(text, statusValueMode), StatusEffectKind.GameStatus, statusValueMode, showAmount: true, showDuration, (STATUSTYPE?)value, defaultAmount, 3f)); } } Plugin.Log.LogInfo((object)($"Loaded {_specialEffects.Count} " + "status effect definitions.")); } private static StatusValueMode ResolveStatusValueMode(string runtimeName) { string text = NormalizeName(runtimeName); if (text.Contains("poison")) { return StatusValueMode.NativeDecay; } if (text.Contains("web") || text.Contains("blind") || text.Contains("snowblind") || text.Contains("lowgravity") || text.Contains("numb") || text.Contains("sleep") || text.Contains("stun")) { return StatusValueMode.TimedConstant; } return StatusValueMode.AmountOnly; } private static float ResolveDefaultAmount() { return 0.1f; } private static string BuildStatusDescription(string runtimeName, StatusValueMode valueMode) { return "游戏状态:" + runtimeName + "。" + valueMode switch { StatusValueMode.AmountOnly => "只修改持有量,不使用菜单计时。", StatusValueMode.NativeDecay => "设置一次持有量,之后由游戏原生逻辑自然减少。", StatusValueMode.TimedConstant => "在指定秒数内保持该持有量,到期归零。", StatusValueMode.TimedDecay => "在指定秒数内逐渐衰减到零。", _ => string.Empty, }; } private static string TranslateStatusName(string runtimeName) { return NormalizeName(runtimeName) switch { "poison" => "中毒", "cold" => "寒冷", "hot" => "炎热", "heat" => "炎热", "hunger" => "饥饿", "curse" => "诅咒", "drowsy" => "困倦", "sleep" => "睡眠", "web" => "蜘蛛网", "webbed" => "蜘蛛网", "webs" => "蜘蛛网", "blind" => "失明", "snowblind" => "雪盲", "numb" => "麻木", "lowgravity" => "低重力", "zombiebite" => "僵尸咬伤", "thorn" => "刺", "thorns" => "刺", "thron" => "刺", "throns" => "刺", "spore" => "孢子", "spores" => "孢子", "crab" => "奇异", "crabs" => "奇异", "stamina" => "体力", _ => runtimeName, }; } private static string NormalizeName(string value) { return value.Replace("_", string.Empty).Replace("-", string.Empty).Replace(" ", string.Empty) .ToLowerInvariant(); } private static float CalculateFinalAmount(float currentAmount, float inputAmount, StatusApplyMode mode) { return mode switch { StatusApplyMode.Add => currentAmount + Mathf.Abs(inputAmount), StatusApplyMode.Subtract => currentAmount - Mathf.Abs(inputAmount), StatusApplyMode.Set => inputAmount, StatusApplyMode.Clear => 0f, _ => inputAmount, }; } private static string BuildAppliedStatusMessage(StatusEffectDefinition effect, float amount, float duration, StatusApplyMode mode) { string text = mode switch { StatusApplyMode.Add => "增加", StatusApplyMode.Subtract => "减少", StatusApplyMode.Set => "设为", StatusApplyMode.Clear => "清零", _ => "修改", }; if (effect.ShowDuration) { return "已将“" + effect.DisplayName + "”" + text + " " + $"{amount:0.##},持续 " + $"{duration:0.##} 秒。"; } return "已将“" + effect.DisplayName + "”" + text + " " + $"{amount:0.##}。"; } private static CharacterAfflictions? FindAfflictions(Character character) { CharacterAfflictions component = ((Component)character).GetComponent(); if (component != null) { return component; } return ((Component)character).GetComponentInChildren(true); } private static bool TrySetStatusValue(CharacterAfflictions afflictions, STATUSTYPE type, float value) { //IL_0001: 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) try { afflictions.SetStatus(type, value, true); return true; } catch (Exception ex) { Plugin.Log.LogWarning((object)($"SetStatus({type}, {value}) failed: " + ex.Message)); return false; } } private static bool TryGetStatusValue(CharacterAfflictions afflictions, STATUSTYPE type, out float value) { //IL_003c: 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) value = 0f; if ((object)GetStatusMethod != null) { try { object raw = GetStatusMethod.Invoke(afflictions, new object[1] { type }); if (TryConvertFloat(raw, out value)) { return true; } } catch { } } return TryReadStatusFromMembers(afflictions, type, out value); } private static MethodInfo? FindGetStatusMethod() { Type typeFromHandle = typeof(CharacterAfflictions); return typeFromHandle.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault(delegate(MethodInfo method) { if (!method.Name.Equals("GetStatus", StringComparison.OrdinalIgnoreCase)) { return false; } ParameterInfo[] parameters = method.GetParameters(); if (parameters.Length != 1 || parameters[0].ParameterType != typeof(STATUSTYPE)) { return false; } return method.ReturnType == typeof(float) || method.ReturnType == typeof(double) || method.ReturnType == typeof(int); }); } private static bool TryReadStatusFromMembers(CharacterAfflictions afflictions, STATUSTYPE type, out float value) { //IL_008e: 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) value = 0f; Type type2 = ((object)afflictions).GetType(); IEnumerable enumerable = type2.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).Cast().Concat(type2.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)); foreach (MemberInfo item in enumerable) { object obj2; try { MemberInfo memberInfo = item; object obj = ((memberInfo is FieldInfo fieldInfo) ? fieldInfo.GetValue(afflictions) : ((!(memberInfo is PropertyInfo { CanRead: not false } propertyInfo)) ? null : propertyInfo.GetValue(afflictions))); obj2 = obj; } catch { continue; } if (obj2 != null) { if (TryReadDictionaryValue(obj2, type, out value)) { return true; } if (TryReadIndexedValue(obj2, Convert.ToInt32(type), out value)) { return true; } } } return false; } private static bool TryReadDictionaryValue(object container, STATUSTYPE type, out float value) { //IL_0015: 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) value = 0f; if (!(container is IDictionary dictionary)) { return false; } try { if (!dictionary.Contains(type)) { return false; } object raw = dictionary[type]; return TryConvertFloat(raw, out value); } catch { return false; } } private static bool TryReadIndexedValue(object container, int index, out float value) { value = 0f; if (index < 0) { return false; } try { if (container is Array array) { if (index >= array.Length) { return false; } return TryConvertFloat(array.GetValue(index), out value); } if (container is IList list) { if (index >= list.Count) { return false; } return TryConvertFloat(list[index], out value); } } catch { return false; } return false; } private static bool SetCharacterBoolean(Character character, PropertyInfo? property, FieldInfo? field, bool value) { try { if ((object)property != null && property.CanWrite) { property.SetValue(character, value); return true; } if ((object)field != null) { field.SetValue(character, value); return true; } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Failed to set Character boolean: " + ex.Message)); } return false; } private static bool TryConvertFloat(object? raw, out float value) { try { if (raw == null) { value = 0f; return false; } value = Convert.ToSingle(raw, CultureInfo.InvariantCulture); return true; } catch { value = 0f; return false; } } private static bool IsFiniteNumber(float value) { if (!float.IsNaN(value)) { return !float.IsInfinity(value); } return false; } private static void LogRuntimeMembers() { Plugin.Log.LogInfo((object)("Status runtime members: infiniteStamProperty=" + $"{(object)InfiniteStaminaProperty != null}, " + "infiniteStamField=" + $"{(object)InfiniteStaminaField != null}, " + "statusesLockedProperty=" + $"{(object)StatusesLockedProperty != null}, " + "statusesLockedField=" + $"{(object)StatusesLockedField != null}, " + "GetStatus=" + $"{(object)GetStatusMethod != null}.")); Plugin.Log.LogInfo((object)("CharacterAfflictions.STATUSTYPE: " + string.Join(", ", Enum.GetNames(typeof(STATUSTYPE))))); } private void Fail(string message) { LastSucceeded = false; LastStatus = message; } } } namespace P.E.A.K_MENU.Features.ItemSpawn { internal sealed class ItemCatalogService : IDisposable { private readonly ItemIconResolver _iconResolver = new ItemIconResolver(); private readonly List _allItems = new List(); private readonly List _visibleNames = new List(); private int _loadedDatabaseId; internal IReadOnlyList AllItems => _allItems; internal void RefreshIfNeeded(bool force = false) { ItemDatabase instance = SingletonAsset.Instance; if (instance != null && ((DatabaseAsset)(object)instance).Objects != null) { int instanceID = ((Object)instance).GetInstanceID(); if (force || _loadedDatabaseId != instanceID || _allItems.Count <= 0) { LoadDatabase(instance, instanceID); } } } internal void ForceRefresh() { RefreshIfNeeded(force: true); } internal IReadOnlyList GetVisibleItems() { RefreshIfNeeded(); List list = new List(); foreach (string visibleName in _visibleNames) { ItemSpawnEntry itemSpawnEntry = FindByPrefabName(visibleName); if (itemSpawnEntry != null) { list.Add(itemSpawnEntry); } } return list; } internal bool ContainsVisible(string prefabName) { return _visibleNames.Contains(prefabName, StringComparer.OrdinalIgnoreCase); } internal void Add(string prefabName) { if (!ContainsVisible(prefabName)) { ItemSpawnEntry itemSpawnEntry = FindByPrefabName(prefabName); if (itemSpawnEntry != null) { _visibleNames.Add(itemSpawnEntry.PrefabName); Save(); Plugin.Log.LogInfo((object)("Added item to ItemSpawn list: " + itemSpawnEntry.PrefabName)); } } } internal void Remove(string prefabName) { int num = _visibleNames.RemoveAll((string name) => string.Equals(name, prefabName, StringComparison.OrdinalIgnoreCase)); if (num > 0) { Save(); Plugin.Log.LogInfo((object)("Removed item from ItemSpawn list: " + prefabName)); } } internal void Move(string prefabName, int direction) { int num = _visibleNames.FindIndex((string name) => string.Equals(name, prefabName, StringComparison.OrdinalIgnoreCase)); if (num >= 0) { int num2 = num + direction; if (num2 >= 0 && num2 < _visibleNames.Count) { string value = _visibleNames[num]; _visibleNames[num] = _visibleNames[num2]; _visibleNames[num2] = value; Save(); } } } internal void RestoreDefaults() { _visibleNames.Clear(); string[] preferredPrefabNames = ItemSpawnDefaults.PreferredPrefabNames; foreach (string preferred in preferredPrefabNames) { ItemSpawnEntry itemSpawnEntry = FindByPrefabName(preferred); ItemSpawnEntry itemSpawnEntry2 = itemSpawnEntry ?? _allItems.FirstOrDefault((ItemSpawnEntry entry) => entry.PrefabName.Contains(preferred, StringComparison.OrdinalIgnoreCase) || entry.DisplayName.Contains(preferred, StringComparison.OrdinalIgnoreCase)); if (itemSpawnEntry2 != null && !ContainsVisible(itemSpawnEntry2.PrefabName)) { _visibleNames.Add(itemSpawnEntry2.PrefabName); } } if (_visibleNames.Count == 0) { IEnumerable collection = from entry in _allItems.Take(12) select entry.PrefabName; _visibleNames.AddRange(collection); } Save(); Plugin.Log.LogInfo((object)("Restored default ItemSpawn list: " + $"{_visibleNames.Count} items.")); } public void Dispose() { _iconResolver.Dispose(); _allItems.Clear(); _visibleNames.Clear(); _loadedDatabaseId = 0; } private void LoadDatabase(ItemDatabase database, int databaseId) { _allItems.Clear(); foreach (Item @object in ((DatabaseAsset)(object)database).Objects) { if (@object != null && !string.IsNullOrWhiteSpace(((Object)@object).name)) { string displayName = ResolveDisplayName(@object); Sprite icon = _iconResolver.Resolve(@object); ItemSpawnEntry entry = new ItemSpawnEntry(@object, displayName, icon); if (!_allItems.Any((ItemSpawnEntry existing) => string.Equals(existing.PrefabName, entry.PrefabName, StringComparison.OrdinalIgnoreCase))) { _allItems.Add(entry); } } } _allItems.Sort((ItemSpawnEntry left, ItemSpawnEntry right) => string.Compare(left.DisplayName, right.DisplayName, StringComparison.OrdinalIgnoreCase)); _loadedDatabaseId = databaseId; LoadConfiguredOrder(); Plugin.Log.LogInfo((object)("Item catalog loaded: " + $"{_allItems.Count} items.")); } private void LoadConfiguredOrder() { _visibleNames.Clear(); IReadOnlyList readOnlyList = ItemSpawnConfiguration.LoadVisibleItemNames(); foreach (string item in readOnlyList) { if (FindByPrefabName(item) != null && !ContainsVisible(item)) { _visibleNames.Add(item); } } if (_visibleNames.Count == 0) { RestoreDefaults(); } } private ItemSpawnEntry? FindByPrefabName(string prefabName) { return _allItems.FirstOrDefault((ItemSpawnEntry entry) => string.Equals(entry.PrefabName, prefabName, StringComparison.OrdinalIgnoreCase)); } private void Save() { ItemSpawnConfiguration.SaveVisibleItemNames(_visibleNames); } private static string ResolveDisplayName(Item item) { return ((Object)item).name ?? "Unknown Item"; } } internal sealed class ItemIconResolver : IDisposable { private readonly Dictionary _cache = new Dictionary(StringComparer.OrdinalIgnoreCase); private readonly List _generatedSprites = new List(); internal Sprite? Resolve(Item item) { string text = ((Object)item).name ?? string.Empty; if (_cache.TryGetValue(text, out Sprite value)) { return value; } Sprite val = null; try { ItemUIData uIData = item.UIData; val = CreateSprite(uIData.icon); if (val == null && uIData.hasAltIcon) { val = CreateSprite(uIData.altIcon); } if (val == null) { Image componentInChildren = ((Component)item).GetComponentInChildren(true); val = ((componentInChildren != null) ? componentInChildren.sprite : null); } if (val == null) { SpriteRenderer componentInChildren2 = ((Component)item).GetComponentInChildren(true); val = ((componentInChildren2 != null) ? componentInChildren2.sprite : null); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Failed to resolve icon for '" + text + "': " + ex.Message)); } _cache[text] = val; return val; } public void Dispose() { foreach (Sprite generatedSprite in _generatedSprites) { if ((Object)(object)generatedSprite != (Object)null) { Object.Destroy((Object)(object)generatedSprite); } } _generatedSprites.Clear(); _cache.Clear(); } private Sprite? CreateSprite(Texture2D? texture) { //IL_0030: 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) if (texture == null || ((Texture)texture).width <= 0 || ((Texture)texture).height <= 0) { return null; } Sprite val = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0); ((Object)val).name = ((Object)texture).name + "_P.E.A.K_MENU_Icon"; _generatedSprites.Add(val); return val; } } internal static class ItemSpawnConfiguration { private static ConfigEntry? _visibleItems; internal static void Initialize(ConfigFile config) { _visibleItems = config.Bind("ItemSpawn", "VisibleItems", string.Empty, "物品生成页面显示的物品 prefab 名称。多个名称使用 | 分隔,保存顺序即菜单显示顺序。留空时使用默认物品和默认排序。"); } internal static IReadOnlyList LoadVisibleItemNames() { string text = _visibleItems?.Value ?? string.Empty; if (string.IsNullOrWhiteSpace(text)) { return Array.Empty(); } return (from value in text.Split(new char[1] { '|' }, StringSplitOptions.RemoveEmptyEntries) select value.Trim() into value where !string.IsNullOrWhiteSpace(value) select value).Distinct(StringComparer.OrdinalIgnoreCase).ToArray(); } internal static void SaveVisibleItemNames(IEnumerable names) { if (_visibleItems != null) { string value = string.Join("|", names.Where((string name) => !string.IsNullOrWhiteSpace(name)).Distinct(StringComparer.OrdinalIgnoreCase)); _visibleItems.Value = value; } } internal static void Clear() { if (_visibleItems != null) { _visibleItems.Value = string.Empty; } } } internal static class ItemSpawnDefaults { internal static readonly string[] PreferredPrefabNames = new string[13] { "ScoutEffigy", "Backpack", "BookOfBones", "Airplane Food", "Cure-All", "RopeSpool", "Anti-Rope Spool", "RopeShooter", "RopeShooterAnti", "RescueHook", "RescueHook_Infinite", "PortableStovetopItem", "HealingDart Variant" }; internal const int FallbackItemCount = 12; } internal sealed class ItemSpawnEntry { internal Item Prefab { get; } internal string PrefabName { get; } internal string DisplayName { get; } internal Sprite? Icon { get; } internal ItemSpawnEntry(Item prefab, string displayName, Sprite? icon) { Prefab = prefab; PrefabName = ((Object)prefab).name ?? string.Empty; DisplayName = (string.IsNullOrWhiteSpace(displayName) ? PrefabName : displayName); Icon = icon; } public override string ToString() { return DisplayName + " (" + PrefabName + ")"; } } internal static class ItemSpawnRuntime { private static ItemCatalogService? _catalog; private static ItemSpawnService? _spawner; private static bool _initialized; internal static bool IsInitialized { get { if (_initialized && _catalog != null) { return _spawner != null; } return false; } } internal static ItemCatalogService Catalog { get { if (_catalog == null) { throw new InvalidOperationException("ItemSpawn Catalog 尚未初始化。"); } return _catalog; } } internal static ItemSpawnService Spawner { get { if (_spawner == null) { throw new InvalidOperationException("ItemSpawn Spawner 尚未初始化。"); } return _spawner; } } internal static void Initialize(ConfigFile config) { if (IsInitialized) { Plugin.Log.LogInfo((object)"ItemSpawn runtime is already initialized."); return; } Plugin.Log.LogInfo((object)"Initializing ItemSpawn runtime..."); ItemSpawnConfiguration.Initialize(config); _catalog = new ItemCatalogService(); _spawner = new ItemSpawnService(); _initialized = true; Plugin.Log.LogInfo((object)"ItemSpawn runtime initialized successfully."); } internal static void Dispose() { if (_initialized || _catalog != null || _spawner != null) { _catalog?.Dispose(); _catalog = null; _spawner = null; _initialized = false; Plugin.Log.LogInfo((object)"ItemSpawn runtime disposed."); } } } internal sealed class ItemSpawnService { internal string LastStatus { get; private set; } = "选择物品以生成。"; internal bool LastSucceeded { get; private set; } internal void Spawn(ItemSpawnEntry entry) { LastSucceeded = false; if (entry.Prefab == null) { LastStatus = "物品预制体无效。"; return; } Character localCharacter = Character.localCharacter; if (localCharacter == null) { LastStatus = "未找到本地玩家,请先进入关卡。"; return; } if (GameUtils.instance == null) { LastStatus = "GameUtils 尚未初始化,请稍后再试。"; return; } try { GameUtils.instance.InstantiateAndGrab(entry.Prefab, localCharacter, 0); LastSucceeded = true; LastStatus = "已生成:" + entry.DisplayName; Plugin.Log.LogInfo((object)("Spawned item '" + entry.PrefabName + "' through InstantiateAndGrab.")); } catch (Exception ex) { LastSucceeded = false; LastStatus = "生成失败:" + ex.Message; Plugin.Log.LogError((object)("Failed to spawn '" + entry.PrefabName + "': " + $"{ex}")); } } internal void ClearStatus() { LastSucceeded = false; LastStatus = "选择物品以生成。"; } } } namespace P.E.A.K_MENU.Features.Flight { internal static class FlightRuntime { private static FlightService? _service; internal static bool IsInitialized => _service != null; internal static FlightService Service { get { if (_service == null) { throw new InvalidOperationException("FlightRuntime 尚未初始化。"); } return _service; } } internal static void Initialize() { if (_service == null) { _service = new FlightService(); Plugin.Log.LogInfo((object)"Flight runtime initialized."); } } internal static void Update() { _service?.Update(); } internal static void FixedUpdate() { _service?.FixedUpdate(); } internal static void Dispose() { _service?.Dispose(); _service = null; Plugin.Log.LogInfo((object)"Flight runtime disposed."); } } internal sealed class FlightService : IDisposable { private const float DefaultFlightSpeed = 16f; private const float MinimumFlightSpeed = 0.5f; private const float MaximumFlightSpeed = 100f; private const float SprintMultiplier = 2f; private const float DoubleTapInterval = 0.3f; private const float ScrollSpeedStep = 5f; private const float WarpInterval = 0.067f; private const float ZeroGravityDuration = 1f; private const float SlowFallDuration = 5f; private const float MaximumSlowFallSpeed = -2.25f; private bool _enabled; private bool _activelyFlying; private bool _doubleTapMode = true; private bool _scrollSpeedEnabled = true; private bool _slowFallEnabled = true; private float _flightSpeed = 16f; private float _lastSpacePressTime = -100f; private float _warpAccumulator; private Vector3 _flightPosition; private bool _flightPositionInitialized; private Character? _activeCharacter; private bool _savedInvincible; private bool _savedAntiKnockback; private bool _hasSavedStatusState; private float _slowFallUntil; private float _zeroGravityUntil; private bool _slowFallWasApplied; private readonly Dictionary _savedGravityStates = new Dictionary(); internal bool Enabled => _enabled; internal bool ActivelyFlying => _activelyFlying; internal bool DoubleTapMode => _doubleTapMode; internal bool ScrollSpeedEnabled => _scrollSpeedEnabled; internal bool SlowFallEnabled => _slowFallEnabled; internal float FlightSpeed => _flightSpeed; internal string LastStatus { get; private set; } = "飞行功能尚未开启。"; internal bool LastSucceeded { get; private set; } internal void Update() { MaintainSlowFall(); if (!_enabled) { return; } MaintainStatusProtection(); Character localCharacter = Character.localCharacter; if (localCharacter == null) { _activeCharacter = null; _flightPositionInitialized = false; _warpAccumulator = 0f; LastSucceeded = false; LastStatus = "未找到本地玩家,请先进入关卡。"; return; } if (_activeCharacter != localCharacter) { _activeCharacter = localCharacter; _flightPositionInitialized = false; _warpAccumulator = 0f; if (_activelyFlying) { InitializeFlightPosition(localCharacter); } Plugin.Log.LogInfo((object)("Flight character changed: " + ((Object)localCharacter).name + ".")); } if (!MenuState.IsOpen) { if (_scrollSpeedEnabled && _activelyFlying) { ReadMouseWheelSpeed(); } if (_doubleTapMode) { DetectDoubleSpace(); } } } internal void FixedUpdate() { //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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) if (!_enabled || !_activelyFlying) { return; } Character localCharacter = Character.localCharacter; if (localCharacter == null || !localCharacter.IsLocal) { return; } if (!_flightPositionInitialized || _activeCharacter != localCharacter) { _activeCharacter = localCharacter; InitializeFlightPosition(localCharacter); } Vector3 val = (MenuState.IsOpen ? Vector3.zero : ReadMovementDirection(localCharacter)); if (((Vector3)(ref val)).sqrMagnitude > 1f) { ((Vector3)(ref val)).Normalize(); } float num = _flightSpeed; if (!MenuState.IsOpen && (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303))) { num *= 2f; } _flightPosition += val * num * Time.fixedDeltaTime; _warpAccumulator += Time.fixedDeltaTime; if (!(_warpAccumulator < 0.067f)) { _warpAccumulator = 0f; if (!TryWarpCharacter(localCharacter, _flightPosition, out string error)) { LastSucceeded = false; LastStatus = "飞行坐标更新失败:" + error; } else { LastSucceeded = true; } } } internal void SetEnabled(bool enabled) { if (_enabled != enabled) { if (enabled) { EnableFlightSystem(); } else { DisableFlightSystem(restoreStatusState: true); } } } internal void SetDoubleTapMode(bool enabled) { if (_doubleTapMode != enabled) { _doubleTapMode = enabled; _lastSpacePressTime = -100f; _warpAccumulator = 0f; if (!_enabled) { LastSucceeded = true; LastStatus = (enabled ? "已选择双击空格切换实际飞行。" : "已选择开启总开关后立即飞行。"); } else if (enabled) { SetActiveFlight(active: false); LastSucceeded = true; LastStatus = "双击模式已开启,目前处于正常状态;双击空格开始飞行。"; } else { SetActiveFlight(active: true); LastSucceeded = true; LastStatus = "双击模式已关闭,已立即进入飞行状态。"; } } } internal void SetScrollSpeedEnabled(bool enabled) { _scrollSpeedEnabled = enabled; LastSucceeded = true; LastStatus = (enabled ? "飞行中滚轮调速已开启。" : "飞行中滚轮调速已关闭。"); } internal void SetSlowFallEnabled(bool enabled) { _slowFallEnabled = enabled; if (!enabled) { ClearSlowFallImmediately(); } LastSucceeded = true; LastStatus = (enabled ? "退出飞行保护已开启:1 秒无重力,随后缓降至第 5 秒。" : "退出飞行保护已关闭。"); } internal void SetFlightSpeed(float speed) { if (float.IsNaN(speed) || float.IsInfinity(speed)) { LastSucceeded = false; LastStatus = "飞行速度格式无效。"; } else { _flightSpeed = Mathf.Clamp(speed, 0.5f, 100f); LastSucceeded = true; LastStatus = "飞行速度已设为 " + $"{_flightSpeed:0.##}。"; } } internal void ToggleActiveFlight() { if (!_enabled) { LastSucceeded = false; LastStatus = "请先开启飞行总开关。"; } else { SetActiveFlight(!_activelyFlying); } } public void Dispose() { DisableFlightSystem(restoreStatusState: true); ClearSlowFallImmediately(); _activeCharacter = null; _flightPositionInitialized = false; _warpAccumulator = 0f; } private void EnableFlightSystem() { if (!StatusRuntime.IsInitialized) { LastSucceeded = false; LastStatus = "状态功能尚未初始化,无法开启飞行保护。"; return; } Character localCharacter = Character.localCharacter; if (localCharacter == null) { LastSucceeded = false; LastStatus = "未找到本地玩家,请先进入关卡。"; return; } StatusService service = StatusRuntime.Service; _savedInvincible = service.Invincible; _savedAntiKnockback = service.AntiKnockback; _hasSavedStatusState = true; service.SetFlightProtectionLock(locked: true); service.SetInvincible(enabled: true, force: true); service.SetAntiKnockback(enabled: true, force: true); _enabled = true; _activeCharacter = localCharacter; _lastSpacePressTime = -100f; _warpAccumulator = 0f; _flightPositionInitialized = false; if (_doubleTapMode) { _activelyFlying = false; LastSucceeded = true; LastStatus = "飞行总开关已开启。双击空格开始飞行。"; Plugin.Log.LogInfo((object)"Flight system enabled in double-tap standby mode."); } else { SetActiveFlight(active: true); LastSucceeded = true; LastStatus = "飞行总开关已开启,已进入坐标飞行状态。"; Plugin.Log.LogInfo((object)"Flight system enabled and coordinate flight activated."); } } private void DisableFlightSystem(bool restoreStatusState) { //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) Character localCharacter = Character.localCharacter; bool activelyFlying = _activelyFlying; _activelyFlying = false; _enabled = false; _activeCharacter = null; _flightPosition = Vector3.zero; _flightPositionInitialized = false; _lastSpacePressTime = -100f; _warpAccumulator = 0f; if (activelyFlying && _slowFallEnabled && localCharacter != null && localCharacter.IsLocal) { RefreshSlowFall(localCharacter); } if (restoreStatusState && _hasSavedStatusState && StatusRuntime.IsInitialized) { StatusService service = StatusRuntime.Service; service.SetFlightProtectionLock(locked: false); service.SetInvincible(_savedInvincible, force: true); service.SetAntiKnockback(_savedAntiKnockback, force: true); } else if (StatusRuntime.IsInitialized) { StatusRuntime.Service.SetFlightProtectionLock(locked: false); } _hasSavedStatusState = false; LastSucceeded = true; LastStatus = ((activelyFlying && _slowFallEnabled) ? "飞行已关闭,已恢复此前状态,并获得 1 秒无重力和总计 5 秒缓降保护。" : "飞行已关闭,并已恢复此前的无敌与防击退状态。"); Plugin.Log.LogInfo((object)"Coordinate flight system disabled."); } private void SetActiveFlight(bool active) { //IL_0060: 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) if (!_enabled || _activelyFlying == active) { return; } Character localCharacter = Character.localCharacter; if (active) { if (localCharacter == null || !localCharacter.IsLocal) { LastSucceeded = false; LastStatus = "未找到本地玩家,无法进入飞行状态。"; return; } ClearSlowFallImmediately(); _activeCharacter = localCharacter; InitializeFlightPosition(localCharacter); _activelyFlying = true; TryResetFalling(localCharacter); if (!TryWarpCharacter(localCharacter, _flightPosition, out string error)) { _activelyFlying = false; _flightPositionInitialized = false; _warpAccumulator = 0f; LastSucceeded = false; LastStatus = "无法开始飞行:" + error; } else { LastSucceeded = true; LastStatus = "已进入坐标飞行状态。"; Plugin.Log.LogInfo((object)("Coordinate flight enabled at " + $"{_flightPosition}.")); } } else { _activelyFlying = false; _flightPositionInitialized = false; _warpAccumulator = 0f; if (_slowFallEnabled && localCharacter != null && localCharacter.IsLocal) { RefreshSlowFall(localCharacter); } LastSucceeded = true; LastStatus = (_slowFallEnabled ? "已退出飞行:获得 1 秒无重力和总计 5 秒缓降保护。" : "已恢复正常状态;双击空格可再次飞行。"); Plugin.Log.LogInfo((object)"Coordinate flight disabled."); } } private void InitializeFlightPosition(Character character) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0044: 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_001a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ResolveCharacterWorldPosition(character); if (!IsFinitePosition(val)) { val = ((Component)character).transform.position; } _flightPosition = val; _flightPositionInitialized = true; _warpAccumulator = 0f; Plugin.Log.LogInfo((object)("Initialized flight position: " + $"{_flightPosition}.")); } private void DetectDoubleSpace() { if (Input.GetKeyDown((KeyCode)32)) { float unscaledTime = Time.unscaledTime; float num = unscaledTime - _lastSpacePressTime; if (num <= 0.3f) { _lastSpacePressTime = -100f; ToggleActiveFlight(); } else { _lastSpacePressTime = unscaledTime; } } } private void ReadMouseWheelSpeed() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) float y = Input.mouseScrollDelta.y; if (!(Mathf.Abs(y) < 0.01f)) { float num = Mathf.Sign(y); float flightSpeed = _flightSpeed; _flightSpeed = Mathf.Clamp(_flightSpeed + num * 5f, 0.5f, 100f); if (!Mathf.Approximately(flightSpeed, _flightSpeed)) { LastSucceeded = true; LastStatus = ((num > 0f) ? $"滚轮提高速度:{_flightSpeed:0.##}。" : $"滚轮降低速度:{_flightSpeed:0.##}。"); } } } private void RefreshSlowFall(Character character) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) RestoreGravityStates(); float unscaledTime = Time.unscaledTime; _zeroGravityUntil = unscaledTime + 1f; _slowFallUntil = unscaledTime + 5f; Rigidbody[] componentsInChildren = ((Component)character).GetComponentsInChildren(true); Rigidbody[] array = componentsInChildren; foreach (Rigidbody val in array) { if (IsUsableRigidbody(val)) { _savedGravityStates[val] = val.useGravity; val.useGravity = false; Vector3 linearVelocity = val.linearVelocity; if (linearVelocity.y < 0f) { linearVelocity.y = 0f; val.linearVelocity = linearVelocity; } } } _slowFallWasApplied = _savedGravityStates.Count > 0; if (!_slowFallWasApplied) { _zeroGravityUntil = 0f; _slowFallUntil = 0f; return; } Plugin.Log.LogInfo((object)("Flight exit protection applied: " + $"{1f:0.##} seconds " + "zero gravity and " + $"{5f:0.##} seconds " + "total slow fall to " + $"{_savedGravityStates.Count} rigidbodies.")); } private void MaintainSlowFall() { //IL_00bf: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (!_slowFallWasApplied) { return; } if (!_slowFallEnabled) { ClearSlowFallImmediately(); return; } float unscaledTime = Time.unscaledTime; if (unscaledTime >= _slowFallUntil) { ClearSlowFallImmediately(); return; } bool flag = unscaledTime < _zeroGravityUntil; KeyValuePair[] array = _savedGravityStates.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair keyValuePair = array[i]; Rigidbody key = keyValuePair.Key; if (!IsUsableRigidbody(key)) { _savedGravityStates.Remove(key); } else if (flag) { key.useGravity = false; Vector3 linearVelocity = key.linearVelocity; if (linearVelocity.y < 0f) { linearVelocity.y = 0f; key.linearVelocity = linearVelocity; } } else { key.useGravity = keyValuePair.Value; Vector3 linearVelocity2 = key.linearVelocity; if (linearVelocity2.y < -2.25f) { linearVelocity2.y = -2.25f; key.linearVelocity = linearVelocity2; } } } if (_savedGravityStates.Count <= 0) { _zeroGravityUntil = 0f; _slowFallUntil = 0f; _slowFallWasApplied = false; } } private void ClearSlowFallImmediately() { RestoreGravityStates(); _zeroGravityUntil = 0f; _slowFallUntil = 0f; _slowFallWasApplied = false; } private void RestoreGravityStates() { KeyValuePair[] array = _savedGravityStates.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair keyValuePair = array[i]; Rigidbody key = keyValuePair.Key; if (key != null) { try { key.useGravity = keyValuePair.Value; } catch (Exception ex) { Plugin.Log.LogDebug((object)("Failed to restore rigidbody gravity: " + ex.Message)); } } } _savedGravityStates.Clear(); } private static Vector3 ReadMovementDirection(Character character) { //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) //IL_0035: 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_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_0020: 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_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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) Camera main = Camera.main; Vector3 forward; Vector3 right; if (main != null) { forward = ((Component)main).transform.forward; right = ((Component)main).transform.right; } else { forward = ((Component)character).transform.forward; right = ((Component)character).transform.right; } forward.y = 0f; right.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } if (((Vector3)(ref right)).sqrMagnitude < 0.001f) { right = Vector3.right; } ((Vector3)(ref forward)).Normalize(); ((Vector3)(ref right)).Normalize(); Vector3 val = Vector3.zero; if (Input.GetKey((KeyCode)119)) { val += forward; } if (Input.GetKey((KeyCode)115)) { val -= forward; } if (Input.GetKey((KeyCode)100)) { val += right; } if (Input.GetKey((KeyCode)97)) { val -= right; } if (Input.GetKey((KeyCode)32)) { val += Vector3.up; } if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305)) { val += Vector3.down; } return val; } private static bool TryWarpCharacter(Character character, Vector3 destination, out string error) { //IL_001a: 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) error = string.Empty; PhotonView photonView = ((MonoBehaviourPun)character).photonView; if (photonView == null) { error = "角色 PhotonView 不存在。"; return false; } if (!IsFinitePosition(destination)) { error = "目标坐标无效。"; return false; } try { photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { destination, false }); return true; } catch (Exception ex) { error = ex.Message; Plugin.Log.LogError((object)("Flight WarpPlayerRPC failed: " + $"{ex}")); return false; } } private static Vector3 ResolveCharacterWorldPosition(Character character) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_009b: 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_00a6: Unknown result type (might be due to invalid IL or missing references) Rigidbody[] componentsInChildren = ((Component)character).GetComponentsInChildren(true); if (componentsInChildren.Length == 0) { return ((Component)character).transform.position; } string[] array = new string[6] { "hip", "hips", "pelvis", "torso", "chest", "body" }; string[] array2 = array; foreach (string value in array2) { Rigidbody[] array3 = componentsInChildren; foreach (Rigidbody val in array3) { if (!IsUsableRigidbody(val)) { continue; } string text = ((Object)val).name ?? string.Empty; if (text.Contains(value, StringComparison.OrdinalIgnoreCase)) { Vector3 worldCenterOfMass = val.worldCenterOfMass; if (IsFinitePosition(worldCenterOfMass)) { return worldCenterOfMass; } } } } Vector3 val2 = Vector3.zero; int num = 0; Rigidbody[] array4 = componentsInChildren; foreach (Rigidbody val3 in array4) { if (IsUsableRigidbody(val3)) { Vector3 worldCenterOfMass2 = val3.worldCenterOfMass; if (IsFinitePosition(worldCenterOfMass2)) { val2 += worldCenterOfMass2; num++; } } } if (num > 0) { return val2 / (float)num; } return ((Component)character).transform.position; } private static bool IsUsableRigidbody(Rigidbody? rigidbody) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (rigidbody == null) { return false; } GameObject gameObject = ((Component)rigidbody).gameObject; if (gameObject != null) { Scene scene = gameObject.scene; if (((Scene)(ref scene)).IsValid()) { return gameObject.activeInHierarchy; } } return false; } private static bool IsFinitePosition(Vector3 position) { //IL_0000: 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_001a: 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) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!float.IsNaN(position.x) && !float.IsNaN(position.y) && !float.IsNaN(position.z) && !float.IsInfinity(position.x) && !float.IsInfinity(position.y)) { return !float.IsInfinity(position.z); } return false; } private static void TryResetFalling(Character character) { try { character.RPCA_UnFall(); } catch (Exception ex) { Plugin.Log.LogDebug((object)("RPCA_UnFall failed while starting flight: " + ex.Message)); } } private void MaintainStatusProtection() { if (StatusRuntime.IsInitialized) { StatusService service = StatusRuntime.Service; if (!service.FlightProtectionLock) { service.SetFlightProtectionLock(locked: true); } if (!service.Invincible) { service.SetInvincible(enabled: true, force: true); } if (!service.AntiKnockback) { service.SetAntiKnockback(enabled: true, force: true); } } } } } namespace P.E.A.K_MENU.Constants { internal static class ModConstants { internal const int WindowId = 938421; internal const float DefaultWindowWidth = 575f; internal const float DefaultWindowHeight = 850f; internal const float MinimumWindowWidth = 520f; internal const float MinimumWindowHeight = 360f; internal const float MaximumWindowWidth = 1100f; internal const float MaximumWindowHeight = 850f; internal const float WindowMargin = 20f; internal const float WindowTop = 80f; internal const float SidebarWidth = 150f; internal const float CategoryButtonHeight = 42f; internal const float ResizeHandleSize = 24f; internal const string WindowTitle = ""; internal const string MainWindowTitle = "P.E.A.K MENU"; internal const string WindowAuthorText = " by Ruangfafa"; internal static readonly KeyCode DefaultToggleMenuKey = (KeyCode)287; } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ConstantExpectedAttribute : Attribute { public object? Min { get; set; } public object? Max { get; set; } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class OverloadResolutionPriorityAttribute : Attribute { public int Priority { get; } public OverloadResolutionPriorityAttribute(int priority) { Priority = priority; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [ExcludeFromCodeCoverage] internal sealed class ParamCollectionAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }