Exemplo n.º 1
0
    /// <summary>
    /// 播放直接碰杠动作
    /// </summary>
    public void PlayCommonPengGang()
    {
        GameObject pengedCard = null;

        pengedCard = getCard;
        getCard    = null;
        if (_data.userId != playerInfoProxy.userID)
        {
            ResourcesMgr.Instance.SetCardMesh(pengedCard, battleProxy.GetPlayerActS2C().actCard);
        }

        for (int i = 0; i < pengGangCards.Count; i++)
        {
            if (BattleAreaUtil.GetMeshCardValue(pengGangCards[i][0]) == battleProxy.GetPlayerActS2C().actCard)
            {
                pengGangCards[i].Add(pengedCard);
                pengedCard.transform.SetParent(pengGangCardContainer);
                for (int j = 0; j < pengGangCards[i].Count; j++)
                {
                    ResourcesMgr.Instance.SetCardMesh(pengGangCards[i][j], battleProxy.GetPlayerActS2C().actCard);
                }
                break;
            }
        }

        BattleAreaUtil.ResortCard(this);
    }
Exemplo n.º 2
0
    /// <summary>
    /// 播放直接暗杠
    /// </summary>
    public void PlayCommonAnGang()
    {
        List <GameObject> gangCards = new List <GameObject>();

        if (getCard != null)
        {
            gangCards.Add(getCard);
            getCard.transform.DOKill();
        }
        getCard = null;
        if (_data.userId == playerInfoProxy.userID || battleProxy.isReport)//自己暗杠找到真正的牌暗杠
        {
            for (int i = 0; i < handCards.Count;)
            {
                if (BattleAreaUtil.GetMeshCardValue(handCards[i]) == battleProxy.GetPlayerActS2C().actCard)
                {
                    gangCards.Add(handCards[i]);
                    handCards.RemoveAt(i);
                }
                else
                {
                    i++;
                }
            }
        }
        else//不是自己暗杠随机找牌暗杠
        {
            var randomIndex = UnityEngine.Random.Range(0, handCards.Count - 3);
            gangCards.Add(handCards[randomIndex]);
            gangCards.Add(handCards[randomIndex + 1]);
            gangCards.Add(handCards[randomIndex + 2]);
            handCards.RemoveAt(randomIndex);
            handCards.RemoveAt(randomIndex);
            handCards.RemoveAt(randomIndex);
            foreach (GameObject gangCard in gangCards)
            {
                ResourcesMgr.Instance.SetCardMesh(gangCard, battleProxy.GetPlayerActS2C().actCard);
            }
        }
        foreach (GameObject card in gangCards)
        {
            card.transform.SetParent(pengGangCardContainer);
        }
        pengGangCards.Add(gangCards);
        BattleAreaUtil.ResortCard(this);
    }
Exemplo n.º 3
0
    /// <summary>
    /// 播放吃的动作
    /// </summary>
    public void PlayChi(GameObject chiedCard)
    {
        chiedCard.transform.DOKill();
        List <GameObject> chiCards = new List <GameObject>();

        chiCards.Add(chiedCard);
        List <int> chiCardArr = new List <int>();

        chiCardArr.Add(battleProxy.GetPlayerActS2C().actCard);
        chiCardArr.AddRange(battleProxy.GetPlayerActS2C().chiCards);
        chiCardArr.Sort();
        if (_data.userId == playerInfoProxy.userID || battleProxy.isReport) //自己碰找到真正的牌碰
        {
            for (int i = 0; i < battleProxy.GetPlayerActS2C().chiCards.Count; i++)
            {
                for (int j = 0; j < handCards.Count; j++)
                {
                    if (BattleAreaUtil.GetMeshCardValue(handCards[j]) == battleProxy.GetPlayerActS2C().chiCards[i])
                    {
                        chiCards.Add(handCards[j]);
                        handCards.RemoveAt(j);
                        break;
                    }
                }
            }
        }
        else
        {
            var randomIndex = UnityEngine.Random.Range(0, handCards.Count - 2);
            chiCards.Add(handCards[randomIndex]);
            chiCards.Add(handCards[randomIndex + 1]);
            handCards.RemoveAt(randomIndex);
            handCards.RemoveAt(randomIndex);
        }
        for (int i = 0; i < chiCards.Count; i++)
        {
            ResourcesMgr.Instance.SetCardMesh(chiCards[i], chiCardArr[i]);
        }
        foreach (GameObject card in chiCards)
        {
            card.transform.SetParent(pengGangCardContainer);
        }
        pengGangCards.Add(chiCards);
        BattleAreaUtil.ResortCard(this);
    }
