Ejemplo n.º 1
0
    public int GetCurrentPlayerRank(UM_Leaderboard leaderboard)
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GCLeaderboard board = GameCenterManager.GetLeaderboard(leaderboard.IOSId);
            if (board != null)
            {
                return(board.GetCurrentPlayerScore(GCBoardTimeSpan.ALL_TIME, GCCollectionType.GLOBAL).rank);
            }
            else
            {
                return(0);
            }

        case RuntimePlatform.Android:
            GPLeaderBoard gBoard = GooglePlayManager.instance.GetLeaderBoard(leaderboard.AndroidId);
            if (gBoard != null)
            {
                return(gBoard.GetCurrentPlayerScore(GPBoardTimeSpan.ALL_TIME, GPCollectionType.GLOBAL).rank);
            }
            else
            {
                return(0);
            }
        }

        return(0);
    }
Ejemplo n.º 2
0
    public long GetCurrentPlayerScore(UM_Leaderboard leaderboard)
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GCLeaderboard board = GameCenterManager.GetLeaderboard(leaderboard.IOSId);
            if (board != null)
            {
                GCScore score = board.GetCurrentPlayerScore(GCBoardTimeSpan.ALL_TIME, GCCollectionType.GLOBAL);
                if (score != null)
                {
                    return(score.GetLongScore());
                }
            }
            break;

        case RuntimePlatform.Android:
            GPLeaderBoard gBoard = GooglePlayManager.instance.GetLeaderBoard(leaderboard.AndroidId);
            if (gBoard != null)
            {
                GPScore score = gBoard.GetCurrentPlayerScore(GPBoardTimeSpan.ALL_TIME, GPCollectionType.GLOBAL);
                if (score != null)
                {
                    return(score.score);
                }
            }
            break;
        }

        return(0);
    }
Ejemplo n.º 3
0
 private void OnScoresListLoaded(ISN_Result res)
 {
     if (res.IsSucceeded)
     {
         Debug.Log("Scores loaded");
         loadedLeaderboard = GameCenterManager.GetLeaderboard(leaderboardId);
     }
     else
     {
         Debug.Log("Failed to load scores");
     }
 }
 private void OnScoresListLoaded(SA.Common.Models.Result res)
 {
     if (res.IsSucceeded)
     {
         loadedLeaderboard = GameCenterManager.GetLeaderboard(leaderboardId_1);
         IOSMessage.Create("Success", "Scores loaded");
     }
     else
     {
         IOSMessage.Create("Fail", "Failed to load scores");
     }
 }
    //--------------------------------------
    // Private Methods
    //--------------------------------------

    private void DispatchUpdate()
    {
        if (Scores.Count == 6)
        {
            GK_Leaderboard       board = GameCenterManager.GetLeaderboard(_leaderboardId);
            GK_LeaderboardResult result;


            if (_ErrorData != null)
            {
                result = new GK_LeaderboardResult(board, _ErrorData);
            }
            else
            {
                board.UpdateCurrentPlayerScore(Scores);
                result = new GK_LeaderboardResult(board);
            }

            GameCenterManager.DispatchLeaderboardUpdateEvent(result, _IsInternal);
        }
    }