示例#1
0
        public WelcomeViewModel(MainViewModel viewModel) : base(viewModel)
        {
            this.Width  = 8;
            this.Height = 8;

            this.Options = new PlayerOptionsViewModel();

            StartGame = new EasyCommand(() => {
                SwitchTo(new GameViewModel(this.viewModel, Width, Height, Options));
            });
        }
示例#2
0
        //public string Color { get; set; }

        public PlayerViewModel(GameViewModel Game, Player player, PlayerOptionsViewModel options)
        {
            this.Game             = Game;
            this.Player           = player;
            this.options          = options;
            this.Score            = Cell.Cell.Create(Game.Board.CountStones(Player));
            Game.PropertyChanged += (s, e) =>
            {
                this.Score.Value = Game.Board.CountStones(Player);
            };
        }
示例#3
0
        public GameViewModel(MainViewModel viewModel, int width, int height, PlayerOptionsViewModel options) : base(viewModel)
        {
            this.Game          = new ReversiGame(width, height);
            this.BoardVM       = new BoardViewModel(this, options);
            this.Board         = Game.Board;
            this.CurrentPlayer = Game.CurrentPlayer;
            this.Options       = options;


            this.PlayerB = new PlayerViewModel(this, Player.BLACK, options);
            this.PlayerW = new PlayerViewModel(this, Player.WHITE, options);
        }
示例#4
0
        public GameOverViewModel(MainViewModel model, PlayerOptionsViewModel options, PlayerViewModel winner) : base(model)
        {
            this.Options = options;
            this.Winner  = winner;
            Exit         = new ExitCommand(this.viewModel);

            Restart = new EasyCommand(() =>
            {
                WelcomeViewModel newGame = new WelcomeViewModel(this.viewModel);
                newGame.Options          = Options;
                SwitchTo(newGame);
            });
        }
示例#5
0
 public BoardSquareViewModel(GameViewModel game, Vector2D position, PlayerOptionsViewModel options)
 {
     this.Game     = game;
     this.Position = position;
     this.PutStone = new PutStoneCommand(Game, Position);
     this.Options  = options;
     if (Game.Board[Position] != null)
     {
         this.Owner = Cell.Cell.Create(Game.Board[Position]);
     }
     else
     {
         this.Owner = Cell.Cell.Create((Player)null);
     }
     this.Valid            = Cell.Cell.Create(Game.IsValidMove(Position));
     Game.PropertyChanged += (s, e) =>
     {
         Refresh();
     };
 }
示例#6
0
 public BoardRowViewModel(GameViewModel game, int rowNumber, PlayerOptionsViewModel options)
 {
     this.Game      = game;
     this.rowNumber = rowNumber;
     this.Options   = options;
 }
示例#7
0
 public BoardViewModel(GameViewModel game, PlayerOptionsViewModel options)
 {
     this.Game    = game;
     this.Options = options;
 }