コード例 #1
0
ファイル: GlavnaIgra.cs プロジェクト: janedzumerko/BlackJack
        public GlavnaIgra(int brojig, Pocetna p1, String[] imi, int[] vlog)
        {
            InitializeComponent();
            igraci = new List<Player>();

            player = new SoundPlayer("winning.wav");
            loser = new SoundPlayer("losing.wav");
            timerIgrac = new Timer();
            timerIgrac.Interval = 500;
            timerIgrac.Tick += new EventHandler(timerIgrac_Tick);
            upotrebeniKarti = new usedCards();
            karti = new List<Karta>();
            generirajSpil();
            r = new Random();
            aktivenIgrac = null;
            iminja = imi;
            vlogo = vlog;
            brojac = 0;
            sekund = 0;
            minut = 0;
            casot=0;
            p = p1;
            brojigraci = brojig;
            textBox1.Enabled = false;
            timer1.Enabled = true;
            timer2.Enabled = true;
            GenerirajSlikiIgraci();
            popolniList();
            zapocniIgra();
        }
コード例 #2
0
        public void CheckDealerWins()//check if 'face
        {
            //Arrange
            var playerHand = new Dictionary<string, int>();
            playerHand.Add("10", 1);
            playerHand.Add("5", 2);

            var dealerHand = new Dictionary<string, int>();
            dealerHand.Add("10", 1);
            dealerHand.Add("11", 5);

            var player = new Player();
            var dealer = new Dealer();

            player.PlayerHand = playerHand;
            dealer.PlayerHand = dealerHand;
            //Act

            player.CountedValue();
            dealer.CountedValue();

            var results = Program.CheckWinner(player, dealer);


            //Assert

            Assert.AreEqual(Program.Win.Dealer, results);

        }
コード例 #3
0
 // methods
 public void AddPlayer(string name = "Joe", int funds = 20)
 {
     if (NumOfPlayers >= ALLOWED_NUM_OF_PLAYERS)
         throw new Exception("\nCannot have more than 8 players.\n");
     else //
     {
         players[NumOfPlayers] = new Player(name, funds);
         NumOfPlayers++;
     }
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: Sakthipriya123/NewsTracker
         public static  Win CheckWinner(Player user, Dealer dealer )
        {
            if (dealer.PlayerScore > 21 && user.PlayerScore < 22)
            {
                return Win.Player;
                
            }
            if (user.PlayerScore > 21 && dealer.PlayerScore < 22)
            {
                return Win.Dealer;

            }
            if(dealer.PlayerScore > user.PlayerScore)
            {
                return Win.Dealer;
            }        
            
            return Win.None;

          }
コード例 #5
0
ファイル: Game.cs プロジェクト: bloodysnowx/ProgramContest
        public Game()
        {
            dealer = new Dealer();
            dealer.shuffle();
            dealer.init();
            player = new Player(new Hand(new List<Card>(){dealer.hit(), dealer.hit()}), dealer);
            player.start();
            dealer.start();

            bool playerWin = false;
            if(player.getHand().isBursted())
                playerWin = false;
            else if(dealer.getHand().isBursted())
                playerWin = true;
            else if(player.getHand().getValue() > dealer.getHand().getValue())
                playerWin = true;
            else if(player.getHand().isBlackJack() && !dealer.getHand().isBlackJack())
                playerWin = true;
            System.Console.WriteLine(playerWin ? "Win" : "Lose");

            Console.ReadLine();
        }
コード例 #6
0
ファイル: GlavnaIgra.cs プロジェクト: janedzumerko/BlackJack
        private void button43_Click(object sender, EventArgs e)
        {
            timerIgrac.Stop();
            MessageBox.Show("Влогот ќе се зголеми сега ќе изнесува: " + aktivenIgrac.vlog * 2, "Зголемен влог!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            int broja = 0;
            int boja1 = 0;
            aktivenIgrac.vlog = aktivenIgrac.vlog * 2;
            aktivenIgrac.doubledown = true;
            while (true)
            {
                broja = r.Next(2, 14);
                boja1 = r.Next(1, 4);
                if (!upotrebeniKarti.zafatenaKarta(broja - 1, boja1 - 1))
                {
                    upotrebeniKarti.dodajKarta(broja - 1, boja1 - 1);
                    break;
                }
            }
            Karta k = new Karta(aktivenIgrac, 3, upotrebeniKarti, boja1, broja);
            aktivenIgrac.dodadiKarta(k);
            String pateka = "karti/";
            pateka += broja.ToString() + "-" + boja1.ToString() + ".png";
            PictureBox box = (PictureBox)aktivenIgrac.ikona.Controls["pictureBox" + aktivenIgrac.id_igr + 3];
            box.Visible = true;
            box.Image = Image.FromFile(pateka);
            this.popolniList();
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "1"].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "2"].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "3"].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "4"].Visible = false;
            aktivenIgrac.ikona.Controls["progressBar" + aktivenIgrac.id_igr].Visible = false;
            aktivenIgrac.ikona.Controls["label" + aktivenIgrac.id_igr + aktivenIgrac.id_igr].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr].Visible = false;
            label444.Text = "Збир на карти: " + aktivenIgrac.presmetajZbir().ToString();
            textBox11.Text = aktivenIgrac.vlog.ToString();
            if (aktivenIgrac.presmetajZbir() > 21)
            {
                brojac = 0;
                izbrisiIgrac(aktivenIgrac);
            }
            else if (aktivenIgrac.presmetajZbir() == 21)
            {
                pobednikNaIgrata();

            }
            if ((igraci.Count > aktivenIgrac.id_igr) && (igraci[aktivenIgrac.id_igr]!=null))
            {
                aktivenIgrac = igraci[aktivenIgrac.id_igr];
                brojac = 0;
                aktivenIgrac.PostaviAktiven();
            }
            else
            {
                brojac = 0;
                otvoriKartaDealer();
            }
        }
