Ejemplo n.º 1
0
 private void kouDiPai(JueSe juese)
 {
     for (int i = 51; i < 54; i++)
     {
         juese.ImagePaiSub.Add(pai[i].Index);
         juese.ShengYuPai.Add(pai[pai[i].Index].Size);
         switch (juese.WeiZhi)
         {
             case 1: paiImage[pai[i].Index].Left = 690; paiImage[pai[i].Index].Top = 475;
                 paiImage[pai[i].Index].Size = new System.Drawing.Size(65, 100);
                 break;
             case 2: paiImage[pai[i].Index].Top = 545;
                 paiImage[pai[i].Index].Size = new System.Drawing.Size(80, 120);
                 paiImage[pai[i].Index].BackgroundImage = pai[pai[i].Index].Image;
                 paiImage[pai[i].Index].Click += new System.EventHandler(paiImage_Click);
                 break;
             case 3: paiImage[pai[i].Index].Left = 18; paiImage[pai[i].Index].Top = 475;
                 paiImage[pai[i].Index].Size = new System.Drawing.Size(65, 100);
                 break;
         }
     }
     pai_paixu(juese); image_paixu(juese, 495);
 }
Ejemplo n.º 2
0
 private void image_paixu(JueSe juese, int j)
 {
     if (juese.ShengYuPai.Count != 0)
     {
         if (juese.WeiZhi == 2)
         {
             if (bl_paiXu) pai_paixu2(juese);
             else pai_paixu(juese);
             int a = 0;
             for (int i = juese.ImagePaiSub.Count - 1; i >= 0; i--)
             {
                 paiImage[(int)juese.ImagePaiSub[a]].BringToFront();
                 paiImage[(int)juese.ImagePaiSub[i]].Left = j;
                 a++; j -= 16;
             }
             pai_paixu(juese);
         }
         else
         {
             int k = 390; int a = 0;
             for (int i = 0; i < juese.ImagePaiSub.Count; i++)
             {
                 paiImage[(int)juese.ImagePaiSub[i]].Top = k;
                 paiImage[(int)juese.ImagePaiSub[a]].BringToFront();
                 a++; k += 5;
             }
         }
     }
 }
Ejemplo n.º 3
0
 private bool isJiaoDiZhu(JueSe juese)
 {
     Random rd = new Random();
     int a = rd.Next(2);
     if (a == 0) return true;
     return false;
 }
Ejemplo n.º 4
0
 private void computerChuPai(JueSe juese)
 {
     ArrayList list = Cchupai.chuPai(juese.ShengYuPai);
     if (list != null && chupai.isRight(list))
     {
         juese1.ShangShouPai.Clear(); juese2.ShangShouPai.Clear(); juese3.ShangShouPai.Clear();
         chuPaiWeiZhi -= list.Count * 9;
         movePai(juese, jiepai.arrayToArgs(list));
         chuPaiWeiZhi = 109;
         isZhaDan_BeiShu_Add2();
     }
     else MessageBox.Show("程序出问题啦! 请与作者联系! QQ 359103820");
 }
Ejemplo n.º 5
0
 private void computerJiePai(JueSe juese)
 {
     chuPaiWeiZhi -= juese2.ShangShouPai.Count * 9;
     bool bl = tiShiJiePai(jiepai.isRight(chupai.PaiType, juese.ShangShouPai, juese.ShengYuPai), juese,false);
     chuPaiWeiZhi = 109;
     if (bl == false)
     {
         if (juese == juese1)
         {
             this.lbl_tiShi_R.Text = "不出";
             juese3.ShangShouPai = (ArrayList)juese.ShangShouPai.Clone();
         }
         else if (juese == juese2)
         {
             this.lbl_tiShi_D.Text = "不出";
             juese1.ShangShouPai = (ArrayList)juese.ShangShouPai.Clone();
         }
         else
         {
             this.lbl_tiShi_L.Text = "不出";
             juese2.ShangShouPai = (ArrayList)juese.ShangShouPai.Clone();
         }
         buChuPai++; juese.ShangShouPai.Clear(); SoundClick.Play();
     }
     else  buChuPai = 0;
 }
