From 2917e8a4eae31c1a1bc4419a9b6f23be7e4fda3e Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 05 八月 2025 19:24:50 +0800
Subject: [PATCH] update team heros

---
 Main/System/HeroUI/HeroScenePosCell.cs |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/Main/System/HeroUI/HeroScenePosCell.cs b/Main/System/HeroUI/HeroScenePosCell.cs
index 2cc5cd1..a8351d2 100644
--- a/Main/System/HeroUI/HeroScenePosCell.cs
+++ b/Main/System/HeroUI/HeroScenePosCell.cs
@@ -20,6 +20,7 @@
     [SerializeField] DragItem dragObj;
     [SerializeField] Transform objForfly;  //鐐瑰嚮椋炲叆鐨勬椂鍊欑殑鏄鹃殣鎺у埗
 
+
     public void Display(string guid, int index, bool isFly = false)
     {
         var hero = HeroManager.Instance.GetHero(guid);
@@ -38,7 +39,7 @@
             heroConfig.AtkDistType == 2 && TeamConst.TeamPos1Array.Contains(index))
         {
             suggestForm.SetActive(true);
-            jobTip.text = Language.Get("heroClass" + heroConfig.Class);
+            jobTip.text = RichTextMsgReplaceConfig.GetRichReplace("Class", heroConfig.Class);
             posTip.text = Language.Get("heroAtkDistType" + heroConfig.AtkDistType);
         }
         else
@@ -46,7 +47,11 @@
             suggestForm.SetActive(false);
         }
 
+        dragObj.pos = index;
+        dragObj.onEndDragEvent -= SwitchPos;
         dragObj.onEndDragEvent += SwitchPos;
+        dragObj.canvas.sortingLayerID =  dragObj.parentCanvas.sortingLayerID;
+        dragObj.canvas.sortingOrder = dragObj.parentCanvas.sortingOrder + index + 1;
 
         heroBtn.AddListener(() =>
         {
@@ -72,6 +77,23 @@
     void SwitchPos(int pos1, int pos2)
     {
         Debug.Log("浜ゆ崲浣嶇疆:" + pos1 + "   " + pos2);
+        var team = TeamManager.Instance.GetTeam(HeroUIManager.Instance.selectTeamType);
+        if (pos2 == -1)
+        {
+            //涓嬮樀
+            team.RemoveHero(pos1);
+            HeroUIManager.Instance.NotifyOnTeamPosChangeEvent(new List<int>() { pos1 }, -1, Vector3.zero);
+        }
+        else if (pos1 == pos2)
+        { 
+            HeroUIManager.Instance.NotifyOnTeamPosChangeEvent(new List<int>() { pos1 }, -1, Vector3.zero);
+        }
+        else
+        {
+            //閫氱煡鍒锋柊
+            team.SwapPosition(pos1, pos2);
+            HeroUIManager.Instance.NotifyOnTeamPosChangeEvent(new List<int>() { pos1, pos2 }, -1, Vector3.zero);
+        }
     }
 
     async UniTask DelayShow()

--
Gitblit v1.8.0