Пример #1
0
        public PokerPattern SelectSuperABCDE(PokerPattern lastABCDE, int heartHostCount, bool chaiPai)
        {
            if (lastABCDE == null || lastABCDE.IsNull)
            {
                lastABCDE = NULL_ABCDE;
            }

            List <SelectNode> selectChain = BuildSelectChain(lastABCDE);

            PokerPile selected =
                SelectNormal(PatternType.IsStraight(lastABCDE.Type), selectChain, 0, null, heartHostCount, chaiPai, 5);

            while (selected != null)
            {
                List <Poker> pokers = GetAllPokers(selected, true);
                if (pokers != null)
                {
                    return(_matcher.Match(pokers));
                }
                else
                {
                    var validator = (PRSelectRoot)selectChain[0].Validator;
                    validator.NumType = selected.NumType;
                    BuildPokerPool();
                    selected = SelectNormal(PatternType.IsStraight(lastABCDE.Type), selectChain, 0, null,
                                            heartHostCount,
                                            true, 5);
                }
            }

            return(PokerPattern.NULL);
        }
Пример #2
0
        private void SetLastChuPai(SeatPosition seatPos, PokerPattern lastChuPai, int sex, bool withEffect = true)
        {
            if (lastChuPai == null)
            {
                return;
            }

            var value   = new PatternValue(GetCurrentHost);
            var matcher = new PatternMatcher(value);
            var pattern = matcher.Match(PokerLogicUtil.ToPokerList(lastChuPai.pokers));
            var pokers  = PokerLogicUtil.ConvertToPokerList(pattern, value);

            SetLastChuPai(seatPos, pokers, sex, withEffect);
        }
Пример #3
0
        private void SetLastChuPai(SeatPosition seatPos, List <Poker> lastChuPai, int sex, bool withEffect = true)
        {
            if (seatPos == SeatPosition.Null)
            {
                return;
            }

            var chuPai = GetLastChuPai(seatPos);

            if (PokerLogicUtil.PokerListEqual(chuPai, lastChuPai))
            {
                // 如果现在要显示的牌,和当前的牌相等的话,就不需要再显示了。
                return;
            }

            SetLastChuPai(seatPos, lastChuPai);

            var slots   = GetLastChuPaiSlots(seatPos);
            var buChu   = GetBuChuImage(seatPos);
            var basePos = GetBasePos(seatPos);

            if (slots.Count > 0)
            {
                for (int i = 0; i < slots.Count; i++)
                {
                    SetSlotIdle(slots[i]);
                }

                slots.Clear();
            }

            if (lastChuPai == null || lastChuPai.Count <= 0)
            {
                var tweener = GetBuChuTweener(seatPos);

                if (tweener != null)
                {
                    tweener.Kill();
                }

                if (buChu)
                {
                    buChu.sprite = BuChuSprite;
                    if (!buChu.gameObject.activeSelf)
                    {
                        // 只有没显示的情况下,才显示动画。
                        tweener = StartBuChuAnimation(buChu.transform);
                        SetBuChuTweener(seatPos, tweener);
                    }
                }

                if (withEffect)
                {
                    _soundController.PlayBuChuSound();
                    _soundController.PlayChuPaiSound(PokerLogic.PokerPattern.BUCHU, sex);
                }

                return;
            }

            if (buChu && buChu.gameObject.activeSelf)
            {
                buChu.gameObject.SetActive(false);
            }

            foreach (var p in lastChuPai)
            {
                var slot = GetSlot();
                if (slot)
                {
                    slot.Poker = p;
                    slots.Add(slot);
                }
            }

            // SortSlot(slots);
            UpdateSlotPosition(basePos, slots);

            if (withEffect)
            {
                var value   = new PatternValue(GetCurrentHost);
                var matcher = new PatternMatcher(value);

                var matched = matcher.Match(lastChuPai);
                if (matched != null && !matched.IsNull)
                {
                    _soundController.PlayChuPaiSound(matched, sex);
                    GameWindow.ShowChuPaiEffect(matched);
                }
            }
        }