Decompiled source of Teleport v1.2.2
Teleport.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GlobalEnums; using HarmonyLib; using InControl; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Mhz")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2025 Masaicker")] [assembly: AssemblyDescription("A simple teleportation mod for Hollow Knight: Silksong")] [assembly: AssemblyFileVersion("1.2.2.0")] [assembly: AssemblyInformationalVersion("1.2.2+782dfcb234b8c2e0be18a78b0d8bdc2a0721a140")] [assembly: AssemblyProduct("Teleport Mod")] [assembly: AssemblyTitle("Teleport Mod")] [assembly: AssemblyVersion("1.2.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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; } } } [BepInPlugin("Mhz.TeleportMod", "Teleport Mod", "1.2.2")] public class TeleportMod : BaseUnityPlugin { public struct SaveSlot { public Vector3 position; public string scene; public bool hasData; public DateTime saveTime; public SaveSlot(Vector3 pos, string sceneName) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) position = pos; scene = sceneName; hasData = true; saveTime = DateTime.Now; } public SaveSlot(Vector3 pos, string sceneName, DateTime time) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) position = pos; scene = sceneName; hasData = true; saveTime = time; } } public class ExtendedSaveSlot { public Vector3 position; public string scene = ""; public DateTime saveTime; public string displayName = ""; public bool hasData = false; public string customNote = ""; public int serialNumber = 0; public ExtendedSaveSlot() { } public ExtendedSaveSlot(Vector3 pos, string sceneName, string? name = null, string? note = null, bool assignNewSerial = true) { //IL_0038: 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) position = pos; scene = sceneName ?? ""; saveTime = DateTime.Now; displayName = name ?? $"{sceneName} {saveTime:HH:mm}"; customNote = note ?? ""; hasData = true; serialNumber = (assignNewSerial ? nextSerialNumber++ : 0); } public ExtendedSaveSlot(SaveSlot oldSlot) { //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) position = oldSlot.position; scene = oldSlot.scene ?? ""; saveTime = oldSlot.saveTime; displayName = $"Legacy Save {saveTime:HH:mm}"; customNote = ""; hasData = oldSlot.hasData; } } [Serializable] public class PersistentData { public Dictionary<int, SerializableSaveSlot> saveSlots = new Dictionary<int, SerializableSaveSlot>(); public Dictionary<string, SerializableExtendedSaveSlot> extendedSlots = new Dictionary<string, SerializableExtendedSaveSlot>(); public int nextSerialNumber = 1; } [Serializable] public class SerializableSaveSlot { public float x; public float y; public float z; public string scene = ""; public bool hasData = false; public string saveTimeString = ""; public SerializableSaveSlot() { } public SerializableSaveSlot(SaveSlot slot) { //IL_0027: 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_0049: Unknown result type (might be due to invalid IL or missing references) x = slot.position.x; y = slot.position.y; z = slot.position.z; scene = slot.scene ?? ""; hasData = slot.hasData; saveTimeString = slot.saveTime.ToString("yyyy-MM-dd HH:mm:ss"); } public SaveSlot ToSaveSlot() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (DateTime.TryParse(saveTimeString, out var result)) { return new SaveSlot(new Vector3(x, y, z), scene, result); } return new SaveSlot(new Vector3(x, y, z), scene); } } [Serializable] public class SerializableExtendedSaveSlot { public float x; public float y; public float z; public string scene = ""; public string saveTimeString = ""; public string displayName = ""; public bool hasData = false; public string customNote = ""; public int serialNumber = 0; public SerializableExtendedSaveSlot() { } public SerializableExtendedSaveSlot(ExtendedSaveSlot slot) { x = slot.position.x; y = slot.position.y; z = slot.position.z; scene = slot.scene ?? ""; saveTimeString = slot.saveTime.ToString("yyyy-MM-dd HH:mm:ss"); displayName = slot.displayName ?? ""; customNote = slot.customNote ?? ""; hasData = slot.hasData; serialNumber = slot.serialNumber; } public ExtendedSaveSlot ToExtendedSaveSlot() { //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) ExtendedSaveSlot extendedSaveSlot = new ExtendedSaveSlot(); extendedSaveSlot.position = new Vector3(x, y, z); extendedSaveSlot.scene = scene ?? ""; extendedSaveSlot.displayName = displayName ?? ""; extendedSaveSlot.customNote = customNote ?? ""; extendedSaveSlot.hasData = hasData; extendedSaveSlot.serialNumber = serialNumber; if (DateTime.TryParse(saveTimeString, out var result)) { extendedSaveSlot.saveTime = result; } else { extendedSaveSlot.saveTime = DateTime.Now; } return extendedSaveSlot; } } [CompilerGenerated] private sealed class <CheckTeleportSafety>d__102 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Vector3 originalPosition; public TeleportMod <>4__this; private Collider2D <heroCollider>5__1; private int <groundLayerMask>5__2; private Collider2D <overlapping>5__3; private Vector3 <safePosition>5__4; private Exception <ex>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CheckTeleportSafety>d__102(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <heroCollider>5__1 = null; <overlapping>5__3 = null; <ex>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00c0: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; case 1: <>1__state = -1; try { if ((Object)(object)HeroController.instance == (Object)null) { return false; } <heroCollider>5__1 = ((Component)HeroController.instance).GetComponent<Collider2D>(); if ((Object)(object)<heroCollider>5__1 == (Object)null) { return false; } <groundLayerMask>5__2 = LayerMask.GetMask(new string[1] { "Terrain" }); Bounds bounds = <heroCollider>5__1.bounds; Vector2 val = Vector2.op_Implicit(((Bounds)(ref bounds)).center); bounds = <heroCollider>5__1.bounds; <overlapping>5__3 = Physics2D.OverlapBox(val, Vector2.op_Implicit(((Bounds)(ref bounds)).size), 0f, <groundLayerMask>5__2); if ((Object)(object)<overlapping>5__3 != (Object)null) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"检测到传送后卡在地形中,尝试修复位置"); } <safePosition>5__4 = <>4__this.FindSafePositionNearby(originalPosition); if (<safePosition>5__4 != Vector3.zero) { <>4__this.PerformTeleport(<safePosition>5__4); LogInfo($"已修复到安全位置: {<safePosition>5__4}"); } else { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)"无法找到安全位置,建议使用Alt+6重新进入场景"); } } } <heroCollider>5__1 = null; <overlapping>5__3 = null; } catch (Exception ex) { <ex>5__5 = ex; ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("检查传送安全性时发生错误: " + <ex>5__5.Message)); } } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PreloadAudioClip>d__96 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TeleportMod <>4__this; private string <fileName>5__1; private Assembly <assembly>5__2; private string <dllDirectory>5__3; private string <audioFilePath>5__4; private string <tempPath>5__5; private byte[] <audioData>5__6; private Exception <ex>5__7; private UnityWebRequest <request>5__8; private Exception <ex>5__9; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PreloadAudioClip>d__96(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <fileName>5__1 = null; <assembly>5__2 = null; <dllDirectory>5__3 = null; <audioFilePath>5__4 = null; <tempPath>5__5 = null; <audioData>5__6 = null; <ex>5__7 = null; <request>5__8 = null; <ex>5__9 = null; <>1__state = -2; } private bool MoveNext() { //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Invalid comparison between Unknown and I4 try { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; LogInfo("开始预加载音频文件..."); ConfigEntry<bool>? enableEasterEggAudio = TeleportMod.enableEasterEggAudio; <fileName>5__1 = ((enableEasterEggAudio != null && enableEasterEggAudio.Value) ? "manbo.wav" : "Gamesave.wav"); <assembly>5__2 = Assembly.GetExecutingAssembly(); <dllDirectory>5__3 = Path.GetDirectoryName(<assembly>5__2.Location); <audioFilePath>5__4 = Path.Combine(<dllDirectory>5__3, <fileName>5__1); LogInfo($"选择音频文件: {<fileName>5__1} (彩蛋音效: {TeleportMod.enableEasterEggAudio?.Value})"); LogInfo("音频文件路径: " + <audioFilePath>5__4); <tempPath>5__5 = ""; try { if (!File.Exists(<audioFilePath>5__4)) { ManualLogSource? logger4 = Logger; if (logger4 != null) { logger4.LogWarning((object)("未找到音频文件: " + <audioFilePath>5__4)); } return false; } <audioData>5__6 = File.ReadAllBytes(<audioFilePath>5__4); LogInfo($"成功读取音频文件,大小: {<audioData>5__6.Length} 字节"); <tempPath>5__5 = Path.GetTempFileName() + ".wav"; File.WriteAllBytes(<tempPath>5__5, <audioData>5__6); <audioData>5__6 = null; } catch (Exception ex) { <ex>5__7 = ex; ManualLogSource? logger5 = Logger; if (logger5 != null) { logger5.LogError((object)("读取音频文件时发生错误: " + <ex>5__7.Message)); } return false; } <request>5__8 = UnityWebRequestMultimedia.GetAudioClip("file://" + <tempPath>5__5, (AudioType)20); <>1__state = -3; <>2__current = <request>5__8.SendWebRequest(); <>1__state = 1; return true; } case 1: <>1__state = -3; if ((int)<request>5__8.result == 1) { cachedSaveAudioClip = DownloadHandlerAudioClip.GetContent(<request>5__8); if ((Object)(object)cachedSaveAudioClip != (Object)null) { Object.DontDestroyOnLoad((Object)(object)cachedSaveAudioClip); LogInfo($"音频预加载成功 - 长度: {cachedSaveAudioClip.length}秒, 频率: {cachedSaveAudioClip.frequency}, 声道: {cachedSaveAudioClip.channels}"); } else { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"无法获取AudioClip"); } } } else { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("预加载音频失败: " + <request>5__8.error)); } } <>m__Finally1(); <request>5__8 = null; try { if (!string.IsNullOrEmpty(<tempPath>5__5) && File.Exists(<tempPath>5__5)) { File.Delete(<tempPath>5__5); LogInfo("已清理预加载临时文件"); } } catch (Exception ex) { <ex>5__9 = ex; ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("删除预加载临时文件失败: " + <ex>5__9.Message)); } } return false; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<request>5__8 != null) { ((IDisposable)<request>5__8).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <TeleportWithSceneChange>d__100 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string targetScene; public Vector3 targetPosition; public string entryPointName; public TeleportMod <>4__this; private string <useEntryPoint>5__1; private Exception <ex>5__2; private Vector3 <finalPosition>5__3; private (Vector3 position, string scene) <benchInfo>5__4; private Exception <ex>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TeleportWithSceneChange>d__100(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <useEntryPoint>5__1 = null; <ex>5__2 = null; <benchInfo>5__4 = default((Vector3, string)); <ex>5__5 = null; <>1__state = -2; } private bool MoveNext() { //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a8: 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_00bf: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: 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_0296: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; LogInfo("开始场景切换到: " + targetScene); <useEntryPoint>5__1 = entryPointName; if (string.IsNullOrEmpty(<useEntryPoint>5__1)) { <useEntryPoint>5__1 = "left1"; } LogInfo("使用入口点: " + <useEntryPoint>5__1); try { GameManager.instance.BeginSceneTransition(new SceneLoadInfo { SceneName = targetScene, EntryGateName = <useEntryPoint>5__1, HeroLeaveDirection = (GatePosition)5, EntryDelay = 0f, Visualization = (SceneLoadVisualizations)0, AlwaysUnloadUnusedAssets = true }); } catch (Exception ex) { <ex>5__2 = ex; ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("开始场景切换时发生错误: " + <ex>5__2.Message)); } return false; } <>2__current = (object)new WaitWhile((Func<bool>)delegate { GameManager instance2 = GameManager.instance; HeroController instance3 = HeroController.instance; return (Object)(object)instance2 == (Object)null || (Object)(object)instance3 == (Object)null || instance2.IsInSceneTransition || !instance3.isHeroInPosition || instance3.cState.transitioning; }); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)delegate { HeroController instance = HeroController.instance; return (Object)(object)instance != (Object)null && instance.CanInput(); }); <>1__state = 2; return true; case 2: <>1__state = -1; try { <finalPosition>5__3 = targetPosition; if (targetPosition == Vector3.one) { LogInfo("获取椅子在新场景中的真实坐标"); <benchInfo>5__4 = <>4__this.GetBenchPositionAndScene(); if (!(<benchInfo>5__4.position != Vector3.zero) || !(<benchInfo>5__4.position != Vector3.one)) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)"场景切换后仍无法找到椅子坐标,使用入口点位置"); } return false; } <finalPosition>5__3 = ApplyBenchSafeOffset(<benchInfo>5__4.position); LogInfo($"找到椅子坐标: {<benchInfo>5__4.position}"); <benchInfo>5__4 = default((Vector3, string)); } if (targetPosition != Vector3.zero) { LogInfo($"场景切换完成,传送到位置: {<finalPosition>5__3}"); <>4__this.PerformSafeTeleport(<finalPosition>5__3); } else { LogInfo("场景切换完成,已在安全入口点位置"); } } catch (Exception ex) { <ex>5__5 = ex; ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("传送到目标位置时发生错误: " + <ex>5__5.Message)); } } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <TeleportWithSceneChange>d__99 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string targetScene; public Vector3 targetPosition; public TeleportMod <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TeleportWithSceneChange>d__99(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.TeleportWithSceneChange(targetScene, targetPosition, null)); <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static ManualLogSource? Logger; public static ConfigEntry<bool>? enableDetailedLogging; private static ConfigEntry<bool>? enableGamepadSupport; private static ConfigEntry<bool>? enableEasterEggAudio; private static ConfigEntry<string>? saveModifierKey; private static ConfigEntry<string>? teleportModifierKey; private static ConfigEntry<string>? resetModifierKey; private static ConfigEntry<string>? gamepadSlot1Key; private static ConfigEntry<string>? gamepadSlot2Key; private static ConfigEntry<string>? gamepadSlot3Key; private static ConfigEntry<string>? gamepadSlot4Key; private static ConfigEntry<string>? gamepadSlot5Key; private static ConfigEntry<string>? gamepadTeleportModifier1; private static ConfigEntry<string>? gamepadTeleportModifier2; private static ConfigEntry<string>? gamepadSaveModifier; private static ConfigEntry<string>? gamepadSaveTrigger; private static ConfigEntry<string>? gamepadSafeRespawnKey; private static ConfigEntry<string>? gamepadHardcodedTeleportKey; private static ConfigEntry<string>? gamepadBenchTeleportKey; private static ConfigEntry<string>? gamepadClearAllModifier1; private static ConfigEntry<string>? gamepadClearAllModifier2; private static ConfigEntry<string>? gamepadClearAllTrigger; private static ConfigEntry<string>? slot1Key; private static ConfigEntry<string>? slot2Key; private static ConfigEntry<string>? slot3Key; private static ConfigEntry<string>? slot4Key; private static ConfigEntry<string>? slot5Key; private static ConfigEntry<string>? safeRespawnKey; private static ConfigEntry<string>? resetAllKey; private static ConfigEntry<string>? hardcodedTeleportKey; private static ConfigEntry<string>? benchTeleportKey; private static ConfigEntry<float>? audioVolume; private static Dictionary<int, SaveSlot> saveSlots = new Dictionary<int, SaveSlot>(); private static Dictionary<string, ExtendedSaveSlot> extendedSaveSlots = new Dictionary<string, ExtendedSaveSlot>(); private static int nextSerialNumber = 1; private static TeleportUIManager? uiManager; private static int currentEntryPointIndex = 0; private static string lastUsedScene = ""; private static bool wasVerticalPressed = false; private static bool wasHorizontalPressed = false; private static GameObject? audioPlayerObject = null; private static AudioSource? audioPlayerSource = null; private static AudioClip? cachedSaveAudioClip = null; private static float lastSaveAudioTime = 0f; private const float AUDIO_COOLDOWN = 0.1f; private static readonly Vector3 BENCH_SAFE_OFFSET = new Vector3(0f, 2f, 0f); private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; try { Harmony val = new Harmony("Mhz.TeleportMod"); val.PatchAll(); ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"Harmony补丁已应用"); } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("初始化Harmony时发生错误: " + ex.Message)); } } enableDetailedLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("日志设置 | Logging", "启用详细日志 | Enable Detailed Logging", false, "是否启用详细的传送日志输出 | Enable detailed teleport logging output"); enableGamepadSupport = ((BaseUnityPlugin)this).Config.Bind<bool>("控制设置 | Controls", "启用手柄支持 | Enable Gamepad Support", true, "是否启用手柄控制传送功能。\ud83d\udcd6 完整操作方案请查看 README.md | Enable gamepad control for teleport functions. \ud83d\udcd6 For complete operation guide, please check README.md"); enableEasterEggAudio = ((BaseUnityPlugin)this).Config.Bind<bool>("音效设置 | Audio Settings", "启用彩蛋音效 | Enable Easter Egg Audio", false, "是否启用彩蛋音效。开启后存档时播放特殊音效,关闭时播放默认音效。需要重启游戏生效 | Enable easter egg audio effect. When enabled, plays special sound effect when saving, otherwise plays default sound effect. Requires game restart to take effect"); audioVolume = ((BaseUnityPlugin)this).Config.Bind<float>("音效设置 | Audio Settings", "音效音量 | Audio Volume", 0.5f, "存档音效的音量大小。范围0.0-1.0,设置为0关闭音效 | Volume level for save sound effect. Range 0.0-1.0, set to 0 to disable audio"); saveModifierKey = ((BaseUnityPlugin)this).Config.Bind<string>("按键设置 | Key Settings", "保存修饰键 | Save Modifier Key", "LeftControl", "保存坐标时使用的修饰键。可选值:LeftControl, RightControl, LeftAlt, RightAlt, LeftShift, RightShift | Modifier key for saving coordinates. Options: LeftControl, RightControl, LeftAlt, RightAlt, LeftShift, RightShift"); teleportModifierKey = ((BaseUnityPlugin)this).Config.Bind<string>("按键设置 | Key Settings", "传送修饰键 | Teleport Modifier Key", "LeftAlt", "传送坐标时使用的修饰键。可选值:LeftControl, RightControl, LeftAlt, RightAlt, LeftShift, RightShift | Modifier key for teleporting coordinates. Options: LeftControl, RightControl, LeftAlt, RightAlt, LeftShift, RightShift"); resetModifierKey = ((BaseUnityPlugin)this).Config.Bind<string>("按键设置 | Key Settings", "重置修饰键 | Reset Modifier Key", "LeftAlt", "重置坐标和安全重生时使用的修饰键。可选值:LeftControl, RightControl, LeftAlt, RightAlt, LeftShift, RightShift | Modifier key for reset and safe respawn functions. Options: LeftControl, RightControl, LeftAlt, RightAlt, LeftShift, RightShift"); gamepadSlot1Key = ((BaseUnityPlugin)this).Config.Bind<string>("手柄存档槽按键 | Gamepad Slot Keys", "手柄存档槽1 | Gamepad Slot 1", "DPadUp", "手柄存档槽1按键 | Gamepad key for slot 1 (默认: DPadUp=方向键上 | Default: DPadUp=D-Pad Up). \ud83d\udcd6 完整按键对照表请查看 README.md | For complete key reference, see README.md"); gamepadSlot2Key = ((BaseUnityPlugin)this).Config.Bind<string>("手柄存档槽按键 | Gamepad Slot Keys", "手柄存档槽2 | Gamepad Slot 2", "DPadDown", "手柄存档槽2按键 | Gamepad key for slot 2 (默认: DPadDown=方向键下 | Default: DPadDown=D-Pad Down)"); gamepadSlot3Key = ((BaseUnityPlugin)this).Config.Bind<string>("手柄存档槽按键 | Gamepad Slot Keys", "手柄存档槽3 | Gamepad Slot 3", "DPadLeft", "手柄存档槽3按键 | Gamepad key for slot 3 (默认: DPadLeft=方向键左 | Default: DPadLeft=D-Pad Left)"); gamepadSlot4Key = ((BaseUnityPlugin)this).Config.Bind<string>("手柄存档槽按键 | Gamepad Slot Keys", "手柄存档槽4 | Gamepad Slot 4", "DPadRight", "手柄存档槽4按键 | Gamepad key for slot 4 (默认: DPadRight=方向键右 | Default: DPadRight=D-Pad Right)"); gamepadSlot5Key = ((BaseUnityPlugin)this).Config.Bind<string>("手柄存档槽按键 | Gamepad Slot Keys", "手柄存档槽5 | Gamepad Slot 5", "JoystickButton0", "手柄存档槽5按键 | Gamepad key for slot 5 (默认: JoystickButton0=A按钮 | Default: JoystickButton0=A Button)"); gamepadTeleportModifier1 = ((BaseUnityPlugin)this).Config.Bind<string>("手柄修饰键 | Gamepad Modifiers", "传送修饰键1 | Teleport Modifier 1", "LeftBumper", "传送修饰键1 (默认: LeftBumper=LB) | Teleport modifier 1 (Default: LeftBumper=LB). 组合: 修饰键1 + 修饰键2 + 存档槽 = 传送 | Combo: Modifier1 + Modifier2 + Slot = Teleport"); gamepadTeleportModifier2 = ((BaseUnityPlugin)this).Config.Bind<string>("手柄修饰键 | Gamepad Modifiers", "传送修饰键2 | Teleport Modifier 2", "RightBumper", "传送修饰键2 (默认: RightBumper=RB) | Teleport modifier 2 (Default: RightBumper=RB). 默认组合: LB + RB | Default combo: LB + RB"); gamepadSaveModifier = ((BaseUnityPlugin)this).Config.Bind<string>("手柄修饰键 | Gamepad Modifiers", "保存修饰键 | Save Modifier", "LeftBumper", "保存修饰键 (默认: LeftBumper=LB) | Save modifier (Default: LeftBumper=LB). 组合: 保存修饰键 + 保存触发键 + 存档槽 = 保存 | Combo: Save Modifier + Save Trigger + Slot = Save"); gamepadSaveTrigger = ((BaseUnityPlugin)this).Config.Bind<string>("手柄修饰键 | Gamepad Modifiers", "保存触发键 | Save Trigger", "JoystickButton7", "保存触发键 (默认: JoystickButton7=Start) | Save trigger (Default: JoystickButton7=Start). 默认组合: LB + Start | Default combo: LB + Start"); gamepadSafeRespawnKey = ((BaseUnityPlugin)this).Config.Bind<string>("手柄特殊功能 | Gamepad Special", "安全重生按键 | Safe Respawn", "JoystickButton3", "安全重生按键 (默认: JoystickButton3=Y按钮) | Safe respawn key (Default: JoystickButton3=Y Button). 传送模式下使用 | Use in teleport mode"); gamepadHardcodedTeleportKey = ((BaseUnityPlugin)this).Config.Bind<string>("手柄特殊功能 | Gamepad Special", "硬编码传送按键 | Hardcoded Teleport", "JoystickButton2", "硬编码传送按键 (默认: JoystickButton2=X按钮) | Hardcoded teleport key (Default: JoystickButton2=X Button). 传送模式下使用 | Use in teleport mode"); gamepadBenchTeleportKey = ((BaseUnityPlugin)this).Config.Bind<string>("手柄特殊功能 | Gamepad Special", "椅子传送按键 | Bench Teleport", "JoystickButton1", "椅子传送按键 (默认: JoystickButton1=B按钮) | Bench teleport key (Default: JoystickButton1=B Button). 传送模式下使用 | Use in teleport mode"); gamepadClearAllModifier1 = ((BaseUnityPlugin)this).Config.Bind<string>("手柄重置组合 | Gamepad Reset Combo", "重置修饰键1 | Reset Modifier 1", "LeftBumper", "重置修饰键1 (默认: LeftBumper=LB) | Reset modifier 1 (Default: LeftBumper=LB). 三键组合清空所有存档 | Triple key combo to clear all saves"); gamepadClearAllModifier2 = ((BaseUnityPlugin)this).Config.Bind<string>("手柄重置组合 | Gamepad Reset Combo", "重置修饰键2 | Reset Modifier 2", "JoystickButton6", "重置修饰键2 (默认: JoystickButton6=Select) | Reset modifier 2 (Default: JoystickButton6=Select). 默认组合: LB + Select + Start | Default combo: LB + Select + Start"); gamepadClearAllTrigger = ((BaseUnityPlugin)this).Config.Bind<string>("手柄重置组合 | Gamepad Reset Combo", "重置触发键 | Reset Trigger", "JoystickButton7", "重置触发键 (默认: JoystickButton7=Start) | Reset trigger (Default: JoystickButton7=Start). ⚠\ufe0f警告: 此操作不可撤销 | ⚠\ufe0fWarning: This action is irreversible"); slot1Key = ((BaseUnityPlugin)this).Config.Bind<string>("键盘存档槽按键 | Keyboard Slot Keys", "键盘存档槽1 | Keyboard Slot 1", "Alpha1", "键盘存档槽1按键。可用:Alpha0-9, F1-F12, Q, W, E, R, T, Y, U, I, O, P等 | Keyboard key for slot 1. Available: Alpha0-9, F1-F12, Q, W, E, R, T, Y, U, I, O, P, etc."); slot2Key = ((BaseUnityPlugin)this).Config.Bind<string>("键盘存档槽按键 | Keyboard Slot Keys", "键盘存档槽2 | Keyboard Slot 2", "Alpha2", "键盘存档槽2按键 | Keyboard key for slot 2"); slot3Key = ((BaseUnityPlugin)this).Config.Bind<string>("键盘存档槽按键 | Keyboard Slot Keys", "键盘存档槽3 | Keyboard Slot 3", "Alpha3", "键盘存档槽3按键 | Keyboard key for slot 3"); slot4Key = ((BaseUnityPlugin)this).Config.Bind<string>("键盘存档槽按键 | Keyboard Slot Keys", "键盘存档槽4 | Keyboard Slot 4", "Alpha4", "键盘存档槽4按键 | Keyboard key for slot 4"); slot5Key = ((BaseUnityPlugin)this).Config.Bind<string>("键盘存档槽按键 | Keyboard Slot Keys", "键盘存档槽5 | Keyboard Slot 5", "Alpha5", "键盘存档槽5按键 | Keyboard key for slot 5"); safeRespawnKey = ((BaseUnityPlugin)this).Config.Bind<string>("键盘特殊功能 | Keyboard Special", "键盘安全重生 | Keyboard Safe Respawn", "Alpha6", "键盘安全重生功能按键 | Keyboard safe respawn function key"); resetAllKey = ((BaseUnityPlugin)this).Config.Bind<string>("键盘特殊功能 | Keyboard Special", "键盘重置所有 | Keyboard Reset All", "Alpha0", "键盘重置所有坐标功能按键 | Keyboard reset all coordinates function key"); hardcodedTeleportKey = ((BaseUnityPlugin)this).Config.Bind<string>("键盘特殊功能 | Keyboard Special", "键盘硬编码传送 | Keyboard Hardcoded Teleport", "Minus", "键盘传送到预设坐标的按键。默认是减号键(-) | Keyboard key for teleporting to preset coordinates. Default is minus key (-)"); benchTeleportKey = ((BaseUnityPlugin)this).Config.Bind<string>("键盘特殊功能 | Keyboard Special", "键盘椅子传送 | Keyboard Bench Teleport", "Alpha7", "键盘传送到椅子(最后重生点)的按键 | Keyboard key for teleporting to bench (last respawn point)"); ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogInfo((object)"Teleport Mod 已加载!"); } ConfigEntry<bool>? obj = enableDetailedLogging; if (obj != null && obj.Value) { ManualLogSource? logger4 = Logger; if (logger4 != null) { logger4.LogInfo((object)"详细日志已启用 | Detailed logging enabled"); } } else { ManualLogSource? logger5 = Logger; if (logger5 != null) { logger5.LogInfo((object)"详细日志已禁用,只显示重要信息 | Detailed logging disabled, showing important messages only"); } } ConfigEntry<bool>? obj2 = enableGamepadSupport; if (obj2 != null && obj2.Value) { ManualLogSource? logger6 = Logger; if (logger6 != null) { logger6.LogInfo((object)"手柄支持已启用 | Gamepad support enabled"); } } else { ManualLogSource? logger7 = Logger; if (logger7 != null) { logger7.LogInfo((object)"手柄支持已禁用 | Gamepad support disabled"); } } LoadPersistentData(); ((MonoBehaviour)this).StartCoroutine(PreloadAudioClip()); InitializeUIManager(); } private void LoadPersistentData() { try { string saveFilePath = GetSaveFilePath(); if (File.Exists(saveFilePath)) { string text = File.ReadAllText(saveFilePath); PersistentData persistentData = JsonConvert.DeserializeObject<PersistentData>(text); if (persistentData == null) { return; } if (persistentData.saveSlots != null) { saveSlots.Clear(); foreach (KeyValuePair<int, SerializableSaveSlot> saveSlot in persistentData.saveSlots) { if (saveSlot.Value != null && saveSlot.Value.hasData) { saveSlots[saveSlot.Key] = saveSlot.Value.ToSaveSlot(); } } } if (persistentData.extendedSlots != null) { extendedSaveSlots.Clear(); foreach (KeyValuePair<string, SerializableExtendedSaveSlot> extendedSlot in persistentData.extendedSlots) { if (extendedSlot.Value != null && extendedSlot.Value.hasData) { ExtendedSaveSlot extendedSaveSlot = extendedSlot.Value.ToExtendedSaveSlot(); if (extendedSaveSlot.serialNumber <= 0) { extendedSaveSlot.serialNumber = nextSerialNumber++; } extendedSaveSlots[extendedSlot.Key] = extendedSaveSlot; } } } nextSerialNumber = Math.Max(persistentData.nextSerialNumber, nextSerialNumber); int num = (persistentData.saveSlots?.Count ?? 0) + (persistentData.extendedSlots?.Count ?? 0); ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)$"已加载持久化数据:{persistentData.saveSlots?.Count ?? 0} 个传统存档,{persistentData.extendedSlots?.Count ?? 0} 个扩展存档,下一个序号: {nextSerialNumber} | Loaded persistent data: {persistentData.saveSlots?.Count ?? 0} traditional slots, {persistentData.extendedSlots?.Count ?? 0} extended slots, next serial: {nextSerialNumber}"); } } else { LogInfo("未找到存档文件,使用默认设置 | No save file found, using defaults"); } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("加载持久化数据时发生错误 | Error loading persistent data: " + ex.Message)); } } } private void SavePersistentData() { try { PersistentData persistentData = new PersistentData(); foreach (KeyValuePair<int, SaveSlot> saveSlot in saveSlots) { if (saveSlot.Value.hasData) { persistentData.saveSlots[saveSlot.Key] = new SerializableSaveSlot(saveSlot.Value); } } foreach (KeyValuePair<string, ExtendedSaveSlot> extendedSaveSlot in extendedSaveSlots) { if (extendedSaveSlot.Value.hasData) { persistentData.extendedSlots[extendedSaveSlot.Key] = new SerializableExtendedSaveSlot(extendedSaveSlot.Value); } } persistentData.nextSerialNumber = nextSerialNumber; string contents = JsonConvert.SerializeObject((object)persistentData, (Formatting)1); string saveFilePath = GetSaveFilePath(); string directoryName = Path.GetDirectoryName(saveFilePath); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } File.WriteAllText(saveFilePath, contents); int num = persistentData.saveSlots.Count + persistentData.extendedSlots.Count; LogInfo($"已保存持久化数据:{persistentData.saveSlots.Count} 个传统存档,{persistentData.extendedSlots.Count} 个扩展存档 | Saved persistent data: {persistentData.saveSlots.Count} traditional slots, {persistentData.extendedSlots.Count} extended slots"); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("保存持久化数据时发生错误 | Error saving persistent data: " + ex.Message)); } } } private string GetSaveFilePath() { try { string persistentDataPath = Application.persistentDataPath; string path = Path.Combine(persistentDataPath, "TeleportMod"); string text = Path.Combine(path, "savedata.json"); LogInfo("存档文件路径 | Save file path: " + text); return text; } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("获取存档文件路径时发生错误 | Error getting save file path: " + ex.Message)); } return Path.Combine("TeleportMod", "savedata.json"); } } public static void LogInfo(string message) { ConfigEntry<bool>? obj = enableDetailedLogging; if (obj != null && obj.Value) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)message); } } } private static Vector3 ApplyBenchSafeOffset(Vector3 benchPosition) { //IL_0001: 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_000e: 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_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_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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0021: 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_0051: Unknown result type (might be due to invalid IL or missing references) if (benchPosition == Vector3.one || benchPosition == Vector3.zero) { return benchPosition; } Vector3 val = benchPosition + BENCH_SAFE_OFFSET; LogInfo($"椅子位置已添加安全偏移: {benchPosition} -> {val}"); return val; } public static bool CanPerformTeleportOperations() { try { if (PlayerData.instance != null && PlayerData.instance.health <= 0) { LogInfo("角色血量为0,禁止保存和传送 | Hero health is 0, blocking save and teleport"); return false; } if (PlayerData.instance != null && PlayerData.instance.atBench) { LogInfo("角色在椅子上,禁止保存和传送 | Hero is at bench, blocking save and teleport"); return false; } if (PlayerData.instance != null && !PlayerData.instance.bindCutscenePlayed) { LogInfo("角色在特殊场景中,禁止保存和传送 | Teleport blocked"); return false; } if ((Object)(object)GameManager.instance != (Object)null && GameManager.instance.RespawningHero) { LogInfo("角色正在重生,禁止保存和传送 | Hero is respawning, blocking save and teleport"); return false; } return true; } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("检查传送操作权限时发生错误: " + ex.Message)); } return false; } } private static bool IsGamepadKeyPressed(string keyConfig) { if (string.IsNullOrEmpty(keyConfig)) { return false; } InputDevice activeDevice = InputManager.ActiveDevice; if (activeDevice == null || !activeDevice.IsAttached) { return false; } if (1 == 0) { } bool result = keyConfig switch { "DPadUp" => ((OneAxisInputControl)activeDevice.DPadUp).WasPressed, "DPadDown" => ((OneAxisInputControl)activeDevice.DPadDown).WasPressed, "DPadLeft" => ((OneAxisInputControl)activeDevice.DPadLeft).WasPressed, "DPadRight" => ((OneAxisInputControl)activeDevice.DPadRight).WasPressed, "LeftBumper" => ((OneAxisInputControl)activeDevice.LeftBumper).WasPressed, "RightBumper" => ((OneAxisInputControl)activeDevice.RightBumper).WasPressed, "LeftTrigger" => ((OneAxisInputControl)activeDevice.LeftTrigger).WasPressed, "RightTrigger" => ((OneAxisInputControl)activeDevice.RightTrigger).WasPressed, "LeftStickButton" => ((OneAxisInputControl)activeDevice.LeftStickButton).WasPressed, "RightStickButton" => ((OneAxisInputControl)activeDevice.RightStickButton).WasPressed, "LeftStickUp" => ((OneAxisInputControl)activeDevice.LeftStickUp).WasPressed, "LeftStickDown" => ((OneAxisInputControl)activeDevice.LeftStickDown).WasPressed, "LeftStickLeft" => ((OneAxisInputControl)activeDevice.LeftStickLeft).WasPressed, "LeftStickRight" => ((OneAxisInputControl)activeDevice.LeftStickRight).WasPressed, "RightStickUp" => ((OneAxisInputControl)activeDevice.RightStickUp).WasPressed, "RightStickDown" => ((OneAxisInputControl)activeDevice.RightStickDown).WasPressed, "RightStickLeft" => ((OneAxisInputControl)activeDevice.RightStickLeft).WasPressed, "RightStickRight" => ((OneAxisInputControl)activeDevice.RightStickRight).WasPressed, _ => keyConfig.StartsWith("JoystickButton") && ParseJoystickButton(keyConfig), }; if (1 == 0) { } return result; } private static bool IsGamepadKeyHeld(string keyConfig) { if (string.IsNullOrEmpty(keyConfig)) { return false; } InputDevice activeDevice = InputManager.ActiveDevice; if (activeDevice == null || !activeDevice.IsAttached) { return false; } if (1 == 0) { } bool result = keyConfig switch { "DPadUp" => ((OneAxisInputControl)activeDevice.DPadUp).IsPressed, "DPadDown" => ((OneAxisInputControl)activeDevice.DPadDown).IsPressed, "DPadLeft" => ((OneAxisInputControl)activeDevice.DPadLeft).IsPressed, "DPadRight" => ((OneAxisInputControl)activeDevice.DPadRight).IsPressed, "LeftBumper" => ((OneAxisInputControl)activeDevice.LeftBumper).IsPressed, "RightBumper" => ((OneAxisInputControl)activeDevice.RightBumper).IsPressed, "LeftTrigger" => ((OneAxisInputControl)activeDevice.LeftTrigger).IsPressed, "RightTrigger" => ((OneAxisInputControl)activeDevice.RightTrigger).IsPressed, "LeftStickButton" => ((OneAxisInputControl)activeDevice.LeftStickButton).IsPressed, "RightStickButton" => ((OneAxisInputControl)activeDevice.RightStickButton).IsPressed, "LeftStickUp" => ((OneAxisInputControl)activeDevice.LeftStickUp).IsPressed, "LeftStickDown" => ((OneAxisInputControl)activeDevice.LeftStickDown).IsPressed, "LeftStickLeft" => ((OneAxisInputControl)activeDevice.LeftStickLeft).IsPressed, "LeftStickRight" => ((OneAxisInputControl)activeDevice.LeftStickRight).IsPressed, "RightStickUp" => ((OneAxisInputControl)activeDevice.RightStickUp).IsPressed, "RightStickDown" => ((OneAxisInputControl)activeDevice.RightStickDown).IsPressed, "RightStickLeft" => ((OneAxisInputControl)activeDevice.RightStickLeft).IsPressed, "RightStickRight" => ((OneAxisInputControl)activeDevice.RightStickRight).IsPressed, _ => keyConfig.StartsWith("JoystickButton") && ParseJoystickButtonHeld(keyConfig), }; if (1 == 0) { } return result; } private static bool ParseJoystickButton(string keyConfig) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) try { if (keyConfig.StartsWith("JoystickButton") && keyConfig.Length > 14) { string s = keyConfig.Substring(14); if (int.TryParse(s, out var result) && result >= 0 && result <= 19) { KeyCode val = (KeyCode)Enum.Parse(typeof(KeyCode), keyConfig); return Input.GetKeyDown(val); } } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("解析JoystickButton时发生错误: " + keyConfig + ", " + ex.Message)); } } return false; } private static bool ParseJoystickButtonHeld(string keyConfig) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) try { if (keyConfig.StartsWith("JoystickButton") && keyConfig.Length > 14) { string s = keyConfig.Substring(14); if (int.TryParse(s, out var result) && result >= 0 && result <= 19) { KeyCode val = (KeyCode)Enum.Parse(typeof(KeyCode), keyConfig); return Input.GetKey(val); } } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("解析JoystickButton时发生错误: " + keyConfig + ", " + ex.Message)); } } return false; } private void Update() { if (!((Object)(object)GameManager.UnsafeInstance == (Object)null)) { ConfigEntry<bool>? obj = enableGamepadSupport; if (obj != null && obj.Value) { HandleGamepadInput(); } HandleKeyboardInput(); } } private void HandleKeyboardInput() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) HandleEmergencyRestartInput(); GameManager unsafeInstance = GameManager.UnsafeInstance; if ((Object)(object)unsafeInstance == (Object)null || unsafeInstance.isPaused || (int)unsafeInstance.GameState != 4 || !CanPerformTeleportOperations()) { return; } if (IsModifierKeyPressed(saveModifierKey?.Value ?? "LeftControl")) { for (int i = 1; i <= 5; i++) { KeyCode slotKey = GetSlotKey(i); if ((int)slotKey != 0 && Input.GetKeyDown(slotKey)) { SaveToSlot(i); break; } } } else if (IsModifierKeyPressed(teleportModifierKey?.Value ?? "LeftAlt")) { for (int j = 1; j <= 5; j++) { KeyCode slotKey2 = GetSlotKey(j); if ((int)slotKey2 != 0 && Input.GetKeyDown(slotKey2)) { LoadFromSlot(j); break; } } } if (IsModifierKeyPressed(resetModifierKey?.Value ?? "LeftAlt")) { KeyCode val = ParseKeyCode(safeRespawnKey?.Value ?? "Alpha6"); if ((int)val != 0 && Input.GetKeyDown(val)) { RespawnToSafeEntryPoint(); return; } KeyCode val2 = ParseKeyCode(resetAllKey?.Value ?? "Alpha0"); if ((int)val2 != 0 && Input.GetKeyDown(val2)) { ClearAllSaveSlots(); return; } KeyCode val3 = ParseKeyCode(hardcodedTeleportKey?.Value ?? "Minus"); if ((int)val3 != 0 && Input.GetKeyDown(val3)) { TeleportToHardcodedPosition(); return; } } if (IsModifierKeyPressed(teleportModifierKey?.Value ?? "LeftAlt")) { KeyCode val4 = ParseKeyCode(benchTeleportKey?.Value ?? "Alpha7"); if ((int)val4 != 0 && Input.GetKeyDown(val4)) { TeleportToBench(); } } } private void HandleGamepadInput() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 try { GameManager unsafeInstance = GameManager.UnsafeInstance; if ((Object)(object)unsafeInstance == (Object)null || unsafeInstance.isPaused || (int)unsafeInstance.GameState != 4 || !CanPerformTeleportOperations()) { return; } bool flag = IsGamepadKeyHeld(gamepadTeleportModifier1?.Value ?? "LeftBumper") && IsGamepadKeyHeld(gamepadTeleportModifier2?.Value ?? "RightBumper"); bool flag2 = IsGamepadKeyHeld(gamepadSaveModifier?.Value ?? "LeftBumper") && IsGamepadKeyHeld(gamepadSaveTrigger?.Value ?? "JoystickButton7"); if (!flag && !flag2) { return; } if (flag && IsGamepadKeyPressed(gamepadSafeRespawnKey?.Value ?? "JoystickButton3")) { RespawnToSafeEntryPoint(); return; } if (flag && IsGamepadKeyPressed(gamepadHardcodedTeleportKey?.Value ?? "JoystickButton2")) { TeleportToHardcodedPosition(); return; } if (flag && IsGamepadKeyPressed(gamepadBenchTeleportKey?.Value ?? "JoystickButton1")) { TeleportToBench(); return; } if (IsGamepadKeyHeld(gamepadClearAllModifier1?.Value ?? "LeftBumper") && IsGamepadKeyHeld(gamepadClearAllModifier2?.Value ?? "JoystickButton6") && IsGamepadKeyPressed(gamepadClearAllTrigger?.Value ?? "JoystickButton7")) { ClearAllSaveSlots(); return; } int num = 0; if (!wasVerticalPressed || !wasHorizontalPressed) { if (!wasVerticalPressed && IsGamepadKeyPressed(gamepadSlot1Key?.Value ?? "DPadUp")) { num = 1; wasVerticalPressed = true; LogInfo("检测到存档槽1按键: " + gamepadSlot1Key?.Value); } else if (!wasVerticalPressed && IsGamepadKeyPressed(gamepadSlot2Key?.Value ?? "DPadDown")) { num = 2; wasVerticalPressed = true; LogInfo("检测到存档槽2按键: " + gamepadSlot2Key?.Value); } else if (!wasHorizontalPressed && IsGamepadKeyPressed(gamepadSlot3Key?.Value ?? "DPadLeft")) { num = 3; wasHorizontalPressed = true; LogInfo("检测到存档槽3按键: " + gamepadSlot3Key?.Value); } else if (!wasHorizontalPressed && IsGamepadKeyPressed(gamepadSlot4Key?.Value ?? "DPadRight")) { num = 4; wasHorizontalPressed = true; LogInfo("检测到存档槽4按键: " + gamepadSlot4Key?.Value); } else if (IsGamepadKeyPressed(gamepadSlot5Key?.Value ?? "JoystickButton0")) { num = 5; LogInfo("检测到存档槽5按键: " + gamepadSlot5Key?.Value); } } string keyConfig = gamepadSlot1Key?.Value ?? "DPadUp"; string keyConfig2 = gamepadSlot2Key?.Value ?? "DPadDown"; string keyConfig3 = gamepadSlot3Key?.Value ?? "DPadLeft"; string keyConfig4 = gamepadSlot4Key?.Value ?? "DPadRight"; if (wasVerticalPressed && !IsGamepadKeyHeld(keyConfig) && !IsGamepadKeyHeld(keyConfig2)) { wasVerticalPressed = false; } if (wasHorizontalPressed && !IsGamepadKeyHeld(keyConfig3) && !IsGamepadKeyHeld(keyConfig4)) { wasHorizontalPressed = false; } if (num > 0) { if (flag2) { SaveToSlot(num); } else if (flag) { LoadFromSlot(num); } } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("处理手柄输入时发生错误 | Error handling gamepad input: " + ex.Message)); } } } private void ClearAllSaveSlots() { try { saveSlots.Clear(); extendedSaveSlots.Clear(); SavePersistentData(); ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"已清空所有存档坐标!| All save slots cleared!"); } LogInfo("所有传送位置已重置,可以重新保存坐标 | All teleport positions reset, you can save new coordinates"); uiManager?.RefreshSlotList(); } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("清空存档坐标时发生错误 | Error clearing save slots: " + ex.Message)); } } } private void InitializeUIManager() { try { UnsubscribeUIEvents(); TeleportUIManager.Initialize(Logger); uiManager = TeleportUIManager.Instance; if ((Object)(object)uiManager != (Object)null) { uiManager.OnTeleportToSlot += OnUITeleportToSlot; uiManager.OnDeleteSlot += OnUIDeleteSlot; uiManager.OnOverwriteSlot += OnUIOverwriteSlot; uiManager.OnSaveCurrentPosition += OnUISaveCurrentPosition; uiManager.OnClearAllSlots += OnUIClearAllSlots; uiManager.OnSafeRespawn += OnUISafeRespawn; uiManager.OnBenchTeleport += OnUIBenchTeleport; uiManager.OnHardcodedTeleport += OnUIHardcodedTeleport; ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"UI管理器初始化完成"); } } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("初始化UI管理器时发生错误: " + ex.Message)); } } } private void UnsubscribeUIEvents() { try { if ((Object)(object)uiManager != (Object)null) { uiManager.OnTeleportToSlot -= OnUITeleportToSlot; uiManager.OnDeleteSlot -= OnUIDeleteSlot; uiManager.OnOverwriteSlot -= OnUIOverwriteSlot; uiManager.OnSaveCurrentPosition -= OnUISaveCurrentPosition; uiManager.OnClearAllSlots -= OnUIClearAllSlots; uiManager.OnSafeRespawn -= OnUISafeRespawn; uiManager.OnBenchTeleport -= OnUIBenchTeleport; uiManager.OnHardcodedTeleport -= OnUIHardcodedTeleport; ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"UI事件订阅已取消"); } } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("取消UI事件订阅时发生错误: " + ex.Message)); } } } private void OnDestroy() { try { UnsubscribeUIEvents(); ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"TeleportMod 组件销毁清理完成"); } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("组件销毁清理时发生错误: " + ex.Message)); } } } private void OnUITeleportToSlot(string slotId) { try { if (!CanPerformTeleportOperations()) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"当前状态不允许传送操作"); } return; } CloseAllMenusBeforeTeleport(); if (slotId.StartsWith("traditional_")) { string s = slotId.Substring("traditional_".Length); if (int.TryParse(s, out var result)) { LoadFromSlot(result); LogInfo($"从UI传送到传统存档: 存档槽 {result}"); } } else if (extendedSaveSlots.ContainsKey(slotId) && extendedSaveSlots[slotId].hasData) { ExtendedSaveSlot extendedSaveSlot = extendedSaveSlots[slotId]; TeleportToExtendedSlot(extendedSaveSlot); LogInfo("从UI传送到存档: " + extendedSaveSlot.displayName); } else { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)("存档 " + slotId + " 不存在或无数据")); } } } catch (Exception ex) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("UI传送操作失败: " + ex.Message)); } } } private void OnUIDeleteSlot(string slotId) { try { if (slotId.StartsWith("traditional_")) { string s = slotId.Substring("traditional_".Length); if (int.TryParse(s, out var result) && saveSlots.ContainsKey(result)) { saveSlots.Remove(result); SavePersistentData(); uiManager?.RefreshSlotList(); LogInfo($"已删除传统存档: 存档槽 {result}"); return; } } if (extendedSaveSlots.ContainsKey(slotId)) { string displayName = extendedSaveSlots[slotId].displayName; extendedSaveSlots.Remove(slotId); SavePersistentData(); uiManager?.RefreshSlotList(); LogInfo("已删除存档: " + displayName + " (" + slotId + ")"); } else { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)("存档 " + slotId + " 不存在")); } } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("删除存档失败: " + ex.Message)); } } } private void OnUIOverwriteSlot(string slotId) { //IL_0057: 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_0093: 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_00d9: 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) try { if (!CanPerformTeleportOperations()) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"当前状态不允许覆盖操作"); } } else if ((Object)(object)HeroController.instance != (Object)null && (Object)(object)GameManager.instance != (Object)null) { Vector3 position = ((Component)HeroController.instance).transform.position; string sceneName = GameManager.instance.sceneName; if (slotId.StartsWith("traditional_")) { int num = int.Parse(slotId.Replace("traditional_", "")); SaveSlot value = new SaveSlot(position, sceneName); saveSlots[num] = value; SavePersistentData(); LogInfo($"已覆盖传统存档槽 {num}: {sceneName} ({position.x:F1}, {position.y:F1})"); } else { if (!extendedSaveSlots.ContainsKey(slotId)) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)("存档 " + slotId + " 不存在,无法覆盖")); } return; } ExtendedSaveSlot extendedSaveSlot = extendedSaveSlots[slotId]; ExtendedSaveSlot extendedSaveSlot2 = new ExtendedSaveSlot(position, sceneName, null, null, assignNewSerial: false); extendedSaveSlot2.serialNumber = extendedSaveSlot.serialNumber; extendedSaveSlots[slotId] = extendedSaveSlot2; SavePersistentData(); LogInfo($"已覆盖存档: {extendedSaveSlot2.displayName} ({slotId}), 保持序号: {extendedSaveSlot2.serialNumber}, 计数器未增加"); } uiManager?.RefreshSlotList(); } else { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogWarning((object)"无法获取当前位置信息"); } } } catch (Exception ex) { ManualLogSource? logger4 = Logger; if (logger4 != null) { logger4.LogError((object)("覆盖存档失败: " + ex.Message)); } } } private void OnUISaveCurrentPosition() { //IL_0057: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) try { if (!CanPerformTeleportOperations()) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"当前状态不允许保存操作"); } } else if ((Object)(object)HeroController.instance != (Object)null && (Object)(object)GameManager.instance != (Object)null) { Vector3 position = ((Component)HeroController.instance).transform.position; string sceneName = GameManager.instance.sceneName; string key = Guid.NewGuid().ToString(); ExtendedSaveSlot extendedSaveSlot = new ExtendedSaveSlot(position, sceneName); extendedSaveSlots[key] = extendedSaveSlot; SavePersistentData(); PlaySaveSound(); uiManager?.RefreshSlotList(); LogInfo($"UI保存新存档: {extendedSaveSlot.displayName} 在 {sceneName} ({position.x:F1}, {position.y:F1})"); } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("UI保存操作失败: " + ex.Message)); } } } private void OnUIClearAllSlots() { try { ClearAllSaveSlots(); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("UI清空操作失败: " + ex.Message)); } } } private void OnUISafeRespawn() { try { if (!CanPerformTeleportOperations()) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"当前状态不允许安全重生操作"); } } else { CloseAllMenusBeforeTeleport(); RespawnToSafeEntryPoint(); LogInfo("从UI执行安全重生"); } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("UI安全重生操作失败: " + ex.Message)); } } } private void OnUIBenchTeleport() { try { if (!CanPerformTeleportOperations()) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"当前状态不允许椅子传送操作"); } } else { CloseAllMenusBeforeTeleport(); TeleportToBench(); LogInfo("从UI执行椅子传送"); } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("UI椅子传送操作失败: " + ex.Message)); } } } private void OnUIHardcodedTeleport() { try { if (!CanPerformTeleportOperations()) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"当前状态不允许预设传送操作"); } } else { CloseAllMenusBeforeTeleport(); TeleportToHardcodedPosition(); LogInfo("从UI执行预设坐标传送"); } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("UI预设传送操作失败: " + ex.Message)); } } } private void CloseAllMenusBeforeTeleport() { try { uiManager?.SetUIVisible(visible: false); UIManager instance = UIManager.instance; if ((Object)(object)instance != (Object)null && ((object)(UIState)(ref instance.uiState)).Equals((object)(UIState)5)) { instance.SetState((UIState)4); LogInfo("检测到ESC菜单打开,已强制关闭以避免传送冲突"); } LogInfo("已关闭所有界面,准备安全传送"); } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("关闭界面时发生错误: " + ex.Message)); } } } private void TeleportToExtendedSlot(ExtendedSaveSlot slot) { //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_0036: 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) //IL_0079: Unknown result type (might be due to invalid IL or missing references) try { string text = GameManager.instance?.sceneName ?? ""; Vector3 position = slot.position; string scene = slot.scene; LogInfo($"准备传送到扩展存档: {slot.displayName} -> {position} 在场景: {scene}"); if (!string.IsNullOrEmpty(scene) && text != scene) { LogInfo("需要切换场景: " + text + " -> " + scene); ((MonoBehaviour)this).StartCoroutine(TeleportWithSceneChange(scene, position)); } else { LogInfo("在当前场景传送"); PerformTeleport(position); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("传送到扩展存档时发生错误: " + ex.Message)); } } } public static Dictionary<string, ExtendedSaveSlot> GetAllSaveSlots() { Dictionary<string, ExtendedSaveSlot> dictionary = new Dictionary<string, ExtendedSaveSlot>(); try { foreach (KeyValuePair<int, SaveSlot> saveSlot in saveSlots) { if (saveSlot.Value.hasData) { string key = $"traditional_{saveSlot.Key}"; ExtendedSaveSlot extendedSaveSlot = new ExtendedSaveSlot(saveSlot.Value); extendedSaveSlot.displayName = $"快捷存档 {saveSlot.Key} | Hotkey {saveSlot.Key}"; dictionary[key] = extendedSaveSlot; } } foreach (KeyValuePair<string, ExtendedSaveSlot> extendedSaveSlot2 in extendedSaveSlots) { if (extendedSaveSlot2.Value.hasData) { dictionary[extendedSaveSlot2.Key] = extendedSaveSlot2.Value; } } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("获取所有存档数据时发生错误: " + ex.Message)); } } return dictionary; } private void HandleEmergencyRestartInput() { try { if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)290)) { EmergencyReturnToMainMenu(); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("处理紧急重启输入时发生错误 | Error handling emergency restart input: " + ex.Message)); } } } private void EmergencyReturnToMainMenu() { try { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"=== 紧急返回主菜单 | EMERGENCY RETURN TO MAIN MENU ==="); } ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)"正在强制返回主菜单,不保存当前进度!| Force returning to main menu without saving current progress!"); } if ((Object)(object)GameManager.instance == (Object)null) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)"GameManager实例未找到,无法返回主菜单 | GameManager instance not found, cannot return to main menu"); } return; } GameManager.instance.ReturnToMainMenuNoSave(); ManualLogSource? logger4 = Logger; if (logger4 != null) { logger4.LogInfo((object)"已触发返回主菜单 | Return to main menu triggered"); } } catch (Exception ex) { ManualLogSource? logger5 = Logger; if (logger5 != null) { logger5.LogError((object)("紧急返回主菜单时发生错误 | Error during emergency return to main menu: " + ex.Message)); } } } private void TeleportToBench() { //IL_0050: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)HeroController.instance == (Object)null || (Object)(object)GameManager.instance == (Object)null) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"HeroController 或 GameManager 未找到,无法传送到椅子"); } return; } LogInfo("=== 传送到椅子 | TELEPORT TO BENCH ==="); (Vector3, string) benchPositionAndScene = GetBenchPositionAndScene(); if (benchPositionAndScene.Item1 == Vector3.zero || string.IsNullOrEmpty(benchPositionAndScene.Item2)) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)"未找到有效的椅子位置或场景信息 | No valid bench position or scene found"); } return; } Vector3 val = ApplyBenchSafeOffset(benchPositionAndScene.Item1); string sceneName = GameManager.instance.sceneName; LogInfo($"准备传送到椅子: {val} 在场景: {benchPositionAndScene.Item2}"); if (!string.IsNullOrEmpty(benchPositionAndScene.Item2) && sceneName != benchPositionAndScene.Item2) { LogInfo("需要切换场景传送到椅子: " + sceneName + " -> " + benchPositionAndScene.Item2); ((MonoBehaviour)this).StartCoroutine(TeleportWithSceneChange(benchPositionAndScene.Item2, val)); } else { LogInfo("在当前场景传送到椅子"); PerformTeleport(val); } } catch (Exception ex) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("传送到椅子时发生错误 | Error during teleport to bench: " + ex.Message)); } } } private KeyCode ParseKeyCode(string keyString) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) try { return (KeyCode)Enum.Parse(typeof(KeyCode), keyString, ignoreCase: true); } catch { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)("无法解析按键设置: " + keyString + ",使用默认值 | Cannot parse key setting: " + keyString + ", using default")); } return (KeyCode)0; } } private bool IsModifierKeyPressed(string modifierKeyString) { //IL_0003: 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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) KeyCode val = ParseKeyCode(modifierKeyString); if ((int)val == 0) { return false; } return Input.GetKey(val); } private KeyCode GetSlotKey(int slotNumber) { //IL_00c7: 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_00cf: Unknown result type (might be due to invalid IL or missing references) if (1 == 0) { } string text = slotNumber switch { 1 => slot1Key?.Value ?? "Alpha1", 2 => slot2Key?.Value ?? "Alpha2", 3 => slot3Key?.Value ?? "Alpha3", 4 => slot4Key?.Value ?? "Alpha4", 5 => slot5Key?.Value ?? "Alpha5", _ => "None", }; if (1 == 0) { } string keyString = text; return ParseKeyCode(keyString); } private void RespawnToSafeEntryPoint() { //IL_016e: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)HeroController.instance == (Object)null || (Object)(object)GameManager.instance == (Object)null) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"HeroController 或 GameManager 未找到,无法执行安全重生"); } return; } string sceneName = GameManager.instance.sceneName; if (lastUsedScene != sceneName) { currentEntryPointIndex = 0; lastUsedScene = sceneName; LogInfo("检测到新场景,重置入口点索引: " + sceneName); } else { LogInfo($"同一场景,继续轮换: {sceneName},当前索引: {currentEntryPointIndex}"); } LogInfo("正在重新进入当前场景的安全入口点: " + sceneName); string nextSafeEntryPointForCurrentScene = GetNextSafeEntryPointForCurrentScene(); if (string.IsNullOrEmpty(nextSafeEntryPointForCurrentScene)) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)"未找到当前场景的安全入口点,使用椅子位置"); } (Vector3, string) benchPositionAndScene = GetBenchPositionAndScene(); if (benchPositionAndScene.Item1 != Vector3.zero && !string.IsNullOrEmpty(benchPositionAndScene.Item2)) { Vector3 targetPosition = ApplyBenchSafeOffset(benchPositionAndScene.Item1); if (benchPositionAndScene.Item2 == sceneName) { PerformTeleport(targetPosition); } else { ((MonoBehaviour)this).StartCoroutine(TeleportWithSceneChange(benchPositionAndScene.Item2, targetPosition)); } } } else { LogInfo($"使用安全入口点 {currentEntryPointIndex}: {nextSafeEntryPointForCurrentScene}"); ((MonoBehaviour)this).StartCoroutine(TeleportWithSceneChange(sceneName, Vector3.zero, nextSafeEntryPointForCurrentScene)); } } catch (Exception ex) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("执行安全重生时发生错误: " + ex.Message)); } } } private void TeleportToHardcodedPosition() { //IL_005e: 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_00ae: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)HeroController.instance == (Object)null || (Object)(object)GameManager.instance == (Object)null) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"HeroController 或 GameManager 未找到,无法执行硬编码传送"); } return; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(71.42231f, 9.597684f, 0.004f); string text = "Bellway_01"; LogInfo($"执行硬编码传送到: {val} 在场景: {text}"); string sceneName = GameManager.instance.sceneName; if (!string.IsNullOrEmpty(text) && sceneName != text) { LogInfo("需要切换场景进行硬编码传送: " + sceneName + " -> " + text); ((MonoBehaviour)this).StartCoroutine(TeleportWithSceneChange(text, val)); } else { LogInfo("在当前场景执行硬编码传送"); PerformTeleport(val); } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)("执行硬编码传送时发生错误: " + ex.Message)); } } } private Vector3 CheckAndFixPositionInCurrentScene(Vector3 targetPosition, int slotNumber) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0077: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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) try { if ((Object)(object)HeroController.instance == (Object)null) { return targetPosition; } if (IsPositionSafe(targetPosition)) { LogInfo($"档位 {slotNumber} 位置安全: {targetPosition}"); return targetPosition; } ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)$"档位 {slotNumber} 位置不安全,正在查找安全位置: {targetPosition}"); } Vector3 val = FindSafePositionNearby(targetPosition); if (val != Vector3.zero) { string sceneName = GameManager.instance.sceneName; DateTime saveTime = saveSlots[slotNumber].saveTime; saveSlots[slotNumber] = new SaveSlot(val, sceneName, saveTime); LogInfo($"档位 {slotNumber} 已修正为安全位置: {targetPosition} -> {val}"); return val; } ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)$"档位 {slotNumber} 无法找到安全位置,将在传送后尝试修复"); } return targetPosition; } catch (Exception ex) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)("检查位置安全性时发生错误: " + ex.Message)); } return targetPosition; } } private bool IsPositionSafe(Vector3 position) { //IL_003d: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) try { HeroController instance = HeroController.instance; Collider2D val = ((instance != null) ? ((Component)instance).GetComponent<Collider2D>() : null); if ((Object)(object)val == (Object)null) { return true; } int mask = LayerMask.GetMask(new string[1] { "Terrain" }); Vector2 val2 = Vector2.op_Implicit(position); Bounds bounds = val.bounds; Collider2D val3 = Physics2D.OverlapBox(val2, Vector2.op_Implicit(((Bounds)(ref bounds)).size), 0f, mask); bool flag = (Object)(object)val3 == (Object)null; LogInfo(string.Format("位置安全检查: {0} -> {1}", position, flag ? "安全" : "不安全")); return flag; } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("检查位置安全性时发生错误: " + ex.Message)); } return true; } } private string? GetNextSafeEntryPointForCurrentScene() { try { List<string> allSafeEntryPointsForCurrentScene = GetAllSafeEntryPointsForCurrentScene(); if (allSafeEntryPointsForCurrentScene == null || allSafeEntryPointsForCurrentScene.Count == 0) { LogInfo("当前场景没有可用的安全入口点"); return null; } if (currentEntryPointIndex >= allSafeEntryPointsForCurrentScene.Count) { currentEntryPointIndex = 0; } string text = allSafeEntryPointsForCurrentScene[currentEntryPointIndex]; LogInfo($"选择安全入口点 {currentEntryPointIndex + 1}/{allSafeEntryPointsForCurrentScene.Count}: {text}"); currentEntryPointIndex++; return text; } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("获取下一个安全入口点时发生错误: " + ex.Message)); } return null; } } private List<string>? GetAllSafeEntryPointsForCurrentScene() { try { List<TransitionPoint> transitionPoints = TransitionPoint.TransitionPoints; if (transitionPoints == null || transitionPoints.Count == 0) { LogInfo("当前场景没有TransitionPoint"); return null; } List<string> list = new List<string>(); List<TransitionPoint> list2 = transitionPoints.Where((TransitionPoint tp) => (Object)(object)tp != (Object)null && ((Object)tp).name.Contains("door") && !tp.isInactive).ToList(); foreach (TransitionPoint item in list2) { list.Add(((Object)item).name); LogInfo("找到门入口点: " + ((Object)item).name); } List<TransitionPoint> list3 = transitionPoints.Where((TransitionPoint tp) => (Object)(object)tp != (Object)null && !tp.isInactive && !((Object)tp).name.Contains("door") && (((Object)tp).name.Contains("left") || ((Object)tp).name.Contains("right") || ((Object)tp).name.Contains("top") || ((Object)tp).name.Contains("bot"))).ToList(); foreach (TransitionPoint item2 in list3) { list.Add(((Object)item2).name); LogInfo("找到其他入口点: " + ((Object)item2).name); } if (list.Count == 0) { List<TransitionPoint> list4 = transitionPoints.Where((TransitionPoint tp) => (Object)(object)tp != (Object)null && !tp.isInactive).ToList(); foreach (TransitionPoint item3 in list4) { list.Add(((Object)item3).name); LogInfo("找到可用入口点: " + ((Object)item3).name); } } LogInfo($"总共找到 {list.Count} 个安全入口点"); return (list.Count > 0) ? list : null; } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("获取所有安全入口点时发生错误: " + ex.Message)); } return null; } } private string? GetSafeEntryPointForCurrentScene() { try { List<TransitionPoint> transitionPoints = TransitionPoint.TransitionPoints; if (transitionPoints == null || transitionPoints.Count == 0) { LogInfo("当前场景没有TransitionPoint"); return null; } List<TransitionPoint> list = transitionPoints.Where((TransitionPoint tp) => (Object)(object)tp != (Object)null && ((Object)tp).name.Contains("door") && !tp.isInactive).ToList(); if (list.Count > 0) { LogInfo("找到门入口点: " + ((Object)list[0]).name); return ((Object)list[0]).name; } List<TransitionPoint> list2 = transitionPoints.Where((TransitionPoint tp) => (Object)(object)tp != (Object)null && !tp.isInactive && (((Object)tp).name.Contains("left") || ((Object)tp).name.Contains("right") || ((Object)tp).name.Contains("top") || ((Object)tp).name.Contains("bot"))).ToList(); if (list2.Count > 0) { LogInfo("找到其他入口点: " + ((Object)list2[0]).name); return ((Object)list2[0]).name; } TransitionPoint val = ((IEnumerable<TransitionPoint>)transitionPoints).FirstOrDefault((Func<TransitionPoint, bool>)((TransitionPoint tp) => (Object)(object)tp != (Object)null && !tp.isInactive)); if ((Object)(object)val != (Object)null) { LogInfo("使用第一个可用入口点: " + ((Object)val).name); return ((Object)val).name; } return null; } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("获取安全入口点时发生错误: " + ex.Message)); } return null; } } private void SaveToSlot(int slotNumber) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) try { if ((Object)(object)HeroController.instance != (Object)null && (Object)(object)GameManager.instance != (Object)null) { Vector3 position = ((Component)HeroController.instance).transform.position; string sceneName = GameManager.instance.sceneName; saveSlots[slotNumber] = new SaveSlot(position, sceneName); LogInfo($"档位 {slotNumber} 已保存: {position} 在场景: {sceneName}"); PlaySaveSound(); SavePersistentData(); if ((Object)(object)uiManager != (Object)null && uiManager.IsUIVisible) { uiManager.RefreshSlotList(); LogInfo($"UI界面已刷新,显示新保存的档位 {slotNumber}"); } } else { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"HeroController 或 GameManager 未找到,无法保存位置"); } } } catch (Exception ex) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogError((object)$"保存档位 {slotNumber} 时发生错误: {ex.Message}"); } } } private void PlaySaveSound() { try { ConfigEntry<float>? obj = audioVolume; if (obj != null && obj.Value <= 0f) { LogInfo("音效音量设置为0,跳过音效播放"); return; } float time = Time.time; if (time - lastSaveAudioTime < 0.1f) { LogInfo("音频播放在冷却中,跳过此次播放"); return; } lastSaveAudioTime = time; EnsureAudioPlayer(); if ((Object)(object)cachedSaveAudioClip != (Object)null && (Object)(object)audioPlayerSource != (Object)null) { audioPlayerSource.PlayOneShot(cachedSaveAudioClip, audioVolume?.Value ?? 0.5f); LogInfo($"使用缓存音频播放存档音效,音量: {audioVolume?.Value ?? 0.5f}"); } else { LogInfo("音频未预加载完成,跳过播放"); } } catch (Exception ex) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogError((object)("播放存档音效时发生错误: " + ex.Message)); } } } private void EnsureAudioPlayer() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if ((Object)(object)audioPlayerObject == (Object)null || (Object)(object)audioPlayerSource == (Object)null) { audioPlayerObject = new GameObject("TeleportAudioPlayer"); audioPlayerSource = audioPlayerObject.AddComponent<AudioSource>(); audioPlayerSource.volume = audioVolume?.Value ?? 0.5f; audioPlayerSource.spatialBlend = 0f; audioPlayerSource.playOnAwake = false; audioPlayerSource.loop = false; Object.DontDestroyOnLoad((Object)(object)audioPlayerObject); LogInfo("创建并复用音频播放器对象"); } } [IteratorStateMachine(typeof(<PreloadAudioClip>d__96))] private IEnumerator PreloadAudioClip() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PreloadAudioClip>d__96(0) { <>4__this = this }; } private void LoadFromSlot(int slotNumber) { //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_00d3: 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_0073: 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_008c: 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) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)HeroController.instance == (Object)null || (Object)(object)GameManager.instance == (Object)null) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"HeroController 或 GameManager 未找到,无法传送"); } return; } string text; Vector3 val; if (saveSlots.ContainsKey(slotNumber) && saveSlots[slotNumber].hasData) { SaveSlot saveSlot = saveSlots[slotNumber]; val = saveSlot.position; text = saveSlot.scene; LogInfo($"准备传送到档位 {slotNumber}: {val} 在场景: {text}"); } else { LogInfo($"档位 {slotNumber} 没有存档数据,传送到椅子位置"); (val, text) = GetBenchPositionAndScene(); if (val == Vector3.zero || string.IsNullOrEmpty(text)) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)"未找到有效的椅子位置或场景信息"); } return; } val = ApplyBenchSafeOffset(val); LogInfo($"椅子位置已添加安全偏移,准备传送到椅子位置: {val} 在场景: {text}"); } string sceneName = GameManager.instance.sceneName; if (!string.IsNullOrEmpty(text) && sceneName != text) { LogInfo("需要切换场景: " + sceneName + " -> " + text); ((MonoBehaviour)this).StartCoroutine(TeleportWithSceneChange(text, val)); } else { Vector3 targetPosition = CheckAndFixPositionInCurrentScene(val, slotNumber); PerformTeleport(targetPosition); } } catch (Exception ex) { ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogError((object)$"从档位 {slotNumber} 传送时发生错误: {ex.Message}"); } } } private (Vector3 position, string scene) GetBenchPositionAndScene() { //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: 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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) try { if (PlayerData.instance == null) { ManualLogSource? logger = Logger; if (logger != null) { logger.LogWarning((object)"PlayerData 未找到"); } return (Vector3.zero, ""); } string respawnMarkerName = PlayerData.instance.respawnMarkerName; string respawnScene = PlayerData.instance.respawnScene; if (string.IsNullOrEmpty(respawnMarkerName) || string.IsNullOrEmpty(respawnScene)) { ManualLogSource? logger2 = Logger; if (logger2 != null) { logger2.LogWarning((object)"未找到椅子标记名称或场景信息"); } return (Vector3.zero, ""); } LogInfo("查找椅子: " + respawnMarkerName + " 在场景: " + respawnScene); string text = GameManager.instance?.sceneName ?? ""; if (text == respawnScene) { if (RespawnMarker.Markers != null) { RespawnMarker val = ((IEnumerable<RespawnMarker>)RespawnMarker.Markers).FirstOrDefault((Func<RespawnMarker, bool>)((RespawnMarker marker) => (Object)(object)marker != (Object)null && ((Object)((Component)marker).gameObject).name == respawnMarkerName)); if ((Object)(object)val != (Object)null) { LogInfo($"在当前场景找到椅子: {((Object)((Component)val).gameObject).name} 位置: {((Component)val).transform.position}"); return (((Component)val).transform.position, respawnScene); } } ManualLogSource? logger3 = Logger; if (logger3 != null) { logger3.LogWarning((object)("在当前场景中未找到椅子标记: " + respawnMarkerName)); } return (Vector3.zero, ""); } LogInfo("椅子在其他场景: " + respawnScene + ",需要切换场景后获取坐标"); return (Vector3.one, respawnScene); } catch (Exception ex) { ManualLogSource? logger4 = Logger; if (logger4 != null) { logger4.LogError((object)("获取椅子位置时发生错误: " + ex.Message)); } return (Vector3.zero, ""); } } [IteratorStateMachine(typeof(<TeleportWithSceneChange>d__99))] private IEnumerator TeleportWithSceneChange(string targetScene, Vector3 targetPo