Esempio n. 1
0
        private void Multiplayer_Click(object sender, EventArgs e)
        {
            Counter_Chooser f = new Counter_Chooser(true);//If multiplayer then will open counter chooser with true to represent multiplayer.

            f.Closed += (s, args) => this.Close();
            f.Show();
            this.Hide();
        }
Esempio n. 2
0
        private void Singleplayer_Click(object sender, EventArgs e)
        {
            Counter_Chooser f = new Counter_Chooser(false);//If singleplayer chosen then will open counter chooser with false for singleplayer.

            f.Closed += (s, args) => this.Close();
            f.Show();
            this.Hide();
        }
        private void userChecker()
        {
            int userCounter = 0;

            if (_isMP && _playerCount == 1)
            {
                if (_otherUserColour == _colourNumber)
                {
                    AIU.Visible = true;
                    return;
                }
                User      p2 = new User(_colourNumber);
                Connect_4 f  = new Connect_4(_p1, p2, false);//If its the second user on multiplayer they will both be assigned the colours and the game will be open.
                f.Closed += (s, args) => this.Close();
                f.Show();
                this.Hide();
            }
            else if (_isMP && _playerCount == 0)
            {
                _playerCount++;
                User            p1 = new User(_colourNumber);
                Counter_Chooser c  = new Counter_Chooser(_isMP, _playerCount, p1, p1.CounterColour);//If its multiplayer but first user then player 1s counter colour assigned and counter chooser called again for player 2.
                c.Closed += (s, args) => this.Close();
                c.Show();
                this.Hide();
            }
            else
            {
                do
                {
                    Random r = new Random();
                    userCounter = r.Next(1, 6);
                } while (userCounter == _colourNumber);// Will choose a random colour for the ai making sure it doesn't clash with the users.
                User       player1 = new User(_colourNumber);
                AI         player2 = new AI(userCounter);
                Difficulty f       = new Difficulty(player1, player2);// The ai and user are assingned there colours then the difficulty form is called.
                f.Closed += (s, args) => this.Close();
                f.Show();
                this.Hide();
            }
        }