protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
 {
     _scope = _scopeOrder[0];
      _page = 1;
      LoadLeaderboard();
      base.OnNavigatedTo(e);
 }
Ejemplo n.º 2
0
 protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
 {
     _scope = _scopeOrder[0];
     _page  = 1;
     LoadLeaderboard();
     base.OnNavigatedTo(e);
 }
Ejemplo n.º 3
0
        public Task <Response <int> > GetLeaderboardCountAsync(string leaderboardId, LeaderboardScope scope)
        {
            var payload = new Dictionary <string, object> {
                { "lid", leaderboardId }, { "scope", (int)scope }
            };

            return(SendPayloadAsync <int>("scores/count", payload));
        }
Ejemplo n.º 4
0
        public Task <Response <Score> > GetLeaderboardAsync(string leaderboardId, LeaderboardScope scope, string userName, string uniqueIdentifier)
        {
            var payload = new Dictionary <string, object> {
                { "lid", leaderboardId }, { "username", userName }, { "userkey", uniqueIdentifier }, { "records", 1 }, { "scope", (int)scope }
            };

            return(SendPayloadAsync <Score>("scores", payload));
        }
Ejemplo n.º 5
0
        public void GetLeaderboard(string leaderboardId, LeaderboardScope scope, string userName, string uniqueIdentifier, int records, Action <Response <LeaderboardScores> > callback)
        {
            var payload = new Dictionary <string, object> {
                { "lid", leaderboardId }, { "username", userName }, { "userkey", uniqueIdentifier }, { "records", records }, { "scope", (int)scope }
            };

            GetLeaderboard(payload, callback);
        }
Ejemplo n.º 6
0
        public void GetLeaderboard(string leaderboardId, LeaderboardScope scope, int page, int records, Action <Response <LeaderboardScores> > callback)
        {
            var payload = new Dictionary <string, object> {
                { "lid", leaderboardId }, { "page", page }, { "records", records }, { "scope", (int)scope }
            };

            GetLeaderboard(payload, callback);
        }
Ejemplo n.º 7
0
        public Task <Response <int> > GetRankAsync(string leaderboardId, int score, LeaderboardScope scope)
        {
            var payload = new Dictionary <string, object> {
                { "lid", leaderboardId }, { "score", score }, { "scopes", (int)scope }
            };

            return(SendPayloadAsync <int>("ranks", payload));
        }
 private void PreviousScope_Click(object sender, RoutedEventArgs e)
 {
     var index = Array.IndexOf(_scopeOrder, _scope);
      if (--index == -1)
      {
     index = _scopeOrder.Length - 1;
      }
      _scope = _scopeOrder[index];
      LoadLeaderboard();
 }
 private void NextScope_Click(object sender, RoutedEventArgs e)
 {
     var index = Array.IndexOf(_scopeOrder, _scope);
      if (++index == _scopeOrder.Length)
      {
     index = 0;
      }
      _scope = _scopeOrder[index];
      LoadLeaderboard();
 }
Ejemplo n.º 10
0
 public void GetLeaderboard(string leaderboardId, LeaderboardScope scope, int page, int records, Action<Response<LeaderboardScores>> callback)
 {
     ValidationHelper.AssertValidId(leaderboardId, "leaderboardId");
      var payload = new Dictionary<string, object> { { "leaderboard", new { id = leaderboardId, scope = (int)scope, page = page, records = records } } };
      var communicator = new Communicator(this);
      communicator.SendPayload<LeaderboardScores>(Communicator.POST, "scores", payload, r =>
      {
     if (r.Success) { r.Data = JsonConvert.DeserializeObject<LeaderboardScores>(r.Raw); }
     callback(r);
      });
 }
Ejemplo n.º 11
0
 public bool GetByScope(LeaderboardScope scope)
 {
     switch (scope)
      {
     case LeaderboardScope.Daily:
        return Daily;
     case LeaderboardScope.Overall:
        return Overall;
     case LeaderboardScope.Weekly:
        return Weekly;
      }
      return false;
 }
Ejemplo n.º 12
0
    public static GC_ScoreTimeSpan GetGCTimeSpan(this LeaderboardScope scope)
    {
        switch (scope)
        {
        case LeaderboardScope.GlobalAllTime: return(GC_ScoreTimeSpan.ALL_TIME);

        case LeaderboardScope.GlobalWeek: return(GC_ScoreTimeSpan.WEEK);

        case LeaderboardScope.GlobalDay: return(GC_ScoreTimeSpan.TODAY);

        default: return(GC_ScoreTimeSpan.ALL_TIME);
        }
    }
