In the Visual Studio Installer I have installed Azure Development ("Desarrollo de Azure") and with that I have managed to create Azure Functions that have worked perfectly.
The problem that I have is that I want to update an statistic (my game has leaderboards) with the Azure Function that you have below.
using System; using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using PlayFab.Samples; namespace FuncionRankingPrueba1 { public static class RankingPrueba { [FunctionName("UpdateRanking")] public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log) { string name = req.Query["name"]; string time = req.Query["time"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.FunctionArgument?.name; time = time ?? data?.FunctionArgument?.time; float timeFloat = Single.Parse(time); var request = new UpdatePlayerStatisticsRequest { Statistics = new List<StatisticUpdate> { new StatisticUpdate { StatisticName = name, Value = timeFloat } } }; var result = server.UpdatePlayerStatistics(request); return new OkObjectResult(result); } } }
I don't know if it is the correct way of doing it, but the problem that I face is that I don't manage to publish the function to Azure because these names are not found:
- UpdatePlayerStatisticsRequest
- List
- StatisticUpdate
- Playfab
I assume that Azure doesn't find the Playfab library, but I don't know how to add it to Visual Studio.