Ejemplo n.º 6
0
 private void yiChuPai(JueSe juese)
 {
     for (int i = 0; i < juese.YiChuPai.Count; i++)
     {
         if (paiImage[(int)juese.YiChuPai[i]].Visible == true)
         {
             paiImage[(int)juese.YiChuPai[i]].Visible = false;
         }
     }
 }
Ejemplo n.º 7
0
 private void ceshi1(JueSe juese)
 {
     /*string str = "";
     for(int i=0;i<juese.ShangShouPai.Count;i++)
     {
         str=str+(int)(juese.ShangShouPai[i])+",,";
     }
     str=str+" 剩余牌 ";
     for(int i=0;i<juese.ShengYuPai.Count;i++)
     {
         str=str+(int)(juese.ShengYuPai[i])+",,";
     }
     this.txt_liaoTian.Text += (((Guize)chupai.PaiType).ToString() + " 上手牌 " + str+"\n");*/
 }
Ejemplo n.º 8
0
 private void tiaoshi(JueSe juese, int j)
 {
     /*if (juese.ShengYuPai.Count != 0)
     {
         if (juese.WeiZhi == 2)
         {
             if (bl_paiXu) pai_paixu2(juese);
             else pai_paixu(juese);
         }
         int k = 190; int a = 0;
         for (int i = juese.ImagePaiSub.Count - 1; i >= 0; i--)
         {
             switch (juese.WeiZhi)
             {
                 case 1: paiImage[(int)juese.ImagePaiSub[a]].SendToBack(); paiImage[(int)juese.ImagePaiSub[i]].Left = 620;
                     paiImage[(int)juese.ImagePaiSub[i]].Top = k; break;
                 case 2: paiImage[(int)juese.ImagePaiSub[a]].BringToFront();
                     paiImage[(int)juese.ImagePaiSub[i]].Left = j; break;
                 case 3: paiImage[(int)juese.ImagePaiSub[a]].SendToBack(); paiImage[(int)juese.ImagePaiSub[i]].Left = 85;
                     paiImage[(int)juese.ImagePaiSub[i]].Top = k; break;
             }
             a++; k += 18; j -= 16;
         }
         if (juese.WeiZhi == 2) pai_paixu(juese);
     }*/
 }