Exemplo n.º 4
0
    /// <summary>
    /// 播放碰的动作
    /// </summary>
    public void PlayPeng(GameObject pengedCard)
    {
        List <GameObject> pengCards = new List <GameObject>();

        pengedCard.transform.DOKill();
        pengCards.Add(pengedCard);
        if (_data.userId == playerInfoProxy.userID || battleProxy.isReport) //自己碰找到真正的牌碰
        {
            for (int i = 0; i < handCards.Count;)
            {
                if (BattleAreaUtil.GetMeshCardValue(handCards[i]) == battleProxy.GetPlayerActS2C().actCard)
                {
                    pengCards.Add(handCards[i]);
                    handCards.RemoveAt(i);
                }
                else
                {
                    i++;
                }
                if (pengCards.Count == 3)
                {
                    break;
                }
            }
        }
        else
        {
            var randomIndex = Random.Range(0, handCards.Count - 2);
            pengCards.Add(handCards[randomIndex]);
            pengCards.Add(handCards[randomIndex + 1]);
            handCards.RemoveAt(randomIndex);
            handCards.RemoveAt(randomIndex);
            foreach (GameObject pengCard in pengCards)
            {
                ResourcesMgr.Instance.SetCardMesh(pengCard, battleProxy.GetPlayerActS2C().actCard);
            }
        }
        foreach (GameObject card in pengCards)
        {
            card.transform.SetParent(pengGangCardContainer);
        }
        pengGangCards.Add(pengCards);
        BattleAreaUtil.ResortCard(this);
    }
Exemplo n.º 5
0
    /// <summary>
    /// 播放回头碰杠动作
    /// </summary>
    public void PlayBackPengGang()
    {
        GameObject pengedCard = null;

        if (_data.userId == playerInfoProxy.userID || battleProxy.isReport)
        {
            for (int i = 0; i < handCards.Count; i++)
            {
                if (BattleAreaUtil.GetMeshCardValue(handCards[i]) == battleProxy.GetPlayerActS2C().actCard)
                {
                    pengedCard = handCards[i];
                    handCards.RemoveAt(i);
                    break;
                }
            }
        }
        else
        {
            var randomIndex = UnityEngine.Random.Range(0, handCards.Count - 1);
            pengedCard = handCards[randomIndex];
            handCards.RemoveAt(randomIndex);
        }

        for (int i = 0; i < pengGangCards.Count; i++)
        {
            if (BattleAreaUtil.GetMeshCardValue(pengGangCards[i][0]) == battleProxy.GetPlayerActS2C().actCard)
            {
                pengGangCards[i].Add(pengedCard);
                pengedCard.transform.SetParent(pengGangCardContainer);
                for (int j = 0; j < pengGangCards[i].Count; j++)
                {
                    ResourcesMgr.Instance.SetCardMesh(pengGangCards[i][j], battleProxy.GetPlayerActS2C().actCard);
                }
                break;
            }
        }
        BattleAreaUtil.ResortCard(this);
    }
Exemplo n.º 6
0
 /// <summary>
 /// 播放过的动作
 /// </summary>
 public void PlayPass()
 {
     BattleAreaUtil.ResortCard(this);
 }
