コード例 #1
0
ファイル: Form1.cs プロジェクト: coop152/GameOfLife
 private void Form1_Shown(object sender, EventArgs e)
 {
     Rows    = (int)rowNumericUpDown.Value;
     Columns = (int)columnNumericUpDown.Value;
     Game    = new ToroidalGameOfLife(Rows, Columns);
     //DrawGrid(Rows, Columns);
     renderPanel.Invalidate();
 }
コード例 #2
0
ファイル: GameForm.cs プロジェクト: coop152/GameOfLife
        private void Form1_Shown(object sender, EventArgs e)
        {
            this.Text += $" - Signed in as \"{Username}\"";
            int rows    = (int)rowNumericUpDown.Value;
            int columns = (int)columnNumericUpDown.Value;

            EnumerateSavegames();
            GameTypeComboBox.SelectedIndex = 0;
            Game = new ToroidalGameOfLife(rows, columns);
            renderPictureBox.Invalidate();
        }
コード例 #3
0
ファイル: GameForm.cs プロジェクト: coop152/GameOfLife
        private void LoadGameButton_Click(object sender, EventArgs e)
        {
            string selected = (string)SavegameListBox.SelectedItem;

            if (selected != null)
            {
                Savegame save = db.LoadSavegame(Username, selected);
                rowNumericUpDown.Value    = save.Rows;
                columnNumericUpDown.Value = save.Columns;
                Game = ToroidalGameOfLife.Deserialise(save.Serialised, save.Rows, save.Columns);
                GameTypeComboBox.SelectedIndex = 0;
                ThresholdsChanged(sender, e);
                renderPictureBox.Invalidate();
            }
        }
コード例 #4
0
ファイル: GameForm.cs プロジェクト: coop152/GameOfLife
 private void GameTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (Game != null)
     {
         ComboBox comboBox = sender as ComboBox;
         Game = GameTypes[comboBox.SelectedIndex](Game.AsArray());
         if (comboBox.SelectedIndex != 3)
         {
             UnderpopulationThresholdUpDown.Enabled = false;
             RebirthThresholdUpDown.Enabled         = false;
             OverpopulationThresholdUpDown.Enabled  = false;
         }
         else
         {
             UnderpopulationThresholdUpDown.Enabled = true;
             RebirthThresholdUpDown.Enabled         = true;
             OverpopulationThresholdUpDown.Enabled  = true;
         }
     }
 }