Browse Source

【优化】玩家断线执行逻辑

johnclot69 1 year ago
parent
commit
7fbd003f11

+ 1 - 1
DotNet/Hotfix/Module/IceBattle/BattleIceAgentComponentSystem.cs

@@ -18,7 +18,7 @@ namespace ET.Server
                 Thread thread = new Thread(() =>
                 {
                     IceApp IceApp = new IceApp();
-                    IceApp.main(new string[] {}, "../Config/ice.config");
+                    IceApp.main(Array.Empty<string>(), "../Config/ice.config");
                 });
                 thread.Start();
             }

+ 7 - 4
DotNet/Hotfix/Scenes/Game/Player/SessionPlayerComponentSystem.cs

@@ -40,13 +40,16 @@ namespace ET.Server
                 {
                     // 记录玩家历史
                     map.SyncPlayerHistoryData(player);
-                    // 场景移除玩家
-                    map.RemovePlayer(player, false);
-
+                    // 战斗服场景玩家离开
                     map.PlayerLeaveRequest(player, false);
+                    // 本地场景移除玩家
+                    map.RemovePlayer(player, false);
+                    // 移除本地组件数据
+                    map.DomainScene().GetComponent<GamePlayerComponent>().Remove(player.GetId());
                 }
 
-                self.DomainScene().GetComponent<GamePlayerComponent>().Remove(player.GetId());
+                // 战斗服结束场景
+                player.GetZoneManager().destroyZoneRequest(map.Id.ToString());
 
                 player.Dispose();
             }