コード例 #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);
    }
コード例 #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);
    }