Пример #1
0
        private void btnLoadGamestate_Click(object sender, EventArgs e)
        {
            var FD = new System.Windows.Forms.OpenFileDialog();
            if (FD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string fileToOpen = FD.FileName;

                GameState gameState = new GameState();

                XmlSerializer deserializer = new XmlSerializer(typeof(GameState));
                TextReader reader = new StreamReader(fileToOpen);
                gameState = (GameState)deserializer.Deserialize(reader);

                gameState.DieSet.Dice.RemoveRange(0, 5);
                reader.Close();

                //Console.WriteLine(playerList.Count);
                MainForm gameForm = new MainForm();

                gameForm.ProcessGameState(gameState);
                gameForm.UpdateActivePlayer();

                gameForm.Show();

                Close();
            }
        }
Пример #2
0
        private void startGame(GameState game)
        {
            PlayerList myPlayerList = new PlayerList();

            foreach (Player player in game.Players.Players)
            {
                if (myLocalPlayers.Contains(player.Name))
                {
                    myPlayerList.Players.Add(new HumanPlayer(player.Name));
                }
                else if (myAIPlayers.Contains(player.Name))
                {
                    //myPlayerList.Players.Add(new ComputerPlayer(player.Name)); // NEED TO GET AI TYPE
                }
                else
                {
                    myPlayerList.Players.Add(new NetworkPlayer(player.Name));
                }
            }

            foreach (Player player in myPlayerList.Players)
            {
                player.ScoreSheet.setupGame("Yahtzee");
            }

            MainForm gameForm = new MainForm();

            gameForm.PlayerList.Players = myPlayerList.Players;
            gameForm.PlayerList.makeNamesUnique();
            gameForm.createScoreSheet();
            gameForm.isNetworkGame = true;

            gameForm.Show();
            Close();
        }
Пример #3
0
        private void startGameBtn_Click(object sender, EventArgs e)
        {
            if (playerList.Count == 0)
            {
                MessageBox.Show("Please Add At Least One Player");
                return;
            }

            if (cmbGameType.SelectedItem.ToString() != "Yahtzee")
            {
                foreach (Player player in playerList)
                {
                    if (player.PlayerType == "Computer")
                    {
                        MessageBox.Show("Sorry, the AI players refuse to play any game type but Yahtzee.  Please either change the game type to Yahtzee or remove the computer players.");
                        return;
                    }
                }
            }

            foreach (Player player in playerList)
            {
                player.ScoreSheet.setupGame(cmbGameType.SelectedItem.ToString());
            }

            Console.WriteLine(playerList.Count);
            MainForm gameForm = new MainForm();

            gameForm.PlayerList.Players = playerList;
            gameForm.PlayerList.makeNamesUnique();
            gameForm.createScoreSheet();
            gameForm.isNetworkGame = false;

            gameForm.Show();
            Close();
        }
Пример #4
0
 private void loginBtn_Click(object sender, EventArgs e)
 {
     var mainForm = new MainForm();
     mainForm.Show();
 }
Пример #5
0
 // CONNECT ============================================================
 private void btnConnect_Click(object sender, EventArgs e)
 {
     MainForm MainForm = new MainForm();
     MainForm.Show();
 }
Пример #6
0
        private void viewHXData_Click(object sender, EventArgs e)
        {
            MainForm mainForm = new MainForm();

            mainForm.Show();
        }