Ejemplo n.º 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));
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 6
0
 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
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 11
0
 public RestartCommand(BoardViewModel bvm)
 {
     this.BoardView = bvm;
 }
Ejemplo n.º 12
0
 public PutStoneCommand(BoardViewModel bvm)
 {
     this.BoardView = bvm;
 }
 public ToEndCommand(OptionsViewModel viewModel, BoardViewModel boardView)
 {
     this.viewModel = viewModel;
     this.BoardView = boardView;
 }
Ejemplo n.º 14
0
 public PutStoneCommand(BoardViewModel bordview)
 {
     this.Bord = bordview;
 }
 public EndGameCommand(BoardViewModel boardView, OptionsViewModel options)
 {
     this.BoardView = boardView;
     this.Options   = options;
 }
Ejemplo n.º 16
0
 public EndGameCommand(OptionsViewModel optionsView, BoardViewModel bvm)
 {
     this.optionsView = optionsView;
     this.BoardView   = bvm;
 }
 public PutStoneNewBoardCommand(BoardViewModel boardview)
 {
     this.BoardView = boardview;
 }