Ejemplo n.º 13
0
    /// <summary>
    /// Request scores
    /// </summary>
    /// <remarks>
    /// RequestScoresCompleted will be called if event is registered.
    /// </remarks>
    /// <param name="leaderboardId">the id of the leaderboard for the score request.</param>
    /// <param name="scope">enum value of leaderboard scope</param>
    /// <param name="userData">
    /// ANDROID ONLY
    /// An optional code that will be returned in the response. Used to associate a function call to its response.
    /// A value of 0 is not recommended because 0 is the value returned when userData is not specified.
    /// </param>
    public static void RequestScores(string leaderboardId, LeaderboardScope scope, int userData = 0)
    {
#if UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
        // GameCircle only functions on device.
#elif UNITY_ANDROID
        JavaObject.Call("requestScores", leaderboardId, (int)scope, userData);
#else
        if (RequestScoresCompleted != null)
        {
            RequestScoresCompleted(AGSRequestScoresResponse.GetPlatformNotSupportedResponse(leaderboardId, scope, userData));
        }
#endif
    }
Ejemplo n.º 14
0
 public static AGSRequestScoreResponse GetBlankResponseWithError(string error,
                                                                  string leaderboardId = "",
                                                                  LeaderboardScope scope = LeaderboardScope.GlobalAllTime,
                                                                  int userData = 0)
 {
     AGSRequestScoreResponse response = new AGSRequestScoreResponse ();
     response.error = error;
     response.userData = userData;
     response.leaderboardId = leaderboardId;
     response.scope = scope;
     response.rank = -1;
     response.score = -1;
     return response;
 }
Ejemplo n.º 15
0
    public static AGSRequestScoresResponse GetBlankResponseWithError(string error,
                                                                     string leaderboardId   = "",
                                                                     LeaderboardScope scope = LeaderboardScope.GlobalAllTime,
                                                                     int userData           = 0)
    {
        AGSRequestScoresResponse response = new AGSRequestScoresResponse();

        response.error         = error;
        response.userData      = userData;
        response.leaderboardId = leaderboardId;
        response.scope         = scope;
        response.scores        = new List <AGSScore>();
        return(response);
    }
Ejemplo n.º 16
0
 public int GetByScope(LeaderboardScope scope)
 {
     switch (scope)
      {
     case LeaderboardScope.Daily:
        return Daily;
     case LeaderboardScope.Overall:
        return Overall;
     case LeaderboardScope.Weekly:
        return Weekly;
     case LeaderboardScope.Yesterday:
        return Yesterday;
      }
      return 0;
 }
Ejemplo n.º 17
0
        public bool GetByScope(LeaderboardScope scope)
        {
            switch (scope)
            {
            case LeaderboardScope.Daily:
                return(Daily);

            case LeaderboardScope.Overall:
                return(Overall);

            case LeaderboardScope.Weekly:
                return(Weekly);
            }
            return(false);
        }
Ejemplo n.º 18
0
    /// <summary>
    /// request percentile ranks
    /// </summary>
    /// <remarks>
    /// RequestPercentileRanksSucceededEvent or RequestPercentileRanksFailedEvent events will be called if they are registered
    /// </remarks>
    /// <param name="leaderboardId">the id of the leaderboard for the score request.</param>
    /// <param name="scope">enum value of leaderboard scope</param>
    public static void RequestPercentileRanks(string leaderboardId, LeaderboardScope scope)
    {
#if UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
        // GameCircle only functions on device.
#elif UNITY_ANDROID
        JavaObject.Call("requestPercentileRanks", leaderboardId, (int)scope);
#elif UNITY_IOS
        _AmazonGameCircleRequestPercentileRanks(leaderboardId, (int)scope);
#else
        if (RequestPercentileRanksFailedEvent != null)
        {
            RequestPercentileRanksFailedEvent(leaderboardId, "PLATFORM_NOT_SUPPORTED");
        }
#endif
    }
