Ejemplo n.º 1
0
        private void GenerirajSlikiIgraci()
        {
            Random r = new Random();
            int boja = r.Next(1, 4);
            int broj = r.Next(2, 14);
            dealer = new Dealer(upotrebeniKarti);
            Karta k = new Karta(dealer, boja, broj);
            dealer.dodajKarta(k);
            String pateka = "karti/";
            pateka += broj.ToString() + "-" + boja.ToString() + ".png";
            upotrebeniKarti.dodajKarta(broj, boja);
            pictureBox8.Image = Image.FromFile(pateka);
            pictureBox7.Image = Properties.Resources.zadna;
            label7.Text = "Збир на картите: " + dealer.PresmetajZbirKarti().ToString();
            if (brojigraci == 1)
            {
                Player player = new Player(upotrebeniKarti, panel1, 1, this);
                player.ime = iminja[0];
                player.vlog = vlogo[0];
                textBox2.Text = iminja[0];
                textBox8.Text = vlogo[0].ToString();
                textBox2.Visible = true;
                textBox8.Visible = true;
                label111.Visible = true;
                label112.Visible = true;
                label111.Text = "Збир на карти: " + player.presmetajZbir().ToString();
                igraci.Add(player);
                pictureBox1.Image = Properties.Resources.player;
                panel1.Controls.Add(pictureBox1);
                player.postaviSlika();

            }
            else if (brojigraci == 2)
            {
                Player player = new Player(upotrebeniKarti, panel1,1, this);
                player.ime = iminja[0];
                player.vlog = vlogo[0];
                textBox8.Text = vlogo[0].ToString();
                label112.Visible = true;
                Player player1 = new Player(upotrebeniKarti, panel2, 2, this);
                player1.ime = iminja[1];
                player1.vlog = vlogo[1];
                textBox9.Text = vlogo[1].ToString();
                label212.Visible = true;
                pictureBox1.Image = Properties.Resources.player;
                pictureBox2.Image = Properties.Resources.player;
                textBox8.Visible = textBox9.Visible=true;
                label111.Visible = true;
                label111.Text = "Збир на карти: " + player.presmetajZbir().ToString();
                label222.Visible = true;
                label222.Text = "Збир на карти: " + player1.presmetajZbir().ToString();

                textBox2.Visible =textBox3.Visible= true;
                textBox2.Text = iminja[0];
                textBox3.Text = iminja[1];
                panel1.Controls.Add(pictureBox1);
                panel2.Controls.Add(pictureBox2);
                player.postaviSlika();
                player1.postaviSlika();
                igraci.Add(player);
                igraci.Add(player1);

            }
            else if (brojigraci == 3)
            {
                Player player = new Player(upotrebeniKarti, panel1, 1, this);
                player.ime = iminja[0];
                player.vlog = vlogo[0];
                textBox8.Text = vlogo[0].ToString() ;
                label112.Visible = true;
                Player player2 = new Player(upotrebeniKarti, panel2, 2, this);
                player2.ime = iminja[1];
                player2.vlog = vlogo[1];
                textBox9.Text = vlogo[1].ToString();
                label212.Visible = true;
                Player player3 = new Player(upotrebeniKarti, panel3, 3, this);
                player3.ime = iminja[2];
                player3.vlog = vlogo[2];
                textBox10.Text = vlogo[2].ToString();
                label312.Visible = true;
                textBox8.Visible = textBox9.Visible =textBox10.Visible= true;
                textBox2.Visible = textBox3.Visible = textBox4.Visible=true;
                pictureBox1.Image = Properties.Resources.player;
                pictureBox2.Image = Properties.Resources.player;
                pictureBox3.Image = Properties.Resources.player;
                label111.Visible = true;
                label111.Text = "Збир на карти: " + player.presmetajZbir().ToString();
                label222.Visible = true;
                label222.Text = "Збир на карти: " + player2.presmetajZbir().ToString();
                label333.Visible = true;
                label333.Text = "Збир на карти: " + player3.presmetajZbir().ToString();

                textBox2.Text = iminja[0];
                textBox3.Text = iminja[1];
                textBox4.Text = iminja[2];
                panel1.Controls.Add(pictureBox1);
                panel2.Controls.Add(pictureBox2);
                player.postaviSlika();
                player2.postaviSlika();
                player3.postaviSlika();
                igraci.Add(player);
                igraci.Add(player2);
                igraci.Add(player3);
            }
            else if (brojigraci == 4)
            {
                Player player = new Player(upotrebeniKarti, panel1,1, this);
                player.ime = iminja[0];
                player.vlog = vlogo[0];
                textBox8.Text = vlogo[0].ToString();
                label112.Visible = true;
                Player player1 = new Player(upotrebeniKarti, panel2, 2, this);
                player1.ime = iminja[1];
                player1.vlog = vlogo[1];
                textBox9.Text = vlogo[1].ToString();
                label212.Visible = true;
                Player player2 = new Player(upotrebeniKarti, panel3, 3, this);
                player2.ime = iminja[2];
                player2.vlog = vlogo[2];
                textBox10.Text = vlogo[2].ToString();
                label312.Visible = true;
                Player player3 = new Player(upotrebeniKarti, panel4, 4, this);
                player3.ime = iminja[3];
                player3.vlog = vlogo[3];
                textBox11.Text = vlogo[3].ToString();
                label412.Visible = true;
                textBox8.Visible = textBox9.Visible = textBox10.Visible = textBox11.Visible=true;
                textBox2.Visible = textBox3.Visible = textBox4.Visible =textBox5.Visible= true;
                panel1.Controls.Add(pictureBox1);
                panel2.Controls.Add(pictureBox2);
                pictureBox1.Image = Properties.Resources.player;
                pictureBox2.Image = Properties.Resources.player;
                pictureBox3.Image = Properties.Resources.player;
                pictureBox4.Image = Properties.Resources.player;
                label111.Visible = true;
                label111.Text = "Збир на карти: " + player.presmetajZbir().ToString();
                label222.Visible = true;
                label222.Text = "Збир на карти: " + player1.presmetajZbir().ToString();
                label333.Visible = true;
                label333.Text = "Збир на карти: " + player2.presmetajZbir().ToString();
                label444.Visible = true;
                label444.Text = "Збир на карти: " + player3.presmetajZbir().ToString();

                textBox2.Text = iminja[0];
                textBox3.Text = iminja[1];
                textBox4.Text = iminja[2];
                textBox5.Text = iminja[3];
                player.postaviSlika();
                player1.postaviSlika();
                player2.postaviSlika();
                player3.postaviSlika();
                igraci.Add(player);
                igraci.Add(player1);
                igraci.Add(player2);
                igraci.Add(player3);

            }
            else if (brojigraci == 5)
            {
                Player player = new Player(upotrebeniKarti, panel1, 1, this);
                player.ime = iminja[0];
                player.vlog = vlogo[0];
                textBox8.Text = vlogo[0].ToString();
                label112.Visible = true;
                Player player1 = new Player(upotrebeniKarti, panel2, 2, this);
                player1.ime = iminja[1];
                player1.vlog = vlogo[1];
                textBox9.Text = vlogo[1].ToString();
                label212.Visible = true;
                Player player2 = new Player(upotrebeniKarti, panel3, 3, this);
                player2.ime = iminja[2];
                player2.vlog = vlogo[2];
                textBox10.Text = vlogo[2].ToString();
                label312.Visible = true;
                Player player3 = new Player(upotrebeniKarti, panel4, 4,this);
                player3.ime = iminja[3];
                player3.vlog = vlogo[3];
                textBox11.Text = vlogo[3].ToString();
                label412.Visible = true;
                Player player4 = new Player(upotrebeniKarti, panel5, 5, this);
                player4.ime = iminja[4];
                player4.vlog = vlogo[4];
                textBox12.Text = vlogo[4].ToString();
                label512.Visible = true;
                textBox8.Visible = textBox9.Visible = textBox10.Visible = textBox11.Visible =textBox12.Visible= true;
                textBox2.Visible = textBox3.Visible = textBox4.Visible = textBox5.Visible =textBox6.Visible= true;
                pictureBox1.Image = Properties.Resources.player;
                pictureBox2.Image = Properties.Resources.player;
                pictureBox3.Image = Properties.Resources.player;
                pictureBox4.Image = Properties.Resources.player;
                pictureBox5.Image = Properties.Resources.player;
                label111.Visible = true;
                label111.Text = "Збир на карти: " + player.presmetajZbir().ToString();
                label222.Visible = true;
                label222.Text = "Збир на карти: " + player1.presmetajZbir().ToString();
                label333.Visible = true;
                label333.Text = "Збир на карти: " + player2.presmetajZbir().ToString();
                label444.Visible = true;
                label444.Text = "Збир на карти: " + player3.presmetajZbir().ToString();
                label555.Visible = true;
                label555.Text = "Збир на карти: " + player4.presmetajZbir().ToString();
                textBox2.Text = iminja[0];
                textBox3.Text = iminja[1];
                textBox4.Text = iminja[2];
                textBox5.Text = iminja[3];
                textBox6.Text = iminja[4];
                panel1.Controls.Add(pictureBox1);
                panel2.Controls.Add(pictureBox2);
                player.postaviSlika();
                player1.postaviSlika();
                player2.postaviSlika();
                player3.postaviSlika();
                player4.postaviSlika();
                igraci.Add(player);
                igraci.Add(player1);
                igraci.Add(player2);
                igraci.Add(player3);
                igraci.Add(player4);

            }
        }