示例#1
0
    public void PerformTileMove(Tile t, BoardInput.SwipeDirection dir)
    {
        Tile otherTile = null;

        Action onSwapComplete = () =>
        {
            List <Match> matches = BoardProcessor.inst.FindMatches(board, t);
            if (matches.Count > 0)
            {
                HighlightMatches(matches, () => { DestroyMatches(matches); });
            }
            else
            {
                SwapTiles(t, otherTile);
            }
        };

        GridPosition otherTilePos = t.gridPos + BoardInput.SwapDirectionToGridOffset(dir);

        if (board.GridPositionIsWithinBounds(otherTilePos))
        {
            otherTile = board.Tiles[otherTilePos.x][otherTilePos.y];

            SwapTiles(t, otherTile, onSwapComplete);
        }
        else
        {
            MoveTileToItsGridPosition(t);
        }
    }
示例#2
0
    public void Slide(BoardInput input)
    {
        switch (input)
        {
        case BoardInput.SlideUp:
            slideBoardUp();
            break;

        case BoardInput.SlideDown:
            slideBoardDown();
            break;

        case BoardInput.SlideLeft:
            slideBoardLeft();
            break;

        case BoardInput.SlideRight:
            slideBoardRight();
            break;

        default:
            throw new Exception($"unexpected input value {input}");
        }

        clearMatches();
        spawnNewPieces();
        clearMatches();
        StateChanged.Invoke();
    }
 public BoardWindow(string boardId, String uN)
 {
     InitializeComponent();
     userName         = uN;
     this.boardId     = boardId;
     boardInput       = new BoardInput(boardId, userName);
     this.DataContext = boardInput;
 }
示例#4
0
 private void Awake()
 {
     _puzzleSpawner = GetComponent <PuzzleSpawner>();
     _puzzleView    = GetComponent <PuzzleView>();
     _boardInput    = GetComponent <BoardInput>();
     _boardAction   = GetComponent <BoardAction>();
     _gameAudio     = GetComponent <GameBoardAudio>();
 }
        public async Task <IActionResult> Create(string projectId)
        {
            var model = new BoardInput
            {
                ProjectId = projectId,
            };

            return(View(model));
        }
        public async Task <IActionResult> Update(BoardInput input)
        {
            if (!ModelState.IsValid)
            {
                return(View(input));
            }

            var result = await _boardService.UpdateAsync(input);

            ValidateResult(result);

            return(View(input));
        }
示例#7
0
 void Awake()
 {
     boardBomber      = GetComponent <BoardBomber>();
     boardClearer     = GetComponent <BoardClearer>();
     boardCollapser   = GetComponent <BoardCollapser>();
     boardDeadlock    = GetComponent <BoardDeadlock>();
     boardFiller      = GetComponent <BoardFiller>();
     boardHighlighter = GetComponent <BoardHighlighter>();
     boardInput       = GetComponent <BoardInput>();
     boardMatcher     = GetComponent <BoardMatcher>();
     boardQuery       = GetComponent <BoardQuery>();
     boardSetup       = GetComponent <BoardSetup>();
     boardShuffler    = GetComponent <BoardShuffler>();
     boardTiles       = GetComponent <BoardTiles>();
 }
示例#8
0
    // Use this for initialization
    void Start()
    {
        // Uncomment the next two lines to hide and lock the cursor
        // Cursor.visible = false;
        // Cursor.lockState = CursorLockMode.Locked;

        // Get the board input script
        boardInput = board.GetComponent <BoardInput>();

        // Get the ball start position
        ballStartPosition = ball.transform.localPosition;

        // Get the ball rigidbody
        ballRigidbody = ball.GetComponent <Rigidbody>();

        // Prevent the player from moving at the start of the game
        boardInput.enabled = false;
    }
示例#9
0
 private void Awake()
 {
     boardInput    = new BoardInput(this, connectionLine);
     boardSpawn    = new BoardSpawn(this);
     boardMovement = new BoardMovement(this);
 }
示例#10
0
        /// <summary>
        ///
        /// </summary>
        public async Task <Result <CommandResult> > UpdateAsync(BoardInput input)
        {
            var updateCommand = _mapper.Map <UpdateBoardCommand>(input);

            return(await SendCommandAsync(updateCommand));
        }
示例#11
0
        /// <summary>
        ///
        /// </summary>
        public async Task <Result <CommandResult> > CreateAsync(BoardInput input)
        {
            var project = _mapper.Map <CreateBoardCommand>(input);

            return(await SendCommandAsync(project));
        }