/// <summary> /// 设置赖子 /// </summary> /// <param name="_laizi"></param> public void SetLaizi(CardFace[] _laizi = null) { if (_laizi == null) { laizi = new CardFace[] { CardFace.BlackJoker, CardFace.RedJoker }; return; } laizi = _laizi; optimalCardCreater.SetLaizi(laizi); nextSlotCreater.SetLaizi(laizi); creater1.SetLaizi(laizi); creater2.SetLaizi(laizi); match.SetLaizi(laizi); }
/// <summary> /// 计算确定的牌型CardFaces /// </summary> /// <returns></returns> public CardFace[] ComputeCardFaces(CardFace[] cardFaces, ref CardsType cardsType) { CardsTypeInfo typeInfo; CardInfo[] cardInfos; CardFace[] removeLaizi = new CardFace[5]; CardFace[] computedCardFaces; CardFace[] resultCardFaces; CardFace[] cardFaces2; int idx = 0; if (cardsType == CardsType.None) { CardsTypeCreater creater = new CardsTypeCreater(); creater.SetLaizi(laizi); creater.CreateAllCardsTypeArray(cardFaces); typeInfo = creater.GetMaxScoreCardsTypeInfo(); cardsType = typeInfo.type; cardInfos = CardsTransform.Instance.CreateRemoveFaceValues(cardFaces, typeInfo.cardFaceValues); cardFaces2 = CardsTransform.Instance.CreateCardFaces(cardInfos); removeLaizi = new CardFace[5]; cardFaces2 = CardsTransform.Instance.RemoveLaiziByCount(cardFaces2, laizi, typeInfo.laiziCount, removeLaizi); computedCardFaces = ComputeCardFaces(typeInfo); resultCardFaces = new CardFace[cardFaces.Length]; for (int i = 0; i < computedCardFaces.Length; i++) { resultCardFaces[idx++] = computedCardFaces[i]; } for (int i = 0; i < cardFaces2.Length; i++) { resultCardFaces[idx++] = cardFaces2[i]; } return(resultCardFaces); } int laiziCount = 0; CardInfo[] cards = CardsTransform.Instance.CreateFormatCards(cardFaces, laizi, ref laiziCount); typeInfo = new CardsTypeInfo() { cardFaceValues = CardsTransform.Instance.CreateCardFaces(cards), laiziCount = laiziCount, type = cardsType }; cardInfos = CardsTransform.Instance.CreateRemoveFaceValues(cardFaces, typeInfo.cardFaceValues); cardFaces2 = CardsTransform.Instance.CreateCardFaces(cardInfos); removeLaizi = new CardFace[5]; cardFaces2 = CardsTransform.Instance.RemoveLaiziByCount(cardFaces2, laizi, typeInfo.laiziCount, removeLaizi); computedCardFaces = ComputeCardFaces(typeInfo); resultCardFaces = new CardFace[cardFaces.Length]; for (int i = 0; i < computedCardFaces.Length; i++) { resultCardFaces[idx++] = computedCardFaces[i]; } for (int i = 0; i < cardFaces2.Length; i++) { resultCardFaces[idx++] = cardFaces2[i]; } return(resultCardFaces); }