Ejemplo n.º 1
0
        protected async Task RefillTruck(int nPosition)
        {
            List <Piece> TruckPieces = (List <Piece>) await gameService.GetTruckPieces(gameId);

            Piece newPiece = null;

            foreach (var piece in TruckPieces)
            {
                if (piece.NPosition == nPosition)
                {
                    newPiece = piece;
                    break;
                }
            }

            if (newPiece != null)
            {
                await JSRuntime.InvokeVoidAsync("tileAnimateImage", "bag", newPiece.NPosition, newPiece.GetImageFileName());

                await Task.Delay(600); // time it takes for animation to complete.

                truck.AddVeg(newPiece);
            }
        }