Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ShopOutsideSimple v0.1.0
plugins/ShopOutsideSimple.dll
Decompiled 3 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] namespace ShopOutsideSimple; [BepInPlugin("cn_xc.ShopOutsideSimple", "商店外区域", "0.1.0")] public sealed class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; private static ConfigEntry<bool> _allowOutside; private static ConfigEntry<float> _expand; private static ConfigEntry<bool> _removePlayerOnlyWalls; private static ConfigEntry<bool> _addGround; private static ConfigEntry<bool> _dryRun; private static ConfigEntry<bool> _verbose; private static ConfigEntry<bool> _clearStep; private static bool _enteredShop; private static float _nextScanAt; private static int _wallOff; private static bool _wallDone; private static bool _playerOnlyDone; private static int _playerOnlyClosed; private static int _groundAdded; private static bool _warnedNoMirror; private static bool _openReady; private static Vector3 _openCenter; private static Vector3 _openHalf; private static int _stepCleared; private const int MAX_GROUND_ADD = 400; private const float GROUND_RADIUS = 150f; internal static void LogInfo(string msg) { if (Log != null) { Log.LogInfo((object)msg); } } internal static void LogWarn(string msg) { if (Log != null) { Log.LogWarning((object)msg); } } internal static void Verbose(string msg) { if (Log != null) { Log.LogDebug((object)msg); } } private void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown try { Log = ((BaseUnityPlugin)this).Logger; _allowOutside = ((BaseUnityPlugin)this).Config.Bind<bool>("商店外区域", "允许走出商店", false, "总开关。仅在商店场景生效。"); _expand = ((BaseUnityPlugin)this).Config.Bind<float>("商店外区域", "镜子搜索扩边(米)", 0.6f, new ConfigDescription("以镜子包围盒为基准向外扩多少米。走不出去就调大(1.2 / 2.0)。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), Array.Empty<object>())); _removePlayerOnlyWalls = ((BaseUnityPlugin)this).Config.Bind<bool>("商店外区域", "移除空气墙", false, "关闭 PlayerOnlyCollision 图层的隐形墙(只挡玩家的那层)。"); _addGround = ((BaseUnityPlugin)this).Config.Bind<bool>("商店外区域", "补外部碰撞", true, "给商店外部「玩家脚下的薄地面」加 MeshCollider,防止走出商店后掉虚空。只处理地面,不动墙/天花板。"); _dryRun = ((BaseUnityPlugin)this).Config.Bind<bool>("调试", "只检测不修改", false, "开启后只把命中/候选写进日志,不做任何修改。"); _clearStep = ((BaseUnityPlugin)this).Config.Bind<bool>("商店外区域", "清理门口台阶", true, "开口后把门口那些低矮的台阶/门槛碰撞(高度 <0.8m、贴地)一并关闭,避免需要跳一下。不会动大地面。"); _verbose = ((BaseUnityPlugin)this).Config.Bind<bool>("调试", "详细日志", false, "输出扫描细节(含候选评分)。排查时再开。"); } catch (Exception ex) { if (((BaseUnityPlugin)this).Logger != null) { ((BaseUnityPlugin)this).Logger.LogError((object)("[商店外区域] 初始化失败,模组本次不生效:" + ex)); } } if (((BaseUnityPlugin)this).Logger != null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[商店外区域] v0.1.0 已加载(只拆镜子正后方那面墙 + 补外部地面碰撞)"); } } private void Update() { try { Tick(); } catch (Exception ex) { Verbose("Tick 异常:" + ex.Message); } } private static bool IsInShop() { try { if (SemiFunc.RunIsShop()) { return true; } } catch { } try { if ((Object)(object)ShopManager.instance != (Object)null) { return true; } } catch { } try { RunManager instance = RunManager.instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.levelCurrent != (Object)null) { string name = ((Object)instance.levelCurrent).name; if (!string.IsNullOrEmpty(name) && name.IndexOf("Shop", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } catch { } return false; } private static PlayerAvatar LocalPlayer() { try { return PlayerAvatar.instance; } catch { return null; } } private static bool CanStart() { if (!IsInShop()) { return false; } if ((Object)(object)LocalPlayer() == (Object)null) { return false; } return true; } private static void Tick() { if (_allowOutside == null || !_allowOutside.Value) { _enteredShop = false; return; } if (!CanStart()) { _wallOff = 0; _wallDone = false; _playerOnlyDone = false; _playerOnlyClosed = 0; _groundAdded = 0; _nextScanAt = 0f; _enteredShop = false; return; } if (!_enteredShop) { _enteredShop = true; LogInfo("[商店外区域] 已进入商店,立即开始处理。"); } if (Time.unscaledTime < _nextScanAt) { return; } _nextScanAt = Time.unscaledTime + 10f; try { _openReady = false; DisableMirrorBackWall(); if (_openReady && _clearStep != null && _clearStep.Value) { ClearStepAtOpening(); } } catch (Exception ex) { Verbose("拆墙失败:" + ex.Message); } try { if (_removePlayerOnlyWalls != null && _removePlayerOnlyWalls.Value) { RemovePlayerOnlyWalls(); } } catch { } try { if (_addGround != null && _addGround.Value) { AddOutsideGround(); } } catch (Exception ex2) { Verbose("补碰撞失败:" + ex2.Message); } } private static void DisableMirrorBackWall() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) if (_wallDone) { return; } Transform val = FindMirrorTransform(); if ((Object)(object)val == (Object)null) { if (!_warnedNoMirror) { _warnedNoMirror = true; Verbose("本场景还没找到商店镜子(可能尚未加载),稍后重试。"); } } else { if (!TryGetBounds(val, out var bounds)) { return; } Vector3 center = ((Bounds)(ref bounds)).center; PlayerAvatar val2 = LocalPlayer(); if ((Object)(object)val2 == (Object)null) { return; } Vector3 position = ((Component)val2).transform.position; Vector3 val3 = center - position; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = ((Component)val).transform.forward; } ((Vector3)(ref val3)).Normalize(); Bounds val4 = bounds; ((Bounds)(ref val4)).Expand(_expand.Value); Vector3 extents = ((Bounds)(ref val4)).extents; extents.y = Mathf.Max(extents.y, 0.8f); if (extents.x < 0.5f) { extents.x = 0.5f; } if (extents.z < 0.5f) { extents.z = 0.5f; } Collider[] array; try { array = Physics.OverlapBox(((Bounds)(ref val4)).center, extents, Quaternion.identity, -1, (QueryTriggerInteraction)1); } catch (Exception ex) { LogWarn("[商店外区域] OverlapBox 失败:" + ex.Message); return; } if (array == null || array.Length == 0) { LogWarn("[商店外区域] 镜子附近没有找到任何碰撞体(扩边 " + _expand.Value + "m)。"); return; } Collider val5 = null; float num = float.MinValue; string text = ""; int num2 = 0; foreach (Collider val6 in array) { if ((Object)(object)val6 == (Object)null || val6.isTrigger || !val6.enabled || IsPlayerCollider(val6)) { continue; } Bounds bounds2 = val6.bounds; if (!(((Bounds)(ref bounds2)).size.y < 1.5f)) { num2++; Vector3 val7 = ((Bounds)(ref bounds2)).center - center; val7.y = 0f; float num3 = ((((Vector3)(ref val7)).sqrMagnitude < 0.0001f) ? 0f : Vector3.Dot(((Vector3)(ref val7)).normalized, val3)); float num4 = HorizontalOverlap(bounds, bounds2); string text2 = ((Object)((Component)val6).gameObject).name ?? ""; bool flag = text2.IndexOf("Mirror", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Wall", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("Collision", StringComparison.OrdinalIgnoreCase) >= 0; float num5 = num3 * 2f + num4 * 3f + (flag ? 1f : 0f); if (_dryRun != null && _dryRun.Value) { Verbose("候选 " + text2 + "(" + ((object)val6).GetType().Name + ",size " + ((object)((Bounds)(ref bounds2)).size/*cast due to .constrained prefix*/).ToString() + ",align=" + num3.ToString("F2") + ",overlap=" + num4.ToString("F2") + ",nameHit=" + flag + ",score=" + num5.ToString("F2") + ")"); } if (num5 > num) { num = num5; val5 = val6; text = "align=" + num3.ToString("F2") + " overlap=" + num4.ToString("F2"); } } } if ((Object)(object)val5 == (Object)null) { LogWarn("[商店外区域] 镜子附近没有符合「墙」特征的候选(竖高 >1.5m)。候选总数 " + array.Length + ",可通过把 镜子搜索扩边(米) 调大重试。镜子=" + ((Object)val).name); return; } string[] obj = new string[6] { ((Object)((Component)val5).gameObject).name, "(", ((object)val5).GetType().Name, ",", null, null }; Bounds bounds3 = val5.bounds; obj[4] = ((object)((Bounds)(ref bounds3)).size/*cast due to .constrained prefix*/).ToString(); obj[5] = ")"; string text3 = string.Concat(obj); if (_dryRun != null && _dryRun.Value) { LogInfo("[商店外区域/只检测] 会关闭的墙:" + text3 + " | " + text + " | 候选 " + num2 + " 个"); } else { val5.enabled = false; _wallOff++; _wallDone = true; _openCenter = center; _openHalf = new Vector3(((Bounds)(ref bounds)).extents.x + 0.6f, 1.2f, ((Bounds)(ref bounds)).extents.z + 0.6f); _openReady = true; LogInfo("[商店外区域] 已关闭镜子正后方那面墙:" + text3 + " | " + text + " | 累计 " + _wallOff + " 次"); } } } private static void ClearStepAtOpening() { //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_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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) if (!_openReady) { return; } PlayerAvatar val = LocalPlayer(); if ((Object)(object)val == (Object)null) { return; } float y = ((Component)val).transform.position.y; Collider[] array; try { array = Physics.OverlapBox(_openCenter, _openHalf, Quaternion.identity, -1, (QueryTriggerInteraction)1); } catch (Exception ex) { Verbose("OverlapBox(台阶) 失败:" + ex.Message); return; } if (array == null) { return; } int num = 0; foreach (Collider val2 in array) { if ((Object)(object)val2 == (Object)null || val2.isTrigger || !val2.enabled || IsPlayerCollider(val2)) { continue; } Bounds bounds = val2.bounds; if (((Bounds)(ref bounds)).size.y > 1.2f) { continue; } if (((Bounds)(ref bounds)).size.y <= 0.35f) { _ = Mathf.Max(((Bounds)(ref bounds)).size.x, ((Bounds)(ref bounds)).size.z) <= 6f; } else _ = 0; if (((Bounds)(ref bounds)).max.y < y - 0.5f || ((Bounds)(ref bounds)).min.y > y + 0.6f) { continue; } float num2 = Mathf.Max(((Bounds)(ref bounds)).size.x, ((Bounds)(ref bounds)).size.z); if (!(num2 > 8f) && !(Vector3.Distance(new Vector3(((Bounds)(ref bounds)).center.x, 0f, ((Bounds)(ref bounds)).center.z), new Vector3(_openCenter.x, 0f, _openCenter.z)) > 2f) && (!(((Bounds)(ref bounds)).size.y < 0.05f) || !(num2 > 20f))) { if (_dryRun != null && _dryRun.Value) { num++; LogInfo("[商店外区域/只检测] 会清理的台阶:" + ((Object)((Component)val2).gameObject).name + "(size " + ((object)((Bounds)(ref bounds)).size/*cast due to .constrained prefix*/).ToString() + ",maxY-" + (((Bounds)(ref bounds)).max.y - y).ToString("F2") + ")"); } else { val2.enabled = false; num++; Verbose("已清理台阶碰撞:" + ((Object)((Component)val2).gameObject).name + "(size " + ((object)((Bounds)(ref bounds)).size/*cast due to .constrained prefix*/).ToString() + ")"); } } } if (num > 0) { _stepCleared += num; LogInfo("[商店外区域] 已清理门口台阶/门槛碰撞 " + num + " 个(累计 " + _stepCleared + ")。"); } } private static bool IsPlayerCollider(Collider c) { try { if ((Object)(object)((Component)c).GetComponentInParent<PlayerAvatar>() != (Object)null) { return true; } if ((Object)(object)((Component)c).GetComponentInParent<PlayerController>() != (Object)null) { return true; } } catch { } return false; } private static float HorizontalOverlap(Bounds a, Bounds b) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_003d: 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_005b: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(((Bounds)(ref a)).min.x, ((Bounds)(ref b)).min.x); float num2 = Mathf.Min(((Bounds)(ref a)).max.x, ((Bounds)(ref b)).max.x); float num3 = Mathf.Max(((Bounds)(ref a)).min.z, ((Bounds)(ref b)).min.z); float num4 = Mathf.Min(((Bounds)(ref a)).max.z, ((Bounds)(ref b)).max.z); float num5 = num2 - num; float num6 = num4 - num3; if (num5 <= 0f || num6 <= 0f) { return 0f; } float num7 = Mathf.Max(0.01f, ((Bounds)(ref a)).size.x * ((Bounds)(ref a)).size.z); return Mathf.Clamp01(num5 * num6 / num7); } private static Transform FindMirrorTransform() { try { ShopMirrorEyeLogic[] array = Object.FindObjectsByType<ShopMirrorEyeLogic>((FindObjectsInactive)1, (FindObjectsSortMode)0); if (array != null) { foreach (ShopMirrorEyeLogic val in array) { if (!((Object)(object)val == (Object)null)) { if ((Object)(object)val.mirrorTransform != (Object)null) { return val.mirrorTransform; } return ((Component)val).transform; } } } } catch (Exception ex) { Verbose("查找 ShopMirrorEyeLogic 失败:" + ex.Message); } try { MirrorReflection[] array2 = Object.FindObjectsByType<MirrorReflection>((FindObjectsInactive)1, (FindObjectsSortMode)0); if (array2 != null && array2.Length != 0 && (Object)(object)array2[0] != (Object)null) { return ((Component)array2[0]).transform; } } catch { } return null; } private static bool TryGetBounds(Transform t, out Bounds bounds) { //IL_0001: 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_00b9: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_007b: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); bool flag = false; try { Renderer[] componentsInChildren = ((Component)t).GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (!((Object)(object)componentsInChildren[i] == (Object)null)) { if (!flag) { bounds = componentsInChildren[i].bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren[i].bounds); } } } } catch { } if (!flag) { try { Collider[] componentsInChildren2 = ((Component)t).GetComponentsInChildren<Collider>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { if (!((Object)(object)componentsInChildren2[j] == (Object)null)) { if (!flag) { bounds = componentsInChildren2[j].bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(componentsInChildren2[j].bounds); } } } } catch { } } if (!flag) { bounds = new Bounds(t.position, Vector3.one); flag = true; } return flag; } private static void AddOutsideGround() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00e6: 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_0105: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) if (_groundAdded >= 400) { return; } PlayerAvatar val = LocalPlayer(); if ((Object)(object)val == (Object)null) { return; } Vector3 position = ((Component)val).transform.position; MeshFilter[] array; try { array = Object.FindObjectsByType<MeshFilter>((FindObjectsSortMode)0); } catch { return; } if (array == null) { return; } int num = 0; for (int i = 0; i < array.Length; i++) { if (_groundAdded + num >= 400) { break; } MeshFilter val2 = array[i]; if ((Object)(object)val2 == (Object)null || (Object)(object)val2.sharedMesh == (Object)null || (Object)(object)((Component)val2).GetComponent<Collider>() != (Object)null) { continue; } Renderer component = ((Component)val2).GetComponent<Renderer>(); if ((Object)(object)component == (Object)null || !component.enabled || Vector3.Distance(((Component)val2).transform.position, position) > 150f) { continue; } Bounds bounds = component.bounds; if (((Bounds)(ref bounds)).size.y > 2f || ((Bounds)(ref bounds)).max.y > position.y + 1f) { continue; } float num2 = Mathf.Min(((Bounds)(ref bounds)).size.x, Mathf.Min(((Bounds)(ref bounds)).size.y, ((Bounds)(ref bounds)).size.z)); float num3 = Mathf.Max(((Bounds)(ref bounds)).size.x, ((Bounds)(ref bounds)).size.z); if (num2 < 1f && num3 > 4f) { string text = ((Object)((Component)val2).gameObject).name ?? ""; bool flag = text.IndexOf("Catwalk", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Shop Outside", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Sidewalk", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Ground", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Floor", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Path", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Grass", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Plane", StringComparison.OrdinalIgnoreCase) >= 0; if (_dryRun != null && _dryRun.Value) { num++; LogInfo("[商店外区域/只检测] 会补碰撞的地面:" + text + " | size " + ((object)((Bounds)(ref bounds)).size/*cast due to .constrained prefix*/).ToString() + (flag ? " | 名字命中" : " | 形状命中")); } else { MeshCollider obj2 = ((Component)val2).gameObject.AddComponent<MeshCollider>(); obj2.sharedMesh = val2.sharedMesh; obj2.convex = false; num++; Verbose("补地面碰撞:" + text + " | size " + ((object)((Bounds)(ref bounds)).size/*cast due to .constrained prefix*/).ToString()); } } } if (num > 0) { _groundAdded += num; LogInfo("[商店外区域] 本轮为 " + num + " 个地面模型补了碰撞(累计 " + _groundAdded + "/" + 400 + ")。"); } } private static void RemovePlayerOnlyWalls() { if (_playerOnlyDone) { return; } _playerOnlyDone = true; Collider[] array; try { array = Object.FindObjectsByType<Collider>((FindObjectsSortMode)0); } catch { return; } if (array == null) { return; } int num = 0; foreach (Collider val in array) { if ((Object)(object)val == (Object)null || !val.enabled) { continue; } string text; try { text = LayerMask.LayerToName(((Component)val).gameObject.layer); } catch { continue; } if (!(text != "PlayerOnlyCollision")) { if (_dryRun != null && _dryRun.Value) { num++; LogInfo("[商店外区域/只检测] 会关闭的隐形墙:" + ((Object)((Component)val).gameObject).name); } else { val.enabled = false; num++; } } } if (num > 0) { _playerOnlyClosed += num; LogInfo("[商店外区域] 又关闭 " + num + " 个只挡玩家的隐形墙(累计 " + _playerOnlyClosed + ")。"); } } }