Exemplo n.º 1
0
        /// <summary>
        /// 点击出牌按钮
        /// </summary>
        public void OnChuPaiClick()
        {
            //Debug.Log("<color=#0021FFFF>" + "点击出牌按钮点击出牌按钮点击出牌按钮点击出牌按钮点击出牌按钮点击出牌按钮" + "</color>");
            int[] cardArr = HdCdctrlInstance.GetUpCdList().ToArray();

            //判断是否需要检测黑三先出,如果手牌有黑三,出的牌没黑三不能出牌
            if (App.GetGameData <GlobalData>().IsHeiSanFirst)
            {
                bool hdhasHeisan = HdCdsListTemp.Any(cd => PokerRuleUtil.GetValue(cd) == 3 && PokerRuleUtil.GetColor(cd) == 4);

                if (hdhasHeisan)
                {
                    bool otcdHasHeisan = cardArr.Any(cd => PokerRuleUtil.GetValue(cd) == 3 && PokerRuleUtil.GetColor(cd) == 4);
                    if (!otcdHasHeisan)
                    {
                        ShowWarnInfo("有黑3必须先出黑3!");
                        return;
                    }
                }
            }

            if (_isRpLeftOne && cardArr.Length == 1 && HdCdsListTemp.Count > 1)
            {
                var cdsValue = PokerRuleUtil.GetSortedValues(HdCdsListTemp.ToArray());
                if (PokerRuleUtil.GetValue(cardArr[0]) != PokerRuleUtil.GetValue(cdsValue[cdsValue.Length - 1]))
                {
                    ShowWarnInfo("下家报单必须出最大!");
                    return;
                }
            }


            SendOutCdsRequest(cardArr);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 检查是不是最后一手牌的,3张,或者 3带1
        /// </summary>
        private bool CheckOutCdsC3OrC31()
        {
            var len = HdCdsListTemp.Count;

            switch (len)
            {
            //3张情况
            case 3:
                return(PokerRuleUtil.GetValue(HdCdsListTemp[0]) == PokerRuleUtil.GetValue(HdCdsListTemp[1]) &&
                       PokerRuleUtil.GetValue(HdCdsListTemp[1]) == PokerRuleUtil.GetValue(HdCdsListTemp[2]));

            //3带1情况
            case 4:

                var cdsValues = PokerRuleUtil.GetSortedValues(HdCdsListTemp.ToArray());
                return(cdsValues[0] == cdsValues[2] || cdsValues[1] == cdsValues[3]);
            }

            return(false);
        }