Esempio n. 1
0
        public void OnModelDragStart(NationPartnerItem dragItem)
        {
            if (dragItem != null && !dragItem.IsEmpty)
            {
                //isOnlyOne = GetTeamMemList(dragItem.TeamName).Count <= 1;

                ReferencePartnerItem    = dragItem;
                CurDragItem.TeamName    = dragItem.TeamName;
                CurDragItem.IndexInTeam = dragItem.IndexInTeam;
                CurDragItem.Fill(dragItem.PartnerItem.PartnerData);
                CurDragItem.mDMono.gameObject.SetActive(true);
                dragItem.Fill(null);
                CurDragItem.mDMono.transform.position = new Vector3(UICamera.lastWorldPosition.x, UICamera.lastWorldPosition.y, DragZ);
            }
        }
Esempio n. 2
0
        public void OnModelDragEnd()
        {
            if (!CurDragItem.mDMono.gameObject.activeSelf)
            {
                return;
            }

            NationPartnerItem targetItem = GetDragOverItem();

            if (targetItem == null)
            {
                OnModelDragOut(CurDragItem);
                CheckTeamState(CurDragItem.TeamName, -1);
            }
            else
            {
                if (targetItem.TeamName == CurDragItem.TeamName)
                {
                    //同一个队伍里面移动伙伴位置
                    bool samePosition = targetItem == ReferencePartnerItem;
                    OnDrag2ModelPos(targetItem.TeamName, CurDragItem.PartnerData.HeroID, targetItem.IndexInTeam, !samePosition, false);
                }
                else if (!targetItem.IsEmpty)
                {
                    //伙伴位置对换
                    OnDrag2ModelPos(CurDragItem.TeamName, CurDragItem.PartnerData.HeroID, CurDragItem.IndexInTeam,
                                    targetItem.TeamName, targetItem.PartnerData.HeroID, targetItem.IndexInTeam);
                }
                else
                {
                    //移动伙伴到其他队伍
                    OnDrag2ModelPos(CurDragItem.TeamName, CurDragItem.PartnerData.HeroID, CurDragItem.IndexInTeam,
                                    targetItem.TeamName, 0, targetItem.IndexInTeam);
                    CheckTeamState(CurDragItem.TeamName, -1);
                    CheckTeamState(targetItem.TeamName, 1);
                }
                if (!targetItem.IsEmpty)
                {
                    //EB.Log.Error("TargetItem Is not empty");
                    ReferencePartnerItem.Fill(targetItem.PartnerData);
                }
                targetItem.Fill(CurDragItem.PartnerData);
                CurDragItem.mDMono.gameObject.SetActive(false);
            }
        }