| | |
| | | [SerializeField] DragItem dragObj; |
| | | [SerializeField] Transform objForfly; //点击飞入的时候的显隐控制 |
| | | |
| | | |
| | | public void Display(string guid, int index, bool isFly = false) |
| | | { |
| | | var hero = HeroManager.Instance.GetHero(guid); |
| | |
| | | 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(() => |
| | | { |
| | |
| | | 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() |