public void SendLeaderboard(ProtectedUInt32 score) { var request = new UpdatePlayerStatisticsRequest { Statistics = new List<StatisticUpdate> { new StatisticUpdate { StatisticName = "Top Score", Value = Convert.ToInt32(score) } } }; PlayFabClientAPI.UpdatePlayerStatistics(request, OnLeaderboardUpdate, OnError); } void OnLeaderboardUpdate(UpdatePlayerStatisticsResult result) { Debug.Log("Successfull leaderboard sent"); } public void SendLeaderboardHigh(ProtectedUInt32 score) { var request = new UpdatePlayerStatisticsRequest { Statistics = new List<StatisticUpdate> { new StatisticUpdate { StatisticName = "PlayerHighScore", Value = Convert.ToInt32(score) } } }; PlayFabClientAPI.UpdatePlayerStatistics(request, OnLeaderboardUpdateSave, OnError); } void OnLeaderboardUpdateSave(UpdatePlayerStatisticsResult result) { Debug.Log("Successfull leaderboard sent save");
=========================================================
public void OnGetStats(GetPlayerStatisticsResult result) { Debug.Log("Received the following Statistics:"); foreach (var eachStat in result.Statistics) { Debug.Log("Statistic (" + eachStat.StatisticName + "): " + eachStat.Value); switch(eachStat.StatisticName) { case "PlayerLevel": //PERFECT PlayerLevel = eachStat.Value; playerLevel.text = PlayerLevel.ToString(); playerLevelsmall.text = PlayerLevel.ToString(); break; case "Top Score": //PERFECT TopScore = eachStat.Value; playerscore.text = TopScore.ToString(); break; case "PlayerHighScore": //PERFECT PlayerHighScore = eachStat.Value; playerhighscore.text = PlayerHighScore.ToString(); break; case "Top Win": //PERFECT TopWin = eachStat.Value; winnertext.text = TopWin.ToString(); break; case "PlayerHighWin": //PERFECT PlayerHighWin = eachStat.Value; winnerhightext.text = PlayerHighWin.ToString(); break; } } }