Ejemplo n.º 19
0
        public static string ToParameter(this LeaderboardScope scope)
        {
            switch (scope)
            {
            case LeaderboardScope.All:
                return("all");

            case LeaderboardScope.FullGame:
                return("full-game");

            case LeaderboardScope.Levels:
                return("levels");
            }

            throw new ArgumentException("scope");
        }
Ejemplo n.º 20
0
        public void GetLeaderboardCount(string leaderboardId, LeaderboardScope scope, Action <Response <int> > callback)
        {
            var payload = new Dictionary <string, object> {
                { "lid", leaderboardId }, { "scope", (int)scope }
            };
            var communicator = new Communicator(this);

            communicator.SendPayload <int>(Communicator.Get, "scores/count", payload, r =>
            {
                if (r.Success)
                {
                    r.Data = JsonConvert.DeserializeObject <int>(r.Raw);
                }
                callback(r);
            });
        }
Ejemplo n.º 21
0
        public void GetRank(string leaderboardId, int score, LeaderboardScope scope, Action <Response <IntClass> > callback)
        {
            var payload = new Dictionary <string, object> {
                { "lid", leaderboardId }, { "score", score }, { "scopes", (int)scope }
            };
            var communicator = new Communicator(this);

            communicator.SendPayload <IntClass>(Communicator.Get, "ranks", payload, r =>
            {
                if (r.Success)
                {
                    r.Data = new IntClass(JsonConvert.DeserializeObject <int>(r.Raw));
                }
                callback(r);
            });
        }
Ejemplo n.º 22
0
        public void GetRivals(string leaderboardId, LeaderboardScope scope, string userName, string uniqueIdentifier, Action <Response <IList <Score> > > callback)
        {
            var payload = new Dictionary <string, object> {
                { "lid", leaderboardId }, { "username", userName }, { "userkey", uniqueIdentifier }, { "scope", (int)scope }
            };
            var communicator = new Communicator(this);

            communicator.SendPayload <IList <Score> >(Communicator.Get, "scores/rivals", payload, r =>
            {
                if (r.Success)
                {
                    r.Data = string.IsNullOrEmpty(r.Raw) ? new List <Score>(0) : JsonConvert.DeserializeObject <IList <Score> >(r.Raw);
                }
                callback(r);
            });
        }
Ejemplo n.º 23
0
        public void GetLeaderboardWithPlayerStats(string leaderboardId, LeaderboardScope scope, string userName, string uniqueIdentifier, int page, int records, Action <Response <LeaderboardScoresWithPlayerStats> > callback)
        {
            var payload = new Dictionary <string, object> {
                { "lid", leaderboardId }, { "with_player", "true" }, { "username", userName }, { "userkey", uniqueIdentifier }, { "page", page }, { "records", records }, { "scope", (int)scope }
            };
            var communicator = new Communicator(this);

            communicator.SendPayload <LeaderboardScoresWithPlayerStats>(Communicator.Get, "scores", payload, r =>
            {
                if (r.Success)
                {
                    r.Data = JsonConvert.DeserializeObject <LeaderboardScoresWithPlayerStats>(r.Raw);
                }
                callback(r);
            });
        }
 public static AGSRequestPercentilesResponse GetBlankResponseWithError(string error,
                                                                       string leaderboardId = "",
                                                                       LeaderboardScope scope = LeaderboardScope.GlobalAllTime,
                                                                       int userData = 0)
 {
     AGSRequestPercentilesResponse response = new AGSRequestPercentilesResponse ();
     response.error = error;
     response.userData = userData;
     response.leaderboardId = leaderboardId;
     response.scope = scope;
     response.leaderboard = AGSLeaderboard.GetBlankLeaderboard ();
     response.percentiles = new List<AGSLeaderboardPercentile>();
     response.userIndex = -1;
     response.scope = scope;
     return response;
 }
