コード例 #1
0
        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;
        }
コード例 #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);
 }
コード例 #3
0
        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);
        }
コード例 #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);
            }
        }
コード例 #5
0
 public EndGameCommand(OptionsViewModel optionsView, BoardViewModel bvm)
 {
     this.optionsView = optionsView;
     this.BoardView   = bvm;
 }
コード例 #6
0
 public ScreenCommand(OptionsViewModel optionsView, StartWindow startWindow)
 {
     this.optionsView = optionsView;
     this.startWindow = startWindow;
 }
コード例 #7
0
 public void SetOptions(OptionsViewModel options)
 {
     this.Options = options;
     this.Command = new EasyCommand(Options, this);
 }
コード例 #8
0
 public RestartCommand(OptionsViewModel options)
 {
     this.Options = options;
 }
コード例 #9
0
 public ToGameCommand(OptionsViewModel viewModel, StartWindow startWindow)
 {
     this.viewModel   = viewModel;
     this.startWindow = startWindow;
 }
コード例 #10
0
ファイル: EndWindow.cs プロジェクト: DylanDriessen/Reversi
 public EndWindow(OptionsViewModel optionsViewModel)
 {
     this.optionsView    = optionsViewModel;
     this.endGameCommand = new EndGameCommand(optionsView, bvm);
     this.newGameCommand = new NewGameCommand(optionsView, this);
 }
コード例 #11
0
 public ToEndCommand(OptionsViewModel viewModel, BoardViewModel boardView)
 {
     this.viewModel = viewModel;
     this.BoardView = boardView;
 }
コード例 #12
0
 public EndGameCommand(BoardViewModel boardView, OptionsViewModel options)
 {
     this.BoardView = boardView;
     this.Options   = options;
 }
コード例 #13
0
 public EasyCommand(OptionsViewModel options, StartScreenViewModel StartScreen)
 {
     this.Options     = options;
     this.StartScreen = StartScreen;
 }