Ejemplo n.º 9
0
 private bool tiShiJiePai(ArrayList list, JueSe juese,bool bl_tishi)
 {
     if (chupai.PaiType == (int)Guize.天炸) return false;//如果上手出了火箭,直接要不起
     #region 单张
     else if (chupai.PaiType == (int)Guize.一张)
     {
         if (list != null)
         {
             int[] jie = null;
             if (((ArrayList)list[0]).Count != 0) jie = jiepai.mArrayToArgs((ArrayList)list[0]);
             else if (((ArrayList)list[1]).Count != 0) jie = jiepai.mArrayToArgs((ArrayList)list[1]);
             else if (((ArrayList)list[2]).Count != 0) jie = jiepai.mArrayToArgs((ArrayList)list[2]);
             else if (((ArrayList)list[3]).Count != 0) jie = jiepai.mArrayToArgs((ArrayList)list[3]);
             if (jie != null)
             {
                 if (tishi == jie.Length) tishi = 0;
                 int[] _jie = new int[] { jie[tishi] };
                 if (bl_tishi) tiShiBottun(_jie);
                 else movePai(juese, _jie);
                 return true;
             }
         }
     }
     #endregion
     #region 对子
     else if (chupai.PaiType == (int)Guize.对子)
     {
         if (list != null)
         {
             int[] jie = null;
             if (((ArrayList)list[0]).Count != 0) jie = jiepai.mArrayToArgs((ArrayList)list[0]);
             else if (((ArrayList)list[1]).Count != 0) jie = jiepai.mArrayToArgs((ArrayList)list[1]);
             else if (((ArrayList)list[2]).Count != 0) jie = jiepai.mArrayToArgs((ArrayList)list[2]);
             if (jie != null)
             {
                 if (tishi == jie.Length) tishi = 0;
                 int[] _jie = new int[] { jie[tishi], jie[tishi] };
                 if (bl_tishi) tiShiBottun(_jie);
                 else movePai(juese, _jie);
                 return true;
             }
         }
     }
     #endregion
     #region 三张
     else if (chupai.PaiType == (int)Guize.三不带)
     {
         if (list != null)
         {
             int[] jie = null;
             if (((ArrayList)list[0]).Count != 0) jie = jiepai.mArrayToArgs((ArrayList)list[0]);
             else if (((ArrayList)list[1]).Count != 0) jie = jiepai.mArrayToArgs((ArrayList)list[1]);
             if (jie != null)
             {
                 if (tishi == jie.Length) tishi = 0;
                 int[] _jie = new int[] { jie[tishi], jie[tishi], jie[tishi] };
                 if (bl_tishi) tiShiBottun(_jie);
                 else movePai(juese, _jie);
                 return true;
             }
         }
     }
     #endregion
     #region 炸弹
     else if (chupai.PaiType == (int)Guize.炸弹)
     {
         if (list != null && list.Count != 0)
         {
             int[] jie = jiepai.mArrayToArgs(list);
             if (tishi == jie.Length) tishi = 0;
             int[] _jie = new int[] { jie[tishi], jie[tishi], jie[tishi], jie[tishi] };
             if (bl_tishi) tiShiBottun(_jie);
             else
             {
                 movePai(juese, _jie);
                 isZhaDan_BeiShu_Add2();
                 lblTiShi = "我也炸";
             }
             return true;
         }
     }
     #endregion
     #region 三带一,三带二,顺子,连对,飞机不带
     else if (chupai.PaiType > 4 && chupai.PaiType < 13)
     {
         if (list != null && list.Count != 0)
         {
             if (tishi == list.Count) tishi = 0;
             int[] jie = jiepai.mArrayToArgs((ArrayList)list[tishi]);
             if (bl_tishi) tiShiBottun(jie);
             else movePai(juese, jie);
             return true;
         }
     }
     #endregion
     #region 四带二,四带两对,飞机带,三飞机带,四飞机带
     else if (chupai.PaiType > 12 && chupai.PaiType < 20)
     {
         if (list != null)
         {
             int[] jie = jiepai.mArrayToArgs(list);
             if (bl_tishi) tiShiBottun(jie);
             else movePai(juese, jie);
             return true;
         }
     }
     #endregion
     #region 如果同类型牌要不起,就判断是否有炸弹
     if (chupai.PaiType != (int)Guize.炸弹)
     {
         list = jiepai.findZhadan(juese.ShengYuPai);
         int[] jie = jiepai.mArrayToArgs(list);
         if (jie != null)
         {
             if (tishi == jie.Length) tishi = 0;
             int[] _jie = new int[] { jie[tishi], jie[tishi], jie[tishi], jie[tishi] };
             if (bl_tishi) tiShiBottun(_jie);
             else
             {
                 chupai.PaiType = (int)Guize.炸弹;
                 movePai(juese, _jie);
                 isZhaDan_BeiShu_Add2();
             }
             return true;
         }
     }
     list = jiepai.findTianzha(juese.ShengYuPai);
     int[] huoJian = jiepai.mArrayToArgs(list);
     if (huoJian != null)
     {
         if (bl_tishi) tiShiBottun(huoJian);
         else
         {
             movePai(juese, huoJian);
             chupai.PaiType = (int)Guize.天炸;
             isZhaDan_BeiShu_Add2();
         }
         return true;
     }
     #endregion
     return false;
 }
Ejemplo n.º 10
0
 private void pai_paixu2(JueSe juese)
 {
     ArrayList list = jiepai.basic(2, juese.ShengYuPai);
     int[] a = jiepai.arrayToArgs((ArrayList)list[0]);
     int[] b = jiepai.arrayToArgs((ArrayList)list[1]);
     int[] c = jiepai.arrayToArgs((ArrayList)list[2]);
     int[] d = jiepai.arrayToArgs((ArrayList)list[3]);
     list.Clear();
     #region 将返回的牌按顺序添加到集合
     if (d != null)
     {
         for (int i = 0; i < d.Length; i++)
         {
             for (int j = 0; j < 4; j++)
             {
                 list.Add(d[i]);
             }
         }
     }
     if (c != null)
     {
         for (int i = 0; i < c.Length; i++)
         {
             for (int j = 0; j < 3; j++)
             {
                 list.Add(c[i]);
             }
         }
     }
     if (b != null)
     {
         for (int i = 0; i < b.Length; i++)
         {
             list.Add(b[i]); list.Add(b[i]);
         }
     }
     if (a != null)
     {
         for (int i = 0; i < a.Length; i++)
         {
             list.Add(a[i]);
         }
     }
     #endregion
     for (int k = 0; k < list.Count; k++)
     {
         for (int m = k; m < juese.ImagePaiSub.Count; m++)
         {
             if ((int)list[k] == pai[(int)juese.ImagePaiSub[m]].Size)
             {
                 int temp = (int)juese.ImagePaiSub[m];
                 juese.ImagePaiSub[m] = juese.ImagePaiSub[k];
                 juese.ImagePaiSub[k] = temp;
             }
         }
     }
 }