Ejemplo n.º 25
0
        public IEnumerable <Leaderboard> GetRecords(
            string gameId,
            int?top = null,
            LeaderboardScope scope = LeaderboardScope.All,
            bool includeMiscellaneousCategories = true,
            bool skipEmptyLeaderboards          = false,
            int?elementsPerPage      = null,
            LeaderboardEmbeds embeds = default)
        {
            var parameters = new List <string>()
            {
                embeds.ToString()
            };

            if (top.HasValue)
            {
                parameters.Add(string.Format("top={0}", top.Value));
            }

            if (scope != LeaderboardScope.All)
            {
                parameters.Add(scope.ToParameter());
            }

            if (!includeMiscellaneousCategories)
            {
                parameters.Add("miscellaneous=false");
            }

            if (skipEmptyLeaderboards)
            {
                parameters.Add("skip-empty=true");
            }

            if (elementsPerPage.HasValue)
            {
                parameters.Add(string.Format("max={0}", elementsPerPage.Value));
            }

            var uri = GetGamesUri(string.Format("/{0}/records{1}",
                                                Uri.EscapeDataString(gameId),
                                                parameters.ToParameters()));

            return(baseClient.DoPaginatedRequest <Leaderboard>(uri,
                                                               x => Leaderboard.Parse(baseClient, x)));
        }
    public static AGSRequestPercentilesResponse GetBlankResponseWithError(string error,
                                                                          string leaderboardId   = "",
                                                                          LeaderboardScope scope = LeaderboardScope.GlobalAllTime,
                                                                          int userData           = 0)
    {
        AGSRequestPercentilesResponse response = new AGSRequestPercentilesResponse();

        response.error         = error;
        response.userData      = userData;
        response.leaderboardId = leaderboardId;
        response.scope         = scope;
        response.leaderboard   = AGSLeaderboard.GetBlankLeaderboard();
        response.percentiles   = new List <AGSLeaderboardPercentile>();
        response.userIndex     = -1;
        response.scope         = scope;
        return(response);
    }
    public static AGSRequestScoreForPlayerResponse GetBlankResponseWithError(string error,
                                                                             string leaderboardId   = "",
                                                                             string playerId        = "",
                                                                             LeaderboardScope scope = LeaderboardScope.GlobalAllTime,
                                                                             int userData           = 0)
    {
        AGSRequestScoreForPlayerResponse response = new AGSRequestScoreForPlayerResponse();

        response.error         = error;
        response.playerId      = playerId;
        response.userData      = userData;
        response.leaderboardId = leaderboardId;
        response.scope         = scope;
        response.rank          = -1;
        response.score         = -1;
        return(response);
    }
Ejemplo n.º 28
0
        public void GetLeaderboard(string leaderboardId, LeaderboardScope scope, int page, int records, Action <Response <LeaderboardScores> > callback)
        {
            ValidationHelper.AssertValidId(leaderboardId, "leaderboardId");
            var payload = new Dictionary <string, object> {
                { "leaderboard", new { id = leaderboardId, scope = (int)scope, page = page, records = records } }
            };
            var communicator = new Communicator(this);

            communicator.SendPayload <LeaderboardScores>(Communicator.POST, "scores", payload, r =>
            {
                if (r.Success)
                {
                    r.Data = JsonConvert.DeserializeObject <LeaderboardScores>(r.Raw);
                }
                callback(r);
            });
        }
Ejemplo n.º 29
0
    /// <summary>
    /// request percentile ranks
    /// </summary>
    /// <remarks>
    /// RequestPercentileRanksCompleted will be called if the event is registered.
    /// </remarks>
    /// <param name="leaderboardId">the id of the leaderboard for the score request.</param>
    /// <param name="scope">enum value of leaderboard scope</param>
    /// <param name="userData">
    /// ANDROID ONLY
    /// An optional code that will be returned in the response. Used to associate a function call to its response.
    /// A value of 0 is not recommended because 0 is the value returned when userData is not specified.
    /// </param>
    public static void RequestPercentileRanks(string leaderboardId, LeaderboardScope scope, int userData = 0)
    {
#if UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
        // GameCircle only functions on device.
#elif UNITY_ANDROID
        JavaObject.Call("requestPercentileRanks", leaderboardId, (int)scope, userData);
#else
        AGSRequestPercentilesResponse response = AGSRequestPercentilesResponse.GetPlatformNotSupportedResponse(leaderboardId, scope, userData);
        if (RequestPercentileRanksFailedEvent != null)
        {
            RequestPercentileRanksFailedEvent(response.leaderboardId, response.error);
        }
        if (RequestPercentileRanksCompleted != null)
        {
            RequestPercentileRanksCompleted(response);
        }
#endif
    }
