瀏覽代碼

修改测试代码,在连续下一局游戏时创建的单位位置错误

大爷 1 年之前
父節點
當前提交
4200cbd419

+ 12 - 1
Unity/Assets/Scripts/Codes/Hotfix/Client/battle/BattleMgr_Cmd.cs

@@ -4,6 +4,7 @@ using ET.Client;
 using ET.EventType;
 using ET.Server;
 using System;
+using System.Collections.Generic;
 using UnityEngine;
 using Random = System.Random;
 using Vector2 = CommonLang.Geometry.Vector2;
@@ -182,7 +183,7 @@ namespace ET
 
     //测试代码,检测当前战场中心
     [Event]
-    public class CameraPlaybleEventHandler : BEvent<CameraPlaybleEvent>
+    public class Test1EventHandler : BEvent<CameraPlaybleEvent>
     {
         protected override async ETTask OnEvent(CameraPlaybleEvent a)
         {
@@ -198,6 +199,16 @@ namespace ET
         }
     }
 
+    [Event]
+    public class Test2EventHandler : BEvent<EventType.GameoverEvent>
+    {
+        protected override async ETTask OnEvent(EventType.GameoverEvent args)
+        {
+            BattleFuncHandler.BattleCenterIndex = 0;
+            await ETTask.CompletedTask;
+        }
+    }
+
     //发送战斗服指令相关
     public partial class BattleMgr
     {

+ 1 - 1
Unity/Assets/Scripts/Codes/HotfixView/Client/Battle/GameoverHanler.cs

@@ -61,7 +61,7 @@ namespace ET
         private void InitRankView(GComponent view)
         {
             var list = view.GetChild("list").asList;
-            var data = RankList;
+            var data = RankList ?? new List<RankInfo>();
 
             int i = 0;
             GComponent chd;

+ 4 - 2
Unity/Assets/Scripts/Codes/HotfixView/Client/UI/HUD/CreateHUD.cs

@@ -1,6 +1,5 @@
 using ET.EventType;
 using FairyGUI;
-
 using UnityEngine;
 
 namespace ET.Client
@@ -37,7 +36,10 @@ namespace ET.Client
             {
                 HUDComonent.listGift[i - 1] = view.GetChild($"CompGift{i}").asCom;
             }
-
+            for (int i = 0; i < HUDComonent.listRank.numChildren; i++)
+            {
+                HUDComonent.listRank.GetChildAt(i).visible = false;
+            }
             HUDComonent.listRank.visible = false;
             HUDComonent.pgTower.visible = false;
             HUDComonent.pgBoss1.visible = false;