/// <summary> /// Posts a score to the leaderboard for the player. /// </summary> /// <param name="index">The index of user</param> /// <param name="id">The ID of the leaderboard to post to.</param> /// <param name="score">The score to post.</param> public async Task <RuyiNetResponse> PostScoreToLeaderboard(int index, string id, int score) { var data = new RuyiNetPostScoreToLeaderboardRequest() { leaderboardId = mClient.AppId + "_" + id, score = score }; var resp = await mClient.BCService.Script_RunParentScriptAsync("PostScoreToLeaderboard", JsonConvert.SerializeObject(data), "RUYI", index, token); return(mClient.Process <RuyiNetResponse>(resp)); }
/// <summary> /// Posts a score to the leaderboard for the player. /// </summary> /// <param name="index">The index of user</param> /// <param name="id">The ID of the leaderboard to post to.</param> /// <param name="score">The score to post.</param> /// <param name="callback">The function to call when the data is retrieved.</param> public void PostScoreToLeaderboard(int index, string id, int score, RuyiNetTask <RuyiNetResponse> .CallbackType callback) { EnqueueTask(() => { var data = new RuyiNetPostScoreToLeaderboardRequest() { leaderboardId = mClient.AppId + "_" + id, score = score }; return(mClient.BCService.Script_RunParentScriptAsync("PostScoreToLeaderboard", JsonConvert.SerializeObject(data), "RUYI", index, token).Result); }, callback); }