Ejemplo n.º 30
0
        public int GetByScope(LeaderboardScope scope)
        {
            switch (scope)
            {
            case LeaderboardScope.Daily:
                return(Daily);

            case LeaderboardScope.Overall:
                return(Overall);

            case LeaderboardScope.Weekly:
                return(Weekly);

            case LeaderboardScope.Yesterday:
                return(Yesterday);
            }
            return(0);
        }
Ejemplo n.º 31
0
        public GetScoresRequest(BeatmapInfo beatmap, RulesetInfo ruleset, LeaderboardScope scope = LeaderboardScope.Global)
        {
            if (!beatmap.OnlineBeatmapID.HasValue)
            {
                throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(BeatmapInfo.OnlineBeatmapID)}.");
            }

            if (scope == LeaderboardScope.Local)
            {
                throw new InvalidOperationException("Should not attempt to request online scores for a local scoped leaderboard");
            }

            this.beatmap = beatmap;
            this.scope   = scope;
            this.ruleset = ruleset ?? throw new ArgumentNullException(nameof(ruleset));

            Success += onSuccess;
        }
 internal RankResponse(int rank, Score score, LeaderboardScope scope)
 {
     this.Rank = rank;
     this.Score = score;
     this.Scope = scope;
 }
 public void GetRanks(string leaderboardId, string userName, LeaderboardScope[] scopes, Action<Response<Ranks>> callback)
 {
     _driver.GetRanks(leaderboardId, userName, GetUniqueIdentifier(), scopes, callback);
 }
Ejemplo n.º 34
0
 public void GetRank(string leaderboardId, string userName, LeaderboardScope scope, Action <Response <int> > callback)
 {
     _driver.GetRank(leaderboardId, userName, GetUniqueIdentifier(), scope, callback);
 }
Ejemplo n.º 35
0
 public void GetLeaderboardCount(string leaderboardId, LeaderboardScope scope, Action <Response <int> > callback)
 {
     _driver.GetLeaderboardCount(leaderboardId, scope, callback);
 }
 public void GetLeaderboardWithPlayerStats(string leaderboardId, LeaderboardScope scope, string userName, int page, int records, Action<Response<LeaderboardScoresWithPlayerStats>> callback)
 {
     _driver.GetLeaderboardWithPlayerStats(leaderboardId, scope, userName, GetUniqueIdentifier(), page, records, callback);
 }
Ejemplo n.º 37
0
        public IRequestToken GetRank(LeaderboardScope leaderboardScope, Score score, ScoreloopCallback<RankResponse> callback)
        {
            if (!this.IsNetworkAvailable)
            {
                callback.InvokeIfNotNull(new ScoreloopResponse<RankResponse>(new RankResponse(-1, null, leaderboardScope), null, false));
                return null;
            }

            IRankingController rankingController = _client.CreateRankingController();
            rankingController.RequestFailed += (o, e) => callback.InvokeIfNotNull(new ScoreloopResponse<RankResponse>(new RankResponse(-1, null, leaderboardScope), rankingController, false));
            rankingController.RequestCancelled += (o, e) => callback.InvokeIfNotNull(new ScoreloopResponse<RankResponse>(new RankResponse(-1, null, leaderboardScope), rankingController, false));
            rankingController.RankingLoaded += (o, e) => callback.InvokeIfNotNull(new ScoreloopResponse<RankResponse>(new RankResponse((int)e.Controller.Rank, e.Controller.Score, leaderboardScope), rankingController, true));

            rankingController.LoadRanking(ScoreloopHelper.GetSearchList(leaderboardScope, rankingController), score);
            return new RequestToken(rankingController);
        }
Ejemplo n.º 38
0
 public void GetLeaderboard(string leaderboardId, LeaderboardScope scope, int page, Action<Leaderboard> callback)
 {
     _driver.GetLeaderboard(leaderboardId, scope, page, callback);
 }
Ejemplo n.º 39
0
 public static AGSRequestScoreResponse GetPlatformNotSupportedResponse(string leaderboardId, LeaderboardScope scope, int userData)
 {
     return GetBlankResponseWithError(PLATFORM_NOT_SUPPORTED_ERROR, leaderboardId, scope, userData);
 }
 public void GetRivals(string leaderboardId, LeaderboardScope scope, string userName, Action<Response<IList<Score>>> callback)
 {
     _driver.GetRivals(leaderboardId, scope, userName, GetUniqueIdentifier(), callback);
 }
 public void GetLeaderboard(string leaderboardId, LeaderboardScope scope, int page, int records, Action<Response<LeaderboardScores>> callback)
 {
     _driver.GetLeaderboard(leaderboardId, scope, page, records, callback);
 }
 public void GetPlayerScore(string leaderboardId, LeaderboardScope scope, string userName, Action<Response<Score>> callback)
 {
     _driver.GetLeaderboard(leaderboardId, scope, userName, GetUniqueIdentifier(), callback);
 }
