From f1e5df1fc8eadd0eb27e0a6870501fa25a42b5a1 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 12 十一月 2025 11:13:53 +0800
Subject: [PATCH] 262 修复切换服务器报错

---
 Main/System/Battle/BattleManager.cs |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Main/System/Battle/BattleManager.cs b/Main/System/Battle/BattleManager.cs
index 827433e..211140e 100644
--- a/Main/System/Battle/BattleManager.cs
+++ b/Main/System/Battle/BattleManager.cs
@@ -2,6 +2,7 @@
 using UnityEngine;
 using LitJson;
 using System;
+using System.Linq;
 
 public class BattleManager : GameSystemManager<BattleManager>
 {
@@ -662,13 +663,16 @@
 
     public void DestroyAllBattleField()
     {
-        foreach (var kvp in battleFields)
+        // 鍒涘缓鍓湰杩涜閬嶅巻锛岄伩鍏嶅湪閬嶅巻鏃朵慨鏀瑰師闆嗗悎
+        var battleFieldsList = battleFields.Values.ToList();
+
+        foreach (var battleField in battleFieldsList)
         {
-            BattleField battleField = kvp.Value;
             if (battleField == null)
                 continue;
-                
+
             DestroyBattleField(battleField);
         }
     }
+
 }
\ No newline at end of file

--
Gitblit v1.8.0