예제 #1
0
        /// <summary>
        /// Constructor waarin het Parrent Form meegegeven word
        /// </summary>
        public Game(startGame ParentForm)
        {
            InitializeComponent();
            this.StartGame = ParentForm;

            if (StartGame.x6SettingDeck())
            {
                MatrixSize = 6;
            }
            else
            {
                MatrixSize = 4;
            }
            naamP1             = Interaction.InputBox("Vul je naam in", "Vul je naam in", "Speler 1", -1, -1);
            naamP2             = Interaction.InputBox("Vul je naam in", "Vul je naam in", "Speler 2", -1, -1);
            lblScoreP1.Text    = naamP1 + ": " + scoreP1;
            lblScoreP2.Text    = naamP2 + ": " + scoreP2;
            lblTurn.Text       = naamP1 + " is aan de beurt";
            lblShowImages.Text = "5";
            setPictureBoxes();
            setRandomImages();
            timerShowImages.Start();
            clickTimer.Interval = 1000;
            clickTimer.Tick    += clickTimer_Tick;
        }
예제 #2
0
        /// <summary>
        /// maakt de pictureboxes aan
        /// </summary>
        private void setPictureBoxes()
        {
            var path = Path.Combine(Directory.GetCurrentDirectory(), "../../Resources/");
            int i    = 0;

            while (i <= MatrixSize * MatrixSize - 1)

            {
                pictureBox[i]      = new PictureBox();
                pictureBox[i].Name = "pictureBox" + i;
                if (StartGame.x6SettingDeck())
                {
                    pictureBox[i].Size = new Size(66, 100);
                }
                else
                {
                    pictureBox[i].Size = new Size(100, 150);
                }
                pictureBox[i].Show();
                pictureBox[i].Tag = null;

                if (StartGame != null)
                {
                    bool gameDeckCheck  = StartGame.deckSettingGame();
                    bool musicDeckCheck = StartGame.deckSettingMusic();
                    bool memeDeckCheck  = StartGame.deckSettingMeme();
                    if (gameDeckCheck == true)
                    {
                        pictureBox[i].ImageLocation = (path + "CoverG" + ".jpg");
                    }
                    else if (musicDeckCheck == true)
                    {
                        pictureBox[i].ImageLocation = (path + "CoverM" + ".jpg");
                    }
                    else if (memeDeckCheck == true)
                    {
                        pictureBox[i].ImageLocation = (path + "CoverMm" + ".jpg");
                    }
                    else
                    {
                        pictureBox[i].ImageLocation = (path + "CoverMm" + ".jpg");
                    }
                }
                else
                {
                    pictureBox[i].ImageLocation = (path + "CoverMm" + ".jpg");
                }

                pictureBox[i].SizeMode    = PictureBoxSizeMode.StretchImage;
                pictureBox[i].MouseClick += new MouseEventHandler(clickImage);
                i++;
            }
            i = 0;
            for (int ix = 0; ix < MatrixSize; ix++)
            {
                for (int iy = 0; iy < MatrixSize; iy++)
                {
                    if (StartGame.x6SettingDeck())
                    {
                        pictureBox[i].Location = new Point(40 + ix * 66, 50 + iy * 100);
                    }
                    else
                    {
                        pictureBox[i].Location = new Point(40 + ix * 100, 50 + iy * 150);
                    }
                    i++;
                }
            }
            Controls.AddRange(pictureBox);
        }