Пример #1
0
        /// <summary>
        /// Method restarts game
        /// </summary>
        public void ResetGame()
        {
            LoadBoardSize();

            gameModel     = new Model.GameBoardModel(this.boardSize, this.numberOfLayers);
            gameModelView = new View.GameBoardView(gameModel);
            gameModelView.InsertGameBoardIntoMainGrid(ref mainBoardGrid, 0, 1);

            gameStatistic.ResetStatistic();

            StartGame();
        }
Пример #2
0
        /// <summary>
        /// Method converts string (saved gamed) to game board, game settings and game score
        /// </summary>
        /// <param name="savedGame"></param>
        public void ImportGame(String savedGame)
        {
            string [] list = savedGame.Split('.');

            Model.GameSettings.GetInstance.ImportSettingsFromString(list[0], list[1], list[2], list[3], list[4]);
            LoadBoardSize();

            gameModel     = new Model.GameBoardModel(this.boardSize, this.numberOfLayers);
            gameModelView = new View.GameBoardView(gameModel);
            gameModelView.InsertGameBoardIntoMainGrid(ref mainBoardGrid, 0, 1);
            gameModel.ImportGameBoardModelFromString(list[5], list[6]);

            gameStatistic.ResetStatistic();
            gameStatistic.ImportScoreModelFromString(list[7]);

            UpdateView();
        }
Пример #3
0
        public GameController(ref Windows.UI.Xaml.Controls.Grid mainBoard,
                              ref Windows.UI.Xaml.Controls.TextBlock bestScore,
                              ref Windows.UI.Xaml.Controls.TextBlock actualScore)
        {
            LoadBoardSize();

            gameStatistic     = new Model.GameScoreModel();
            gameStatisticView = new View.GameScoreView(ref bestScore, ref actualScore);

            mainBoardGrid = mainBoard;
            gameModel     = new Model.GameBoardModel(this.boardSize, this.numberOfLayers);
            gameModelView = new View.GameBoardView(gameModel);

            gameModelView.InsertGameBoardIntoMainGrid(ref mainBoardGrid, 0, 1);

            StartGame();
        }