Ejemplo n.º 43
0
 private void LoadLeaderboard(LeaderboardScope scope, int page)
 {
     sblist.Clear();
     Mogade.GetLeaderboard(MogadeHelper.LeaderboardId(Leaderboards.Main), scope, page, r => LeaderboardReceived(r));
 }
 public void GetRanks(string leaderboardId, int score, LeaderboardScope[] scopes, Action<Response<Ranks>> callback)
 {
     _driver.GetRanks(leaderboardId, score, scopes, callback);
 }
Ejemplo n.º 45
0
 public void GetRank(LeaderboardScope scope, ScoreloopCallback<RankResponse> callback)
 {
     _scoreloopManager.GetRank(scope, _mode, callback);
 }
Ejemplo n.º 46
0
 public IRequestToken GetUserScore(LeaderboardScope leaderboardScope, uint mode, ScoreloopCallback<Score> callback)
 {
     return this.GetRank(leaderboardScope, mode, response =>
     {
         if (callback != null)
         {
             callback(new ScoreloopResponse<Score>(response.Data != null ? response.Data.Score : null, response.RequestSource, response.Success));
         }
     });
 }
Ejemplo n.º 47
0
 public void GetLeaderboard(string leaderboardId, LeaderboardScope scope, int page, int records, Action<Response<LeaderboardScores>> callback)
 {
     var payload = new Dictionary<string, object> {{"lid", leaderboardId}, {"page", page}, {"records", records}, {"scope", (int) scope}};
      GetLeaderboard(payload, callback);
 }
Ejemplo n.º 48
0
 public void GetPlayerScore(string leaderboardId, LeaderboardScope scope, string userName, Action <Response <Score> > callback)
 {
     _driver.GetLeaderboard(leaderboardId, scope, userName, GetUniqueIdentifier(), callback);
 }
Ejemplo n.º 49
0
        public IRequestToken LoadScores(LeaderboardScope leaderboardScope, RangeInt scoreRange, uint mode, ScoreloopCallback<LeaderboardScoresResponse> callback)
        {
            if (!this.IsNetworkAvailable)
            {
                callback.InvokeIfNotNull(new ScoreloopResponse<LeaderboardScoresResponse>(null, null, false));
                return null;
            }

            Ensure.True(scoreRange.Length > 0);

            IScoresController scoresController = _client.CreateScoresController();
            scoresController.RequestCancelled += (o, e) => callback.InvokeIfNotNull(new ScoreloopResponse<LeaderboardScoresResponse>(null, scoresController, false));
            scoresController.RequestFailed += (o, e) => callback.InvokeIfNotNull(new ScoreloopResponse<LeaderboardScoresResponse>(null, scoresController, false));
            scoresController.ScoresLoaded += (o, e) => callback.InvokeIfNotNull(new ScoreloopResponse<LeaderboardScoresResponse>(new LeaderboardScoresResponse(e.Controller.Scores, scoreRange.Min), scoresController, true));

            scoresController.LoadScores(ScoreloopHelper.GetSearchList(leaderboardScope, scoresController), new ScoreloopRange(scoreRange.Min, (uint)scoreRange.Length), mode);
            return new RequestToken(scoresController);
        }
 public void GetLeaderboardCount(string leaderboardId, LeaderboardScope scope, Action<Response<int>> callback)
 {
     _driver.GetLeaderboardCount(leaderboardId, scope, callback);
 }
Ejemplo n.º 51
0
 public void GetRivals(string leaderboardId, LeaderboardScope scope, string userName, string uniqueIdentifier, Action<Response<IList<Score>>> callback)
 {
     var payload = new Dictionary<string, object> { { "lid", leaderboardId }, { "username", userName }, { "userkey", uniqueIdentifier }, { "scope", (int)scope } };
      var communicator = new Communicator(this);
      communicator.SendPayload<IList<Score>>(Communicator.Get, "scores/rivals", payload, r =>
      {
     if (r.Success) { r.Data = string.IsNullOrEmpty(r.Raw) ? new List<Score>(0) : JsonConvert.DeserializeObject<IList<Score>>(r.Raw); }
     callback(r);
      });
 }
