Example #1
0
        private bool CheckOutCdsC1112223434(List <int> HdCdsListTemp)
        {
            var len = HdCdsListTemp.Count;

            if (len >= 6)
            {
                var hdcdSplitGp = new CdSplitStruct(HdCdsListTemp.ToArray());

                var sanLianList = new List <int>();
                sanLianList.AddRange(hdcdSplitGp.ThreeCds);
                sanLianList.AddRange(hdcdSplitGp.FourCds);

                sanLianList.Sort();
                var posbLian    = PokerRuleUtil.GetAllPossibleShun(sanLianList.ToArray(), 2);
                var posbLianLen = posbLian.Count;
                if (posbLian.Count < 1)
                {
                    return(false);
                }
                //找到最长的三连
                posbLian.Sort(DDzUtil.SortCdsintesByLen);

                //最终得到最大三连牌长度
                var maxThreeLianCdsLen = posbLian[posbLianLen - 1].Length;

                if ((len - maxThreeLianCdsLen * 3) <= (maxThreeLianCdsLen * 2))
                {
                    return(true);
                }
            }

            return(false);
        }
Example #2
0
        /// <summary>
        /// 检测是否可以一次把牌全出去的牌型
        /// </summary>
        private CardType CheckCanOutCdsOneTime(CdSplitStruct hdcdSplitGp)
        {
            var cdType = PokerRuleUtil.GetCdsType(HdCdsListTemp.ToArray());

            //如果可以一次出,则直接全出
            if (cdType != CardType.None && cdType != CardType.Exception)
            {
                GlobalData.ServInstance.ThrowOutCard(HdCdsListTemp.ToArray(), new int[] { -1 }, (int)cdType);
                return(cdType);
            }

            //如果是3张或者3带1的情况直接发送出牌信息
            if (CheckOutCdsC3OrC31())
            {
                GlobalData.ServInstance.ThrowOutCard(HdCdsListTemp.ToArray(), new int[] { -1 }, (int)CardType.C32);
                return(CardType.C32);
            }

            if (CheckOutCdsC1112223434(hdcdSplitGp))
            {
                GlobalData.ServInstance.ThrowOutCard(HdCdsListTemp.ToArray(), new int[] { -1 }, (int)CardType.C1112223434);
                return(CardType.C1112223434);
            }

            return(CardType.None);
        }
Example #3
0
        /// <summary>
        /// 显示按钮,并disable所有按钮
        /// </summary>
        private void DisableAllBtns()
        {
            //DDzUtil.DisableBtn(BuYaoBtn, DisBuYaoBtn);
            DDzUtil.DisableBtn(TiShiBtn, DisTiShiBtn);
            DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn);

            var hdcdSplitGp = new CdSplitStruct(HdCdsListTemp.ToArray());

            //如果含有炸弹则跳过
            if (hdcdSplitGp.FourCds.Count < 1)
            {
                var canOutType = CheckCanOutCdsOneTime(hdcdSplitGp);
                //防止发送消息不成功,直接点亮出牌按钮,让玩家有再次发送的机会
                if (canOutType != CardType.None && canOutType != CardType.Exception)
                {
                    HdCdctrlInstance.UpAllHandCds();
                    DDzUtil.ActiveBtn(ChuPaiBtn, DisChuPaiBtn);
                    return;
                }
            }

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

            OnHdCdsCtrlEvent(null, args);
            _onoffIchosecCds = true;
        }
Example #4
0
        /// <summary>
        /// 检查飞机带2张
        /// </summary>
        /// <param name="cdsTypeDic"></param>
        /// <param name="cdSplit"></param>
        private void CheckC1112223434(ref Dictionary <int[], CardType> cdsTypeDic, CdSplitStruct cdSplit)
        {
            var listTemp = new List <int>();

            listTemp.AddRange(cdSplit.ThreeCds);
            listTemp.AddRange(cdSplit.FourCds);

            var allshunList = PokerRuleUtil.AnalyAllPartOfShun(listTemp.ToArray(), 2);


            var dancds = cdSplit.DanCds;
            //存在于三顺中的4牌
            var fourInDanCds = new List <int>();
            //把对子分解成单牌
            var duiToDanCds = new List <int>();

            foreach (var duiCd in cdSplit.DuiCds)
            {
                duiToDanCds.AddRange(new int[] { duiCd, duiCd });
            }
            //不存在与三顺中的3牌
            var threeToDancds = new List <int>();
            //不存在三顺中的4牌
            var fourToDanCds = new List <int>();

            var otherPartCdsList = new List <int>();

            foreach (var pureSanValues in allshunList)
            {
                threeToDancds.Clear();
                var values = pureSanValues;
                foreach (var threeCd in cdSplit.ThreeCds.Where(threeCd => !values.Contains(threeCd)))
                {
                    threeToDancds.AddRange(new int[] { threeCd, threeCd, threeCd });
                }

                fourInDanCds.Clear();
                fourToDanCds.Clear();
                foreach (var fcd in cdSplit.FourCds)
                {
                    if (!values.Contains(fcd))
                    {
                        fourToDanCds.AddRange(new int[] { fcd, fcd, fcd, fcd });
                    }
                    else
                    {
                        fourInDanCds.Add(fcd);
                    }
                }

                otherPartCdsList.Clear();
                otherPartCdsList.AddRange(dancds);
                otherPartCdsList.AddRange(fourInDanCds);
                otherPartCdsList.AddRange(duiToDanCds);
                otherPartCdsList.AddRange(threeToDancds);
                otherPartCdsList.AddRange(fourToDanCds);

                var sanLen = pureSanValues.Length;
                if (otherPartCdsList.Count * 2 >= sanLen)
                {
                    var c1112223434Cds = new List <int>();
                    var otherptCds     = new List <int>();
                    int j = 0;
                    for (var i = 0; i < sanLen; i++)
                    {
                        //添加三连部分
                        c1112223434Cds.AddRange(new int[] { pureSanValues[i], pureSanValues[i], pureSanValues[i] });
                        otherptCds.Add(otherPartCdsList[j++]);
                        otherptCds.Add(otherPartCdsList[j++]);
                    }
                    c1112223434Cds.AddRange(otherptCds);
                    cdsTypeDic[c1112223434Cds.ToArray()] = CardType.C1112223434;
                }
            }
        }