コード例 #7
0
ファイル: GlavnaIgra.cs プロジェクト: janedzumerko/BlackJack
        private void izbrisiIgrac(Player aktivenIgrac)
        {
            loser.Play();
            MessageBox.Show("Играчот со имe: " + aktivenIgrac.ime + " изгуби бидејќи има збир на карти " + aktivenIgrac.presmetajZbir().ToString(), "Изгубена партија", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            aktivenIgrac.igra = false;

            this.popolniList();
            brojac = 0;
            aktivenIgrac.ikona.Dispose();
        }
コード例 #8
0
ファイル: GlavnaIgra.cs プロジェクト: janedzumerko/BlackJack
 public void PocetokPogolemiCifri()
 {
     brojac = 0;
     izbrisiIgrac(aktivenIgrac);
     if (brojigraci > aktivenIgrac.id_igr)
     {
         aktivenIgrac = igraci[aktivenIgrac.id_igr];
         aktivenIgrac.PostaviAktiven();
     }
     else
     {
         otvoriKartaDealer();
     }
 }
コード例 #9
0
ファイル: GameMech.cs プロジェクト: smiles/codeninja
        private void GeneratePlayers(int HowMany)
        {
            Console.Clear();
            Banner();

            for (int Increment = 0; Increment < HowMany; Increment++)
            {
                Console.Write("What is Player {0} name? ", Increment + 1);
                Player player = new Player(Console.ReadLine(), _baseWalletValue);
                AllPlayers.Add(player);
            }
        }
コード例 #10
0
ファイル: GameMech.cs プロジェクト: smiles/codeninja
        private void UserInputGneratePlayer()
        {
            String UserInput = Console.ReadLine();

            if (!Validation.NotEmpty(UserInput))
            {
                bjPlayer = new Player(UserInput, _userWallet);
            }
            else
            {
                bjPlayer = new Player("Player", _userWallet);
            }
        }
コード例 #11
0
ファイル: GlavnaIgra.cs プロジェクト: janedzumerko/BlackJack
        private void button51_Click(object sender, EventArgs e)
        {
            timerIgrac.Stop();
            int broja = 0;
            int boja1 = 0;
            brojac = 0;
            if (aktivenIgrac.brojNaKarti < 5)
            {
                while (true)
                {
                    broja = r.Next(2, 14);
                    boja1 = r.Next(1, 4);
                    if (!upotrebeniKarti.zafatenaKarta(broja - 1, boja1 - 1))
                    {
                        upotrebeniKarti.dodajKarta(broja - 1, boja1 - 1);
                        break;
                    }
                }
                Karta k = new Karta(aktivenIgrac, aktivenIgrac.brojNaKarti + 1, upotrebeniKarti, boja1, broja);

                String pateka = "karti/";
                pateka += broja.ToString() + "-" + boja1.ToString() + ".png";
                PictureBox box = (PictureBox)aktivenIgrac.ikona.Controls["pictureBox" + aktivenIgrac.id_igr + (aktivenIgrac.brojNaKarti + 1).ToString()];
                aktivenIgrac.dodadiKarta(k);
                box.Visible = true;
                box.Image = Image.FromFile(pateka);
                this.popolniList();
            }
                aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "1"].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "2"].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "3"].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "4"].Visible = false;
            aktivenIgrac.ikona.Controls["progressBar" + aktivenIgrac.id_igr].Visible = false;
            aktivenIgrac.ikona.Controls["label" + aktivenIgrac.id_igr + aktivenIgrac.id_igr].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr].Visible = false;
            label555.Text = "Збир на карти: " + aktivenIgrac.presmetajZbir().ToString();
            aktivenIgrac.aktiven = true;
            Player p = aktivenIgrac;
            if (aktivenIgrac.presmetajZbir() > 21)
            {

                izbrisiIgrac(aktivenIgrac);
                otvoriKartaDealer();
            }
            else if (aktivenIgrac.presmetajZbir() == 21)
            {
                pobednikNaIgrata();
            }
            else if ((aktivenIgrac.presmetajZbir()<21)&&(aktivenIgrac.brojNaKarti < 5)) { aktivenIgrac.PostaviAktiven(); }
            else if (aktivenIgrac.presmetajZbir() < 21)
            {
                if ((igraci.Count > aktivenIgrac.id_igr) && ((igraci.Count > aktivenIgrac.id_igr) && (igraci[aktivenIgrac.id_igr] != null)))
                {
                    aktivenIgrac = igraci[aktivenIgrac.id_igr];
                    brojac = 0;
                    aktivenIgrac.PostaviAktiven();
                }
                else
                {
                    brojac = 0;
                    otvoriKartaDealer();
                }
            }
        }
