Example #1
0
    /// <summary>
    /// 播放发牌动画
    /// </summary>
    private IEnumerator PlaySendCardAnimator()
    {
        //发牌之前先回收之前的牌
        foreach (BattleAreaItem areaItem in View.battleAreaItems)
        {
            areaItem.SaveAllCard();
        }
        View.cardArrowIcon.SetActive(false);
        ResourcesMgr.Instance.RecoveryAll();
        if (GlobalData.hasHeap)
        {
            foreach (BattleAreaItem areaItem in View.battleAreaItems)
            {
                BattleAreaUtil.InitHeapCard(areaItem, GlobalData.CardWare.Length);
            }
        }
        yield return(new WaitForSeconds(4f));

        HideRotaeSaizi();
        //Facade.SendNotification(NotificationConstant.HIDESAIZI);

        var selfInfoVO     = battleProxy.playerIdInfoDic[playerInfoProxy.userID];
        var sendStartIndex = (battleProxy.GetBankerPlayerInfoVOS2C().sit - selfInfoVO.sit + GlobalData.SIT_NUM) % GlobalData.SIT_NUM;

        for (int i = 0; i < View.battleAreaItems.Count; i++)
        {
            View.battleAreaItems[i].SetData(battleProxy.playerSitInfoDic[GlobalData.GetNextSit(selfInfoVO.sit, i)]);
        }
        int sendCount = Mathf.CeilToInt((float)GlobalData.PLAYER_CARD_NUM / GlobalData.SEND_SINGLE) * GlobalData.SIT_NUM;

        for (int i = 0; i < sendCount; i++)
        {
            GameMgr.Instance.StartCoroutine(View.battleAreaItems[(i + sendStartIndex) % GlobalData.SIT_NUM].PlaySendCardAnimator());
            yield return(new WaitForSeconds(0.4f));
        }
        yield return(new WaitForSeconds(0.5f));

        for (int i = 0; i < View.battleAreaItems.Count; i++)
        {
            GameMgr.Instance.StartCoroutine(View.battleAreaItems[i].PlayCloseCardAction());
        }
        yield return(new WaitForSeconds(0.83f));

        ClientAIMgr.Instance.AIPutCard();
        battleProxy.SetIsForbit(false);
        SendNotification(NotificationConstant.MEDI_BATTLE_PLAYACTTIP);
    }
Example #2
0
 /// <summary>
 /// 回退操作
 /// </summary>
 private void BackStepHandler()
 {
     GameMgr.Instance.StopAllCoroutines();
     battleProxy.isSkipTween = true;
     battleProxy.SetIsForbit(false);
     for (int i = 0; i < 5; i++)
     {
         if (curActionIndex <= 0)
         {
             gameMgrProxy.ReviseScaleTimeTo(battleProxy.report.actions[curActionIndex].actionTime - 2000);
             ApplicationFacade.Instance.SendNotification(NotificationConstant.MEDI_BATTLEVIEW_INITPLAYERCARDS);
             battleProxy.isSkipTween = false;
             return;
         }
         curActionIndex--;
         gameMgrProxy.ReviseScaleTimeTo(battleProxy.report.actions[curActionIndex].actionTime + 1);//防止回退后立即播放上一步
         BackSingleAction();
     }
     ApplicationFacade.Instance.SendNotification(NotificationConstant.MEDI_BATTLEVIEW_INITPLAYERCARDS);
     battleProxy.isSkipTween = false;
 }
Example #3
0
    /// <summary>
    /// 播放摸牌动画
    /// </summary>
    public IEnumerator PlayGetCard()
    {
        GameObject cardItem = null;

        if (GlobalData.hasHeap)
        {
            cardItem = (ApplicationFacade.Instance.RetrieveMediator(Mediators.BATTLE_AREA_MEDIATOR) as BattleAreaMediator).GetHeapCard(battleProxy.GetPlayerActS2C().actCard);
            cardItem.transform.SetParent(handCardContainer);
            cardItem.transform.localScale       = sendCard.transform.localScale;
            cardItem.transform.localEulerAngles = sendCard.transform.localEulerAngles;
        }
        else
        {
            cardItem = ResourcesMgr.Instance.GetFromPool(battleProxy.GetPlayerActS2C().actCard);
            cardItem.transform.SetParent(handCardContainer);
            cardItem.transform.localPosition    = sendCard.transform.localPosition;
            cardItem.transform.localScale       = sendCard.transform.localScale;
            cardItem.transform.localEulerAngles = sendCard.transform.localEulerAngles;
        }

        Vector3 targetPos = Vector3.zero;

        if (handCards.Count > 0)
        {
            targetPos = handCards[handCards.Count - 1].transform.localPosition + getHandCardGap;
        }
        else
        {
            targetPos = getCardContainer.localPosition;
        }

        if (_data.userId == playerInfoProxy.userID)
        {
            targetPos.y = 0;
            targetPos.z = 0;
        }
        if (getCard != null)
        {
            handCards.Add(getCard);
            getCard.transform.DOKill();
            getCard = null;
        }
        if (handCards.Count != _data.handCards.Count)
        {
            Debug.LogError("显示和数据不一致");
        }
        getCard = cardItem;
        if (battleProxy.isSkipTween)
        {
            cardItem.transform.localPosition = targetPos;
            if (_data.userId == playerInfoProxy.userID)
            {
                cardItem.layer = GlobalData.SELF_HAND_CARDS;
            }
            else if (dir == AreaDir.RIGHT)
            {
                cardItem.layer = GlobalData.RIGHT_HAND_CARDS;
            }
            else
            {
                cardItem.layer = GlobalData.OTHER_CARDS;
            }
            BattleAreaUtil.ResortHandGangGetCard(this);
        }
        else
        {
            cardItem.transform.DOLocalMove(targetPos, 0.1f);
            if (_data.userId == playerInfoProxy.userID)
            {
                cardItem.layer = GlobalData.SELF_HAND_CARDS;
            }
            else if (dir == AreaDir.RIGHT)
            {
                cardItem.layer = GlobalData.RIGHT_HAND_CARDS;
            }
            else
            {
                cardItem.layer = GlobalData.OTHER_CARDS;
            }
            battleProxy.SetIsForbit(true);
            yield return(new WaitForSeconds(0.15f));

            BattleAreaUtil.ResortHandGangGetCard(this);
            battleProxy.SetIsForbit(false);
        }
    }