public static void SubmitLeaderboard(string inToken, int inPastScore, SubmitData inData, Action <PlayerData> onCompleted, Action <string> onFailed) { if (_config.isLocal) { var leaderBoardResponse = LocalLeaderboardSystem.SubmitLeaderboard(inToken, inPastScore, inData); if (leaderBoardResponse.isFailed) { onFailed?.Invoke(leaderBoardResponse.message); } else { onCompleted?.Invoke(leaderBoardResponse.result); } return; } var request = DefaultRequest(); request.ContentType = "application/x-www-form-urlencoded"; request.Method = "POST"; request.Uri = UriList.LeaderboardsSubmit; request.Headers = new Dictionary <string, string> { { "Authorization", $"Bearer {inToken}" } }; request.SimpleForm = inData.ToForm(); SendRequest(request, response => { var result = JsonUtility.FromJson <PlayerData>(response); onCompleted?.Invoke(result); }, onFailed); }
private void SubmitFakePlayers() //testing purpose { //fil with fake player LocalLeaderboardSystem.SubmitLeaderboard(Data.Register.idToken, 0, new SubmitData() { name = "Atef Sassi", score = 1989, tournamentId = [email protected] }); LocalLeaderboardSystem.SubmitLeaderboard(Data.Register.idToken, 0, new SubmitData() { name = "AirCoder", score = 1567, tournamentId = [email protected] }); }