Beispiel #1
0
 public PlayerViewModel(BoardViewModel parent, Player player, int dimension)
 {
     this.parent = parent;
     this.player = player;
     Score       = Cell.Derive(this.parent.ReversiGame, g => g.Board.CountStones(player));
     ScoreBar    = Cell.Derive(Score, s => ScoreBarSize(s, dimension));
 }
Beispiel #2
0
 public StartWindow(OptionsViewModel optionsViewModel)
 {
     this.optionsView = optionsViewModel;
     try
     {
         if (playerOne == null)
         {
             playerOne = "Sonic";
         }
         if (playerTwo == null)
         {
             playerTwo = "Mario";
         }
         Width  = 6;
         Height = 6;
         var board = new BoardViewModel();
         board.playerOne = playerOne;
         board.playerTwo = playerTwo;
     }
     catch (Exception)
     {
         if (playerOne == null)
         {
             playerOne = "Sonic";
         }
         if (playerTwo == null)
         {
             playerTwo = "Mario";
         }
         var board = new BoardViewModel();
         board.playerOne = playerOne;
         board.playerTwo = playerTwo;
     }
     this.screenCommand = new ScreenCommand(optionsView, this);
 }
 public void NewGameExecute()
 {
     Debug.WriteLine("NewGame from AppVM");
     Board             = new BoardViewModel(Menu.GameInformation);
     CurrentWorkSpace  = Board;
     Prefs.PlayerBlack = Menu.PlayerOne.Color.Value;
     Prefs.PlayerWhite = Menu.PlayerTwo.Color.Value;
 }
Beispiel #4
0
 public EndWindow(OptionsViewModel optionsModel, BoardViewModel viewmodel)
 {
     this.optionsModel = optionsModel;
     this.commandend   = new ToEndCommand(optionsModel, viewmodel);
     this.winner       = viewmodel.getWinner();
     this.spel         = viewmodel;
     Debug.WriteLine(spel);
     this.bord = viewmodel.bord;
     Debug.WriteLine(bord);
 }
        public OptionsViewModel()
        {
            var bordview = new BoardViewModel(ReversiBoard.CreateInitialState(6, 6), this); // hetzelfde spel wordt hier gebruikt, we gaan dezelfde bordview gebruiken om onze gegevens uit te halen

            this.OptionPanes = new List <object> {
                new OptionsCategory(new StartWindow(this)),
                new OptionsCategory(bordview),//Maakt bord aan
            };
            this.SelectedOptionPane = OptionPanes.First();
        }
 public BoardRowViewModel(BoardViewModel parent, int index)
 {
     this.Parent  = parent;
     this.Index   = index;
     this.Squares = new List <BoardSquareViewModel>();
     for (int i = 0; i < ReversiBoard.Width; i++)
     {
         Squares.Add(new BoardSquareViewModel(this, i));
     }                                                                                               //initialise columns
 }
Beispiel #7
0
        public void Execute(object parameter) // wat er gebeurt wanneer men op de knop zelf klikt
        {
            BoardViewModel bvm;

            bvm               = new BoardViewModel(ReversiBoard.CreateInitialState(6, 6), viewModel);// waardes grote ingeven
            bvm.height        = startWindow.height;
            bvm.width         = startWindow.width;
            bvm               = new BoardViewModel(ReversiBoard.CreateInitialState(bvm.width, bvm.height), viewModel);
            bvm.playerNameOne = startWindow.playerNameOne;
            bvm.playerNameTwo = startWindow.playerNameTwo;

            viewModel.SelectedOptionPane = new OptionsViewModel.OptionsCategory(bvm);
            System.Diagnostics.Debug.WriteLine(bvm.playerNameOne + " playerOne");
        }
        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;
        }
        public void Execute(object parameter)
        {
            BoardViewModel b;

            try
            {
                b = new BoardViewModel(ReversiBoard.CreateInitialState(StartScreen.Width, StartScreen.Height), Options);
            }
            catch (Exception)
            {
                b = new BoardViewModel(ReversiBoard.CreateInitialState(6, 6), Options);
            }
            Debug.WriteLine("Heigt= " + b.Board.Height);
            Debug.WriteLine("Width= " + b.Board.Width);
            Options.SelectedOptionPane = new OptionsViewModel.OptionsCategory(b);
        }
Beispiel #10
0
        public void Execute(object parameter)
        {
            BoardViewModel bvm;

            try
            {
                bvm           = new BoardViewModel(ReversiBoard.CreateInitialState(startWindow.Width, startWindow.Height), optionsView);
                bvm.playerOne = startWindow.playerOne;
                bvm.playerTwo = startWindow.playerTwo;
            }
            catch (Exception)
            {
                bvm           = new BoardViewModel(ReversiBoard.CreateInitialState(6, 6), optionsView);
                bvm.playerOne = startWindow.playerOne;
                bvm.playerTwo = startWindow.playerTwo;
            }
            this.optionsView.SelectedOptionPane = new OptionsViewModel.OptionsCategory(bvm);
        }
Beispiel #11
0
 public RestartCommand(BoardViewModel bvm)
 {
     this.BoardView = bvm;
 }
Beispiel #12
0
 public PutStoneCommand(BoardViewModel bvm)
 {
     this.BoardView = bvm;
 }
 public ToEndCommand(OptionsViewModel viewModel, BoardViewModel boardView)
 {
     this.viewModel = viewModel;
     this.BoardView = boardView;
 }
Beispiel #14
0
 public PutStoneCommand(BoardViewModel bordview)
 {
     this.Bord = bordview;
 }
 public EndGameCommand(BoardViewModel boardView, OptionsViewModel options)
 {
     this.BoardView = boardView;
     this.Options   = options;
 }
Beispiel #16
0
 public EndGameCommand(OptionsViewModel optionsView, BoardViewModel bvm)
 {
     this.optionsView = optionsView;
     this.BoardView   = bvm;
 }
 public PutStoneNewBoardCommand(BoardViewModel boardview)
 {
     this.BoardView = boardview;
 }