public StartWindow(OptionsViewModel viewModel)
        {
            this.viewModel = viewModel;
            this.command   = new ToGameCommand(viewModel, this);

            // bord = ReversiBoard.CreateInitialState


            var bord = new BoardViewModel();

            bord.playerNameOne = playerNameOne;
            bord.playerNameTwo = playerNameTwo;
            bord.height        = height;
            bord.width         = width;
        }
Ejemplo n.º 2
0
 public EndScreenViewModel(String winner, String winnerClass, OptionsViewModel options)
 {
     if (winner == null)
     {
         this.Winner = "Draw";
         WinnerClass = "Draw";
     }
     else
     {
         this.Winner = winner;
         WinnerClass = winnerClass;
     }
     this.Options        = options;
     this.RestartCommand = new RestartCommand(Options);
 }
        public BoardViewModel(ReversiBoard board, OptionsViewModel options)

        {
            this.spel = new ReversiGame(board.Width, board.Height);
            this.Rows = new List <BoardRowViewModel>();

            this.bord          = board;
            this.black         = bord.CountStones(Player.BLACK);
            this.white         = bord.CountStones(Player.WHITE);
            this.currentPlayer = spel.CurrentPlayer;
            this.options       = options;

            //timer



            var timeService = ServiceLocator.Current.GetInstance <ITimeService>();

            _start = timeService.Now;

            _timer       = ServiceLocator.Current.GetInstance <ITimerService>();
            _timer.Tick += Timer_Tick;
            _timer.Start(new TimeSpan(0, 0, 0, 0, 100));

            //this.Milliseconds = modelTimer.Milliseconds;

            for (var i = 0; i < board.Height; i++)
            {
                var rij = new BoardRowViewModel(spel);

                for (var j = 0; j < board.Width; j++)
                {
                    rij.Squares[j].speler  = spel.Board[new Vector2D(j, i)]; //breedte hoogte, j breedte i hoogte
                    rij.Squares[j].Positie = new Vector2D(j, i);             // nu is er aan elke square een juiste positie toegekend
                }
                Rows.Add(rij);
            }

            this.Command    = new PutStoneCommand(this); // heeft een board nodig dus daarom de this we gaan deze direct meegeven
            this.commandend = new ToEndCommand(options, this);
        }
Ejemplo n.º 4
0
        public BoardViewModel(ReversiBoard reversiBoard, OptionsViewModel options)
        {
            try
            {
                this.game = new ReversiGame(reversiBoard.Width, reversiBoard.Height);
                System.Diagnostics.Debug.WriteLine(reversiBoard.Width);
            }
            catch
            {
                this.game = new ReversiGame(6, 6);
            }
            this.Rows           = new List <BoardRowViewModel>();
            this.Command        = new PutStoneCommand(this);
            this.restartCommand = new RestartCommand(this);
            this.optionsView    = options;
            this.endGameCommand = new EndGameCommand(optionsView, this);

            _timer          = new DispatcherTimer(DispatcherPriority.Render);
            _timer.Interval = TimeSpan.FromSeconds(1);
            _timer.Tick    += (sender, args) =>
            {
                CurrentTime = DateTime.Now.ToLongTimeString();
            };
            _timer.Start();

            for (int i = 0; i < game.Board.Height; i++)
            {
                var boardRow = new BoardRowViewModel(game);
                for (int j = 0; j < game.Board.Width; j++)
                {
                    boardRow.Squares[j].Owner          = game.Board[new Vector2D(j, i)];
                    boardRow.Squares[j].SquarePosition = new Vector2D(j, i);
                }
                Rows.Add(boardRow);
            }
        }
Ejemplo n.º 5
0
 public EndGameCommand(OptionsViewModel optionsView, BoardViewModel bvm)
 {
     this.optionsView = optionsView;
     this.BoardView   = bvm;
 }
Ejemplo n.º 6
0
 public ScreenCommand(OptionsViewModel optionsView, StartWindow startWindow)
 {
     this.optionsView = optionsView;
     this.startWindow = startWindow;
 }
 public void SetOptions(OptionsViewModel options)
 {
     this.Options = options;
     this.Command = new EasyCommand(Options, this);
 }
 public RestartCommand(OptionsViewModel options)
 {
     this.Options = options;
 }
Ejemplo n.º 9
0
 public ToGameCommand(OptionsViewModel viewModel, StartWindow startWindow)
 {
     this.viewModel   = viewModel;
     this.startWindow = startWindow;
 }
Ejemplo n.º 10
0
 public EndWindow(OptionsViewModel optionsViewModel)
 {
     this.optionsView    = optionsViewModel;
     this.endGameCommand = new EndGameCommand(optionsView, bvm);
     this.newGameCommand = new NewGameCommand(optionsView, this);
 }
 public ToEndCommand(OptionsViewModel viewModel, BoardViewModel boardView)
 {
     this.viewModel = viewModel;
     this.BoardView = boardView;
 }
 public EndGameCommand(BoardViewModel boardView, OptionsViewModel options)
 {
     this.BoardView = boardView;
     this.Options   = options;
 }
 public EasyCommand(OptionsViewModel options, StartScreenViewModel StartScreen)
 {
     this.Options     = options;
     this.StartScreen = StartScreen;
 }