コード例 #12
0
ファイル: GlavnaIgra.cs プロジェクト: janedzumerko/BlackJack
 public void pobednikNaIgrata()
 {
     timerIgrac.Stop();
     player.Play();
     DialogResult d = MessageBox.Show("Играчот: "+String.Format("{0}", aktivenIgrac.ime)+" доби BlackJack. Неговата добивка изнесува"+String.Format("{0}", (aktivenIgrac.vlog+(int)(aktivenIgrac.vlog*1.25))), "BlackJack.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     aktivenIgrac.vlog= aktivenIgrac.vlog+(int)(aktivenIgrac.vlog*1.25);
     aktivenIgrac.pobednik = true;
     aktivenIgrac.igra = false;
     ispolnilistapobednik();
     if ((igraci.Count > aktivenIgrac.id_igr) && (igraci[aktivenIgrac.id_igr] != null))
     {
         aktivenIgrac = igraci[aktivenIgrac.id_igr];
         brojac = 0;
         aktivenIgrac.PostaviAktiven();
     }
     else
     {
         brojac = 0;
         otvoriKartaDealer();
     }
 }
コード例 #13
0
ファイル: GlavnaIgra.cs プロジェクト: janedzumerko/BlackJack
        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);

            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: Sakthipriya123/NewsTracker
        static void Main(string[] args)
        {
            var playGame = true;

                        do
            {
                var Deck = new Dictionary<string, int>();

                Deck = Deck.CreateDeck();

                var dealer = new Dealer();

                var user = new Player();

                var gameOver = false;

                var cardBeingDealt = 0;
                //Deal the initial 2 cards to each player


                for (int i = 0; i < 2; i++)
                {
                    dealer.DealCards(Deck, cardBeingDealt);
                    if (dealer.CardDealt)
                    {
                        cardBeingDealt++;
                    }
                }

                for (int i = 2; i < 4; i++)
                {
                    user.DealCards(Deck, cardBeingDealt);
                    if (user.CardDealt)
                    {
                        cardBeingDealt++;
                    }
                }

                do
                {

                    user.ShowHand(user.PlayerHand);                                       
                    if (dealer.PlayerScore < 21 && user.PlayerScore < 21)
                    {
                        dealer.DealerChoice(Deck, cardBeingDealt);
                        if (dealer.CardDealt)
                        {
                            cardBeingDealt++;
                        }
                         user.HitOrStay(Deck, cardBeingDealt);
                            if (user.CardDealt)
                            {
                                cardBeingDealt++;
                            }
                        else
                        {
                            gameOver =true;
                        }
                      
                        
                    }
                    else
                    {
                        
                        Console.WriteLine("Your Score is {0}",user.PlayerScore);
                        Console.WriteLine("Dealer Score is {0}", dealer.PlayerScore);
                        CheckWinner(user, dealer);

                        //if(user.PlayerScore > dealer.PlayerScore)
                        //{
                        //    Console.WriteLine("Dealer Wins");
                        //}
                        // else if(user.PlayerScore > 21 || dealer.PlayerScore > 21)
                        //{
                        //    Console.WriteLine("Bust");
                        //}
                        //else if(dealer.PlayerScore > user.PlayerScore)
                        //{
                        //    Console.WriteLine("You Win");
                        //}
                        //Console.WriteLine("Game Over!");
                        gameOver = true;
                    }


                }
                while (!gameOver);




                playGame = false;
            }


            while (!playGame == false);







            //for (int i = 0; i < 52; i++)
            //{
            //    var newCard = Dealer.DealCards(Deck, i);
            //    Console.WriteLine(newCard);
            //}

            Console.ReadLine();

        }
