/// submit a score to the leaderboards, /// updating the client on a response static void SubmitScore(float time) { // The Leaderboards to submit our time to Leaderboards leaderboards = new Leaderboards(); // The score to submit string ourName = GamerTagManager.GetGamerTag(); string theirName = MultiPlayerController.Instance.theirName; int tenthSeconds = ClockController.SecondsToTenthsOfSeconds(time); Score score = new Score(tenthSeconds, ourName, theirName); // Submit the time the the leaderboards, and send a message // to the client upon response leaderboards.SubmitScoreAsync(SceneManager.opts.level, score, delegate(SubmissionResponse r, ServerException e) { if (e != null) { UILogger.Log(e.Message); } position = (byte)r.position; positionSet = true; updateManager.SendLeaderboardsUpdate(position); }); }
public void AsyncSubmittingTest() { // Test that submitting a score works properly Score submittedScore = new Score(1, "abc", "xyz"); lb.SubmitScoreAsync(uniqueLevelName, submittedScore, delegate(SubmissionResponse response, ServerException error) { callbackDone.Set(); }); callbackDone.WaitOne(); // Confirm the top score is the one just submitted // Note: uses synchronous RequestScores for simplicity ScoresResponse r = lb.RequestScores(uniqueLevelName); Assert.AreEqual(submittedScore, r.leaders[0]); }