Ejemplo n.º 1
0
 //出牌的声音,判断是出牌还是抢牌还是炸弹
 public void Player_OutorFollowCard_Voice(int who_out, int nowPerson, List <Card> [] toOutCard, Boolean sex)
 {
     if (who_out == nowPerson || toOutCard[who_out].Count == 0)    //出牌声音
     {
         Player_OutCard_Voice(sex, toOutCard[nowPerson]);
     }
     else                                                                                                        //抢牌声音
     {
         if (CardStyle.isBumb(toOutCard[nowPerson]) != 0 || CardStyle.isFourGhost(toOutCard[nowPerson]) == true) //如果是炸弹
         {
             BombVoice();
         }
         else
         {
             Player_FollowOutCard_Voice(sex);
             t           = new System.Timers.Timer(500); //实例化Timer类,设置间隔时间为1000毫秒
             t.AutoReset = false;                        //设置是执行一次(false)还是一直执行(true)
             t.Enabled   = true;                         //是否执行System.Timers.Timer.Elapsed事件
             t.Elapsed  += new System.Timers.ElapsedEventHandler(delegate(object sender2, System.Timers.ElapsedEventArgs e2)
             {
                 if (CardStyle.isPlaneWithTwo(toOutCard[nowPerson]) != 0 || CardStyle.isPlane(toOutCard[nowPerson]) != 0)    //如果是飞机
                 {
                     PlaneVoice();
                 }
                 else if (CardStyle.isStraight(toOutCard[nowPerson]) != 0 || CardStyle.isNextTwo(toOutCard[nowPerson]) != 0) //如果是连对
                 {
                     NextTwoStraightVoice();
                 }
             });
         }
     }
 }
Ejemplo n.º 2
0
        //农民打别人的牌//打农民不炸 > 原来的算法 > 卡位
        private List <Card> Farmer_CrushCard(ref List <Card>[] people, int whosland, int whoOut, int nowPerson, List <Card> prevCard)
        {
            //landlord:谁是地主    nowPerson:谁要出牌     whoOut:上家出牌的是谁
            List <Card> tCard = new List <Card>();

            if ((CardStyle.isBumb(NextRemindCard[0]) != 0 || NextRemindCard[0].Count == 0) && whoOut != whosland) //上家出牌的是自己人而且我只能出炸弹,则不出牌
            {
                return(tCard);                                                                                    //返回空值
            }
            //如果下家是地主,且上家出的牌是单牌,则需要守门
            if ((nowPerson + 1) % 4 == whosland)
            {
                if (prevCard.Count == 1)
                {
                    List <Card> tempCard2 = new List <Card>();
                    tempCard2 = Robort_Single_Remind(ref people[nowPerson], prevCard, true);
                    return(tempCard2);
                }
            }
            //判断自己是否一定要出炸弹
            int i, j;

            for (i = nowPerson, j = 0; i != whosland; i = (i + 1) % 4, j++)
            {
                if (CardStyle.isBumb(NextRemindCard[j]) == 0 && NextRemindCard[j].Count != 0) //如果该家出的是普通牌
                {
                    break;
                }
            }
            if (i == nowPerson || i == whosland)  //如果我家出的是普通牌,或者没有一家出的不是普通牌
            {
                return(NextRemindCard[0]);
            }
            else    //后面有农民可以要住,我就不用炸
            {
                return(tCard);
            }
        }