void OnDrag(Vector2 delta)
    {
        if (battleLogic == null)
        {
            return;
        }

        if (Obj_MyselfPlayer.GetMe().isAutoFowrard)
        {
            return;
        }

        //如果卡牌正在播放复活动画,就不要拖动
        if (gameObject.GetComponent <CardUI>().InReviveAnimation)
        {
            return;
        }

        BattleProcedureType state = battleLogic.GetComponent <BattleLogic>().GetBattleCore().GetBattlePlayer().GetBattleStateType();

        if (state != BattleProcedureType.E_BATTLE_PROCEDURE_WAITING)
        {
            return;
        }

        if (srcPos >= 0 && srcPos <= 5)
        {
            Debug.Log("OnDrag(), delta = " + delta.x + ", " + delta.y);

            delta *= screenHeight / Screen.height;
            transform.localPosition += (Vector3)delta;
        }
        isDraged = true;
    }
Example #2
0
 public void ChangProcedure(BattleProcedureType type)
 {
     if (m_CurrentProcedure.GetProcedureType() != type)
     {
         m_CurrentProcedure.OnLeave();
         m_CurrentProcedure = m_ProcedureList[type];
         m_CurrentProcedure.OnEnter();
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (battleProcedureType != mBattlePlayer.GetBattleStateType())
     {
         battleProcedureType = mBattlePlayer.GetBattleStateType();
         Reset();
     }
     UpdateStepValue();
 }
    // Use this for initialization
    void Start()
    {
        moneyLabel.text = "" + moneyCount;
        cardLabel.text  = "" + cardCount;
        itemLabel.text  = "" + itemCount;
        battleType      = Obj_MyselfPlayer.GetMe().battleType;
        BattleLogic bl = GameObject.Find("BattleLogic").GetComponent <BattleLogic>();

        mBattlePlayer       = bl.GetBattleCore().GetBattlePlayer();
        battleProcedureType = mBattlePlayer.GetBattleStateType();
        Reset();
    }
Example #5
0
        public BattleProcedureType GetBattleProcedureType()
        {
            BattleProcedureType type = BattleProcedureType.E_BATTLE_PROCEDURE_BATTLE_START;

            foreach (KeyValuePair <BattleProcedureType, BattleProcedureBase> procedure in m_ProcedureList)
            {
                if (procedure.Value == m_CurrentProcedure)
                {
                    type = procedure.Key;
                    break;
                }
            }
            return(type);
        }
    void OnPress(bool isPress)
    {
        if (isPress)
        {
            isDraged = false;
        }
        if (battleLogic == null)
        {
            return;
        }

        BattleProcedureType state = battleLogic.GetComponent <BattleLogic>().GetBattleCore().GetBattlePlayer().GetBattleStateType();

        if (state != BattleProcedureType.E_BATTLE_PROCEDURE_WAITING)
        {
            return;
        }

        if (srcPos < 0 || srcPos > 5)
        {
            return;
        }

        Debug.Log("OnPress(), isPress = " + isPress);

        if (isPress)
        {
            screenHeight             = 1024f;//GameObject.FindWithTag("UIRoot").GetComponent<UIRoot>().manualHeight;
            transform.localPosition += new Vector3(0f, 0f, -50f);
        }
        else
        {
            transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, initPos.z);
            float fx = transform.localPosition.x;
            float fy = transform.localPosition.y;
            tarPos = -1;
            if (fx < cardx[1] && fx > cardx[0])
            {
                if (fy < cardy[0] && fy > cardy[1])
                {
                    tarPos = 0;
                }
                else if (fy < cardy[2] && fy > cardy[3])
                {
                    tarPos = 3;
                }
            }
            else if (fx < cardx[3] && fx > cardx[2])
            {
                if (fy < cardy[0] && fy > cardy[1])
                {
                    tarPos = 1;
                }
                else if (fy < cardy[2] && fy > cardy[3])
                {
                    tarPos = 4;
                }
            }
            else if (fx < cardx[5] && fx > cardx[4])
            {
                if (fy < cardy[0] && fy > cardy[1])
                {
                    tarPos = 2;
                }
                else if (fy < cardy[2] && fy > cardy[3])
                {
                    tarPos = 5;
                }
            }
            Debug.Log("srcPos = " + srcPos + "; tgtPos = " + tarPos);
            transform.localPosition = new Vector3(cx, cy, transform.localPosition.z);
            if (tarPos < 0 || tarPos == srcPos)
            {
                return;                //--退出,不改变--
            }
            long temp;
            temp = Obj_MyselfPlayer.GetMe().battleArray[tarPos];
            Obj_MyselfPlayer.GetMe().battleArray[tarPos] = Obj_MyselfPlayer.GetMe().battleArray[srcPos];
            Obj_MyselfPlayer.GetMe().battleArray[srcPos] = temp;


            //如果当前移动的地方有助战好友,保存助战好友新位置
            if (tarPos == Obj_MyselfPlayer.GetMe().nfightFriendPos)
            {
                Obj_MyselfPlayer.GetMe().nfightFriendPos = srcPos;
            }
            else if (srcPos == Obj_MyselfPlayer.GetMe().nfightFriendPos)
            {
                Obj_MyselfPlayer.GetMe().nfightFriendPos = tarPos;
            }

            Debug.Log("wo yun 1:");
            Obj_MyselfPlayer.GetMe().SavebattleArray();

            BattleCardManager.Instance.OnCardPosChanged(srcPos, tarPos);
        }
    }