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); }
public PokerAI(PatternMatcher matcher, PatternValue value) { _matcher = matcher; _value = value; }
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); } } }