private void LevelChangeHelper(GameLevelEnum nDifficulty) { if ((this.nDifficulty != nDifficulty) && (this.fGameFinished || (DialogResult.Yes == MessageBox.Show("Do you want to resign this game?", this.Text,MessageBoxButtons.YesNo,MessageBoxIcon.Question)))) { this.nDifficulty = nDifficulty; UpdateLevelMenu(); NewGameHelper(); } }
public MainForm() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializedComponent call // fGameFinished = true; nDifficulty = GameLevelEnum.Beginner; // Easiest level try { m_Driver = new TileDriver.Driver(); } catch(Exception e) { Console.WriteLine("MainForm.MainForm() : Caught exception while instantiating TileDriver object."); Console.WriteLine((e.Message).ToString()); } Debug.Assert(m_Driver != null, "m_Driver != null", "Cannot create 'Driver' object!"); // // Init board // // MainBoard = new PuzzleBoard(this); int[] rgGoal = new int[MainBoard.MaxTile]; for (int i = 0; i < MainBoard.MaxTile; i++) rgGoal[i] = i+1; rgGoal[MainBoard.MaxTile-1] = 0; MainBoard.InitTile(rgGoal,false); this.UpdateLevelMenu(); this.UpdateBoardSizeMenu(3,3); this.UpdateAlgMenu(3); this.UpdateStatusPanel(); this.UpdateToolbarButton(); this.AlgType = 3; this.On_ReSize(null,null); // Load a default image mnuUseImage.Checked = true; mnuChangeImage.Enabled = true; this.sBackgroundPic = "ImageFromEmbedResource"; MainBoard.ChangeImage(); if(fSelfTest) { OnNewGame(this, new EventArgs()); Thread.Sleep(10); OnSolve(this, new EventArgs()); } }