Example #1
0
        public BlackHoleGame()
        {
            InitializeComponent();
            grid                      = new List <GridButton>();
            blackHole                 = new GridButton(this, 0, 0);
            previousButton            = new GridButton(this, 0, 0);
            model                     = new BlackHoleModel();
            model.GameOver           += this.OnModel_gameOver;
            model.GameUpdated        += this.OnModel_gameUpdated;
            toolStripMenuItem8.Click += SaveGame;
            toolStripMenuItem9.Click += LoadGame;
            turnPhaseOne              = true;
            model.FirstsTurn          = true;
            model.FieldChanged       += this.OnModel_fieldChanged;

            gridSize = 9;
            model.NewGame(gridSize);
            formWidth  = 500;
            formHeigth = 500 + menuStrip1.Height;

            gameField.Margin  = new Padding(0, 0, 0, 0);
            gameField.Padding = new Padding(0, 0, 0, 0);

            this.Size = new Size(formWidth, formHeigth);

            buttonHeigth = gameField.Height / gridSize;
            buttonWidth  = gameField.Width / gridSize;

            this.MaximumSize = this.Size;
            this.MinimumSize = this.MaximumSize;
            GenerateTable(gridSize);

            this.toolStripMenuItem3.Click += On_5x5newGame;
            this.toolStripMenuItem4.Click += On_7x7newGame;
            this.toolStripMenuItem5.Click += On_9x9newGame;
        }
 public void Initialize()
 {
     model              = new BlackHoleModel();
     model.GameUpdated += (a, b) => { };
     model.GameOver    += (a, b) => { };
 }