예제 #1
0
        public DefaultApp()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var notifiableView = new NotifiableGameView();;

            this.view = notifiableView;
            var board = new SquareBoard(4);
            var game  = new Game(notifiableView, board);

            this.controller = new DefaultGameController(game);
            mainWindow      = new Window(view, controller);
            mainWindow.SetEventOnNewImageSelected(ChangePuzzleImage);

            var outputControl = FindControl(boardOutputControlName);
            var defaultImage  = Image.FromFile(defaultImagePath);
            var cellFactory   = new BoardCellFactory(controller, defaultImage);

            this.boardRenderer = new BoardRenderer(outputControl, board, cellFactory);
            view.SetEventOnCellMoved(boardRenderer.SwapCells);
            view.SetEventOnBoardChanged(boardRenderer.Render);

            boardRenderer.Render(board);
        }
예제 #2
0
        public void Init()
        {
            this.view  = new NotifiableGameView();
            this.board = new SquareBoard(boardSize);
            this.game  = new Game(view, board);

            this.controller = new DefaultGameController(game);
        }
예제 #3
0
        public Game(NotifiableGameView view, SquareBoard board)
        {
            this.view              = view;
            this.board             = board;
            this.isGameBeingSolved = false;
            this.drawCounter       = 0;

            this.solveTimer     = new System.Windows.Forms.Timer();
            solveTimer.Interval = replayStepTimeInMs;

            DisorderBoard();
        }
예제 #4
0
 private void CreateObservableAndGameView()
 {
     gameView = new NotifiableGameView();
     view     = gameView;
 }