//检测能不能胡
 public static bool IsCanHu(this FiveStarPlayer fiveStarPlayer, int card = 0, int playCardIndex = 0)
 {
     if (card > 0)
     {
         fiveStarPlayer.Hands.Add(card);
     }
     fiveStarPlayer.boolData = CardFiveStarHuPaiLogic.IsHuPai(fiveStarPlayer.Hands);
     //不是自摸要判断 是否是平胡
     if (fiveStarPlayer.boolData && card > 0)
     {
         //如果有一家亮倒 可以胡
         if (fiveStarPlayer.IsLiangDao || fiveStarPlayer.FiveStarRoom.FiveStarPlayerDic[playCardIndex].IsLiangDao)
         {
         }
         //如果没有亮倒 并且胡牌的倍数小于 最小放冲胡的倍数就不能胡
         else if (CardFiveStarHuPaiLogic.GetMultiple(fiveStarPlayer.Hands, fiveStarPlayer.PengGangs, card, fiveStarPlayer.FiveStarRoom.IsGangShangCard) < FiveStarRoom.FaangChongHuMinHuCardMultiple)
         {
             fiveStarPlayer.boolData = false;
         }
     }
     if (card > 0)
     {
         fiveStarPlayer.Hands.Remove(card);
     }
     return(fiveStarPlayer.boolData);
 }
        //检测是否能胡牌并显示胡牌提示
        public void DetectionIsTingCard(IList <int> hands)
        {
            List <int> tingCards = CardFiveStarHuPaiLogic.IsTingPai(hands);

            if (tingCards.Count > 0)
            {
                UIComponent.GetUiView <FiveStarMingPaiHintPanelComponent>().ShowSelfTingHuCardHint(tingCards);
            }
        }
Пример #3
0
        //亮倒
        public void Video_LiangDao()
        {
            IsLiangDao = true;
            OperationSpecialMgr.Ins.ShowSpecial(FiveStarOperateType.Liang, _OperationSpecialPoint);
            List <int> tingCards = CardFiveStarHuPaiLogic.IsTingPai(_VideoHands);

            //显示亮牌图标
            UIComponent.GetUiView <FiveStarMingPaiHintPanelComponent>().Video_ShowMIngCardHint(ClientSeatIndex, tingCards);
        }
        //显示亮倒的牌
        public virtual void ShowLiangDaoCards(RepeatedField <int> cards)
        {
            RepeatedField <RepeatedField <int> > liangDaoCards = CardFiveStarHuPaiLogic.GetLiangDaoNoneHuCards(cards);

            ClearLiangCards();
            AddLiangCards(AnGangCardType, liangDaoCards[1]);
            liangDaoCards[0].Sort();
            AddLiangCards(LaingCardType, liangDaoCards[0]);
        }
Пример #5
0
        //获取亮倒无关牌 和可以胡的牌 返回 是否可以亮牌
        public static bool IsCanLiangDaoAndHuCardsAndNoneCards(this FiveStarPlayer fiveStarPlayer)
        {
            List <int> huCards = CardFiveStarHuPaiLogic.IsTingPai(fiveStarPlayer.Hands);

            if (huCards.Count > 0)
            {
                fiveStarPlayer.LiangDaoNoneCards = CardFiveStarHuPaiLogic.GetLiangDaoNoneHuCards(fiveStarPlayer.Hands)[1];
                fiveStarPlayer.FiveStarRoom.AddLiangDaoCanHuCards(huCards);
            }
            return(huCards.Count > 0);
        }
Пример #6
0
 //广播玩家买码
 public static int BoradcastPlayerMaiMa(this FiveStarRoom fiveStarRoom)
 {
     if (fiveStarRoom.ResidueCards.Count > 0)
     {
         Actor_FiveStar_MaiMa actorFiveStarMaiMa = new Actor_FiveStar_MaiMa();
         actorFiveStarMaiMa.Card = fiveStarRoom.ResidueCards[fiveStarRoom.ResidueCards.Count - 1];
         fiveStarRoom.MaiMaCard  = actorFiveStarMaiMa.Card;//记录买马的牌
         int maiMaMulttiple = CardFiveStarHuPaiLogic.GetMaiMaMultiple(actorFiveStarMaiMa.Card);
         actorFiveStarMaiMa.Score = maiMaMulttiple * fiveStarRoom.RoomConfig.BottomScore;
         fiveStarRoom.RecordMaiMa(actorFiveStarMaiMa);//记录买马信息
         fiveStarRoom.BroadcastMssagePlayers(actorFiveStarMaiMa);
         return(maiMaMulttiple);
     }
     return(0);
 }