Ejemplo n.º 11
0
 private void pai_paixu(JueSe juese)
 {
     for (int i = 0; i < juese.ImagePaiSub.Count; i++)
     {
         for (int j = i; j < juese.ImagePaiSub.Count; j++)
         {
             if (pai[(int)juese.ImagePaiSub[i]].Size < pai[(int)juese.ImagePaiSub[j]].Size)
             {
                 int temp = (int)juese.ImagePaiSub[i];
                 juese.ImagePaiSub[i] = juese.ImagePaiSub[j];
                 juese.ImagePaiSub[j] = temp;
             }
         }
     }
 }
Ejemplo n.º 12
0
 private void newPlayer(string name1, string name2, string name3)
 {
     Player player1 = new Player(name1);
     Player player2 = new Player(name2);
     Player player3 = new Player(name3);
     juese1 = new JueSe(player1);
     juese2 = new JueSe(player2);
     juese3 = new JueSe(player3);
     juese1.WeiZhi = 1;
     juese2.WeiZhi = 2;
     juese3.WeiZhi = 3;
 }
Ejemplo n.º 13
0
 private void addJuesePai(JueSe juese)
 {
     for (int i = 0; i < juese.ImagePaiSub.Count; i++)
     {
         juese.ShengYuPai.Add(pai[(int)juese.ImagePaiSub[i]].Size);
     }
 }
Ejemplo n.º 14
0
 private void movePai(JueSe juese, int[] whatPai)
 {
     juese.ShangShouPai.Clear();
     chupai.format(whatPai);
     int j = 0; int place = 250;
     for (int i = 0; i < juese.ImagePaiSub.Count; i++)
     {
         if (pai[(int)juese.ImagePaiSub[i]].Size == whatPai[j])
         {
             paiImage[(int)juese.ImagePaiSub[i]].BringToFront();
             switch (juese.WeiZhi)
             {
                 case 1: juese3.ShangShouPai.Add(pai[(int)juese.ImagePaiSub[i]].Size);
                     paiImage[(int)juese.ImagePaiSub[i]].SetBounds(550, place, 65, 100);
                     paiImage[(int)juese.ImagePaiSub[i]].BackgroundImage = pai[(int)juese.ImagePaiSub[i]].Image;
                     break;
                 case 2: juese1.ShangShouPai.Add(pai[(int)juese.ImagePaiSub[i]].Size);
                     paiImage[(int)juese.ImagePaiSub[i]].SetBounds(place + chuPaiWeiZhi, 410, 70, 105);
                     place -= 3;
                     break;
                 case 3: juese2.ShangShouPai.Add(pai[(int)juese.ImagePaiSub[i]].Size);
                     paiImage[(int)juese.ImagePaiSub[i]].SetBounds(150, place, 65, 100);
                     paiImage[(int)juese.ImagePaiSub[i]].BackgroundImage = pai[(int)juese.ImagePaiSub[i]].Image;
                     break;
             }
             juese.YiChuPai.Add((int)juese.ImagePaiSub[i]);
             juese.ShengYuPai.Remove(pai[(int)juese.ImagePaiSub[i]].Size);
             juese.ImagePaiSub.RemoveAt(i);
             place += 18; j++; i--;
             if (j == whatPai.Length) break;
         }
     }
     if (juese.ShengYuPai.Count == 0)  bl_chuPaiOver = true;
     SoundGive.Play();
     int place1 = 0;
     if (juese.WeiZhi == 2 && juese.Dizhu) place1 = 490 - (20 - juese.ImagePaiSub.Count) / 2 * 16;
     else place1 = 460 - (17 - juese.ImagePaiSub.Count) / 2 * 16;
     image_paixu(juese, place1);
 }