/// <summary> /// Submits a score to the specified leaderboard. /// Documentation https://developers.google.com/games/v1/reference/scores/submit /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Games service.</param> /// <param name="leaderboardId">The ID of the leaderboard.</param> /// <param name="score">The score you're submitting. The submitted score is ignored if it is worse than a previously submitted score, where worse depends on the leaderboard sort order. The meaning of the score value depends on the leaderboard format type. For fixed-point, the score represents the raw value. For time, the score represents elapsed time in milliseconds. For currency, the score represents a value in micro units.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>PlayerScoreResponseResponse</returns> public static PlayerScoreResponse Submit(GamesService service, string leaderboardId, string score, ScoresSubmitOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (leaderboardId == null) { throw new ArgumentNullException(leaderboardId); } if (score == null) { throw new ArgumentNullException(score); } // Building the initial request. var request = service.Scores.Submit(leaderboardId, score); // Applying optional parameters to the request. request = (ScoresResource.SubmitRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request Scores.Submit failed.", ex); } }
/// <summary> /// Submits multiple scores to leaderboards. /// Documentation https://developers.google.com/games/v1/reference/scores/submitMultiple /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Games service.</param> /// <param name="body">A valid Games v1 body.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>PlayerScoreListResponseResponse</returns> public static PlayerScoreListResponse SubmitMultiple(GamesService service, PlayerScoreSubmissionList body, ScoresSubmitMultipleOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } // Building the initial request. var request = service.Scores.SubmitMultiple(body); // Applying optional parameters to the request. request = (ScoresResource.SubmitMultipleRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request Scores.SubmitMultiple failed.", ex); } }
/// Documentation https://developers.google.com/games/v1/reference/scores/get /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Games service.</param> /// <param name="playerId">A player ID. A value of me may be used in place of the authenticated player's ID.</param> /// <param name="leaderboardId">The ID of the leaderboard. Can be set to 'ALL' to retrieve data for all leaderboards for this application.</param> /// <param name="timeSpan">The time span for the scores and ranks you're requesting.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>PlayerLeaderboardScoreListResponseResponse</returns> public static PlayerLeaderboardScoreListResponse Get(GamesService service, string playerId, string leaderboardId, string timeSpan, ScoresGetOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (playerId == null) { throw new ArgumentNullException(playerId); } if (leaderboardId == null) { throw new ArgumentNullException(leaderboardId); } if (timeSpan == null) { throw new ArgumentNullException(timeSpan); } // Building the initial request. var request = service.Scores.Get(playerId, leaderboardId, timeSpan); // Applying optional parameters to the request. request = (ScoresResource.GetRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request Scores.Get failed.", ex); } }
/// <summary> /// Lists the scores in a leaderboard around (and including) a player's score. /// Documentation https://developers.google.com/games/v1/reference/scores/listWindow /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Games service.</param> /// <param name="leaderboardId">The ID of the leaderboard.</param> /// <param name="collection">The collection of scores you're requesting.</param> /// <param name="timeSpan">The time span for the scores and ranks you're requesting.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>LeaderboardScoresResponse</returns> public static LeaderboardScores ListWindow(GamesService service, string leaderboardId, string collection, string timeSpan, ScoresListWindowOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (leaderboardId == null) { throw new ArgumentNullException(leaderboardId); } if (collection == null) { throw new ArgumentNullException(collection); } if (timeSpan == null) { throw new ArgumentNullException(timeSpan); } // Building the initial request. var request = service.Scores.ListWindow(leaderboardId, collection, timeSpan); // Applying optional parameters to the request. request = (ScoresResource.ListWindowRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request Scores.ListWindow failed.", ex); } }