Пример #7
0
        //玩家胡牌获取胡牌的类型和 总倍数
        public static RepeatedField <int> GetHuPaiType(this FiveStarPlayer fiveStarPlayer, int winCard, ref int totalMultiple)
        {
            fiveStarPlayer.boolData = fiveStarPlayer.Hands.Count % 3 == 1;//如果是1证明需要 赢的那张牌 才能形成胡牌
            if (fiveStarPlayer.boolData)
            {
                fiveStarPlayer.Hands.Add(winCard);
            }
            RepeatedField <int> types = CardFiveStarHuPaiLogic.GetHuPaiTypes(fiveStarPlayer.Hands, fiveStarPlayer.PengGangs, winCard, fiveStarPlayer.FiveStarRoom.IsGangShangCard);

            totalMultiple = CardFiveStarHuPaiLogic.GetMultiple(types, fiveStarPlayer.FiveStarRoom.RoomConfig.FengDingFanShu);
            if (fiveStarPlayer.boolData)
            {
                fiveStarPlayer.Hands.Remove(winCard);
            }
            return(types);
        }
        //检测出牌的胡牌提示和 是否可以亮倒
        public void DetectionChuCardHintAndLiang()
        {
            _isSelectLiang = false;
            if (CardFiveStarRoom.Ins.GetUserPlayerInfo().IsLiangDao)
            {
                return;                                                                    //已经亮了 就不用检测了
            }
            _HuCardInMultiple.Clear();                                                     //清空 胡的牌 和对应的倍数
            UIComponent.GetUiView <FiveStarMingPaiHintPanelComponent>().HideHuCardHint(0); //先隐藏胡牌提示
            Dictionary <int, List <int> > chuCardHuDic = CardFiveStarHuPaiLogic.HuPaiTiShi(_NewestHands);

            if (chuCardHuDic.Count > 0)
            {
                EventMsgMgr.SendEvent(CardFiveStarEventID.CanChuCardHaveHuHint, chuCardHuDic);
                UIComponent.GetUiView <CanOpertionPanelComponent>().ShowCanOpration(FiveStarOperateType.Liang);
            }
        }
Пример #9
0
        //显示亮倒的牌
        public override void ShowLiangDaoCards(RepeatedField <int> cards)
        {
            RepeatedField <RepeatedField <int> > liangDaoCards = CardFiveStarHuPaiLogic.GetLiangDaoNoneHuCards(cards);

            ClearLiangCards();
            liangDaoCards[1].Sort();
            for (int i = 0; i < liangDaoCards[1].Count; i++)
            {
                CardFiveStarDownDaoDiZhengMainCard card = CardFiveStarCardPool.Ins.Create(LaingCardType, liangDaoCards[1][i], _LiangCardGroupGo.transform) as CardFiveStarDownDaoDiZhengMainCard;
                _liangCards.Add(card);
                card.ShowKouIcon();
            }
            liangDaoCards[0].Sort();
            for (int i = 0; i < liangDaoCards[0].Count; i++)
            {
                _liangCards.Add(CardFiveStarCardPool.Ins.Create(LaingCardType, liangDaoCards[0][i], _LiangCardGroupGo.transform));
            }
        }
        //亮倒
        public void LiangDao(RepeatedField <int> hands, bool isShowSpecial = true)
        {
            IsLiangDao = true;
            if (isShowSpecial)
            {
                OperationSpecialMgr.Ins.ShowSpecial(FiveStarOperateType.Liang, _OperationSpecialPoint); //亮倒 特效
                CardFiveStarSoundMgr.Ins.PlaySound(_user.Sex, FiveStarOperateType.Liang);               //亮倒 音效
            }
            List <int> tingCards = CardFiveStarHuPaiLogic.IsTingPai(hands);

            UIComponent.GetUiView <FiveStarMingPaiHintPanelComponent>().ShowMingCardHint(ClientSeatIndex, tingCards);
            ClearHand();
            ShowLiangDaoCards(hands);
            CardFiveStarRoom.Ins.AddLiangDaoCanHuCards(ClientSeatIndex, tingCards);
            if (ClientSeatIndex != 0)
            {
                CardFiveStarRoom.Ins.ReduceCardInNum(hands); //删除牌的剩余数量
            }
            EventMsgMgr.SendEvent(CardFiveStarEventID.PlayerLiangDao);
        }
        //获取打这张牌的胡牌倍数
        public int GetCardInMultiple(int winCard, int chuCard = -1)
        {
            if (_HuCardInMultiple.ContainsKey(chuCard))
            {
                if (_HuCardInMultiple[chuCard].ContainsKey(winCard))
                {
                    return(_HuCardInMultiple[chuCard][winCard]);
                }
            }
            RepeatedField <int> copyHand = new RepeatedField <int>()
            {
                _NewestHands
            };

            if (chuCard > 0)
            {
                copyHand.Remove(chuCard);
            }
            copyHand.Add(winCard);

            int multiple = CardFiveStarHuPaiLogic.GetMultiple(copyHand, CardFiveStarRoom.Ins.GetUserPlayerInfo()._PengGangArray, winCard);

            if (_HuCardInMultiple.ContainsKey(chuCard))
            {
                _HuCardInMultiple[chuCard].Add(winCard, multiple);
            }
            else
            {
                _HuCardInMultiple.Add(chuCard, new Dictionary <int, int>()
                {
                    { winCard, multiple }
                });
            }

            return(multiple);
        }
 //检测能不能听牌
 public static bool IsTingCard(this FiveStarPlayer fiveStarPlayer)
 {
     return(CardFiveStarHuPaiLogic.IsCanTingPai(fiveStarPlayer.Hands));
 }