コード例 #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();
            }
        }