Esempio n. 1
0
 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();
 }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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();
            }
        }
Esempio n. 4
0
 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;
         }
     }
 }