Пример #1
0
 public shuffledDeck(mainForm m)
 {
     main = m;
     InitializeComponent();
     PictureBox[] pB = new PictureBox[] { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8, pictureBox9, pictureBox10, pictureBox11, pictureBox12, pictureBox13, pictureBox14, pictureBox15, pictureBox16, pictureBox17, pictureBox18, pictureBox19, pictureBox20, pictureBox21, pictureBox22, pictureBox23, pictureBox24, pictureBox25, pictureBox26, pictureBox27, pictureBox28, pictureBox29, pictureBox30, pictureBox31, pictureBox32, pictureBox33, pictureBox34, pictureBox35, pictureBox36, pictureBox37, pictureBox38, pictureBox39, pictureBox40, pictureBox41, pictureBox42, pictureBox43, pictureBox44, pictureBox45, pictureBox46, pictureBox47, pictureBox48, pictureBox49, pictureBox50, pictureBox51, pictureBox52 };
     for (int i = 0; i < main.allCardsArr.Length; i++)
         pB[i].Image = Image.FromFile(Environment.CurrentDirectory + "\\cardImages\\" + main.allCardsArr[i] + ".png"); //make relative path
 }
Пример #2
0
        //constructor that allows us to retreive data from the anther from
        public showHandsForm(mainForm m)
        {
            InitializeComponent();
            main = m;

            PictureBox[] pB = new PictureBox[] { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8, pictureBox9, pictureBox10, pictureBox11, pictureBox12, pictureBox13, pictureBox14, pictureBox15, pictureBox16, pictureBox17, pictureBox18, pictureBox19, pictureBox20, pictureBox21, pictureBox22, pictureBox23, pictureBox24, pictureBox25, pictureBox26, pictureBox27, pictureBox28, pictureBox29, pictureBox30, pictureBox31, pictureBox32, pictureBox33, pictureBox34, pictureBox35, pictureBox36, pictureBox37, pictureBox38, pictureBox39, pictureBox40, pictureBox41, pictureBox42, pictureBox43, pictureBox44, pictureBox45, pictureBox46, pictureBox47, pictureBox48, pictureBox49, pictureBox50, pictureBox51, pictureBox52 };
            for (int i = 0, j=0; i < 13; i++, j+=4)
            {
                pB[i].Image = Image.FromFile(Environment.CurrentDirectory + "\\cardImages\\" + main.allCardsArr[j] + ".png");
                pB[i+(13*1)].Image = Image.FromFile(Environment.CurrentDirectory + "\\cardImages\\" + main.allCardsArr[j+1] + ".png");
                pB[i+(13*2)].Image = Image.FromFile(Environment.CurrentDirectory + "\\cardImages\\" + main.allCardsArr[j+2] + ".png");
                pB[i+(13*3)].Image = Image.FromFile(Environment.CurrentDirectory + "\\cardImages\\" + main.allCardsArr[j+3] + ".png");
            }

            if(main.arrange==true)
            {
                main.p1 = mergeSort(main.p1);
                main.p2 = mergeSort(main.p2);
                main.p3 = mergeSort(main.p3);
                main.p4 = mergeSort(main.p4);

                //stick all the data from the individual hands of the players and put it together in order to be able to print it easily
                string[][] allP = new string[][] { main.p1, main.p2, main.p3, main.p4 };
                string[] allSorted = new string[52];
                for (int i = 0, j = 0, k = 0; i < allSorted.Length; i++, k++)
                {
                    if (i == 13 || i == 26 || i == 39)
                    {
                        j++;
                        k = 0;
                    }
                    allSorted[i] = allP[j][k];
                }

                PictureBox[] pB2 = new PictureBox[] { pictureBox104, pictureBox103, pictureBox102, pictureBox101, pictureBox100, pictureBox99, pictureBox98, pictureBox97, pictureBox96, pictureBox95, pictureBox94, pictureBox93, pictureBox92, pictureBox91, pictureBox90, pictureBox89, pictureBox88, pictureBox87, pictureBox86, pictureBox85, pictureBox84, pictureBox83, pictureBox82, pictureBox81, pictureBox80, pictureBox79, pictureBox78, pictureBox77, pictureBox76, pictureBox75, pictureBox74, pictureBox73, pictureBox72, pictureBox71, pictureBox70, pictureBox69, pictureBox68, pictureBox67, pictureBox66, pictureBox65, pictureBox64, pictureBox63, pictureBox62, pictureBox61, pictureBox60, pictureBox59, pictureBox58, pictureBox57, pictureBox56, pictureBox55, pictureBox54, pictureBox53 };
                for (int i = 0; i < allSorted.Length; i++)
                    pB2[i].Image = Image.FromFile(Environment.CurrentDirectory + "\\cardImages\\" + allSorted[i] + ".png");
            }
        }