コード例 #1
0
        public void AfterFirstPlayerBoardShouldNotBeEmpty()
        {
            _context.ExecuteCommand(new PlayerSetCommand("X", 1, 1));

            var board = _context.GetContextInstance <BoardContext>();

            Assert.False(board.Board.All(b => b.All(f => f == " ")));
        }
コード例 #2
0
            public override EventResult HandleEvent(EventContext context, PlayerTouchedActorInstanceEvent @event)
            {
                switch (@event.TouchDirection)
                {
                case TouchDirection.FromBelow:
                    context.ExecuteCommand(Commands.ActorInstanceMove(@event.Target, MoveDirection.Up));
                    break;

                case TouchDirection.FromAbove:
                    context.ExecuteCommand(Commands.ActorInstanceMove(@event.Target, MoveDirection.Down));
                    break;

                case TouchDirection.FromLeft:
                    context.ExecuteCommand(Commands.ActorInstanceMove(@event.Target, MoveDirection.Right));
                    break;

                case TouchDirection.FromRight:
                    context.ExecuteCommand(Commands.ActorInstanceMove(@event.Target, MoveDirection.Left));
                    break;
                }

                return(EventResult.Completed);
            }
コード例 #3
0
 public void Apply(PlayerSet eventDto)
 {
     _context.ExecuteCommand(new SelectNextPlayerCommand());
 }
コード例 #4
0
 public void OnClick(int row, int col)
 {
     _context.ExecuteCommand(new PlayerSetCommand(PlayersContext.CurrentPlayer, row, col));
     OnPropertyChanged();
 }