Ejemplo n.º 52
0
 public void GetLeaderboard(string leaderboardId, LeaderboardScope scope, int page, Action<Response<LeaderboardScores>> callback)
 {
     GetLeaderboard(leaderboardId, scope, page, 10, callback);
 }
Ejemplo n.º 53
0
 public void GetLeaderboard(string leaderboardId, LeaderboardScope scope, int page, int records, Action <Response <LeaderboardScores> > callback)
 {
     _driver.GetLeaderboard(leaderboardId, scope, page, records, callback);
 }
Ejemplo n.º 54
0
        public IEnumerable<Leaderboard> GetRecords(string gameId,
            int? top = null, LeaderboardScope scope = LeaderboardScope.All,
            bool includeMiscellaneousCategories = true, bool skipEmptyLeaderboards = false,
            int? elementsPerPage = null,
            LeaderboardEmbeds embeds = default(LeaderboardEmbeds))
        {
            var parameters = new List<string>() { embeds.ToString() };

            if (top.HasValue)
                parameters.Add(string.Format("top={0}", top.Value));
            if (scope != LeaderboardScope.All)
                parameters.Add(scope.ToParameter());
            if (!includeMiscellaneousCategories)
                parameters.Add("miscellaneous=false");
            if (skipEmptyLeaderboards)
                parameters.Add("skip-empty=true");
            if (elementsPerPage.HasValue)
                parameters.Add(string.Format("max={0}", elementsPerPage.Value));

            var uri = GetGamesUri(string.Format("/{0}/records{1}",
                Uri.EscapeDataString(gameId),
                parameters.ToParameters()));

            return baseClient.DoPaginatedRequest<Leaderboard>(uri,
                x => Leaderboard.Parse(baseClient, x));
        }
Ejemplo n.º 55
0
 public void GetLeaderboard(string leaderboardId, LeaderboardScope scope, string userName, int records, Action <Response <LeaderboardScores> > callback)
 {
     _driver.GetLeaderboard(leaderboardId, scope, userName, GetUniqueIdentifier(), records, callback);
 }
Ejemplo n.º 56
0
 public void GetLeaderboard(string leaderboardId, LeaderboardScope scope, int page, string userName, string uniqueIdentifier, Action<Response<LeaderboardScoresWithUser>> callback)
 {
     GetLeaderboard(leaderboardId, scope, page, 10, userName, uniqueIdentifier, callback);
 }
Ejemplo n.º 57
0
 public void GetRivals(string leaderboardId, LeaderboardScope scope, string userName, Action <Response <IList <Score> > > callback)
 {
     _driver.GetRivals(leaderboardId, scope, userName, GetUniqueIdentifier(), callback);
 }
 /// <summary>
 /// request percentile ranks
 /// </summary>
 /// <remarks>
 /// RequestPercentileRanksSucceededEvent or RequestPercentileRanksFailedEvent events will be called if they are registered
 /// </remarks>
 /// <param name="leaderboardId">the id of the leaderboard for the score request.</param>
 /// <param name="scope">enum value of leaderboard scope</param>
 public static void RequestPercentileRanks(string leaderboardId, LeaderboardScope scope )
 {
     #if UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
     // GameCircle only functions on device.
     #elif UNITY_ANDROID
     JavaObject.Call( "requestPercentileRanks", leaderboardId, (int)scope );
     #elif UNITY_IOS
     _AmazonGameCircleRequestPercentileRanks(leaderboardId, (int)scope);
     #else
     if(RequestPercentileRanksFailedEvent != null ){
         RequestPercentileRanksFailedEvent( leaderboardId, "PLATFORM_NOT_SUPPORTED" );
     }
     #endif
 }
Ejemplo n.º 59
0
 public void GetRank(string leaderboardId, int score, LeaderboardScope scope, Action <Response <int> > callback)
 {
     _driver.GetRank(leaderboardId, score, scope, callback);
 }
 public void GetRank(string leaderboardId, int score, LeaderboardScope scope, Action<Response<int>> callback)
 {
     _driver.GetRank(leaderboardId, score, scope, callback);
 }