Exemplo n.º 7
0
    /// <summary>
    /// 播放出牌动作
    /// </summary>
    public IEnumerator PlayPutCard()
    {
        var        cardValue = battleProxy.GetPlayerActS2C().actCard;
        GameObject putCard   = null;

        if (getCard != null)
        {
            handCards.Add(getCard);
            getCard.transform.DOKill();
            getCard = null;
        }
        if (_data.userId == playerInfoProxy.userID || battleProxy.isReport)
        {
            for (int i = 0; i < handCards.Count; i++)
            {
                if (selectCardInstance == handCards[i].GetInstanceID() && BattleAreaUtil.GetMeshCardValue(handCards[i]) == battleProxy.GetPlayerActS2C().actCard)
                {
                    putCard = handCards[i];
                    handCards.RemoveAt(i);
                    break;
                }
            }
            if (putCard == null)
            {
                for (int i = 0; i < handCards.Count; i++)
                {
                    if (BattleAreaUtil.GetMeshCardValue(handCards[i]) == battleProxy.GetPlayerActS2C().actCard)
                    {
                        putCard = handCards[i];
                        handCards.RemoveAt(i);
                        break;
                    }
                }
            }
            if (_data.userId == playerInfoProxy.userID || battleProxy.isReport)
            {
                for (int i = 0; i < handCards.Count; i++)
                {
                    handCards[i].name = "HandCard" + i;
                }
                handCards.Sort(BattleAreaUtil.CompareCard);
            }
        }
        else
        {
            var randomIndex = Random.Range(0, handCards.Count - 1);
            putCard = handCards[randomIndex];
            handCards.RemoveAt(randomIndex);
            ResourcesMgr.Instance.SetCardMesh(putCard, cardValue);
        }
        putCards.Add(putCard);
        var selfInfoVO = battleProxy.playerIdInfoDic[playerInfoProxy.userID];
        var sitIndex   = (_data.sit - selfInfoVO.sit + GlobalData.SIT_NUM) % GlobalData.SIT_NUM;

        GameMgr.Instance.StartCoroutine(AudioSystem.Instance.PlayEffectAudio(string.Format("Voices/{0}/Card/{1}", _data.sex == 1 ? "Man" : "Woman", cardValue)));
        if (battleProxy.isSkipTween)
        {
            BattleAreaUtil.ResortCard(this);
            ApplicationFacade.Instance.SendNotification(NotificationConstant.TING_UPDATE);
            ApplicationFacade.Instance.SendNotification(NotificationConstant.SHOW_CARD_ARROW, this);
            yield break;
        }
        battleProxy.SetIsForbit(true);
        putCard.transform.DOKill();
        if (sitIndex == 1)
        {
            putCard.transform.localEulerAngles = new Vector3(0, -60, 90);
            putCard.transform.DOScale(Vector3.one * 3, 0.14f);
        }
        else if (sitIndex == 2)
        {
            putCard.transform.localEulerAngles = new Vector3(0, 0, 180);
            putCard.transform.DOScale(Vector3.one * 1.5f, 0.14f);
        }
        else if (sitIndex == 3)
        {
            putCard.transform.localEulerAngles = new Vector3(0, 60, -90);
            putCard.transform.DOScale(Vector3.one * 3, 0.14f);
        }
        else
        {
            putCard.transform.DOScale(Vector3.one * 1.5f, 0.14f);
        }
        putCard.transform.DOLocalMove(sendCard.localPosition, 0.14f);
        yield return(new WaitForSeconds(0.25f));

        putCard.transform.SetParent(putCardContainer);
        var anglePosition = BattleAreaUtil.GetPutCardPosition(this, putCards.Count - 1);

        putCard.transform.localEulerAngles = anglePosition[0];
        putCard.transform.DOLocalMove(anglePosition[1], 0.1f);
        putCard.transform.DOScale(Vector3.one, 0.1f);
        yield return(new WaitForSeconds(0.1f));

        GameMgr.Instance.StartCoroutine(AudioSystem.Instance.PlayEffectAudio("Voices/Effect/PutCard"));
        BattleAreaUtil.ResortCard(this);
        ApplicationFacade.Instance.SendNotification(NotificationConstant.TING_UPDATE);
        battleProxy.SetIsForbit(false);
        ApplicationFacade.Instance.SendNotification(NotificationConstant.SHOW_CARD_ARROW, this);

        if (PlayerPrefs.GetInt(battleProxy.GetPlayerActS2C().userId.ToString()) == 1)
        {
            SetHandCardsGray(null, true);
        }
    }