コード例 #1
0
        private void NewGame()
        {                                                        //*** START A NEW GAME ***
            masterImage = (Image)this.Resources["MasterImage1"]; //Get the game image

            BitmapSource bitmap = (BitmapSource)masterImage.Source;

            _puzzleSize = new Size(bitmap.PixelWidth * 1.8, bitmap.PixelHeight * 1.8); //Set the size of the image

            //check if a puzzle already exisits
            if (_dwellTimePuzzleGrid != null)
            {
                _puzzleHostingPanel.Children.Remove(_dwellTimePuzzleGrid); //true remove it
            }

            _dwellTimePuzzleGrid = new DwellTimePuzzleGrid(); //initialise _MousePuzzleGrid

            _dwellTimePuzzleGrid.NumRows = _numRows;          //number of rows in the grid

            _dwellTimePuzzleGrid.PuzzleImage = masterImage;   //background image

            _dwellTimePuzzleGrid.PuzzleSize = _puzzleSize;    //size of the puzzle

            _dwellTimePuzzleGrid.ConfigType = "A";            //Use game congiguration A
            //_dwellTimePuzzleGrid.ConfigType = "B";         //Use game configuration B
            //_dwellTimePuzzleGrid.ConfigType = "T";         //Use trial configuration

            _puzzleHostingPanel.Children.Add(_dwellTimePuzzleGrid); //add grid to the user interface


            _dwellTimePuzzleGrid.StartConfig("ConfigA");       //Use start configuration A
            //_dwellTimePuzzleGrid.StartConfig("ConfigB");       //Use start configuration B
            //_dwellTimePuzzleGrid.StartConfig("Trial");       //Use the trial configuration to start
        }
コード例 #2
0
        private void NewGame()
        {
            //*** START A NEW GAME ***
            masterImage = (Image)this.Resources["MasterImage1"]; //Get the game image

            BitmapSource bitmap = (BitmapSource)masterImage.Source;
            _puzzleSize = new Size(bitmap.PixelWidth * 1.8, bitmap.PixelHeight * 1.8); //Set the size of the image

            //check if a puzzle already exisits
            if (_dwellTimePuzzleGrid != null)
            {
                _puzzleHostingPanel.Children.Remove(_dwellTimePuzzleGrid); //true remove it
            }

            _dwellTimePuzzleGrid = new DwellTimePuzzleGrid(); //initialise _MousePuzzleGrid

            _dwellTimePuzzleGrid.NumRows = _numRows; //number of rows in the grid

            _dwellTimePuzzleGrid.PuzzleImage = masterImage; //background image

            _dwellTimePuzzleGrid.PuzzleSize = _puzzleSize; //size of the puzzle

            _dwellTimePuzzleGrid.ConfigType = "A";           //Use game congiguration A
            //_dwellTimePuzzleGrid.ConfigType = "B";         //Use game configuration B
            //_dwellTimePuzzleGrid.ConfigType = "T";         //Use trial configuration

            _puzzleHostingPanel.Children.Add(_dwellTimePuzzleGrid); //add grid to the user interface

            _dwellTimePuzzleGrid.StartConfig("ConfigA");       //Use start configuration A
            //_dwellTimePuzzleGrid.StartConfig("ConfigB");       //Use start configuration B
            //_dwellTimePuzzleGrid.StartConfig("Trial");       //Use the trial configuration to start
        }