Decompiled source of CustomLevelOnlyUp v1.1.6
Unity╜┼▒╛/NanJu.LevelUnityScripts.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NanJu.LevelUnityScripts")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("MyStaff")] [assembly: AssemblyTitle("NanJu.LevelUnityScripts")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class CountdownTimer : MonoBehaviour { [CompilerGenerated] private sealed class <CountdownRoutine>d__15 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CountdownTimer <>4__this; private float <nextRefreshTime>5__1; private float <displaySeconds>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CountdownRoutine>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <nextRefreshTime>5__1 = 0f; break; case 1: <>1__state = -1; <>4__this.remainingTime -= 1f; <>4__this.每秒更新事件?.Invoke(<>4__this.remainingTime); break; } if (<>4__this.remainingTime > 0f) { <displaySeconds>5__2 = Mathf.Ceil(<>4__this.remainingTime); if (Time.time >= <nextRefreshTime>5__1) { GUIManager.instance.SetHeroTitle(<>4__this.标题文字 + "\n" + <>4__this.FormatTime(<displaySeconds>5__2), (AudioClip)null); <nextRefreshTime>5__1 = Time.time + <>4__this.UI刷新间隔; } else { if ((Object)(object)GUIManager.instance.heroText != (Object)null) { ((TMP_Text)GUIManager.instance.heroText).text = <>4__this.标题文字 + "\n" + <>4__this.FormatTime(<displaySeconds>5__2); } if ((Object)(object)GUIManager.instance.heroDayText != (Object)null) { ((TMP_Text)GUIManager.instance.heroDayText).text = ""; } if ((Object)(object)GUIManager.instance.heroTimeOfDayText != (Object)null) { ((TMP_Text)GUIManager.instance.heroTimeOfDayText).text = ""; } } if (<>4__this.显示调试 && <>4__this.remainingTime % 10f < 1f) { Debug.Log((object)("[CountdownTimer] " + ((Object)((Component)<>4__this).gameObject).name + " 剩余: " + <>4__this.FormatTime(<>4__this.remainingTime))); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } <>4__this.isRunning = false; GUIManager.instance.SetHeroTitle(<>4__this.结束文字, (AudioClip)null); UnityEvent 结束事件 = <>4__this.结束事件; if (结束事件 != null) { 结束事件.Invoke(); } if (<>4__this.显示调试) { Debug.Log((object)("[CountdownTimer] " + ((Object)((Component)<>4__this).gameObject).name + " 倒计时结束")); } 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(); } } [Header("倒计时设置")] [Tooltip("倒计时总时长(秒)")] public float 总时间 = 300f; [Tooltip("初始显示的文字(会在前面显示)")] public string 标题文字 = "倒计时"; [Tooltip("倒计时结束时显示的文字")] public string 结束文字 = "时间到"; [Header("UI刷新")] [Tooltip("每隔多少秒重新调用SetHeroTitle刷新UI(防止动画淡出后文字消失)")] public float UI刷新间隔 = 4f; [Header("事件")] [Tooltip("倒计时开始时触发")] public UnityEvent 开始事件; [Tooltip("倒计时结束时触发")] public UnityEvent 结束事件; [Tooltip("每秒更新时触发,传递剩余秒数")] public UnityEvent<float> 每秒更新事件; [Header("调试")] public bool 显示调试 = false; private float remainingTime; private bool isRunning = false; private Coroutine countdownCoroutine; private void OnDestroy() { Stop(); } public void 开始倒计时() { if (isRunning) { return; } if ((Object)(object)GUIManager.instance == (Object)null) { Debug.LogWarning((object)("[CountdownTimer] " + ((Object)((Component)this).gameObject).name + " GUIManager不可用")); return; } isRunning = true; remainingTime = 总时间; UnityEvent obj = 开始事件; if (obj != null) { obj.Invoke(); } if (显示调试) { Debug.Log((object)("[CountdownTimer] " + ((Object)((Component)this).gameObject).name + " 倒计时开始: " + FormatTime(remainingTime))); } countdownCoroutine = ((MonoBehaviour)this).StartCoroutine(CountdownRoutine()); } public void 停止倒计时() { if (isRunning) { Stop(); } } private void Stop() { if (countdownCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(countdownCoroutine); countdownCoroutine = null; } isRunning = false; } [IteratorStateMachine(typeof(<CountdownRoutine>d__15))] private IEnumerator CountdownRoutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <CountdownRoutine>d__15(0) { <>4__this = this }; } private string FormatTime(float seconds) { int num = Mathf.Max(0, Mathf.FloorToInt(seconds)); int num2 = num / 60; int num3 = num % 60; return $"{num2:D2}:{num3:D2}"; } } public class FallingPlatform : MonoBehaviour { private enum State { Idle, Counting, Falling, Restoring } [Header("平台设置")] public Rigidbody 刚体; public Collider 感应碰撞体; public LayerMask 检测图层 = LayerMask.op_Implicit(-1); [Header("掉落设置")] public float 掉落延迟 = 1.5f; public bool 只触发一次 = true; [Header("复原设置")] public float 复原延迟 = 3f; [Header("事件")] public UnityEvent 掉落事件; public UnityEvent 复原事件; [Header("调试")] public bool 显示调试 = false; private Vector3 originalPosition; private Quaternion originalRotation; private State state = State.Idle; private float timer = 0f; private bool used = false; private void Awake() { if ((Object)(object)刚体 == (Object)null) { 刚体 = ((Component)this).GetComponent<Rigidbody>(); } if ((Object)(object)感应碰撞体 == (Object)null) { 感应碰撞体 = ((Component)this).GetComponent<Collider>(); } if ((Object)(object)刚体 == (Object)null) { 刚体 = ((Component)this).gameObject.AddComponent<Rigidbody>(); } 刚体.isKinematic = true; 刚体.useGravity = false; } private void Start() { //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_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) originalPosition = ((Component)this).transform.position; originalRotation = ((Component)this).transform.rotation; } private void Update() { if (state == State.Idle) { if (只触发一次 && used) { return; } DetectPlayer(); } if (state == State.Counting) { timer += Time.deltaTime; if (timer >= 掉落延迟) { DoFall(); } } if (state == State.Falling) { timer += Time.deltaTime; if (复原延迟 > 0f && timer >= 复原延迟) { DoRestore(); } } } private void DetectPlayer() { //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_003b: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0061: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00c4: 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_00ec: 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_0104: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) Collider detectCollider = GetDetectCollider(); if ((Object)(object)detectCollider == (Object)null) { return; } BoxCollider val = (BoxCollider)(object)((detectCollider is BoxCollider) ? detectCollider : null); Collider[] array; if (val != null) { Vector3 val2 = ((Component)val).transform.TransformPoint(val.center); Vector3 val3 = Vector3.Scale(val.size * 0.5f, ((Component)val).transform.lossyScale); array = Physics.OverlapBox(val2, val3, ((Component)val).transform.rotation, LayerMask.op_Implicit(检测图层)); } else { SphereCollider val4 = (SphereCollider)(object)((detectCollider is SphereCollider) ? detectCollider : null); if (val4 != null) { Vector3 val5 = ((Component)val4).transform.TransformPoint(val4.center); float num = val4.radius * Mathf.Max(new float[3] { ((Component)val4).transform.lossyScale.x, ((Component)val4).transform.lossyScale.y, ((Component)val4).transform.lossyScale.z }); array = Physics.OverlapSphere(val5, num, LayerMask.op_Implicit(检测图层)); } else { CapsuleCollider val6 = (CapsuleCollider)(object)((detectCollider is CapsuleCollider) ? detectCollider : null); if (val6 != null) { GetCapsulePoints(val6, out var p, out var p2, out var radius); array = Physics.OverlapCapsule(p, p2, radius, LayerMask.op_Implicit(检测图层)); } else { array = Physics.OverlapSphere(((Component)detectCollider).transform.position, 1f, LayerMask.op_Implicit(检测图层)); } } } Collider[] array2 = array; foreach (Collider other in array2) { if (IsValidTarget(other)) { state = State.Counting; timer = 0f; used = true; if (显示调试) { Debug.Log((object)("[FallingPlatform] " + ((Object)((Component)this).gameObject).name + " 感应到物体,开始计时")); } break; } } } private void DoFall() { state = State.Falling; timer = 0f; 刚体.isKinematic = false; 刚体.useGravity = true; UnityEvent obj = 掉落事件; if (obj != null) { obj.Invoke(); } if (显示调试) { Debug.Log((object)("[FallingPlatform] " + ((Object)((Component)this).gameObject).name + " 开始掉落")); } if (复原延迟 <= 0f) { DoRestore(); } } private void DoRestore() { //IL_0033: 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_0056: 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) state = State.Idle; timer = 0f; 刚体.isKinematic = true; 刚体.useGravity = false; 刚体.linearVelocity = Vector3.zero; 刚体.angularVelocity = Vector3.zero; ((Component)this).transform.position = originalPosition; ((Component)this).transform.rotation = originalRotation; UnityEvent obj = 复原事件; if (obj != null) { obj.Invoke(); } if (显示调试) { Debug.Log((object)("[FallingPlatform] " + ((Object)((Component)this).gameObject).name + " 已复原")); } } private Collider GetDetectCollider() { return ((Object)(object)感应碰撞体 != (Object)null) ? 感应碰撞体 : ((Component)this).GetComponent<Collider>(); } private bool IsValidTarget(Collider other) { return (((LayerMask)(ref 检测图层)).value & (1 << ((Component)other).gameObject.layer)) != 0; } private void GetCapsulePoints(CapsuleCollider capsule, out Vector3 p1, out Vector3 p2, out float radius) { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_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_008f: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_010d: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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) Transform transform = ((Component)capsule).transform; Vector3 val = transform.TransformPoint(capsule.center); Vector3 lossyScale = transform.lossyScale; float num = capsule.direction; float radius2 = capsule.radius; float height = capsule.height; float num2; Vector3 val2; if (num == 0f) { num2 = Mathf.Max(lossyScale.y, lossyScale.z); val2 = transform.right; } else if (num == 1f) { num2 = Mathf.Max(lossyScale.x, lossyScale.z); val2 = transform.up; } else { num2 = Mathf.Max(lossyScale.x, lossyScale.y); val2 = transform.forward; } radius = radius2 * num2; float num3 = height * 0.5f * ((num == 0f) ? lossyScale.x : ((num == 1f) ? lossyScale.y : lossyScale.z)); num3 = Mathf.Max(num3 - radius, 0f); p1 = val + val2 * num3; p2 = val - val2 * num3; } public void ForceFall() { if (state == State.Idle) { state = State.Counting; timer = 0f; used = true; } } private void OnDrawGizmos() { //IL_0050: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00b9: 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) Collider detectCollider = GetDetectCollider(); if ((Object)(object)detectCollider == (Object)null) { return; } Gizmos.color = ((state == State.Falling) ? new Color(1f, 0f, 0f, 0.3f) : new Color(0f, 1f, 1f, 0.3f)); Gizmos.matrix = ((Component)detectCollider).transform.localToWorldMatrix; BoxCollider val = (BoxCollider)(object)((detectCollider is BoxCollider) ? detectCollider : null); if (val != null) { Gizmos.DrawCube(val.center, val.size); Gizmos.DrawWireCube(val.center, val.size); return; } SphereCollider val2 = (SphereCollider)(object)((detectCollider is SphereCollider) ? detectCollider : null); if (val2 != null) { Gizmos.DrawSphere(val2.center, val2.radius); Gizmos.DrawWireSphere(val2.center, val2.radius); } } } public class InteractArea : MonoBehaviour, IInteractibleConstant, IInteractible { public enum TriggerMode { Interact, Trigger } [Header("模式设置")] [Tooltip("Interact=按E交互触发, Trigger=碰撞体接触即触发")] public TriggerMode 触发模式 = TriggerMode.Interact; [Header("显示设置")] [Tooltip("交互时显示的名称")] public string 显示名称 = "交互区域"; [Tooltip("交互提示文字(Interact模式显示在屏幕上的文字)")] public string 提示文字 = "交互"; [Header("交互设置(Interact模式)")] [Tooltip("按住交互所需时间(秒)")] public float 交互时间 = 2f; [Tooltip("交互完成后是否保持按住状态")] public bool 保持按住 = true; [Header("触发设置(Trigger模式)")] [Tooltip("检测的目标图层(只检测勾选的图层)")] public LayerMask 检测图层 = LayerMask.op_Implicit(-1); [Header("通用设置")] [Tooltip("是否只触发一次")] public bool 只触发一次 = true; [Header("事件")] [Tooltip("交互完成/触发时执行的事件")] public UnityEvent 触发事件; [Tooltip("交互完成/触发后,将触发者的GameObject作为参数传递")] public UnityEvent<GameObject> 触发事件_带参数; [Header("调试")] public bool 显示调试 = false; private bool triggered = false; private Collider detectCollider; public float interactTime => 交互时间; public bool holdOnFinish => 保持按住; private void Awake() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) detectCollider = ((Component)this).GetComponent<Collider>(); if ((Object)(object)detectCollider == (Object)null) { detectCollider = (Collider)(object)((Component)this).gameObject.AddComponent<BoxCollider>(); ((Collider)(BoxCollider)detectCollider).isTrigger = true; } else { detectCollider.isTrigger = true; } } private void OnTriggerEnter(Collider other) { if (触发模式 == TriggerMode.Trigger && (!只触发一次 || !triggered) && CheckLayer(((Component)other).gameObject)) { triggered = true; FireEvent(((Component)other).gameObject); if (显示调试) { Debug.Log((object)("[InteractArea] " + ((Object)((Component)this).gameObject).name + " Trigger触发,物体: " + ((Object)other).name)); } } } private void OnTriggerStay(Collider other) { if (触发模式 == TriggerMode.Trigger && (!只触发一次 || !triggered) && CheckLayer(((Component)other).gameObject)) { triggered = true; FireEvent(((Component)other).gameObject); if (显示调试) { Debug.Log((object)("[InteractArea] " + ((Object)((Component)this).gameObject).name + " Trigger持续触发: " + ((Object)other).name)); } } } private bool CheckLayer(GameObject obj) { return (((LayerMask)(ref 检测图层)).value & (1 << obj.layer)) != 0; } private void FireEvent(GameObject triggerObject) { UnityEvent obj = 触发事件; if (obj != null) { obj.Invoke(); } 触发事件_带参数?.Invoke(triggerObject); if (显示调试) { Debug.Log((object)("[InteractArea] " + ((Object)((Component)this).gameObject).name + " 触发事件已执行")); } } public void CancelCast(Character interactor) { } public Vector3 Center() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position; } public string GetInteractionText() { if (触发模式 == TriggerMode.Trigger) { return ""; } if (只触发一次 && triggered) { return ""; } return 提示文字; } public float GetInteractTime(Character interactor) { return 交互时间; } public string GetName() { return 显示名称; } public Transform GetTransform() { return ((Component)this).transform; } public void HoverEnter() { } public void HoverExit() { } public void Interact(Character interactor) { } public void Interact_CastFinished(Character interactor) { if (触发模式 == TriggerMode.Interact && (!只触发一次 || !triggered)) { triggered = true; FireEvent(((Object)(object)interactor != (Object)null) ? ((Component)interactor).gameObject : null); if (显示调试) { Debug.Log((object)("[InteractArea] " + ((Object)((Component)this).gameObject).name + " 交互完成")); } } } public bool IsConstantlyInteractable(Character interactor) { return IsInteractible(interactor); } public bool IsInteractible(Character interactor) { if (触发模式 == TriggerMode.Trigger) { return false; } if (只触发一次 && triggered) { return false; } return true; } public void ReleaseInteract(Character interactor) { } public void ResetTrigger() { triggered = false; } } public class LayerEventSystem : MonoBehaviourPunCallbacks { public enum DetectionMode { Trigger, Raycast } [Header("图层检测设置")] [Tooltip("检测的目标图层(只检测勾选的图层)")] public LayerMask 检测图层 = LayerMask.op_Implicit(-1); [Tooltip("检测模式:Trigger=碰撞体体积检测, Raycast=射线检测")] public DetectionMode 检测模式 = DetectionMode.Trigger; [Tooltip("触发碰撞体(Trigger模式,用于定义检测体积的形状和位置,拖入其他物体的Collider也生效)")] public Collider 触发碰撞体; [Header("触发事件")] [Tooltip("物体进入检测区域时触发")] public UnityEvent 进入事件; [Tooltip("物体停留在检测区域时持续触发")] public UnityEvent 停留事件; [Tooltip("物体离开检测区域时触发")] public UnityEvent 离开事件; [Header("网络同步")] [Tooltip("是否启用Photon网络同步")] public bool 启用网络同步 = true; [Tooltip("是否由服务器(MasterClient)控制事件触发")] public bool 服务器控制 = false; [Tooltip("网络事件同步冷却(秒),防止频繁发送")] public float 网络同步冷却 = 0.3f; [Header("高级设置")] [Tooltip("是否只触发一次")] public bool 只触发一次 = false; [Tooltip("触发冷却时间(秒),0表示无冷却")] public float 触发冷却 = 0f; [Tooltip("射线检测起点方向")] public Vector3 射线方向 = Vector3.forward; [Tooltip("射线检测最大距离")] public float 射线距离 = 10f; [Tooltip("检测频率(秒),Trigger和Raycast模式都生效")] public float 检测间隔 = 0.1f; [Header("调试")] public bool 显示调试 = false; private PhotonView photonView; private bool hasTriggered = false; private float lastTriggerTime = -999f; private float lastNetworkSyncTime = -999f; private float lastDetectTime = -999f; private bool isInside = false; private GameObject lastDetectedObject = null; private HashSet<GameObject> previousInsideObjects = new HashSet<GameObject>(); private void Awake() { photonView = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)photonView == (Object)null && 启用网络同步) { Debug.LogWarning((object)("[LayerEventSystem] " + ((Object)((Component)this).gameObject).name + " 缺少PhotonView组件,网络同步将不可用")); } if (检测模式 == DetectionMode.Trigger && (Object)(object)触发碰撞体 == (Object)null) { 触发碰撞体 = ((Component)this).GetComponent<Collider>(); } } private void Update() { if (!(Time.time - lastDetectTime < 检测间隔)) { lastDetectTime = Time.time; if (检测模式 == DetectionMode.Trigger) { UpdateTriggerDetect(); } else if (检测模式 == DetectionMode.Raycast) { UpdateRaycastDetect(); } } } private Collider GetDetectCollider() { if ((Object)(object)触发碰撞体 != (Object)null) { return 触发碰撞体; } return ((Component)this).GetComponent<Collider>(); } private void UpdateTriggerDetect() { //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_0043: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0069: 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_0077: 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_00af: 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_00cc: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) Collider detectCollider = GetDetectCollider(); if ((Object)(object)detectCollider == (Object)null) { return; } HashSet<GameObject> hashSet = new HashSet<GameObject>(); BoxCollider val = (BoxCollider)(object)((detectCollider is BoxCollider) ? detectCollider : null); Collider[] array; if (val != null) { Vector3 val2 = ((Component)val).transform.TransformPoint(val.center); Vector3 val3 = Vector3.Scale(val.size * 0.5f, ((Component)val).transform.lossyScale); array = Physics.OverlapBox(val2, val3, ((Component)val).transform.rotation, LayerMask.op_Implicit(检测图层)); } else { SphereCollider val4 = (SphereCollider)(object)((detectCollider is SphereCollider) ? detectCollider : null); if (val4 != null) { Vector3 val5 = ((Component)val4).transform.TransformPoint(val4.center); float num = val4.radius * Mathf.Max(new float[3] { ((Component)val4).transform.lossyScale.x, ((Component)val4).transform.lossyScale.y, ((Component)val4).transform.lossyScale.z }); array = Physics.OverlapSphere(val5, num, LayerMask.op_Implicit(检测图层)); } else { CapsuleCollider val6 = (CapsuleCollider)(object)((detectCollider is CapsuleCollider) ? detectCollider : null); if (val6 != null) { GetCapsulePoints(val6, out var p, out var p2, out var radius); array = Physics.OverlapCapsule(p, p2, radius, LayerMask.op_Implicit(检测图层)); } else { array = Physics.OverlapSphere(((Component)detectCollider).transform.position, 1f, LayerMask.op_Implicit(检测图层)); } } } Collider[] array2 = array; foreach (Collider val7 in array2) { hashSet.Add(((Component)val7).gameObject); } foreach (GameObject item in hashSet) { if (!previousInsideObjects.Contains(item)) { if (CanProcess()) { isInside = true; lastDetectedObject = item; MarkTriggered(); FireEnterEvent(item); } } else if (!只触发一次 || !hasTriggered) { UnityEvent obj = 停留事件; if (obj != null) { obj.Invoke(); } } } foreach (GameObject previousInsideObject in previousInsideObjects) { if (!hashSet.Contains(previousInsideObject)) { isInside = false; lastDetectedObject = null; UnityEvent obj2 = 离开事件; if (obj2 != null) { obj2.Invoke(); } SyncNetworkEvent("Exit", previousInsideObject); if (显示调试) { Debug.Log((object)("[LayerEventSystem] " + ((Object)((Component)this).gameObject).name + " 物体离开: " + ((Object)previousInsideObject).name)); } } } if (hashSet.Count == 0) { isInside = false; } previousInsideObjects = hashSet; } private void UpdateRaycastDetect() { //IL_000d: 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_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: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.TransformDirection(((Vector3)(ref 射线方向)).normalized); RaycastHit val2 = default(RaycastHit); bool flag = Physics.Raycast(((Component)this).transform.position, val, ref val2, 射线距离, LayerMask.op_Implicit(检测图层)); if (flag && !isInside) { if (CanProcess()) { isInside = true; lastDetectedObject = ((Component)((RaycastHit)(ref val2)).collider).gameObject; MarkTriggered(); FireEnterEvent(((Component)((RaycastHit)(ref val2)).collider).gameObject); } } else if (flag && isInside) { if (!只触发一次 || !hasTriggered) { UnityEvent obj = 停留事件; if (obj != null) { obj.Invoke(); } } } else if (!flag && isInside) { isInside = false; UnityEvent obj2 = 离开事件; if (obj2 != null) { obj2.Invoke(); } SyncNetworkEvent("Exit", null); lastDetectedObject = null; if (显示调试) { Debug.Log((object)("[LayerEventSystem] " + ((Object)((Component)this).gameObject).name + " 射线检测物体离开")); } } } private void GetCapsulePoints(CapsuleCollider capsule, out Vector3 p1, out Vector3 p2, out float radius) { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_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_008f: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_010d: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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) Transform transform = ((Component)capsule).transform; Vector3 val = transform.TransformPoint(capsule.center); Vector3 lossyScale = transform.lossyScale; float num = capsule.direction; float radius2 = capsule.radius; float height = capsule.height; float num2; Vector3 val2; if (num == 0f) { num2 = Mathf.Max(lossyScale.y, lossyScale.z); val2 = transform.right; } else if (num == 1f) { num2 = Mathf.Max(lossyScale.x, lossyScale.z); val2 = transform.up; } else { num2 = Mathf.Max(lossyScale.x, lossyScale.y); val2 = transform.forward; } radius = radius2 * num2; float num3 = height * 0.5f * ((num == 0f) ? lossyScale.x : ((num == 1f) ? lossyScale.y : lossyScale.z)); num3 = Mathf.Max(num3 - radius, 0f); p1 = val + val2 * num3; p2 = val - val2 * num3; } private void FireEnterEvent(GameObject obj) { UnityEvent obj2 = 进入事件; if (obj2 != null) { obj2.Invoke(); } SyncNetworkEvent("Enter", obj); if (显示调试) { Debug.Log((object)("[LayerEventSystem] " + ((Object)((Component)this).gameObject).name + " 检测到图层物体: " + ((Object)obj).name + " (Layer: " + LayerMask.LayerToName(obj.layer) + ")")); } } private bool CanProcess() { if (只触发一次 && hasTriggered) { return false; } if (触发冷却 > 0f && Time.time - lastTriggerTime < 触发冷却) { return false; } return true; } private void MarkTriggered() { hasTriggered = true; lastTriggerTime = Time.time; } private void SyncNetworkEvent(string eventType, GameObject target) { if (!启用网络同步 || !PhotonNetwork.IsConnected || (Object)(object)photonView == (Object)null || (服务器控制 && !PhotonNetwork.IsMasterClient) || Time.time - lastNetworkSyncTime < 网络同步冷却) { return; } lastNetworkSyncTime = Time.time; int num = 0; if ((Object)(object)target != (Object)null) { PhotonView component = target.GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { num = component.ViewID; } } photonView.RPC("RPC_SyncLayerEvent", (RpcTarget)1, new object[2] { eventType, num }); if (显示调试) { Debug.Log((object)("[LayerEventSystem] 发送网络事件: " + eventType)); } } [PunRPC] private void RPC_SyncLayerEvent(string eventType, int targetViewID) { switch (eventType) { case "Enter": { UnityEvent obj2 = 进入事件; if (obj2 != null) { obj2.Invoke(); } break; } case "Stay": { UnityEvent obj3 = 停留事件; if (obj3 != null) { obj3.Invoke(); } break; } case "Exit": { UnityEvent obj = 离开事件; if (obj != null) { obj.Invoke(); } break; } } if (显示调试) { Debug.Log((object)("[LayerEventSystem] 收到网络事件: " + eventType)); } } [PunRPC] public void RPC_SetDetectionLayer(int layerMask) { ((LayerMask)(ref 检测图层)).value = layerMask; } [PunRPC] public void RPC_SetEnabled(bool enabled) { ((Behaviour)this).enabled = enabled; } [PunRPC] public void RPC_ResetTrigger() { hasTriggered = false; lastTriggerTime = -999f; isInside = false; previousInsideObjects.Clear(); } public void ResetTrigger() { if (启用网络同步 && PhotonNetwork.IsConnected && (Object)(object)photonView != (Object)null) { photonView.RPC("RPC_ResetTrigger", (RpcTarget)0, Array.Empty<object>()); return; } hasTriggered = false; lastTriggerTime = -999f; isInside = false; previousInsideObjects.Clear(); } public void SetDetectionLayer(LayerMask newLayer) { //IL_0050: 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 (启用网络同步 && PhotonNetwork.IsConnected && (Object)(object)photonView != (Object)null) { photonView.RPC("RPC_SetDetectionLayer", (RpcTarget)0, new object[1] { ((LayerMask)(ref newLayer)).value }); } else { 检测图层 = newLayer; } } public void SetEnabled(bool enabled) { if (启用网络同步 && PhotonNetwork.IsConnected && (Object)(object)photonView != (Object)null) { photonView.RPC("RPC_SetEnabled", (RpcTarget)0, new object[1] { enabled }); } else { ((Behaviour)this).enabled = enabled; } } public bool IsInside() { return isInside; } public GameObject GetLastDetectedObject() { return lastDetectedObject; } private void OnDrawGizmos() { //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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_0045: 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_0089: 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_008e: 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_009d: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) //IL_0105: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) Collider detectCollider = GetDetectCollider(); if ((Object)(object)detectCollider == (Object)null) { return; } if (检测模式 == DetectionMode.Trigger) { Color color = (isInside ? new Color(0f, 1f, 0f, 0.3f) : new Color(1f, 0.5f, 0f, 0.2f)); Color val = (Color)(isInside ? Color.green : new Color(1f, 0.5f, 0f, 0.6f)); Gizmos.color = color; Gizmos.matrix = ((Component)detectCollider).transform.localToWorldMatrix; BoxCollider val2 = (BoxCollider)(object)((detectCollider is BoxCollider) ? detectCollider : null); if (val2 != null) { Gizmos.DrawCube(val2.center, val2.size); Gizmos.color = val; Gizmos.DrawWireCube(val2.center, val2.size); return; } SphereCollider val3 = (SphereCollider)(object)((detectCollider is SphereCollider) ? detectCollider : null); if (val3 != null) { Gizmos.DrawSphere(val3.center, val3.radius); Gizmos.color = val; Gizmos.DrawWireSphere(val3.center, val3.radius); return; } CapsuleCollider val4 = (CapsuleCollider)(object)((detectCollider is CapsuleCollider) ? detectCollider : null); if (val4 != null) { DrawCapsuleGizmo(val4, val); } } else if (检测模式 == DetectionMode.Raycast) { Vector3 val5 = ((Component)this).transform.TransformDirection(((Vector3)(ref 射线方向)).normalized); Gizmos.color = Color.red; Gizmos.DrawRay(((Component)this).transform.position, val5 * 射线距离); Gizmos.color = new Color(1f, 0f, 0f, 0.3f); Gizmos.DrawSphere(((Component)this).transform.position + val5 * 射线距离, 0.15f); } } private void DrawCapsuleGizmo(CapsuleCollider capsule, Color wireColor) { //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_0024: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) Vector3 center = capsule.center; float radius = capsule.radius; float num = capsule.height * 0.5f - radius; Gizmos.matrix = ((Component)capsule).transform.localToWorldMatrix; Gizmos.color = wireColor; Gizmos.DrawWireSphere(center + Vector3.up * num, radius); Gizmos.DrawWireSphere(center - Vector3.up * num, radius); } } public class MovePlatformTwoPoint : MonoBehaviourPunCallbacks { [Header("移动设置")] [Tooltip("移动速度")] public float 移动速度 = 2f; [Tooltip("移动力度(物理模式下生效)")] public float 移动力度 = 5f; [Tooltip("是否使用物理引擎")] public bool 使用物理 = false; [Header("位置设置")] [Tooltip("起点位置物体(绑定后使用物体位置)")] public Transform 起点物体; [Tooltip("终点位置物体(绑定后使用物体位置)")] public Transform 终点物体; [Tooltip("起点坐标(当起点物体为空时使用)")] public Vector3 起点坐标 = Vector3.zero; [Tooltip("终点坐标(当终点物体为空时使用)")] public Vector3 终点坐标 = new Vector3(0f, 0f, 2f); [Header("网络同步")] [Tooltip("是否启用网络同步")] public bool 启用网络同步 = true; [Tooltip("是否由服务器控制")] public bool 服务器控制 = true; private Rigidbody rb; private bool isMovingToEnd = true; private float moveProgress = 0f; private void Awake() { rb = ((Component)this).GetComponent<Rigidbody>(); if (使用物理 && (Object)(object)rb == (Object)null) { rb = ((Component)this).gameObject.AddComponent<Rigidbody>(); } if ((Object)(object)rb != (Object)null) { rb.useGravity = false; rb.isKinematic = !使用物理; } } private void Start() { //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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)起点物体 != (Object)null) { 起点坐标 = 起点物体.position; } if ((Object)(object)终点物体 != (Object)null) { 终点坐标 = 终点物体.position; } ((Component)this).transform.position = 起点坐标; } private void Update() { if ((!启用网络同步 || !PhotonNetwork.IsConnected || !服务器控制 || PhotonNetwork.IsMasterClient) && !使用物理) { MoveLerp(); } } private void FixedUpdate() { if ((!启用网络同步 || !PhotonNetwork.IsConnected || !服务器控制 || PhotonNetwork.IsMasterClient) && 使用物理 && (Object)(object)rb != (Object)null) { MovePhysics(); } } private void MoveLerp() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_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_002f: 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_007d: 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_0085: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (isMovingToEnd ? 起点坐标 : 终点坐标); Vector3 val2 = (isMovingToEnd ? 终点坐标 : 起点坐标); float num = Vector3.Distance(val, val2); if (num < 0.01f) { isMovingToEnd = !isMovingToEnd; return; } float num2 = 移动速度 / num; moveProgress += Time.deltaTime * num2; ((Component)this).transform.position = Vector3.Lerp(val, val2, moveProgress); if (moveProgress >= 1f) { isMovingToEnd = !isMovingToEnd; moveProgress = 0f; if (启用网络同步 && PhotonNetwork.IsConnected && (Object)(object)((MonoBehaviourPun)this).photonView != (Object)null && ((MonoBehaviourPun)this).photonView.ViewID != 0) { ((MonoBehaviourPun)this).photonView.RPC("RPC_SyncDirection", (RpcTarget)1, new object[1] { isMovingToEnd }); } } } private void MovePhysics() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f9: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_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_008d: 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_0095: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (isMovingToEnd ? 终点坐标 : 起点坐标); Vector3 val2 = val - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Vector3.Distance(((Component)this).transform.position, val); if (num < 0.1f) { isMovingToEnd = !isMovingToEnd; val = (isMovingToEnd ? 终点坐标 : 起点坐标); val2 = val - ((Component)this).transform.position; normalized = ((Vector3)(ref val2)).normalized; if (启用网络同步 && PhotonNetwork.IsConnected && (Object)(object)((MonoBehaviourPun)this).photonView != (Object)null && ((MonoBehaviourPun)this).photonView.ViewID != 0) { ((MonoBehaviourPun)this).photonView.RPC("RPC_SyncDirection", (RpcTarget)1, new object[1] { isMovingToEnd }); } } rb.linearVelocity = normalized * 移动速度; } [PunRPC] private void RPC_SyncDirection(bool movingToEnd) { isMovingToEnd = movingToEnd; moveProgress = 0f; } [PunRPC] private void RPC_SyncPosition(Vector3 position) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = position; } private void OnDrawGizmos() { //IL_001d: 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_0022: 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_0032: 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_0045: 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_005c: 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_0073: 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_007f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (((Object)(object)起点物体 != (Object)null) ? 起点物体.position : 起点坐标); Vector3 val2 = (((Object)(object)终点物体 != (Object)null) ? 终点物体.position : 终点坐标); Gizmos.color = Color.blue; Gizmos.DrawSphere(val, 0.15f); Gizmos.color = Color.red; Gizmos.DrawSphere(val2, 0.15f); Gizmos.color = Color.yellow; Gizmos.DrawLine(val, val2); } } public class RotatingObject_Clean : MonoBehaviour { [Header("旋转设置")] [Tooltip("旋转速度,正数顺时针,负数逆时针")] public Vector3 rotationSpeed = new Vector3(0f, 30f, 0f); [Tooltip("旋转力度/强度,影响旋转的幅度或力量")] public float rotationForce = 1f; [Tooltip("是否启用物理旋转")] public bool usePhysicsRotation = false; [Header("物理设置(仅在使用物理旋转时生效)")] public float physicsTorque = 10f; private Rigidbody rb; private void Start() { if (usePhysicsRotation) { rb = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)rb == (Object)null) { rb = ((Component)this).gameObject.AddComponent<Rigidbody>(); } rb.freezeRotation = false; } } private void Update() { //IL_0016: 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_002b: Unknown result type (might be due to invalid IL or missing references) if (!usePhysicsRotation) { ((Component)this).transform.Rotate(rotationSpeed * rotationForce * Time.deltaTime); } } private void FixedUpdate() { //IL_001e: 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_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_0040: Unknown result type (might be due to invalid IL or missing references) if (usePhysicsRotation && (Object)(object)rb != (Object)null) { Vector3 val = rotationSpeed * rotationForce * physicsTorque; rb.AddTorque(val); } } } public class RotatingObject_Network : MonoBehaviour { [Header("旋转设置")] [Tooltip("旋转速度,正数顺时针,负数逆时针")] public Vector3 rotationSpeed = new Vector3(0f, 30f, 0f); [Tooltip("旋转力度/强度,影响旋转的幅度或力量")] public float rotationForce = 1f; [Tooltip("是否启用物理旋转")] public bool usePhysicsRotation = false; [Header("网络同步设置")] [Tooltip("是否由服务器控制旋转(适用于场景物体)")] public bool serverControlled = true; [Tooltip("同步频率(秒)")] public float syncInterval = 0.1f; private Rigidbody rb; private float lastSyncTime; private PhotonView photonView; private void Awake() { photonView = ((Component)this).GetComponent<PhotonView>(); rb = ((Component)this).GetComponent<Rigidbody>(); if ((Object)(object)photonView == (Object)null) { Debug.LogWarning((object)"RotatingObject_Network: PhotonView component not found! Disabling network features."); } } private void Start() { if (!usePhysicsRotation && (Object)(object)rb != (Object)null) { rb.isKinematic = true; } } private void Update() { //IL_0046: 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: Unknown result type (might be due to invalid IL or missing references) bool flag = true; if (PhotonNetwork.IsConnected && serverControlled && !PhotonNetwork.IsMasterClient) { flag = false; } if (flag) { if (!usePhysicsRotation) { ((Component)this).transform.Rotate(rotationSpeed * rotationForce * Time.deltaTime); } if (PhotonNetwork.IsConnected && (Object)(object)photonView != (Object)null) { SyncRotation(); } } } private void FixedUpdate() { //IL_004f: 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_0064: Unknown result type (might be due to invalid IL or missing references) bool flag = true; if (PhotonNetwork.IsConnected && serverControlled && !PhotonNetwork.IsMasterClient) { flag = false; } if (flag && usePhysicsRotation && (Object)(object)rb != (Object)null) { rb.AddTorque(rotationSpeed * rotationForce * Time.fixedDeltaTime); } } private void SyncRotation() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)photonView == (Object)null) && (!serverControlled || PhotonNetwork.IsMasterClient) && !((Object)(object)photonView == (Object)null) && photonView.ViewID != 0 && Time.time - lastSyncTime >= syncInterval) { lastSyncTime = Time.time; photonView.RPC("RPC_SyncRotation", (RpcTarget)1, new object[1] { ((Component)this).transform.eulerAngles }); } } [PunRPC] public void RPC_SyncRotation(Vector3 rotation) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (serverControlled || !photonView.IsMine) { ((Component)this).transform.eulerAngles = rotation; } } [PunRPC] public void RPC_SetRotationSpeed(Vector3 speed) { //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) rotationSpeed = speed; } [PunRPC] public void RPC_SetRotationForce(float force) { rotationForce = force; } public void SetRotationSpeed(Vector3 speed) { //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_0030: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsConnected && (Object)(object)photonView != (Object)null) { photonView.RPC("RPC_SetRotationSpeed", (RpcTarget)0, new object[1] { speed }); } else { rotationSpeed = speed; } } public void SetRotationForce(float force) { if (PhotonNetwork.IsConnected && (Object)(object)photonView != (Object)null) { photonView.RPC("RPC_SetRotationForce", (RpcTarget)0, new object[1] { force }); } else { rotationForce = force; } } } public class Spawner : MonoBehaviour { [Header("生成设置")] public GameObject 预制体; [Tooltip("生成位置(为空则用自身位置)")] public Transform 生成位置; [Tooltip("生成后是否为Kinematic刚体")] public bool 固定刚体 = false; [Header("事件")] [Tooltip("物体生成后触发")] public UnityEvent 生成事件; [Tooltip("生成时传递生成的GameObject")] public UnityEvent<GameObject> 生成事件_带参数; [Header("防重复设置")] [Tooltip("两次生成之间的最短间隔(秒),防止一帧内多次调用导致生成多个")] public float 生成间隔 = 1f; [Header("调试")] public bool 显示调试 = false; private float lastSpawnTime = -999f; public void Spawn() { //IL_0082: 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_0087: 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_009c: 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_00d8: 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_00c6: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)预制体 == (Object)null) { Debug.LogWarning((object)("[Spawner] " + ((Object)((Component)this).gameObject).name + " 预制体为空")); } else { if (Time.time - lastSpawnTime < 生成间隔) { return; } lastSpawnTime = Time.time; Vector3 val = (((Object)(object)生成位置 != (Object)null) ? 生成位置.position : ((Component)this).transform.position); Quaternion val2 = (((Object)(object)生成位置 != (Object)null) ? 生成位置.rotation : ((Component)this).transform.rotation); GameObject val3 = ((!PhotonNetwork.IsConnected) ? Object.Instantiate<GameObject>(预制体, val, val2) : PhotonNetwork.InstantiateItemRoom(((Object)预制体).name, val, val2)); if ((Object)(object)val3 == (Object)null) { Debug.LogError((object)("[Spawner] " + ((Object)((Component)this).gameObject).name + " 生成失败")); return; } if (固定刚体) { PhotonView component = val3.GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && PhotonNetwork.IsConnected) { component.RPC("SetKinematicRPC", (RpcTarget)3, new object[3] { true, val, val2 }); } else { Rigidbody component2 = val3.GetComponent<Rigidbody>(); if ((Object)(object)component2 != (Object)null) { component2.isKinematic = true; } } } UnityEvent obj = 生成事件; if (obj != null) { obj.Invoke(); } 生成事件_带参数?.Invoke(val3); if (显示调试) { Debug.Log((object)("[Spawner] " + ((Object)((Component)this).gameObject).name + " 已生成: " + ((Object)val3).name)); } } } private void OnDrawGizmos() { //IL_0033: 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_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) //IL_0044: 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_0051: 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_005c: 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 ((Object)(object)预制体 != (Object)null) { Vector3 val = (((Object)(object)生成位置 != (Object)null) ? 生成位置.position : ((Component)this).transform.position); Gizmos.color = Color.blue; Gizmos.DrawWireSphere(val, 0.25f); Gizmos.DrawLine(val, val + Vector3.up * 1f); } } } public class TriggerMover : MonoBehaviourPunCallbacks { [Header("感应设置")] [Tooltip("感应碰撞体(必须设置)")] public Collider 感应碰撞体; [Tooltip("是否只感应玩家(否则感应所有带刚体的物体)")] public bool 只感应玩家 = true; [Tooltip("目标移动物体")] public Transform 目标物体; [Tooltip("绑定目标位置物体(为空则使用下方坐标)")] public Transform 目标位置物体; [Tooltip("目标位置坐标(当目标位置物体为空时使用)")] public Vector3 目标位置 = Vector3.zero; [Header("移动设置")] [Tooltip("移动速度")] public float 移动速度 = 2f; [Tooltip("移动距离(仅方向模式)")] public float 移动距离 = 2f; [Tooltip("移动方向(仅方向模式)")] public Vector3 移动方向 = Vector3.forward; [Header("模式设置")] [Tooltip("移动模式:0=方向模式,1=目标位置模式")] public int 移动模式 = 0; [Tooltip("移动类型:0=单次移动,1=来回移动")] public int 移动类型 = 0; [Header("网络同步")] [Tooltip("是否启用网络同步")] public bool 启用网络同步 = true; [Tooltip("是否由服务器控制")] public bool 服务器控制 = true; private Vector3 originalPosition; private bool isMoving = false; private bool isReturning = false; private float moveProgress = 0f; private void Awake() { if ((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null) { Debug.LogWarning((object)"TriggerMover: PhotonView component not found!"); } if ((Object)(object)感应碰撞体 == (Object)null) { 感应碰撞体 = ((Component)this).GetComponent<Collider>(); if ((Object)(object)感应碰撞体 == (Object)null) { Debug.LogError((object)"TriggerMover: 未设置感应碰撞体!"); } } if ((Object)(object)感应碰撞体 != (Object)null) { 感应碰撞体.isTrigger = true; } } private void Start() { //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) if ((Object)(object)目标物体 != (Object)null) { originalPosition = 目标物体.position; } } private void Update() { if ((!启用网络同步 || !PhotonNetwork.IsConnected || !服务器控制 || PhotonNetwork.IsMasterClient) && isMoving && (Object)(object)目标物体 != (Object)null) { MoveObject(); } } private void OnTriggerEnter(Collider other) { if (!CanTrigger()) { return; } bool flag = false; if (只感应玩家) { if (((Component)other).CompareTag("Player")) { flag = true; } } else { Rigidbody component = ((Component)other).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { flag = true; } } if (flag && !isMoving) { StartMovement(); } } private bool CanTrigger() { if (启用网络同步 && PhotonNetwork.IsConnected && 服务器控制 && !PhotonNetwork.IsMasterClient) { return false; } return true; } private void StartMovement() { isMoving = true; isReturning = false; moveProgress = 0f; if (启用网络同步 && PhotonNetwork.IsConnected && (Object)(object)((MonoBehaviourPun)this).photonView != (Object)null) { ((MonoBehaviourPun)this).photonView.RPC("RPC_StartMovement", (RpcTarget)1, Array.Empty<object>()); } } [PunRPC] private void RPC_StartMovement() { isMoving = true; isReturning = false; moveProgress = 0f; } private void MoveObject() { //IL_0022: 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_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_0047: 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_004f: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_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_003f: Unknown result type (might be due to invalid IL or missing references) moveProgress += Time.deltaTime * 移动速度 / 移动距离; Vector3 val = originalPosition; Vector3 val2 = GetTargetPosition(); if (isReturning) { Vector3 val3 = val; val = val2; val2 = val3; } 目标物体.position = Vector3.Lerp(val, val2, moveProgress); if (moveProgress >= 1f) { if (移动类型 == 1) { isReturning = !isReturning; moveProgress = 0f; } else { CheckAndReturn(); } } } private Vector3 GetTargetPosition() { //IL_0018: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_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_004f: 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) if ((Object)(object)目标位置物体 != (Object)null) { return 目标位置物体.position; } if (移动模式 == 0) { return originalPosition + ((Vector3)(ref 移动方向)).normalized * 移动距离; } return 目标位置; } private void CheckAndReturn() { if (!CheckTriggerHasObject()) { isReturning = true; moveProgress = 0f; } else { isMoving = false; } } private bool CheckTriggerHasObject() { //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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) if ((Object)(object)感应碰撞体 == (Object)null) { return false; } Bounds bounds = 感应碰撞体.bounds; Vector3 center = ((Bounds)(ref bounds)).center; bounds = 感应碰撞体.bounds; Collider[] array = Physics.OverlapBox(center, ((Bounds)(ref bounds)).extents); Collider[] array2 = array; foreach (Collider val in array2) { if ((Object)(object)val == (Object)(object)感应碰撞体) { continue; } if (只感应玩家) { if (((Component)val).CompareTag("Player")) { return true; } } else if ((Object)(object)((Component)val).GetComponent<Rigidbody>() != (Object)null) { return true; } } return false; } [PunRPC] private void RPC_StopMovement() { isMoving = false; isReturning = false; moveProgress = 0f; } [PunRPC] private void RPC_SetTargetPosition(Vector3 pos) { //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) 目标位置 = pos; } private void OnDrawGizmosSelected() { //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_002e: 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_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_005c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)目标物体 != (Object)null) { Gizmos.color = Color.blue; Gizmos.DrawSphere(originalPosition, 0.1f); Gizmos.color = Color.green; Gizmos.DrawSphere(GetTargetPosition(), 0.1f); Gizmos.color = Color.yellow; Gizmos.DrawLine(originalPosition, GetTargetPosition()); } } } [BepInPlugin("NanJu.LevelUnityScripts", "Unity脚本插件", "1.0.0")] public class UnityScriptsPlugin : BaseUnityPlugin { private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Unity脚本插件已加载"); } } public static class PluginInfo { public const string PLUGIN_GUID = "NanJu.LevelUnityScripts"; public const string PLUGIN_NAME = "Unity脚本插件"; public const string PLUGIN_VERSION = "1.0.0"; } namespace MyStaff { public static class MyPluginInfo { public const string PLUGIN_GUID = "NanJu.LevelUnityScripts"; public const string PLUGIN_NAME = "MyStaff"; public const string PLUGIN_VERSION = "0.1.0"; } }
FogRemove╚Ñ╬φ╚τ╣√╙╨┐╔╥╘╔╛│².dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Diagnostics; 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 UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("FogRemover")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Mod for removing fog in PEAK")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d2d866fd73d0e86b799bd7475b8582103b6a59b8")] [assembly: AssemblyProduct("FogRemover")] [assembly: AssemblyTitle("FogRemover")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DisableFogPostMod { [BepInPlugin("com.coddingcat.disablefogpost", "FogRemover", "1.0.0")] public class DisableFogPostPlugin : BaseUnityPlugin { internal static ManualLogSource Log; private ConfigEntry<bool> disablePostFog; private ConfigEntry<bool> disableSphereFog; private void Awake() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"Disable FogPost Plugin loaded"); disablePostFog = ((BaseUnityPlugin)this).Config.Bind<bool>("Fog Options", "DisablePostFog", true, "Disable the 'Post Fog' visual fog."); disableSphereFog = ((BaseUnityPlugin)this).Config.Bind<bool>("Fog Options", "DisableSphereFog", false, "Disable the damaging 'Sphere Fog', the one that rises with progress"); SceneManager.sceneLoaded += OnSceneLoaded; Harmony val = new Harmony("com.chatgpt.disablefogpost"); val.PatchAll(); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { Log.LogInfo((object)("Scene loaded: " + ((Scene)(ref scene)).name)); DisableFogObjects(); } private void DisableFogObjects() { if (disablePostFog.Value) { DisablePostFog(); } if (disableSphereFog.Value) { ((MonoBehaviour)this).StartCoroutine(DisableSphereFogCoroutine()); } } private void DisablePostFog() { GameObject val = GameObject.Find("Post Fog"); if ((Object)(object)val != (Object)null) { val.SetActive(false); Log.LogInfo((object)"bye bye fog!"); } else { Log.LogWarning((object)"No Post Fog Found in this scene lol"); } } private IEnumerator DisableSphereFogCoroutine() { while (true) { GameObject sphereFog = GameObject.Find("Sphere Fog"); GameObject sphereFog2 = GameObject.Find("FogSphereSystem"); if ((Object)(object)sphereFog != (Object)null) { if (sphereFog.activeSelf) { sphereFog.SetActive(false); sphereFog2.SetActive(false); Log.LogInfo((object)"you are not going to hurt no one anymore"); } } else { Log.LogWarning((object)"bye bye"); } yield return (object)new WaitForSeconds(10f); } } } }
NanJu.LevelMOD.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 System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using PEAKLib.Core; using PEAKLib.UI; using PEAKLib.UI.Elements; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using Zorro.Core; using Zorro.Settings; [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("NanJu.LevelMOD")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("MyStaff")] [assembly: AssemblyTitle("NanJu.LevelMOD")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [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; } } } namespace MyStaff { public static class SwitcherConfig { public const string RoomSelectionKey = "MyStaff.Selection"; public const int ModeOff = -1; public const int ModeCustomLevel = 0; public static Vector2 ToggleButtonPosition = new Vector2(545f, 405f); public static Vector2 ToggleButtonSize = new Vector2(120f, 30f); public static Color ColorActive = new Color(0.9804f, 0.8075f, 0.1922f, 1f); public static Color ColorInactive = new Color(0.1922f, 0.2941f, 0.9804f, 1f); } public static class LocalizationHelper { private const int ChineseLanguageIndex = 9; public static bool IsChinese { get { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 try { return (int)LocalizedText.CURRENT_LANGUAGE == 9; } catch { return false; } } } public static string Choose(string english, string chinese) { return IsChinese ? chinese : english; } public static void Install() { SetText("MyStaffToggleOn", "Custom Level", "自定义关卡"); SetText("MyStaffToggleOff", "Default", "原版"); SetText("MyStaffTitle", "Custom Level: Only Up", "自定义关卡_攀爬"); SetText("MyStaffDesc", "Play your custom level. Press F3 to select save points.", "进入关卡可以通过F3选择保存点"); SetText("MyMenuTitle", "Custom Level Menu", "自定义关卡菜单"); SetText("MyMenuLoading", "Loading...", "等待加载..."); SetText("MyMenuClose", "Close", "关闭"); SetText("MyMenuSelectSave", "Select Save Point", "选择保存点"); SetText("MyMenuTeleport", "Teleport to Save Point", "传送到保存点"); SetText("MyMenuAuthor", "Author: NanJu", "作者:楠橘"); SetText("MyMenuAuthorTip", "(Click name if you have questions)", "(如果问题可以点击名字)"); SetText("MyMenuLoadedSave", "{0} save points loaded", "已加载 {0} 个保存点"); SetText("MyMenuNoSaveModeOn", "No Save Point Mode: ON", "无保存点模式:开启"); SetText("MyMenuNoSaveModeOff", "No Save Point Mode: OFF", "无保存点模式:关闭"); SetText("MyMenuTeleportStart", "Teleport to start", "传送到起点"); SetText("MyMenuSavePointDisabled", "Save point selection disabled", "保存点选择已禁用"); SetText("MyMenuNightModeOn", "Night Mode: ON", "黑夜模式:开启"); SetText("MyMenuNightModeOff", "Night Mode: OFF", "黑夜模式:关闭"); } private static void SetText(string key, string english, string chinese) { List<string> list = new List<string>(); for (int i = 0; i < 15; i++) { list.Add(english); } list[9] = chinese; LocalizedText.mainTable[key.ToUpperInvariant()] = list; } } [HarmonyPatch] public static class BoardingPassHandler { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__20_0; internal void <EnsureButtons>b__20_0() { useCustomMode = !useCustomMode; CustomLevelManager.SetEnabled(useCustomMode); if (!useCustomMode) { PublishSelectionToRoom(-1); } if ((Object)(object)GUIManager.instance?.boardingPass != (Object)null) { if (useCustomMode) { GUIManager.instance.boardingPass.ascentIndex = 0; } RefreshUI(GUIManager.instance.boardingPass); } } } private static bool useCustomMode; private static bool uiApplied; private static GameObject? toggleButton; private static TextMeshProUGUI? toggleButtonText; private static bool capturedOriginalState; private static string? originalTitleText; private static Color originalTitleColor; private static string? originalDescText; private static bool originalRewardActive; private static bool originalCustomOptionsActive; private static float originalDescLineSpacing; private static float originalDescParagraphSpacing; private static Vector4 originalDescMargin; private static bool originalDescAutoSizing; private static float originalDescFontSizeMin; private static float originalDescFontSizeMax; [HarmonyPatch(typeof(GUIManager), "Start")] [HarmonyPostfix] private static void GUIManager_Start_Postfix() { if ((Object)(object)GUIManager.instance != (Object)null && (Object)(object)GUIManager.instance.boardingPass != (Object)null) { EnsureButtons(GUIManager.instance.boardingPass); RefreshUI(GUIManager.instance.boardingPass); } } [HarmonyPatch(typeof(BoardingPass), "UpdateAscent")] [HarmonyPostfix] private static void BoardingPass_UpdateAscent_Postfix(BoardingPass __instance) { EnsureButtons(__instance); RefreshUI(__instance); } [HarmonyPatch(typeof(BoardingPass), "StartGame")] [HarmonyPrefix] private static bool BoardingPass_StartGame_Prefix(BoardingPass __instance) { if ((Object)(object)__instance == (Object)null || LoadingScreenHandler.loading) { return true; } if (RunSettings.IsCustomRun || !useCustomMode) { DisableCustomMode(__instance); return true; } RunSettings.IsCustomRun = false; __instance.ascentIndex = 0; PublishSelectionToRoom(0); ApplyCustomMode(__instance); return false; } [HarmonyPatch(typeof(AirportCheckInKiosk), "BeginIslandLoadRPC")] [HarmonyPrefix] private static void AirportCheckInKiosk_BeginIslandLoadRPC_Prefix() { ApplyRoomSelection("BeginIslandLoadRPC"); } private static void EnsureButtons(BoardingPass pass) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown if ((Object)(object)pass == (Object)null || (Object)(object)toggleButton != (Object)null) { return; } Transform val = ((Component)pass).transform.Find("BoardingPass/Panel"); if ((Object)(object)val == (Object)null) { val = ((Component)pass).transform.Find("Panel"); } if ((Object)(object)val == (Object)null || (Object)(object)pass.incrementAscentButton == (Object)null) { return; } GameObject gameObject = ((Component)pass.incrementAscentButton).gameObject; Transform parent = val; Vector2 toggleButtonPosition = SwitcherConfig.ToggleButtonPosition; Vector2 toggleButtonSize = SwitcherConfig.ToggleButtonSize; object obj = <>c.<>9__20_0; if (obj == null) { UnityAction val2 = delegate { useCustomMode = !useCustomMode; CustomLevelManager.SetEnabled(useCustomMode); if (!useCustomMode) { PublishSelectionToRoom(-1); } if ((Object)(object)GUIManager.instance?.boardingPass != (Object)null) { if (useCustomMode) { GUIManager.instance.boardingPass.ascentIndex = 0; } RefreshUI(GUIManager.instance.boardingPass); } }; <>c.<>9__20_0 = val2; obj = (object)val2; } toggleButton = CreateButton(pass, gameObject, parent, "MyStaffToggle", toggleButtonPosition, toggleButtonSize, (UnityAction)obj, out toggleButtonText); } private static GameObject CreateButton(BoardingPass pass, GameObject referenceButton, Transform parent, string name, Vector2 position, Vector2 size, UnityAction onClick, out TextMeshProUGUI label) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_008c: 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_00e7: Expected O, but got Unknown //IL_0106: 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_0120: 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_01de: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(referenceButton, parent, false); ((Object)val).name = name; Animator component = val.GetComponent<Animator>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Transform val2 = val.transform.Find("Image"); if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)((Component)val2).gameObject); } RectTransform component2 = val.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.zero; component2.pivot = Vector2.zero; component2.anchoredPosition = position; component2.sizeDelta = size; Button component3 = val.GetComponent<Button>(); ((UnityEventBase)component3.onClick).RemoveAllListeners(); ((UnityEvent)component3.onClick).AddListener(onClick); ((Selectable)component3).interactable = true; label = val.GetComponentInChildren<TextMeshProUGUI>(true); if ((Object)(object)label == (Object)null) { GameObject val3 = new GameObject("Text (TMP)"); val3.transform.SetParent(val.transform, false); RectTransform val4 = val3.AddComponent<RectTransform>(); val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; val4.offsetMin = Vector2.zero; val4.offsetMax = Vector2.zero; label = val3.AddComponent<TextMeshProUGUI>(); } ((TMP_Text)label).alignment = (TextAlignmentOptions)514; if ((Object)(object)pass.ascentTitle != (Object)null && (Object)(object)pass.ascentTitle.font != (Object)null) { ((TMP_Text)label).font = pass.ascentTitle.font; } ((TMP_Text)label).enableAutoSizing = true; ((TMP_Text)label).fontSizeMin = 10f; ((TMP_Text)label).fontSizeMax = 15f; ((TMP_Text)label).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)label).overflowMode = (TextOverflowModes)1; ((TMP_Text)label).margin = new Vector4(8f, 0f, 8f, 0f); ((Graphic)label).raycastTarget = false; val.transform.SetAsLastSibling(); return val; } private static void RefreshUI(BoardingPass pass) { //IL_0054: 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) if (!((Object)(object)toggleButton == (Object)null)) { bool isCustomRun = RunSettings.IsCustomRun; toggleButton.SetActive(!isCustomRun); bool flag = useCustomMode && !isCustomRun; MakeButtonUsable(toggleButton); SetButtonColor(toggleButton, useCustomMode ? SwitcherConfig.ColorActive : SwitcherConfig.ColorInactive); SetButtonText(toggleButtonText, GetToggleButtonText()); if (!flag) { RestoreOriginalUI(pass); } else { ApplyCustomUI(pass); } } } private static void ApplyCustomUI(BoardingPass pass) { if (!((Object)(object)pass == (Object)null)) { if (!uiApplied) { uiApplied = true; CaptureOriginalState(pass); } SetOriginalButtonsVisible(pass, visible: false); pass.ascentTitle.text = LocalizationHelper.Choose("Custom Level: Only Up", "自定义关卡_攀爬"); pass.ascentDesc.text = LocalizationHelper.Choose("Play your custom level. Press F3 to select save points.", "进入关卡可以通过F3选择保存点"); if ((Object)(object)pass.reward != (Object)null) { pass.reward.SetActive(false); } if ((Object)(object)pass.customOptionsButton != (Object)null) { ((Component)pass.customOptionsButton).gameObject.SetActive(false); } ApplyDescriptionLayout(pass); } } private static void RestoreOriginalUI(BoardingPass pass) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pass == (Object)null || !uiApplied) { return; } SetOriginalButtonsVisible(pass, visible: true); if (capturedOriginalState) { if ((Object)(object)pass.ascentTitle != (Object)null) { pass.ascentTitle.text = originalTitleText; ((Graphic)pass.ascentTitle).color = originalTitleColor; } if ((Object)(object)pass.ascentDesc != (Object)null) { pass.ascentDesc.text = originalDescText; pass.ascentDesc.lineSpacing = originalDescLineSpacing; pass.ascentDesc.paragraphSpacing = originalDescParagraphSpacing; pass.ascentDesc.margin = originalDescMargin; pass.ascentDesc.enableAutoSizing = originalDescAutoSizing; pass.ascentDesc.fontSizeMin = originalDescFontSizeMin; pass.ascentDesc.fontSizeMax = originalDescFontSizeMax; } if ((Object)(object)pass.reward != (Object)null) { pass.reward.SetActive(originalRewardActive); } if ((Object)(object)pass.customOptionsButton != (Object)null) { ((Component)pass.customOptionsButton).gameObject.SetActive(originalCustomOptionsActive); } } uiApplied = false; } private static void CaptureOriginalState(BoardingPass pass) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!capturedOriginalState && !((Object)(object)pass == (Object)null)) { capturedOriginalState = true; if ((Object)(object)pass.ascentTitle != (Object)null) { originalTitleText = pass.ascentTitle.text; originalTitleColor = ((Graphic)pass.ascentTitle).color; } if ((Object)(object)pass.ascentDesc != (Object)null) { originalDescText = pass.ascentDesc.text; originalDescLineSpacing = pass.ascentDesc.lineSpacing; originalDescParagraphSpacing = pass.ascentDesc.paragraphSpacing; originalDescMargin = pass.ascentDesc.margin; originalDescAutoSizing = pass.ascentDesc.enableAutoSizing; originalDescFontSizeMin = pass.ascentDesc.fontSizeMin; originalDescFontSizeMax = pass.ascentDesc.fontSizeMax; } if ((Object)(object)pass.reward != (Object)null) { originalRewardActive = pass.reward.activeSelf; } if ((Object)(object)pass.customOptionsButton != (Object)null) { originalCustomOptionsActive = ((Component)pass.customOptionsButton).gameObject.activeSelf; } } } private static void SetOriginalButtonsVisible(BoardingPass pass, bool visible) { if ((Object)(object)pass.incrementAscentButton != (Object)null) { ((Component)pass.incrementAscentButton).gameObject.SetActive(visible); } if ((Object)(object)pass.decrementAscentButton != (Object)null) { ((Component)pass.decrementAscentButton).gameObject.SetActive(visible); } } private static void ApplyDescriptionLayout(BoardingPass pass) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)pass?.ascentDesc == (Object)null)) { pass.ascentDesc.enableAutoSizing = true; pass.ascentDesc.lineSpacing = (LocalizationHelper.IsChinese ? 10f : 1f); pass.ascentDesc.paragraphSpacing = 0f; pass.ascentDesc.fontSizeMin = 22f; pass.ascentDesc.fontSizeMax = 29f; pass.ascentDesc.margin = new Vector4(0f, 4f, 12f, 0f); } } private static string GetToggleButtonText() { return useCustomMode ? LocalizationHelper.Choose("Custom Level", "自定义关卡_攀爬") : LocalizationHelper.Choose("Default", "原版"); } private static void PublishSelectionToRoom(int mode) { //IL_001a: 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_0034: Expected O, but got Unknown try { if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { Hashtable val = new Hashtable { [(object)"MyStaff.Selection"] = mode }; PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } } catch { } } private static void ApplyRoomSelection(string source) { try { if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { Hashtable customProperties = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties; if (customProperties != null && TryGetInt(customProperties, "MyStaff.Selection", out var value)) { useCustomMode = value != -1; CustomLevelManager.SetEnabled(useCustomMode); } } } catch { } } private static bool TryGetInt(Hashtable table, string key, out int value) { value = 0; if (!((Dictionary<object, object>)(object)table).ContainsKey((object)key)) { return false; } object obj = table[(object)key]; if (obj is int num) { value = num; return true; } if (obj is short num2) { value = num2; return true; } if (obj is byte b) { value = b; return true; } return int.TryParse(obj?.ToString(), out value); } private static void ApplyCustomMode(BoardingPass pass) { if ((Object)(object)pass.kiosk != (Object)null) { pass.kiosk.StartGame(0); } } private static void DisableCustomMode(BoardingPass pass) { CustomLevelManager.SetEnabled(enabled: false); PublishSelectionToRoom(-1); } private static void SetButtonColor(GameObject button, Color color) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) Image component = button.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = color; ((Graphic)component).raycastTarget = true; } } private static void MakeButtonUsable(GameObject button) { if ((Object)(object)button == (Object)null) { return; } Button component = button.GetComponent<Button>(); if ((Object)(object)component != (Object)null) { ((Selectable)component).interactable = true; } Image component2 = button.GetComponent<Image>(); if ((Object)(object)component2 != (Object)null) { ((Graphic)component2).raycastTarget = true; if ((Object)(object)component != (Object)null) { ((Selectable)component).targetGraphic = (Graphic)(object)component2; } } button.transform.SetAsLastSibling(); } private static void SetButtonText(TextMeshProUGUI? label, string text) { if ((Object)(object)label != (Object)null) { ((TMP_Text)label).text = text; } } } public class InputHandler : MonoBehaviour { private void Update() { MyModMenuUI.TickUiWarmup(); if (Input.GetKeyDown((KeyCode)284)) { ToggleMenu(); } } private void ToggleMenu() { MyModMenuUI.ToggleMenu(); } } internal static class MyModMenuUI { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<GameObject, bool> <>9__23_0; public static Func<GameObject, bool> <>9__23_1; public static UnityAction <>9__26_0; public static UnityAction <>9__26_1; public static UnityAction <>9__26_2; public static UnityAction <>9__26_3; public static UnityAction <>9__26_4; public static UnityAction <>9__26_5; public static UnityAction <>9__26_6; public static UnityAction <>9__26_7; public static UnityAction <>9__26_8; public static UnityAction <>9__26_9; public static Func<MethodInfo, bool> <>9__31_0; public static Func<MethodInfo, bool> <>9__31_1; internal bool <TryRecoverButtonTemplate>b__23_0(GameObject obj) { return (Object)(object)obj != (Object)null && ((Object)obj).name == "UI_MainMenuButton_LeaveGame (2)"; } internal bool <TryRecoverButtonTemplate>b__23_1(GameObject obj) { return (Object)(object)obj != (Object)null && ((Object)obj).name.StartsWith("UI_MainMenuButton_LeaveGame"); } internal void <BuildUI>b__26_0() { _isOpen = true; RefreshSavePointDisplay(); UpdateUIState(); } internal void <BuildUI>b__26_1() { _isOpen = false; } internal void <BuildUI>b__26_2() { CloseMenu(); } internal void <BuildUI>b__26_3() { PrevSavePoint(); } internal void <BuildUI>b__26_4() { NextSavePoint(); } internal void <BuildUI>b__26_5() { TeleportToSelectedSavePoint(); } internal void <BuildUI>b__26_6() { ToggleNoSavePointMode(); } internal void <BuildUI>b__26_7() { ToggleSavePointSharing(); } internal void <BuildUI>b__26_8() { ToggleNightMode(); } internal void <BuildUI>b__26_9() { OpenBiliBiliLink(); } internal bool <CloseMenu>b__31_0(MethodInfo m) { return m.Name == "Close" && m.GetParameters().Length == 0; } internal bool <CloseMenu>b__31_1(MethodInfo m) { return m.Name == "Close" && m.GetParameters().Length == 1; } } private static bool _uiBuilt; private static PeakCustomPage? _page; private static PeakText? _headerText; private static PeakMenuButton? _closeButton; private static PeakText? _savePointLabel; private static PeakText? _statusLabel; private static PeakMenuButton? _prevButton; private static PeakMenuButton? _nextButton; private static PeakMenuButton? _teleportButton; private static PeakMenuButton? _noSaveModeButton; private static PeakMenuButton? _nightModeButton; private static PeakMenuButton? _savePointSharingButton; private static PeakMenuButton? _authorButton; private static PeakText? _authorTip; private static List<string> _savePointNames = new List<string>(); private static MethodInfo? _menuWindowOpenMethod; private static MethodInfo? _menuWindowCloseMethod; private static float _nextUIWarmupCheckTime; private static bool _isOpen; public static void Initialize() { } public static void TickUiWarmup() { if (!_uiBuilt && !(Time.unscaledTime < _nextUIWarmupCheckTime)) { _nextUIWarmupCheckTime = Time.unscaledTime + 0.1f; if (IsUIReady(out string _)) { BuildUI(); _uiBuilt = true; } } } private static bool IsUIReady(out string reason) { List<string> list = new List<string>(3); InputCellMapper instance = SingletonAsset<InputCellMapper>.Instance; if ((Object)(object)instance == (Object)null) { list.Add("InputCellMapper.Instance == null"); } else if ((Object)(object)instance.FloatSettingCell == (Object)null) { list.Add("InputCellMapper.FloatSettingCell == null"); } if (!HasButtonTemplate() && !TryRecoverButtonTemplate(out string reason2)) { if (string.IsNullOrWhiteSpace(reason2)) { list.Add("Templates.ButtonTemplate == null"); } else { list.Add("Templates.ButtonTemplate == null (" + reason2 + ")"); } } if (list.Count == 0) { reason = string.Empty; return true; } reason = string.Join(", ", list); return false; } private static bool HasButtonTemplate() { try { PropertyInfo property = typeof(Templates).GetProperty("ButtonTemplate", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property == null) { return false; } object value = property.GetValue(null); return value != null; } catch { return false; } } private static bool TryRecoverButtonTemplate(out string reason) { reason = string.Empty; if (HasButtonTemplate()) { return true; } bool result; try { GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>(); if (array == null || array.Length == 0) { reason = "Resources empty"; result = false; } else { GameObject val = ((IEnumerable<GameObject>)array).FirstOrDefault((Func<GameObject, bool>)((GameObject obj) => (Object)(object)obj != (Object)null && ((Object)obj).name == "UI_MainMenuButton_LeaveGame (2)")); if ((Object)(object)val == (Object)null) { val = ((IEnumerable<GameObject>)array).FirstOrDefault((Func<GameObject, bool>)((GameObject obj) => (Object)(object)obj != (Object)null && ((Object)obj).name.StartsWith("UI_MainMenuButton_LeaveGame"))); } if ((Object)(object)val == (Object)null) { reason = "MainMenu button prefab not found"; result = false; } else { GameObject val2 = Object.Instantiate<GameObject>(val); ((Object)val2).name = "PeakUIButton"; RemoveLocalizedTextComponent(val2); Object.DontDestroyOnLoad((Object)(object)val2); if (!TrySetTemplatesProperty("ButtonTemplate", val2, out string reason2)) { reason = reason2; result = false; } else { result = true; } } } } catch (Exception ex) { reason = ex.GetType().Name + ": " + ex.Message; result = false; } return result; } private static bool TrySetTemplatesProperty(string propertyName, object value, out string reason) { reason = string.Empty; PropertyInfo property = typeof(Templates).GetProperty(propertyName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property == null) { reason = "Templates." + propertyName + " property not found"; return false; } MethodInfo setMethod = property.GetSetMethod(nonPublic: true); if (setMethod == null) { reason = "Templates." + propertyName + " setter not accessible"; return false; } setMethod.Invoke(null, new object[1] { value }); return true; } private static void RemoveLocalizedTextComponent(GameObject target) { if ((Object)(object)target == (Object)null) { return; } Component[] componentsInChildren = target.GetComponentsInChildren<Component>(true); foreach (Component val in componentsInChildren) { if ((Object)(object)val != (Object)null && ((object)val).GetType().Name == "LocalizedText") { Object.DestroyImmediate((Object)(object)val); } } } private static void BuildUI() { //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_0058: Expected O, but got Unknown //IL_008d: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0157: 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_0199: 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_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Expected O, but got Unknown //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_070d: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Expected O, but got Unknown //IL_0744: Unknown result type (might be due to invalid IL or missing references) //IL_075b: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_0789: Unknown result type (might be due to invalid IL or missing references) //IL_07a0: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Unknown result type (might be due to invalid IL or missing references) //IL_07fd: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_082b: Unknown result type (might be due to invalid IL or missing references) //IL_0842: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_0902: Unknown result type (might be due to invalid IL or missing references) //IL_08d2: Unknown result type (might be due to invalid IL or missing references) //IL_08d7: Unknown result type (might be due to invalid IL or missing references) //IL_08dd: Expected O, but got Unknown //IL_0939: Unknown result type (might be due to invalid IL or missing references) //IL_0950: Unknown result type (might be due to invalid IL or missing references) //IL_0967: Unknown result type (might be due to invalid IL or missing references) //IL_097e: Unknown result type (might be due to invalid IL or missing references) //IL_0995: Unknown result type (might be due to invalid IL or missing references) //IL_0a09: Unknown result type (might be due to invalid IL or missing references) //IL_09d9: Unknown result type (might be due to invalid IL or missing references) //IL_09de: Unknown result type (might be due to invalid IL or missing references) //IL_09e4: Expected O, but got Unknown //IL_0a40: Unknown result type (might be due to invalid IL or missing references) //IL_0a57: Unknown result type (might be due to invalid IL or missing references) //IL_0a6e: Unknown result type (might be due to invalid IL or missing references) //IL_0a85: Unknown result type (might be due to invalid IL or missing references) //IL_0a9c: Unknown result type (might be due to invalid IL or missing references) //IL_0b28: Unknown result type (might be due to invalid IL or missing references) //IL_0af8: Unknown result type (might be due to invalid IL or missing references) //IL_0afd: Unknown result type (might be due to invalid IL or missing references) //IL_0b03: Expected O, but got Unknown //IL_0b5f: Unknown result type (might be due to invalid IL or missing references) //IL_0b76: Unknown result type (might be due to invalid IL or missing references) //IL_0b8d: Unknown result type (might be due to invalid IL or missing references) //IL_0ba4: Unknown result type (might be due to invalid IL or missing references) //IL_0bbb: Unknown result type (might be due to invalid IL or missing references) //IL_0c74: Unknown result type (might be due to invalid IL or missing references) //IL_0c44: Unknown result type (might be due to invalid IL or missing references) //IL_0c49: Unknown result type (might be due to invalid IL or missing references) //IL_0c4f: Expected O, but got Unknown //IL_0cab: Unknown result type (might be due to invalid IL or missing references) //IL_0cc2: Unknown result type (might be due to invalid IL or missing references) //IL_0cd9: Unknown result type (might be due to invalid IL or missing references) //IL_0cf0: Unknown result type (might be due to invalid IL or missing references) //IL_0d07: Unknown result type (might be due to invalid IL or missing references) //IL_0dc0: Unknown result type (might be due to invalid IL or missing references) //IL_0d90: Unknown result type (might be due to invalid IL or missing references) //IL_0d95: Unknown result type (might be due to invalid IL or missing references) //IL_0d9b: Expected O, but got Unknown //IL_0df7: Unknown result type (might be due to invalid IL or missing references) //IL_0e0e: Unknown result type (might be due to invalid IL or missing references) //IL_0e25: Unknown result type (might be due to invalid IL or missing references) //IL_0e3c: Unknown result type (might be due to invalid IL or missing references) //IL_0e53: Unknown result type (might be due to invalid IL or missing references) //IL_0ef4: Unknown result type (might be due to invalid IL or missing references) //IL_0ec4: Unknown result type (might be due to invalid IL or missing references) //IL_0ec9: Unknown result type (might be due to invalid IL or missing references) //IL_0ecf: Expected O, but got Unknown //IL_0f2b: Unknown result type (might be due to invalid IL or missing references) //IL_0f42: Unknown result type (might be due to invalid IL or missing references) //IL_0f59: Unknown result type (might be due to invalid IL or missing references) //IL_0f70: Unknown result type (might be due to invalid IL or missing references) //IL_0f87: Unknown result type (might be due to invalid IL or missing references) //IL_0fdd: Unknown result type (might be due to invalid IL or missing references) //IL_10d9: Unknown result type (might be due to invalid IL or missing references) //IL_103e: Unknown result type (might be due to invalid IL or missing references) //IL_1055: Unknown result type (might be due to invalid IL or missing references) //IL_106c: Unknown result type (might be due to invalid IL or missing references) //IL_1083: Unknown result type (might be due to invalid IL or missing references) //IL_109a: Unknown result type (might be due to invalid IL or missing references) _page = MenuAPI.CreatePageWithBackground("MyModMenuPage"); _page.OpenOnStart = false; _page.CloseOnUICancel = true; _page.AutoHideOnClose = true; PeakCustomPage? page = _page; object obj = <>c.<>9__26_0; if (obj == null) { UnityAction val = delegate { _isOpen = true; RefreshSavePointDisplay(); UpdateUIState(); }; <>c.<>9__26_0 = val; obj = (object)val; } page.SetOnOpen((UnityAction)obj); PeakCustomPage? page2 = _page; object obj2 = <>c.<>9__26_1; if (obj2 == null) { UnityAction val2 = delegate { _isOpen = false; }; <>c.<>9__26_1 = val2; obj2 = (object)val2; } page2.SetOnClose((UnityAction)obj2); PeakElement val3 = ElementExtensions.SetSize<PeakElement>(ElementExtensions.SetPosition<PeakElement>(ElementExtensions.SetAnchorMax<PeakElement>(ElementExtensions.SetAnchorMin<PeakElement>(ElementExtensions.ParentTo<PeakElement>(new GameObject("Panel").AddComponent<PeakElement>(), (Component)(object)_page), new Vector2(0.5f, 0.5f)), new Vector2(0.5f, 0.5f)), Vector2.zero), new Vector2(500f, 560f)); RectTransform component = ((Component)val3).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(500f, 510f); } Image val4 = ((Component)val3).gameObject.AddComponent<Image>(); ((Graphic)val4).color = new Color(0.05f, 0.04f, 0.03f, 0.9f); Outline val5 = ((Component)val3).gameObject.AddComponent<Outline>(); ((Shadow)val5).effectColor = new Color(1f, 1f, 1f, 0.3f); ((Shadow)val5).effectDistance = new Vector2(2f, -2f); ((Component)val3).transform.SetAsLastSibling(); PeakElement val6 = ElementExtensions.SetSize<PeakElement>(ElementExtensions.SetPosition<PeakElement>(ElementExtensions.SetAnchorMax<PeakElement>(ElementExtensions.SetAnchorMin<PeakElement>(ElementExtensions.ParentTo<PeakElement>(new GameObject("Header").AddComponent<PeakElement>(), (Component)(object)val3), new Vector2(0.5f, 1f)), new Vector2(0.5f, 1f)), new Vector2(0f, -16f)), new Vector2(450f, 34f)); RectTransform component2 = ((Component)val6).GetComponent<RectTransform>(); if ((Object)(object)component2 != (Object)null) { component2.pivot = new Vector2(0.5f, 1f); } _headerText = ElementExtensions.ExpandToParent<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText(LocalizationHelper.Choose("Custom Level Menu", "自定义关卡菜单")).SetFontSize(24f), (Component)(object)val6)); ((TMP_Text)_headerText.TextMesh).alignment = (TextAlignmentOptions)514; ((Graphic)_headerText.TextMesh).color = new Color(0.95f, 0.92f, 0.86f, 1f); _statusLabel = ElementExtensions.ExpandToParent<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText(LocalizationHelper.Choose("Loading...", "等待加载...")).SetFontSize(14f), (Component)(object)val6)); RectTransform component3 = ((Component)_statusLabel).GetComponent<RectTransform>(); if ((Object)(object)component3 != (Object)null) { component3.anchorMin = new Vector2(0.5f, 1f); component3.anchorMax = new Vector2(0.5f, 1f); component3.pivot = new Vector2(0.5f, 1f); component3.anchoredPosition = new Vector2(0f, -45f); component3.sizeDelta = new Vector2(450f, 24f); } ((TMP_Text)_statusLabel.TextMesh).alignment = (TextAlignmentOptions)514; ((Graphic)_statusLabel.TextMesh).color = Color.yellow; _closeButton = ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton(LocalizationHelper.Choose("Close", "关闭")), (Component)(object)val3); PeakMenuButton? closeButton = _closeButton; object obj3 = <>c.<>9__26_2; if (obj3 == null) { UnityAction val7 = delegate { CloseMenu(); }; <>c.<>9__26_2 = val7; obj3 = (object)val7; } closeButton.OnClick((UnityAction)obj3); RemoveLocalizedTextComponent(((Component)_closeButton).gameObject); RectTransform component4 = ((Component)_closeButton).GetComponent<RectTransform>(); _closeButton.SetColor(new Color(0.22f, 0.16f, 0.12f, 0.95f), false); _closeButton.SetBorderColor(new Color(0.62f, 0.54f, 0.44f, 0.55f)); if ((Object)(object)((PeakLocalizableElement)_closeButton).Text != (Object)null) { ((PeakLocalizableElement)_closeButton).Text.fontSize = 16f; ((PeakLocalizableElement)_closeButton).Text.alignment = (TextAlignmentOptions)514; ((PeakLocalizableElement)_closeButton).Text.textWrappingMode = (TextWrappingModes)0; ((PeakLocalizableElement)_closeButton).Text.overflowMode = (TextOverflowModes)1; ((PeakLocalizableElement)_closeButton).Text.margin = Vector4.zero; ((Graphic)((PeakLocalizableElement)_closeButton).Text).color = new Color(0.95f, 0.92f, 0.86f, 1f); ((Graphic)((PeakLocalizableElement)_closeButton).Text).raycastTarget = false; } NormalizeButtonLayout((PeakElement)(object)_closeButton, (Vector2?)new Vector2(82f, 32f)); if ((Object)(object)component4 != (Object)null) { component4.anchorMin = new Vector2(1f, 1f); component4.anchorMax = new Vector2(1f, 1f); component4.pivot = new Vector2(1f, 1f); component4.anchoredPosition = new Vector2(-12f, -10f); component4.sizeDelta = new Vector2(82f, 32f); } PeakElement val8 = ElementExtensions.SetSize<PeakElement>(ElementExtensions.SetPosition<PeakElement>(ElementExtensions.SetAnchorMax<PeakElement>(ElementExtensions.SetAnchorMin<PeakElement>(ElementExtensions.ParentTo<PeakElement>(new GameObject("SavePointContainer").AddComponent<PeakElement>(), (Component)(object)val3), new Vector2(0.5f, 1f)), new Vector2(0.5f, 1f)), new Vector2(0f, -100f)), new Vector2(450f, 80f)); RectTransform component5 = ((Component)val8).GetComponent<RectTransform>(); if ((Object)(object)component5 != (Object)null) { component5.pivot = new Vector2(0.5f, 1f); } Image val9 = ((Component)val8).gameObject.AddComponent<Image>(); ((Graphic)val9).color = new Color(0.11f, 0.09f, 0.07f, 0.95f); Outline val10 = ((Component)val8).gameObject.AddComponent<Outline>(); ((Shadow)val10).effectColor = new Color(1f, 1f, 1f, 0.2f); ((Shadow)val10).effectDistance = new Vector2(1f, -1f); _prevButton = ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton("<"), (Component)(object)val8); PeakMenuButton? prevButton = _prevButton; object obj4 = <>c.<>9__26_3; if (obj4 == null) { UnityAction val11 = delegate { PrevSavePoint(); }; <>c.<>9__26_3 = val11; obj4 = (object)val11; } prevButton.OnClick((UnityAction)obj4); RemoveLocalizedTextComponent(((Component)_prevButton).gameObject); NormalizeButtonLayout((PeakElement)(object)_prevButton, (Vector2?)new Vector2(60f, 60f)); RectTransform component6 = ((Component)_prevButton).GetComponent<RectTransform>(); if ((Object)(object)component6 != (Object)null) { component6.anchorMin = new Vector2(0f, 0.5f); component6.anchorMax = new Vector2(0f, 0.5f); component6.pivot = new Vector2(0f, 0.5f); component6.anchoredPosition = new Vector2(12f, 0f); component6.sizeDelta = new Vector2(60f, 60f); } _savePointLabel = ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText(LocalizationHelper.Choose("Select Save Point", "选择保存点")).SetFontSize(18f), (Component)(object)val8); RectTransform component7 = ((Component)_savePointLabel).GetComponent<RectTransform>(); if ((Object)(object)component7 != (Object)null) { component7.anchorMin = new Vector2(0.5f, 0.5f); component7.anchorMax = new Vector2(0.5f, 0.5f); component7.pivot = new Vector2(0.5f, 0.5f); component7.anchoredPosition = new Vector2(0f, 0f); component7.sizeDelta = new Vector2(300f, 60f); } ((TMP_Text)_savePointLabel.TextMesh).alignment = (TextAlignmentOptions)514; ((Graphic)_savePointLabel.TextMesh).color = new Color(0.95f, 0.92f, 0.86f, 1f); _nextButton = ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton(">"), (Component)(object)val8); PeakMenuButton? nextButton = _nextButton; object obj5 = <>c.<>9__26_4; if (obj5 == null) { UnityAction val12 = delegate { NextSavePoint(); }; <>c.<>9__26_4 = val12; obj5 = (object)val12; } nextButton.OnClick((UnityAction)obj5); RemoveLocalizedTextComponent(((Component)_nextButton).gameObject); NormalizeButtonLayout((PeakElement)(object)_nextButton, (Vector2?)new Vector2(60f, 60f)); RectTransform component8 = ((Component)_nextButton).GetComponent<RectTransform>(); if ((Object)(object)component8 != (Object)null) { component8.anchorMin = new Vector2(1f, 0.5f); component8.anchorMax = new Vector2(1f, 0.5f); component8.pivot = new Vector2(1f, 0.5f); component8.anchoredPosition = new Vector2(-12f, 0f); component8.sizeDelta = new Vector2(60f, 60f); } _teleportButton = ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton(LocalizationHelper.Choose("Teleport to Save Point", "传送到保存点")), (Component)(object)val3); PeakMenuButton? teleportButton = _teleportButton; object obj6 = <>c.<>9__26_5; if (obj6 == null) { UnityAction val13 = delegate { TeleportToSelectedSavePoint(); }; <>c.<>9__26_5 = val13; obj6 = (object)val13; } teleportButton.OnClick((UnityAction)obj6); RemoveLocalizedTextComponent(((Component)_teleportButton).gameObject); NormalizeButtonLayout((PeakElement)(object)_teleportButton, (Vector2?)new Vector2(200f, 50f)); RectTransform component9 = ((Component)_teleportButton).GetComponent<RectTransform>(); if ((Object)(object)component9 != (Object)null) { component9.anchorMin = new Vector2(0.5f, 1f); component9.anchorMax = new Vector2(0.5f, 1f); component9.pivot = new Vector2(0.5f, 1f); component9.anchoredPosition = new Vector2(0f, -220f); component9.sizeDelta = new Vector2(200f, 50f); } _noSaveModeButton = ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton(CustomLevelManager.NoSavePointMode ? LocalizationHelper.Choose("No Save Point Mode: ON", "无保存点模式:开启") : LocalizationHelper.Choose("No Save Point Mode: OFF", "无保存点模式:关闭")), (Component)(object)val3); PeakMenuButton? noSaveModeButton = _noSaveModeButton; object obj7 = <>c.<>9__26_6; if (obj7 == null) { UnityAction val14 = delegate { ToggleNoSavePointMode(); }; <>c.<>9__26_6 = val14; obj7 = (object)val14; } noSaveModeButton.OnClick((UnityAction)obj7); RemoveLocalizedTextComponent(((Component)_noSaveModeButton).gameObject); NormalizeButtonLayout((PeakElement)(object)_noSaveModeButton, (Vector2?)new Vector2(220f, 45f)); RectTransform component10 = ((Component)_noSaveModeButton).GetComponent<RectTransform>(); if ((Object)(object)component10 != (Object)null) { component10.anchorMin = new Vector2(0.5f, 1f); component10.anchorMax = new Vector2(0.5f, 1f); component10.pivot = new Vector2(0.5f, 1f); component10.anchoredPosition = new Vector2(0f, -285f); component10.sizeDelta = new Vector2(220f, 45f); } if ((Object)(object)((PeakLocalizableElement)_noSaveModeButton).Text != (Object)null) { ((PeakLocalizableElement)_noSaveModeButton).Text.fontSize = 16f; } _savePointSharingButton = ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton(CustomLevelManager.SavePointSharing ? LocalizationHelper.Choose("Save Point Sharing: ON", "保存点共享:开启") : LocalizationHelper.Choose("Save Point Sharing: OFF", "保存点共享:关闭")), (Component)(object)val3); PeakMenuButton? savePointSharingButton = _savePointSharingButton; object obj8 = <>c.<>9__26_7; if (obj8 == null) { UnityAction val15 = delegate { ToggleSavePointSharing(); }; <>c.<>9__26_7 = val15; obj8 = (object)val15; } savePointSharingButton.OnClick((UnityAction)obj8); RemoveLocalizedTextComponent(((Component)_savePointSharingButton).gameObject); NormalizeButtonLayout((PeakElement)(object)_savePointSharingButton, (Vector2?)new Vector2(220f, 45f)); RectTransform component11 = ((Component)_savePointSharingButton).GetComponent<RectTransform>(); if ((Object)(object)component11 != (Object)null) { component11.anchorMin = new Vector2(0.5f, 1f); component11.anchorMax = new Vector2(0.5f, 1f); component11.pivot = new Vector2(0.5f, 1f); component11.anchoredPosition = new Vector2(0f, -345f); component11.sizeDelta = new Vector2(220f, 45f); } if ((Object)(object)((PeakLocalizableElement)_savePointSharingButton).Text != (Object)null) { ((PeakLocalizableElement)_savePointSharingButton).Text.fontSize = 16f; } _nightModeButton = ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton(CustomLevelManager.NightMode ? LocalizationHelper.Choose("Night Mode: ON", "黑夜模式:开启") : LocalizationHelper.Choose("Night Mode: OFF", "黑夜模式:关闭")), (Component)(object)val3); PeakMenuButton? nightModeButton = _nightModeButton; object obj9 = <>c.<>9__26_8; if (obj9 == null) { UnityAction val16 = delegate { ToggleNightMode(); }; <>c.<>9__26_8 = val16; obj9 = (object)val16; } nightModeButton.OnClick((UnityAction)obj9); RemoveLocalizedTextComponent(((Component)_nightModeButton).gameObject); NormalizeButtonLayout((PeakElement)(object)_nightModeButton, (Vector2?)new Vector2(220f, 45f)); RectTransform component12 = ((Component)_nightModeButton).GetComponent<RectTransform>(); if ((Object)(object)component12 != (Object)null) { component12.anchorMin = new Vector2(0.5f, 1f); component12.anchorMax = new Vector2(0.5f, 1f); component12.pivot = new Vector2(0.5f, 1f); component12.anchoredPosition = new Vector2(0f, -405f); component12.sizeDelta = new Vector2(220f, 45f); } if ((Object)(object)((PeakLocalizableElement)_nightModeButton).Text != (Object)null) { ((PeakLocalizableElement)_nightModeButton).Text.fontSize = 16f; } _authorButton = ElementExtensions.ParentTo<PeakMenuButton>(MenuAPI.CreateMenuButton(LocalizationHelper.Choose("Author: NanJu", "作者:楠橘")), (Component)(object)val3); PeakMenuButton? authorButton = _authorButton; object obj10 = <>c.<>9__26_9; if (obj10 == null) { UnityAction val17 = delegate { OpenBiliBiliLink(); }; <>c.<>9__26_9 = val17; obj10 = (object)val17; } authorButton.OnClick((UnityAction)obj10); RemoveLocalizedTextComponent(((Component)_authorButton).gameObject); NormalizeButtonLayout((PeakElement)(object)_authorButton, (Vector2?)new Vector2(150f, 45f)); RectTransform component13 = ((Component)_authorButton).GetComponent<RectTransform>(); if ((Object)(object)component13 != (Object)null) { component13.anchorMin = new Vector2(0.5f, 1f); component13.anchorMax = new Vector2(0.5f, 1f); component13.pivot = new Vector2(0.5f, 1f); component13.anchoredPosition = new Vector2(0f, -465f); component13.sizeDelta = new Vector2(150f, 45f); } if ((Object)(object)((PeakLocalizableElement)_authorButton).Text != (Object)null) { ((PeakLocalizableElement)_authorButton).Text.fontSize = 20f; ((Graphic)((PeakLocalizableElement)_authorButton).Text).color = new Color(1f, 0.8f, 0.2f, 1f); } _authorTip = ElementExtensions.ExpandToParent<PeakText>(ElementExtensions.ParentTo<PeakText>(MenuAPI.CreateText(LocalizationHelper.Choose("(Click name if you have questions)", "(如果问题可以点击名字)")).SetFontSize(12f), (Component)(object)val3)); RectTransform component14 = ((Component)_authorTip).GetComponent<RectTransform>(); if ((Object)(object)component14 != (Object)null) { component14.anchorMin = new Vector2(0.5f, 1f); component14.anchorMax = new Vector2(0.5f, 1f); component14.pivot = new Vector2(0.5f, 1f); component14.anchoredPosition = new Vector2(0f, -520f); component14.sizeDelta = new Vector2(300f, 30f); } ((TMP_Text)_authorTip.TextMesh).alignment = (TextAlignmentOptions)514; ((Graphic)_authorTip.TextMesh).color = new Color(0.7f, 0.7f, 0.7f, 1f); ((Component)_page).gameObject.SetActive(false); } private static void NormalizeButtonLayout(PeakElement button, Vector2? size = null) { //IL_0034: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0118: 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_0132: 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_00ae: 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_00c8: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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_019b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)button == (Object)null) { return; } RectTransform component = ((Component)button).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.pivot = new Vector2(0.5f, 0.5f); ((Transform)component).localScale = Vector3.one; if (size.HasValue) { component.sizeDelta = size.Value; } } Button componentInChildren = ((Component)button).GetComponentInChildren<Button>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)((Component)componentInChildren).gameObject != (Object)(object)((Component)button).gameObject) { RectTransform component2 = ((Component)componentInChildren).GetComponent<RectTransform>(); if ((Object)(object)component2 != (Object)null) { component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; ((Transform)component2).localScale = Vector3.one; } } Transform val = ((Component)button).transform.Find("Panel"); if ((Object)(object)val != (Object)null) { RectTransform val2 = (RectTransform)val; val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; } Transform val3 = ((Component)button).transform.Find("Text"); if ((Object)(object)val3 != (Object)null) { RectTransform val4 = (RectTransform)val3; val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; val4.offsetMin = Vector2.zero; val4.offsetMax = Vector2.zero; } } public static void ToggleMenu() { if (CustomLevelManager.IsEnabled && EnsureUIBuilt()) { if (_isOpen) { CloseMenu(); } else { OpenMenu(); } } } private static bool EnsureUIBuilt() { if (_uiBuilt) { if ((Object)(object)_page != (Object)null) { return true; } ResetState("Cached UI page was destroyed."); } if (!IsUIReady(out string _)) { return false; } BuildUI(); _uiBuilt = true; return true; } public static void OpenMenu() { if ((!((Object)(object)_page == (Object)null) || EnsureUIBuilt()) && !((Object)(object)_page == (Object)null)) { if (_menuWindowOpenMethod == null) { _menuWindowOpenMethod = typeof(MenuWindow).GetMethod("Open", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_menuWindowOpenMethod != null) { _menuWindowOpenMethod.Invoke(_page, null); } else { ((Component)_page).gameObject.SetActive(true); } _isOpen = true; UpdateUIState(); RefreshSavePointDisplay(); } } public static void CloseMenu() { if ((Object)(object)_page == (Object)null) { return; } if (_menuWindowCloseMethod == null) { MethodInfo methodInfo = typeof(MenuWindow).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == "Close" && m.GetParameters().Length == 0); if (methodInfo == null) { methodInfo = typeof(MenuWindow).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == "Close" && m.GetParameters().Length == 1); } _menuWindowCloseMethod = methodInfo; } if (_menuWindowCloseMethod != null) { ParameterInfo[] parameters = _menuWindowCloseMethod.GetParameters(); object[] parameters2 = ((parameters.Length != 1) ? Array.Empty<object>() : new object[1] { true }); _menuWindowCloseMethod.Invoke(_page, parameters2); } else { ((Component)_page).gameObject.SetActive(false); } _isOpen = false; } private static void ResetState(string reason) { _page = null; _headerText = null; _closeButton = null; _savePointLabel = null; _statusLabel = null; _prevButton = null; _nextButton = null; _teleportButton = null; _noSaveModeButton = null; _nightModeButton = null; _savePointSharingButton = null; _authorButton = null; _authorTip = null; _uiBuilt = false; _isOpen = false; } public static void RefreshSavePoints(List<string> points) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) _savePointNames = new List<string>(points); CustomLevelManager.SetSavePoints(points.ToArray()); if (_savePointNames.Count > 0 && CustomLevelManager.SavePointIndex >= _savePointNames.Count) { CustomLevelManager.SelectSavePoint(0); } RefreshSavePointDisplay(); UpdateUIState(skipStatusLabel: true); if ((Object)(object)_statusLabel != (Object)null) { string text = string.Format(LocalizationHelper.Choose("{0} save points loaded", "已加载 {0} 个保存点"), points.Count); ((TMP_Text)_statusLabel.TextMesh).SetText(text); ((Graphic)_statusLabel.TextMesh).color = Color.green; } } private static void RefreshSavePointDisplay() { if ((Object)(object)_savePointLabel != (Object)null) { ((TMP_Text)_savePointLabel.TextMesh).SetText(CustomLevelManager.SelectedSavePoint); } } private static void OpenBiliBiliLink() { Application.OpenURL("https://space.bilibili.com/235763982?spm_id_from=333.1007.0.0"); } private static void ToggleNoSavePointMode() { bool noSavePointMode = !CustomLevelManager.NoSavePointMode; CustomLevelManager.SetNoSavePointMode(noSavePointMode); UpdateUIState(); } private static void UpdateUIState(bool skipStatusLabel = false) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) bool noSavePointMode = CustomLevelManager.NoSavePointMode; bool isMasterClient = PhotonNetwork.IsMasterClient; if ((Object)(object)_headerText != (Object)null) { ((TMP_Text)_headerText.TextMesh).SetText(LocalizationHelper.Choose("Custom Level Menu", "自定义关卡菜单")); } if ((Object)(object)_closeButton != (Object)null && (Object)(object)((PeakLocalizableElement)_closeButton).Text != (Object)null) { ((PeakLocalizableElement)_closeButton).Text.SetText(LocalizationHelper.Choose("Close", "关闭")); } if ((Object)(object)_statusLabel != (Object)null && !skipStatusLabel) { ((TMP_Text)_statusLabel.TextMesh).SetText(LocalizationHelper.Choose("Loading...", "等待加载...")); ((Graphic)_statusLabel.TextMesh).color = Color.yellow; } if ((Object)(object)_savePointLabel != (Object)null) { if (noSavePointMode) { ((TMP_Text)_savePointLabel.TextMesh).SetText(LocalizationHelper.Choose("Save point selection disabled", "保存点选择已禁用")); } else { ((TMP_Text)_savePointLabel.TextMesh).SetText(CustomLevelManager.SelectedSavePoint); } } if ((Object)(object)_prevButton != (Object)null) { ((Component)_prevButton).gameObject.SetActive(!noSavePointMode); } if ((Object)(object)_nextButton != (Object)null) { ((Component)_nextButton).gameObject.SetActive(!noSavePointMode); } if ((Object)(object)_teleportButton != (Object)null && (Object)(object)((PeakLocalizableElement)_teleportButton).Text != (Object)null) { if (noSavePointMode) { ((PeakLocalizableElement)_teleportButton).Text.SetText(LocalizationHelper.Choose("Teleport to start", "传送到起点")); } else { ((PeakLocalizableElement)_teleportButton).Text.SetText(LocalizationHelper.Choose("Teleport to Save Point", "传送到保存点")); } } if ((Object)(object)_noSaveModeButton != (Object)null && (Object)(object)((PeakLocalizableElement)_noSaveModeButton).Text != (Object)null) { string text = (noSavePointMode ? LocalizationHelper.Choose("No Save Point Mode: ON", "无保存点模式:开启") : LocalizationHelper.Choose("No Save Point Mode: OFF", "无保存点模式:关闭")); ((PeakLocalizableElement)_noSaveModeButton).Text.SetText(text); } if ((Object)(object)_savePointSharingButton != (Object)null) { ((Component)_savePointSharingButton).gameObject.SetActive(isMasterClient); if ((Object)(object)((PeakLocalizableElement)_savePointSharingButton).Text != (Object)null) { string text2 = (CustomLevelManager.SavePointSharing ? LocalizationHelper.Choose("Save Point Sharing: ON", "保存点共享:开启") : LocalizationHelper.Choose("Save Point Sharing: OFF", "保存点共享:关闭")); ((PeakLocalizableElement)_savePointSharingButton).Text.SetText(text2); } } if ((Object)(object)_nightModeButton != (Object)null) { ((Selectable)_nightModeButton.Button).interactable = isMasterClient; if ((Object)(object)((PeakLocalizableElement)_nightModeButton).Text != (Object)null) { string text3 = (CustomLevelManager.NightMode ? LocalizationHelper.Choose("Night Mode: ON", "黑夜模式:开启") : LocalizationHelper.Choose("Night Mode: OFF", "黑夜模式:关闭")); ((PeakLocalizableElement)_nightModeButton).Text.SetText(text3); } } if ((Object)(object)_authorButton != (Object)null && (Object)(object)((PeakLocalizableElement)_authorButton).Text != (Object)null) { string text4 = LocalizationHelper.Choose("Author: NanJu", "作者:楠橘"); ((PeakLocalizableElement)_authorButton).Text.SetText(text4); } if ((Object)(object)_authorTip != (Object)null) { ((TMP_Text)_authorTip.TextMesh).SetText(LocalizationHelper.Choose("(Click name if you have questions)", "(如果问题可以点击名字)")); } } private static void ToggleNightMode() { bool flag = !CustomLevelManager.NightMode; CustomLevelManager.SetNightMode(flag); if ((Object)(object)NetworkSyncManager.Instance != (Object)null) { NetworkSyncManager.Instance.SyncNightMode(flag); } UpdateUIState(); } private static void ToggleSavePointSharing() { bool flag = !CustomLevelManager.SavePointSharing; CustomLevelManager.SetSavePointSharing(flag); if ((Object)(object)NetworkSyncManager.Instance != (Object)null) { NetworkSyncManager.Instance.SyncSavePointSharing(flag); } UpdateUIState(); } private static void PrevSavePoint() { if (_savePointNames.Count > 0) { int num = CustomLevelManager.SavePointIndex - 1; if (num < 0) { num = _savePointNames.Count - 1; } CustomLevelManager.SelectSavePoint(num); RefreshSavePointDisplay(); } } private static void NextSavePoint() { if (_savePointNames.Count > 0) { int num = CustomLevelManager.SavePointIndex + 1; if (num >= _savePointNames.Count) { num = 0; } CustomLevelManager.SelectSavePoint(num); RefreshSavePointDisplay(); } } private static void TeleportToSelectedSavePoint() { //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_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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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) if ((Object)(object)Character.localCharacter == (Object)null) { return; } Vector3 selectedSavePointPosition; if (CustomLevelManager.NoSavePointMode) { int savePointIndex = CustomLevelManager.SavePointIndex; CustomLevelManager.SelectSavePoint(0); selectedSavePointPosition = Plugin.GetSelectedSavePointPosition(); CustomLevelManager.SelectSavePoint(savePointIndex); string text = ((_savePointNames.Count > 0) ? _savePointNames[0] : "Start"); } else { selectedSavePointPosition = Plugin.GetSelectedSavePointPosition(); string text = CustomLevelManager.SelectedSavePoint; } if (!(selectedSavePointPosition == Vector3.zero)) { selectedSavePointPosition.y += 0.5f; ((MonoBehaviourPun)Character.localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { selectedSavePointPosition, false }); if (!CustomLevelManager.NoSavePointMode) { SaveManager.Instance.SetLastSavePoint(selectedSavePointPosition); } } } public static bool IsMenuOpen() { return _isOpen; } public static bool GetFeatureEnabled() { return CustomLevelManager.IsEnabled; } } public static class CustomLevelManager { private static bool _enabled = false; private static string _selectedSavePoint = "初始保存点"; private static int _savePointIndex = 0; private static string[]? _savePoints; private static bool _noSavePointMode = false; private static bool _nightMode = false; private static bool _savePointSharing = false; private static Vector3 _sharedSavePointPosition = Vector3.zero; public static bool IsEnabled => _enabled; public static string SelectedSavePoint => _selectedSavePoint; public static int SavePointIndex => _savePointIndex; public static string[]? SavePoints => _savePoints; public static bool NoSavePointMode => _noSavePointMode; public static bool NightMode => _nightMode; public static bool SavePointSharing => _savePointSharing; public static Vector3 SharedSavePointPosition => _sharedSavePointPosition; public static void SetEnabled(bool enabled) { _enabled = enabled; } public static void SetSavePoints(string[] points) { _savePoints = points; } public static void SelectSavePoint(int index) { if (_savePoints != null && index >= 0 && index < _savePoints.Length) { _savePointIndex = index; _selectedSavePoint = _savePoints[index]; } } public static void SelectSavePoint(string name) { _selectedSavePoint = name; if (_savePoints == null) { return; } for (int i = 0; i < _savePoints.Length; i++) { if (_savePoints[i] == name) { _savePointIndex = i; break; } } } public static void SetNoSavePointMode(bool enabled) { _noSavePointMode = enabled; } public static void SetNightMode(bool enabled) { _nightMode = enabled; if (_enabled) { NightGlobals.ApplyNightMode(_nightMode); } } public static void SetSavePointSharing(bool enabled) { _savePointSharing = enabled; } public static void SetSharedSavePointPosition(Vector3 position) { //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) _sharedSavePointPosition = position; } } public class EndArea : MonoBehaviourPun, IInteractibleConstant, IInteractible { private bool triggered = false; public float interactTime => 2f; public bool holdOnFinish => true; public void Awake() { if ((Object)(object)((Component)this).GetComponent<Collider>() == (Object)null) { BoxCollider val = ((Component)this).gameObject.AddComponent<BoxCollider>(); ((Collider)val).isTrigger = true; } else { ((Component)this).GetComponent<Collider>().isTrigger = true; } } public void CancelCast(Character interactor) { } public Vector3 Center() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position; } public string GetInteractionText() { if (triggered) { return ""; } return "到达终点"; } public float GetInteractTime(Character interactor) { return interactTime; } public string GetName() { string text = ((Object)((Component)this).gameObject).name; if (text.StartsWith("终点区域_")) { text = text.Substring(5); } return text; } public Transform GetTransform() { return ((Component)this).transform; } public void HoverEnter() { } public void HoverExit() { } public void Interact(Character interactor) { } public void Interact_CastFinished(Character interactor) { if (!triggered) { triggered = true; MoveFinishObject(); if (PhotonNetwork.IsMasterClient) { ((MonoBehaviourPun)interactor).photonView.RPC("RPCEndGame_ForceWin", (RpcTarget)0, Array.Empty<object>()); } } } private void MoveFinishObject() { //IL_002e: 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_006e: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("感谢游玩"); if (!((Object)(object)val == (Object)null)) { val.transform.position = new Vector3(-155.3f, 1359.2f, 2519f); val.transform.eulerAngles = new Vector3(15f, 180f, 0f); val.transform.localScale = new Vector3(129f, 129f, 200f); val.SetActive(true); } } public bool IsConstantlyInteractable(Character interactor) { return IsInteractible(interactor); } public bool IsInteractible(Character interactor) { return !triggered; } public void ReleaseInteract(Character interactor) { } public static void ScanAndAttach(GameObject prefab = null) { if ((Object)(object)prefab != (Object)null) { Transform[] componentsInChildren = prefab.GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { GameObject gameObject = ((Component)val).gameObject; if (((Object)gameObject).name.StartsWith("终点区域_") && (Object)(object)gameObject.GetComponent<EndArea>() == (Object)null) { gameObject.AddComponent<EndArea>(); } } return; } GameObject[] array = Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0); foreach (GameObject val2 in array) { if (((Object)val2).name.StartsWith("终点区域_") && (Object)(object)val2.GetComponent<EndArea>() == (Object)null) { val2.AddComponent<EndArea>(); } } } } public class EndGameZone : MonoBehaviour { private List<int> charactersInTrigger = new List<int>(); private void Awake() { Collider component = ((Component)this).GetComponent<Collider>(); if ((Object)(object)component == (Object)null) { BoxCollider val = ((Component)this).gameObject.AddComponent<BoxCollider>(); ((Collider)val).isTrigger = true; } else { component.isTrigger = true; } } private void MoveFinishObject() { //IL_002e: 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_006e: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("感谢游玩"); if (!((Object)(object)val == (Object)null)) { val.transform.position = new Vector3(-155.3f, 1359.2f, 2519f); val.transform.eulerAngles = new Vector3(15f, 180f, 0f); val.transform.localScale = new Vector3(129f, 129f, 200f); val.SetActive(true); } } private void OnTriggerEnter(Collider other) { Character componentInParent = ((Component)other).GetComponentInParent<Character>(); if ((Object)(object)componentInParent == (Object)null) { return; } int viewID = ((MonoBehaviourPun)componentInParent).photonView.ViewID; if (!charactersInTrigger.Contains(viewID)) { charactersInTrigger.Add(viewID); MoveFinishObject(); if (PhotonNetwork.IsMasterClient) { ((MonoBehaviourPun)componentInParent).photonView.RPC("RPCEndGame_ForceWin", (RpcTarget)0, Array.Empty<object>()); } } } private void OnTriggerExit(Collider other) { Character componentInParent = ((Component)other).GetComponentInParent<Character>(); if (!((Object)(object)componentInParent == (Object)null)) { charactersInTrigger.Remove(((MonoBehaviourPun)componentInParent).photonView.ViewID); } } public static void ScanAndAttach(GameObject prefab = null) { if ((Object)(object)prefab != (Object)null) { Transform[] componentsInChildren = prefab.GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { GameObject gameObject = ((Component)val).gameObject; if (((Object)gameObject).name == "离开游戏" && (Object)(object)gameObject.GetComponent<EndGameZone>() == (Object)null) { gameObject.AddComponent<EndGameZone>(); } } return; } GameObject[] array = Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0); foreach (GameObject val2 in array) { if (((Object)val2).name == "离开游戏" && (Object)(object)val2.GetComponent<EndGameZone>() == (Object)null) { val2.AddComponent<EndGameZone>(); } } } } [HarmonyPatch] public class FlarePatch { private static bool hasTriggeredEndGame; private static void MoveFinishObject() { //IL_002e: 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_006e: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("感谢游玩"); if (!((Object)(object)val == (Object)null)) { val.transform.position = new Vector3(-155.3f, 1359.2f, 2519f); val.transform.eulerAngles = new Vector3(15f, 180f, 0f); val.transform.localScale = new Vector3(129f, 129f, 200f); val.SetActive(true); } } [HarmonyPostfix] [HarmonyPatch(typeof(Flare), "Update")] public static void UpdatePostfix(Flare __instance) { //IL_00d7: 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_00e2: Unknown result type (might be due to invalid IL or missing references) if (!CustomLevelManager.IsEnabled || hasTriggeredEndGame || (Object)(object)__instance == (Object)null || (Object)(object)((ItemComponent)__instance).item == (Object)null) { return; } BoolItemData data = ((ItemComponent)__instance).GetData<BoolItemData>((DataEntryKey)3); if (data == null || !data.Value || !((Object)(object)((ItemComponent)__instance).item.holderCharacter != (Object)null)) { return; } GameObject val = GameObject.Find("离开游戏"); if ((Object)(object)val == (Object)null) { return; } Collider component = val.GetComponent<Collider>(); if ((Object)(object)component == (Object)null) { return; } Collider component2 = ((Component)__instance).GetComponent<Collider>(); if ((Object)(object)component2 == (Object)null) { return; } Bounds bounds = component.bounds; if (((Bounds)(ref bounds)).Intersects(component2.bounds)) { hasTriggeredEndGame = true; MoveFinishObject(); if (PhotonNetwork.IsMasterClient && (Object)(object)((ItemComponent)__instance).item.holderCharacter != (Object)null) { ((MonoBehaviourPun)((ItemComponent)__instance).item.holderCharacter).photonView.RPC("RPCEndGame_ForceWin", (RpcTarget)0, Array.Empty<object>()); } } } } public class AreaTitleDisplay : MonoBehaviour { public static HashSet<AreaTitleDisplay> allAreas = new HashSet<AreaTitleDisplay>(); private HashSet<Character> notifiedPlayers = new HashSet<Character>(); private void OnEnable() { allAreas.Add(this); } private void OnDisable() { allAreas.Remove(this); } private void Awake() { if ((Object)(object)((Component)this).GetComponent<Collider>() == (Object)null) { BoxCollider val = ((Component)this).gameObject.AddComponent<BoxCollider>(); ((Collider)val).isTrigger = true; } else { ((Component)this).GetComponent<Collider>().isTrigger = true; } } private void OnTriggerEnter(Collider other) { Character val = ((Component)other).GetComponent<Character>(); if ((Object)(object)val == (Object)null) { val = ((Component)other).GetComponentInParent<Character>(); } if ((Object)(object)val != (Object)null && val.refs.view.IsMine && !notifiedPlayers.Contains(val)) { notifiedPlayers.Add(val); DisplayAreaTitle(); } } private void DisplayAreaTitle() { string text = ((Object)((Component)this).gameObject).name; if (text.StartsWith("文字_")) { text = text.Substring(3); } else if (text.StartsWith("死亡文字_")) { text = text.Substring(5); } if ((Object)(object)GUIManager.instance != (Object)null) { GUIManager.instance.SetHeroTitle(text, (AudioClip)null); } } public static void ScanAndAttachToPrefab(GameObject prefab) { if ((Object)(object)prefab == (Object)null) { return; } Transform[] componentsInChildren = prefab.GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { GameObject gameObject = ((Component)val).gameObject; if (((Object)gameObject).name.StartsWith("文字_") || ((Object)gameObject).name.StartsWith("死亡文字_")) { EnsureSetup(gameObject); } } } public static void ScanAndAttachToScene() { GameObject[] array = Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0); foreach (GameObject val in array) { if (((Object)val).name.StartsWith("文字_") || ((Object)val).name.StartsWith("死亡文字_")) { EnsureSetup(val); } } } public static void ForceScan() { GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>(); for (int i = 0; i < array.Length; i++) { Object val = (Object)(object)array[i]; GameObject val2 = (GameObject)(object)((val is GameObject) ? val : null); if ((Object)(object)val2 != (Object)null && (((Object)val2).name.StartsWith("文字_") || ((Object)val2).name.StartsWith("死亡文字_"))) { EnsureSetup(val2); } } } private static void EnsureSetup(GameObject obj) { if ((Object)(object)obj.GetComponent<Collider>() == (Object)null) { ((Collider)obj.AddComponent<BoxCollider>()).isTrigger = true; } else { obj.GetComponent<Collider>().isTrigger = true; } if ((Object)(object)obj.GetComponent<AreaTitleDisplay>() == (Object)null) { obj.AddComponent<AreaTitleDisplay>(); } } } [HarmonyPatch] public class CheckEndGamePatch { [HarmonyPrefix] [HarmonyPatch(typeof(Character), "CheckEndGame")] public static bool CheckEndGamePrefix() { if (!CustomLevelManager.IsEnabled) { return true; } return false; } } public class DeathPoint : MonoBehaviour { private void OnTriggerEnter(Collider other) { Character val = ((Component)other).GetComponent<Character>(); if ((Object)(object)val == (Object)null) { val = ((Component)other).GetComponentInParent<Character>(); } if ((Object)(object)val != (Object)null && val.refs.view.IsMine) { if (val.data.dead) { Plugin.SendLog("⚠ 玩家已死亡,跳过死亡区域: " + ((Object)((Component)this).gameObject).name); return; } Plugin.SendLog("✓ 玩家进入死亡区域,触发死亡: " + ((Object)((Component)this).gameObject).name); ((MonoBehaviour)val).Invoke("DieInstantly", 0.02f); } } } [HarmonyPatch] public class DeathRevivePatch { [CompilerGenerated] private sealed class <ReviveCoroutine>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private Vector3 <revivePosition>5__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ReviveCoroutine>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_007d: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00f1: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; _isReviving = true; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)Character.localCharacter != (Object)null && Character.localCharacter.data.dead) { if (CustomLevelManager.NoSavePointMode) { <revivePosition>5__1 = SaveManager.Instance.GetInitialSavePoint(); if (<revivePosition>5__1 == Vector3.zero) { <revivePosition>5__1 = Plugin.GetSelectedSavePointPosition(); } } else if (CustomLevelManager.SavePointSharing && CustomLevelManager.SharedSavePointPosition != Vector3.zero) { <revivePosition>5__1 = CustomLevelManager.SharedSavePointPosition; } else { <revivePosition>5__1 = SaveManager.Instance.GetRevivePosition(); } if (<revivePosition>5__1 != Vector3.zero) { ((MonoBehaviourPun)Character.localCharacter).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[3] { <revivePosition>5__1, false, -1 }); } else { ((MonoBehaviourPun)Character.localCharacter).photonView.RPC("RPCA_Revive", (RpcTarget)0, new object[1] { false }); } } _isReviving = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static bool _isReviving; [HarmonyPostfix] [HarmonyPatch(typeof(Character), "RPCA_Die")] public static void RPCA_DiePostfix(Character __instance, Vector3 itemSpawnPoint) { if (CustomLevelManager.IsEnabled && __instance.refs.view.IsMine && !_isReviving) { GameStatsManager.Instance?.AddDeath(); ((MonoBehaviour)__instance).StartCoroutine(ReviveCoroutine()); } } [IteratorStateMachine(typeof(<ReviveCoroutine>d__2))] private static IEnumerator ReviveCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ReviveCoroutine>d__2(0); } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "RPCA_Revive")] public static bool RPCA_RevivePrefix(ref bool applyStatus) { if (!CustomLevelManager.IsEnabled) { return true; } applyStatus = false; return true; } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "RPCA_ReviveAtPosition")] public static bool RPCA_ReviveAtPositionPrefix(ref bool applyStatus) { if (!CustomLevelManager.IsEnabled) { return true; } applyStatus = false; return true; } [HarmonyPrefix] [HarmonyPatch(typeof(Character), "ApplyPostReviveStatus")] public static bool ApplyPostReviveStatusPrefix() { if (!CustomLevelManager.IsEnabled) { return true; } return false; } } public class GameStatsManager : MonoBehaviour { public int deathCount = 0; public float startTime = 0f; public bool gameStarted = false; public static GameStatsManager Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); StartTimer(); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } public void StartTimer() { if (!gameStarted) { gameStarted = true; startTime = Time.time; } } public void AddDeath() { deathCount++; ShowDeathMilestone(); } private void ShowDeathMilestone() { foreach (AreaTitleDisplay allArea in AreaTitleDisplay.allAreas) { string name = ((Object)((Component)allArea).gameObject).name; if (!name.StartsWith("死亡文字_")) { continue; } string text = name.Substring(5); int num = text.IndexOf('_'); if (num <= 0) { continue; } string s = text.Substring(0, num); if (int.TryParse(s, out var result) && deathCount == result) { string text2 = text.Substring(num + 1); if ((Object)(object)GUIManager.instance != (Object)null) { GUIManager.instance.SetHeroTitle(text2, (AudioClip)null); } break; } } } public string GetFormattedTime() { if (!gameStarted) { return "00:00:00"; } float num = Time.time - startTime; TimeSpan timeSpan = TimeSpan.FromSeconds(num); return $"{timeSpan.Hours:D2}:{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}"; } public void Reset() { deathCount = 0; startTime = Time.time; gameStarted = true; } } [HarmonyPatch(typeof(GUIManager))] public class HeroTitlePositionPatch { [HarmonyPrefix] [HarmonyPatch("SetHeroTitle")] public static void SetHeroTitlePrefix(GUIManager __instance) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_00a6: Unknown result type (might be due to invalid IL or missing references) if (!CustomLevelManager.IsEnabled) { return; } if ((Object)(object)__instance.heroObject != (Object)null) { RectTransform component = __instance.heroObject.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(0.5f, 1f); component.anchorMax = new Vector2(0.5f, 1f); component.pivot = new Vector2(0.5f, 1f); component.anchoredPosition = new Vector2(0f, -80f); ((Transform)component).localScale = new Vector3(0.8f, 0.8f, 1f); } } if ((Object)(object)__instance.heroBG != (Object)null) { ((Component)__instance.heroBG).gameObject.SetActive(false); } } } public enum LanternMode { Omni, Spot } public static class LanternLightManager { private struct LanternLightBaseVals { public LightType type; public float range; public float intensity; public float spotAngle; } private static readonly Dictionary<int, LanternMode> _lanternModes = new Dictionary<int, LanternMode>(); private static readonly Dictionary<int, LanternLightBaseVals> _lanternBaseValues = new Dictionary<int, LanternLightBaseVals>(); private const float OmniRangeMultiplier = 5f; private const float OmniIntensityMultiplier = 5f; private const float SpotAngle = 35f; private const float SpotRangeMultiplier = 10f; private const float SpotIntensityMultiplier = 5f; public static void InitializeLantern(Lantern lantern) { if (!((Object)(object)lantern == (Object)null) && !((Object)(object)lantern.lanternLight == (Object)null)) { int instanceID = ((Object)lantern).GetInstanceID(); if (!_lanternModes.ContainsKey(instanceID)) { _lanternModes[instanceID] = LanternMode.Omni; } CaptureBaseValues(lantern, instanceID); ApplyLanternMode(lantern); } } private static void CaptureBaseValues(Lantern lantern, int key) { //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_0047: Unknown result type (might be due to invalid IL or missing references) Light lanternLight = lantern.lanternLight; if (!((Object)(object)lanternLight == (Object)null)) { LanternLightBaseVals lanternLightBaseVals = default(LanternLightBaseVals); lanternLightBaseVals.type = lanternLight.type; lanternLightBaseVals.range = lanternLight.range; lanternLightBaseVals.intensity = lantern.lightIntensity; lanternLightBaseVals.spotAngle = (((int)lanternLight.type == 0) ? lanternLight.spotAngle : 40f); LanternLightBaseVals value = lanternLightBaseVals; _lanternBaseValues[key] = value; } } public static void ApplyLanternMode(Lantern lantern) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)lantern == (Object)null) && !((Object)(object)lantern.lanternLight == (Object)null)) { int instanceID = ((Object)lantern).GetInstanceID(); if (!_lanternBaseValues.ContainsKey(instanceID)) { CaptureBaseValues(lantern, instanceID); } Light lanternLight = lantern.lanternLight; LanternLightBaseVals lanternLightBaseVals = _lanternBaseValues[instanceID]; LanternMode lanternMode = (_lanternModes.ContainsKey(instanceID) ? _lanternModes[instanceID] : LanternMode.Omni); lanternLight.type = lanternLightBaseVals.type; lanternLight.range = lanternLightBaseVals.range; lantern.lightIntensity = lanternLightBaseVals.intensity; lanternLight.shadows = (LightShadows)0; if (lanternMode == LanternMode.Omni) { lanternLight.type = (LightType)2; lanternLight.range = lanternLightBaseVals.range * 5f; lantern.lightIntensity = lanternLightBaseVals.intensity * 5f; } else { lanternLight.type = (LightType)0; lanternLight.spotAngle = 35f; lanternLight.range = lanternLightBaseVals.range * 10f; lantern.lightIntensity = lanternLightBaseVals.intensity * 5f; } } } public static void ToggleLanternMode(Lantern lantern) { if (!((Object)(object)lantern == (Object)null)) { int instanceID = ((Object)lantern).GetInstanceID(); if (!_lanternModes.ContainsKey(instanceID)) { _lanternModes[instanceID] = LanternMode.Omni; } LanternMode lanternMode = _lanternModes[instanceID]; _lanternModes[instanceID] = ((lanternMode == LanternMode.Omni) ? LanternMode.Spot : LanternMode.Omni); ApplyLanternMode(lantern); } } public static LanternMode GetLanternMode(Lantern lantern) { if ((Object)(object)lantern == (Object)null) { return LanternMode.Omni; } int instanceID = ((Object)lantern).GetInstanceID(); return _lanternModes.ContainsKey(instanceID) ? _lanternModes[instanceID] : LanternMode.Omni; } public static bool IsSpotMode(Lantern lantern) { return GetLanternMode(lantern) == LanternMode.Spot; } public static void CleanupLantern(Lantern lantern) { if (!((Object)(object)lantern == (Object)null)) { int instanceID = ((Object)lantern).GetInstanceID(); _lanternModes.Remove(instanceID); _lanternBaseValues.Remove(instanceID); } } } public class NetworkSyncManager : MonoBehaviourPunCallbacks { private const string KEY_NIGHT = "NJ_NM"; private const string KEY_SHARING = "NJ_SPS"; private const byte EVT_SAVE_NOTIFY = 101; private const byte EVT_SAVE_POS = 102; private static NetworkSyncManager? _instance; public static NetworkSyncManager? Instance => _instance; private void Awake() { if ((Object)(object)_instance != (Object)null && (Object)(object)_instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private void OnEnable() { try { PhotonNetwork.NetworkingClient.EventReceived += OnEvent; } catch { } } private void OnDisable() { try { PhotonNetwork.NetworkingClient.EventReceived -= OnEvent; } catch { } } private void OnDestroy() { if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } public static void Initialize() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)_instance == (Object)null) { GameObject val = new GameObject("NetworkSyncManager"); val.AddComponent<NetworkSyncManager>(); } } private void OnEvent(EventData evt) { //IL_00ca: 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) try { if (evt.Code == 101) { if (evt.CustomData is object[] array && array.Length >= 2 && (Object)(object)GUIManager.instance != (Object)null) { GUIManager.instance.SetHeroTitle(array[0]?.ToString() + " 已保存在 " + array[1], (AudioClip)null); } } else if (evt.Code == 102 && evt.CustomData is object[] array2 && array2.Length >= 3) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor((float)array2[0], (float)array2[1], (float)array2[2]); CustomLevelManager.SetSharedSavePointPosition(val); if ((Object)(object)SaveManager.Instance != (Object)null) { SaveManager.Instance.SetLastSavePoint(val); } } } catch { } } public override void OnRoomPropertiesUpdate(Hashtable props) { if (((Dictionary<object, object>)(object)props).ContainsKey((object)"NJ_NM")) { bool flag = TryGetBool(props, "NJ_NM"); CustomLevelManager.SetNightMode(flag); NightGlobals.ApplyNightMode(flag); } if (((Dictionary<object, object>)(object)props).ContainsKey((object)"NJ_SPS")) { CustomLevelManager.SetSavePointSharing(TryGetBool(props, "NJ_SPS")); } } public override void OnJoinedRoom() { ((MonoBehaviourPunCallbacks)this).OnJoinedRoom(); if (PhotonNetwork.IsMasterClient) { ((MonoBehaviour)this).Invoke("SyncInit", 1f); } } public override void OnPlayerEnteredRoom(Player p) { ((MonoBehaviourPunCallbacks)this).OnPlayerEnteredRoom(p); if (PhotonNetwork.IsMasterClient) { ((MonoBehaviour)this).Invoke("SyncInit", 1f); } } private void SyncInit() { if (PhotonNetwork.IsMasterClient) { SetProp("NJ_NM", CustomLevelManager.NightMode); SetProp("NJ_SPS", CustomLevelManager.SavePointSharing); } } public void SyncNightMode(bool on) { SetProp("NJ_NM", on); } public void SyncSavePointSharing(bool on) { SetProp("NJ_SPS", on); } public void SyncSharedSavePoint(Vector3 pos) { //IL_0019: 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_0035: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be