示例#1
0
        /// <summary>
        /// 最终检测手牌
        /// </summary>
        /// <param name="isgetcdsWithoutCompare">是不是在没有其他人出牌情况下</param>
        private void FinalOutCdsCheck(bool isgetcdsWithoutCompare)
        {
            //经过智能检索后最后检查一遍抬出的牌是否合法----start---

            var finalType = PokerRuleUtil.GetCdsType(HdCdctrlInstance.GetUpCdList().ToArray());

            if (finalType != CardType.None && finalType != CardType.Exception)
            {
                //如果选出的牌型不是那种单牌,或者对子的小牌型,就先关闭智能选牌
                if (isgetcdsWithoutCompare && finalType != CardType.C1 && finalType != CardType.C2)
                {
                    _onoffIchosecCds = false;
                }
                else if (!isgetcdsWithoutCompare)
                {
                    _onoffIchosecCds = false;
                }

                DDzUtil.ActiveBtn(ChuPaiBtn, DisChuPaiBtn);
            }
            else
            {
                DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn);
            }

            //------------end
        }
示例#2
0
        /// <summary>
        /// 当玩家有对手牌进行点击操作时
        /// </summary>
        /// <param name="args"></param>
        private void OnHdCdsCtrlEvent(HdCdCtrlEvtArgs args)
        {
            //如果不该自己行动
            if (!_isMyTurn)
            {
                return;
            }

            //如果没有选牌
            if (args.SelectedCds.Length == 0)
            {
                if (ChuPaiBtn.activeSelf)
                {
                    SetBtnState(ChuPaiBtn, false);
                }

                _onoffIchosecCds = true;
                return;
            }

            var selectedCds = args.SelectedCds;

            var lastOutCds = _lastOutData.GetIntArray(RequestKey.KeyCards);

            //-----------------------start 智能选牌过程-------有赖子,或者开关关闭则不用智能选牌----------------------------
            bool isgetcdsWithoutCompare = false;    //标记是不是在自己出动出牌时做出的智能选牌

            int[] mayOutCds      = null;
            bool  selCdshasLaizi = PokerRuleUtil.CheckHaslz(selectedCds);

            if (!selCdshasLaizi && _onoffIchosecCds)
            {
                if (_lastOutData.GetInt(RequestKey.KeySeat) == App.GetGameData <DdzGameData>().SelfSeat)
                {
                    mayOutCds = _checkCardTool.GetcdsWithOutCompare(selectedCds, HdCdsListTemp.ToArray());
                    isgetcdsWithoutCompare = true;
                }
                else
                {
                    SetBtnActive(BuYaoBtn, true);
                    mayOutCds = _checkCardTool.ChkCanoutCdListWithLastCdList(selectedCds,
                                                                             _cardManager.GetTishiGroupDic, lastOutCds);
                }
            }
            //---------------------------------------------------------------------------------------end


            /*            //---start---------------使智能选牌出了相同的牌型,不重复执行-----------------------
             *          var haschosemayOutCds = DDzUtil.IsTwoArrayEqual(HdCdsCtrl.SortCds(_mayoutCdsTemp), HdCdsCtrl.SortCds(mayOutCds));
             *          _mayoutCdsTemp = mayOutCds;
             *          //如果上次智能选牌和本次相同,则直接取消一次智能选牌
             *          if (haschosemayOutCds)
             *          {
             *              mayOutCds = null;
             *          }
             *          //----------------------------------------------------------------------------------end*/



            if (mayOutCds == null || mayOutCds.Length == 0)
            {
                bool isMatch;

                //如果_lastOutData不是自己出牌
                if (_lastOutData.GetInt(RequestKey.KeySeat) != App.GetGameData <DdzGameData>().SelfSeat)
                {
                    var lastoutcds = new List <int>();

                    if (lastOutCds != null)
                    {
                        lastoutcds.AddRange(lastOutCds);
                    }

                    var cardTypeDic = _cardManager.GetAutoCardsList(selectedCds, selCdshasLaizi, lastoutcds.ToArray());
                    isMatch = cardTypeDic != null && cardTypeDic.Count > 0;
                }
                else
                {
                    var cardTypeDic = _cardManager.GetAutoCardsList(selectedCds, selCdshasLaizi, null);
                    isMatch = cardTypeDic != null && cardTypeDic.Count > 0;
                }

                if (isMatch)
                {
                    HdCdctrlInstance.UpCdList(selectedCds);
                }
                else
                {
                    if (ChuPaiBtn.activeSelf)
                    {
                        SetBtnState(ChuPaiBtn, false);
                    }
                    //DDzUtil.DisableBtn(ChuPaiBtn, DisChuPaiBtn);
                    return;
                }
            }
            else
            {
                if (!ChooseMayOutCards(mayOutCds, selectedCds)) //如果选中的牌不能出
                {
                    if (ChuPaiBtn.activeSelf)
                    {
                        SetBtnState(ChuPaiBtn, false);
                    }
                    return;
                }
            }


            //经过智能检索后最后检查一遍抬出的牌是否合法----start---

            var finalType = PokerRuleUtil.GetCdsType(HdCdctrlInstance.GetUpCdList().ToArray());

            SetBtnState(ChuPaiBtn, true);
            //DDzUtil.ActiveBtn(ChuPaiBtn, DisChuPaiBtn);

            if (finalType != CardType.None && finalType != CardType.Exception)
            {
                //如果选出的牌型不是那种单牌,或者对子的小牌型,就先关闭智能选牌
                if (isgetcdsWithoutCompare && finalType != CardType.C1 && finalType != CardType.C2)
                {
                    _onoffIchosecCds = false;
                }
                else if (!isgetcdsWithoutCompare)
                {
                    _onoffIchosecCds = false;
                }
            }


            //------------end
        }