コード例 #15
0
ファイル: GlavnaIgra.cs プロジェクト: janedzumerko/BlackJack
 private void button42_Click(object sender, EventArgs e)
 {
     timerIgrac.Stop();
     if (aktivenIgrac.brojNaKarti < 21)
     {
         aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "1"].Visible = false;
         aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "2"].Visible = false;
         aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "3"].Visible = false;
         aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "4"].Visible = false;
         aktivenIgrac.ikona.Controls["progressBar" + aktivenIgrac.id_igr].Visible = false;
         aktivenIgrac.ikona.Controls["label" + aktivenIgrac.id_igr + aktivenIgrac.id_igr].Visible = false;
         aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr].Visible = false;
         if ((igraci.Count > aktivenIgrac.id_igr) && (igraci[aktivenIgrac.id_igr]!=null))
         {
             aktivenIgrac = igraci[aktivenIgrac.id_igr];
             brojac = 0;
             aktivenIgrac.PostaviAktiven();
         }
         else
         {
             brojac = 0;
             otvoriKartaDealer();
         }
     }
 }
コード例 #16
0
ファイル: GlavnaIgra.cs プロジェクト: janedzumerko/BlackJack
        void timerIgrac_Tick(object sender, EventArgs e)
        {
            brojac++;
            if (brojac == 120)
            {
                timerIgrac.Stop();
                otkaziIgrac();
                MessageBox.Show("Играчот се откажа.");
                aktivenIgrac.ikona.Controls["progressBar" + aktivenIgrac.id_igr].Visible = false;
                aktivenIgrac.ikona.Controls["label" + aktivenIgrac.id_igr + aktivenIgrac.id_igr].Visible = false;
                aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "1"].Visible = true;
                aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "2"].Visible = true;
                aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "3"].Visible = true;
                aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr + "4"].Visible = true;
                if ((igraci.Count > aktivenIgrac.id_igr) && (igraci[aktivenIgrac.id_igr] != null))
                {
                    aktivenIgrac = igraci[aktivenIgrac.id_igr];
                    brojac = 0;
                    aktivenIgrac.PostaviAktiven();
                }
                else
                {
                    otvoriKartaDealer();
                }

            }
            ProgressBar pro = (ProgressBar)aktivenIgrac.ikona.Controls["progressBar" + aktivenIgrac.id_igr];
            aktivenIgrac.ikona.Controls["label" + aktivenIgrac.id_igr + aktivenIgrac.id_igr].Text = (120 - brojac).ToString();
            pro.Value = brojac;
        }
コード例 #17
0
ファイル: GlavnaIgra.cs プロジェクト: janedzumerko/BlackJack
        private void zapocniIgra()
        {
            aktivenIgrac = null;
            foreach (Player p in igraci)
            {

                if (p.igra)
                {
                    aktivenIgrac = p;
                    break;
                }
            }
            if (aktivenIgrac != null)
            {
                aktivenIgrac.PostaviAktiven();

            }
        }
コード例 #18
0
ファイル: GlavnaIgra.cs プロジェクト: janedzumerko/BlackJack
        private void button44_Click(object sender, EventArgs e)
        {
            timerIgrac.Stop();
            MessageBox.Show("Играчот се откажа." + "Неговата добивка изнесува: " + aktivenIgrac.vlog / 2);
            textBox11.Text = (aktivenIgrac.vlog / 2).ToString();

            String[] p = new String[2];
            p[0] = aktivenIgrac.ime;
            p[1] = Convert.ToString((aktivenIgrac.vlog / 2));
            dataGridView3.Rows.Add(p);
            aktivenIgrac.vlog = aktivenIgrac.vlog / 2;
            brojac = 0;
            aktivenIgrac.igra = false;
            aktivenIgrac.otkazi = true;

            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr.ToString() + "1"].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr.ToString() + "2"].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr.ToString() + "3"].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr.ToString() + "4"].Visible = false;
            aktivenIgrac.ikona.Controls["progressBar" + aktivenIgrac.id_igr.ToString()].Visible = false;
            aktivenIgrac.ikona.Controls["label" + aktivenIgrac.id_igr.ToString() + aktivenIgrac.id_igr.ToString()].Visible = false;
            aktivenIgrac.ikona.Controls["button" + aktivenIgrac.id_igr.ToString()].Visible = false;
            otkaziIgrac();
            if ((igraci.Count > aktivenIgrac.id_igr) && (igraci[aktivenIgrac.id_igr]!=null))
            {
                aktivenIgrac = igraci[aktivenIgrac.id_igr];
                brojac = 0;
                aktivenIgrac.PostaviAktiven();
            }
            else
            {
                brojac = 0;
                otvoriKartaDealer();
            }
        }
コード例 #19
0
		/// <summary>
		/// Deals a card to the player.
		/// Every card dealt is taken out of the game deck.
		/// </summary>
		/// <param name="player">the player which a card is being dealt to</param>
		public void HitPlayer(Player player)
		{
			player.Hand.Push(GameDeck.Cards.Pop());
		}