public static void ViewAll(ILeaderboardCaller caller) { Leaderboard.caller = caller; string uri = string.Format(URI_PREFIX + "?act=viewall&gameid={0}", GameId); HttpWebRequest viewAllRequest = (HttpWebRequest)HttpWebRequest.Create(uri); viewAllRequest.BeginGetResponse(viewAllCallback, viewAllRequest); }
public static void RemoveScore(ILeaderboardCaller caller) { Leaderboard.caller = caller; string hash = MD5Core.GetHashString(string.Format("{0}.{1}.{2}", GameId, DeviceId, 0)); string uri = string.Format(URI_PREFIX + "?act=remove&gameid={0}&deviceid={1}&score={2}&hash={3}", GameId, DeviceId, 0, hash); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri); request.BeginGetResponse(removeScoreCallback, request); }
public static void GetRank(ILeaderboardCaller caller) { Leaderboard.caller = caller; if (Score == 0) { caller.OnGetRankSuccess(-1); return; } string hash = MD5Core.GetHashString(string.Format("{0}.{1}.{2}", GameId, DeviceId, Score)); string uri = string.Format(URI_PREFIX + "?act=myrank&gameid={0}&deviceid={1}&score={2}&hash={3}", GameId, DeviceId, Score, hash); HttpWebRequest rankRequest = (HttpWebRequest)HttpWebRequest.Create(uri); rankRequest.BeginGetResponse(getRankCallback, rankRequest); }
public static void SubmitScore(int score, string username, ILeaderboardCaller caller) { Leaderboard.caller = caller; UserName = username; if (Score < score) { Score = score; } string hash = MD5Core.GetHashString(string.Format("{0}.{1}.{2}", GameId, DeviceId, score)); string uri = string.Format(URI_PREFIX + "?act=submit&gameid={0}&deviceid={1}&score={2}&hash={3}&name={4}", GameId, DeviceId, Score, hash, UserName); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri); request.BeginGetResponse(submitScoreCallback, request); SettingHelper.SaveSetting(); }