Пример #1
0
    void ProcessReady(JSONObject messageObj)
    {
        string         uid    = messageObj["body"].ToString();
        GameObject     player = GameObject.Find(_nnPlayerName + uid);
        TBTWPlayerCtrl ctrl   = player.GetComponent <TBTWPlayerCtrl>();

        //去掉牌型显示
        if (uid == EginUser.Instance.uid)
        {
            //StartCoroutine(ctrl.SetDeal(false, null));
            ctrl.SetDeal(false, null);
            ctrl.SetCardTypeUser(null, 0);
            ctrl.SetScore(-1);
        }
        else
        {
            //如果主玩家已经重新开始,则清除当前用户的牌型显示
            if (!btnBegin.activeSelf)
            {
                //StartCoroutine(ctrl.SetDeal(false, null));
                ctrl.SetDeal(false, null);
                ctrl.SetCardTypeOther(null, 0);
                ctrl.SetScore(-1);
            }
        }

        //显示准备
        ctrl.SetReady(true);
        _playingPlayerList.Add(player);
    }
Пример #2
0
    /// <summary>
    /// Processes the deal.(带发牌动画)
    /// </summary>
    /// <returns>The deal.</returns>
    /// <param name="messageObj">Message object.</param>
    IEnumerator ProcessDeal(JSONObject messageObj)
    {
        //游戏已经开始
        _isPlaying = true;
        foreach (GameObject player in _readyPlayerList)
        {
            if (!_playingPlayerList.Contains(player))
            {
                Debug.Log(player.name);
                _playingPlayerList.Add(player);
            }
        }
        _readyPlayerList.Clear();

        StartCoroutine(TimeAnimation());
        //清除未被清除的牌
        foreach (GameObject player in _playingPlayerList)
        {
            if (player != null && player != userPlayerObj)
            {
                TBTWPlayerCtrl ctrl = player.GetComponent <TBTWPlayerCtrl>();
                //StartCoroutine(ctrl.SetDeal(false, null));
                ctrl.SetDeal(false, null);
                ctrl.SetCardTypeOther(null, 0);
                ctrl.SetScore(-1);
            }
        }
        //去掉“准备”
        foreach (GameObject player in _playingPlayerList)
        {
            if (player != null)
            {
                player.GetComponent <TBTWPlayerCtrl>().SetReady(false);
            }
        }
        //去掉筹码显示
        foreach (GameObject player in _playingPlayerList)
        {
            if (player != null)
            {
                player.GetComponent <TBTWPlayerCtrl>().SetBet(0);
            }
        }
        EginTools.PlayEffect(soundXiazhu);

        JSONObject        body  = messageObj["body"];
        List <JSONObject> cards = body["cards"].list;
        int chip = (int)body["chip"].n;
        int t    = (int)body["t"].n;

        TBTWCount.Instance.UpdateHUD(t);
        //下注
        foreach (GameObject player in _playingPlayerList)
        {
            if (player != null)
            {
                TBTWPlayerCtrl ctrl = player.GetComponent <TBTWPlayerCtrl>();

                ctrl.SetBet(chip);
                ctrl.SetUserChip(chip);
            }
        }

        //发牌
        foreach (GameObject player in _playingPlayerList)
        {
            if (player != null)
            {
                TBTWPlayerCtrl ctrl = player.GetComponent <TBTWPlayerCtrl>();
                ctrl.SetBet(chip);
                ctrl.SetUserChip(chip);
                if (player == userPlayerObj)
                {
                    //StartCoroutine(ctrl.SetDeal(true, cards));
                    ctrl.SetDeal(true, cards);
                }
                else
                {
                    //StartCoroutine(ctrl.SetDeal(true, null));
                    ctrl.SetDeal(true, null);
                }
            }
        }

        yield return(new WaitForSeconds(2.5f));

        //非late进入时才显示摊牌按钮
        if (!_late)
        {
            if (SettingInfo.Instance.deposit == true)
            {
                yield return(new WaitForSeconds((_playingPlayerList.Count * 0.5f)));

                UserShow();
            }
        }
    }