コード例 #1
0
 //玩家胡牌
 public static bool HuPai(this FiveStarPlayer fiveStarPlayer, int card = 0, int playCardIndex = 0)
 {
     if (fiveStarPlayer.IsCanHu(card, playCardIndex))
     {
         if (card > 0)
         {
             fiveStarPlayer.Hands.Add(card);
         }
         return(true);
     }
     return(false);
 }
コード例 #2
0
 //检测能不能进行操作
 public static bool IsCanOperate(this FiveStarPlayer fiveStarPlayer, int playCard = 0, int playCardIndex = 0)
 {
     if (fiveStarPlayer.IsRestIn)//如果是在休息中 直接不能操作
     {
         return(false);
     }
     fiveStarPlayer.canOperateLists.Clear();              //可操作列表清空
     fiveStarPlayer.canGangCards.Clear();                 //可杠列表清空
     if (fiveStarPlayer.IsCanHu(playCard, playCardIndex)) //检测能不能胡牌
     {
         fiveStarPlayer.canOperateLists.Add(FiveStarOperateType.FangChongHu);
     }
     if (playCard > 0)
     {
         //别人打牌的时候
         fiveStarPlayer.intData = fiveStarPlayer.IsCanPengAndGang(playCard);
         if (fiveStarPlayer.intData != 0)//检测能不能碰和暗杆
         {
             if (fiveStarPlayer.IsLiangDao && fiveStarPlayer.intData == FiveStarOperateType.MingGang &&
                 fiveStarPlayer.LiangDaoNoneCards.Contains(playCard))
             {
                 fiveStarPlayer.AddCanGangOpearte();
             }
             else if (fiveStarPlayer.intData == FiveStarOperateType.Peng)
             {
                 fiveStarPlayer.canOperateLists.Add(FiveStarOperateType.Peng);
             }
             else if (fiveStarPlayer.intData == FiveStarOperateType.MingGang)
             {
                 fiveStarPlayer.canOperateLists.Add(FiveStarOperateType.Peng);
                 fiveStarPlayer.AddCanGangOpearte();
             }
         }
     }
     else
     {
         //自己摸牌的时候
         if (fiveStarPlayer.IsCanCaGang() || fiveStarPlayer.IsCanAnGang())
         {
             fiveStarPlayer.AddCanGangOpearte();
         }
     }
     //广播可操作消息
     return(fiveStarPlayer.canOperateLists.Count > 0);
 }