瀏覽代碼

【优化】gameOver判断由战斗服事件驱动,场景增加缓存标记

johnclot69 1 年之前
父節點
當前提交
da30ad6259

+ 2 - 0
DotNet/Hotfix/Scenes/Game/Map/MapEventComponentSystem.cs

@@ -143,6 +143,8 @@ namespace ET.Server
         /** 场景结算事件 **/
         public static void OnGameOver(this MapEventComponent self, Map map)
         {
+            map.IsGameOver = true;
+
             if (map?.Players is not { Count: > 0 })
             {
                 return;

+ 1 - 1
DotNet/Hotfix/Scenes/Game/Map/MapSystem.cs

@@ -210,7 +210,7 @@ namespace ET.Server
         /// <returns></returns>
         public static bool IsGameOver(this Map self)
         {
-            return self.DeadUnits.Contains(1001) && self.DeadUnits.Contains(1002) && self.DeadUnits.Contains(1003);
+            return self.IsGameOver;
         }
     }
 }

+ 3 - 1
DotNet/Model/Scenes/Game/Map/Map.cs

@@ -26,9 +26,11 @@ namespace ET.Server
         public Dictionary<long, WNPlayer> Players = new Dictionary<long, WNPlayer>();
         /** 场景中单位玩家objId列表 **/
         public List<int> UnitObjIds { get; set; }
-
         /** 死亡的单位 **/
         [StaticField]
         public List<int> DeadUnits = new List<int>();
+        /** 游戏结束标记 **/
+        [StaticField]
+        public bool IsGameOver = false;
     }
 }