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
        //---------------end--

        /// <summary>
        /// 检测是否可以一手全出所有手牌,如果可以自动全出。
        /// </summary>
        private bool CheckCanOutOneTime()
        {
            if (!_autoLastOut)
            {
                return(false);
            }

            var hdCds   = HdCdsListTemp.ToArray();
            var cdsType = PokerRuleUtil.GetCdsType(hdCds);

            if (cdsType == CardType.None || cdsType == CardType.Exception || cdsType == CardType.C411)
            {
                return(false);
            }
            //如果是飞机带单牌,查找是否含有炸弹,有则不自动出了
            if (cdsType == CardType.C11122234)
            {
                var sotedCds = PokerRuleUtil.GetSortedValues(hdCds);
                var cdNum    = 0;
                var curCd    = -1;
                if (ExistC42(sotedCds))
                {
                    return(false);
                }
                foreach (var cd in sotedCds)
                {
                    if (curCd != cd)
                    {
                        curCd = cd;
                        if (cdNum >= 4)
                        {
                            return(false);
                        }
                        cdNum = 1;
                        continue;
                    }
                    cdNum++;
                }
                if (cdNum >= 4)
                {
                    return(false);
                }
            }

            //赖子代表的牌
            var laiziRepCds = new[] { -1 };

            App.GetRServer <DdzGameServer>().ThrowOutCard(hdCds, laiziRepCds, (int)cdsType);
            return(true);
        }
Exemplo n.º 3
0
        //------------------------------------------------------------------------------------------------
        /// <summary>
        /// 当上一次玩家出牌不是自己时
        /// </summary>
        /// <param name="lastOutData">最后一次出牌的信息</param>
        /// <param name="isRejoin">标记是否是重连进入的</param>
        private void OnNotSelfOutCds(ISFSObject lastOutData, bool isRejoin = false)
        {
            //DDzUtil.ActiveBtn(BuYaoBtn, DisBuYaoBtn);
            DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn);
            //玩家剩余最后4张牌,牌型三带一,最后一次出牌信息三带二,特殊改为玩家三带二计算(特殊情况)
            var lastcdType = CardType.None;

            lastcdType = PokerRuleUtil.GetCdsType(lastOutData.GetIntArray(RequestKey.KeyCards));
            if (HdCdsListTemp.ToArray().Length == 4 && lastcdType == CardType.C32)
            {
                var sortedLastOutCd = PokerRuleUtil.GetSortedValues(HdCdsListTemp.ToArray());
                var dictoNum        = new Dictionary <int, int>();
                foreach (var cd in sortedLastOutCd)
                {
                    if (!dictoNum.ContainsKey(cd))
                    {
                        dictoNum[cd] = 1;
                        continue;
                    }
                    dictoNum[cd]++;
                }
                var dictoNumTwo = dictoNum;
                foreach (var cd in dictoNum.Keys.Where(cd => dictoNum[cd] == 1))
                {
                    dictoNumTwo[cd]++;
                    break;
                }
                List <int> TempHdCdsListTemp = new List <int>();
                foreach (var item in dictoNumTwo)
                {
                    for (int i = 0; i < item.Value; i++)
                    {
                        TempHdCdsListTemp.Add(item.Key);
                    }
                }
                endchupaiV(isRejoin, TempHdCdsListTemp, lastOutData);
            }
            else
            {
                endchupaiV(isRejoin, HdCdsListTemp, lastOutData);
            }

            var args = new HdCdCtrlEvtArgs(HdCdctrlInstance.GetUpCdList().ToArray());

            OnHdCdsCtrlEvent(null, args);
            _onoffIchosecCds = true;
        }
Exemplo n.º 4
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);
        }