Ejemplo n.º 1
0
    public UM_Score GetCurrentPlayerScore(UM_TimeSpan span, UM_CollectionType collection)
    {
        UM_Score umScore = null;

        if (IsValid)
        {
            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                GPScore gp = gp_Leaderboard.GetCurrentPlayerScore(span.Get_GP_TimeSpan(), collection.Get_GP_CollectionType());
                if (gp != null)
                {
                    umScore = new UM_Score(null, gp);
                }
                break;

            case RuntimePlatform.IPhonePlayer:
                GK_Score gk = gk_Leaderboard.GetCurrentPlayerScore(span.Get_GK_TimeSpan(), collection.Get_GK_CollectionType());
                if (gk != null)
                {
                    umScore = new UM_Score(gk, null);
                }
                break;
            }
        }

        return(umScore);
    }
    public int GetCurrentPlayerRank(UM_Leaderboard leaderboard)
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GK_Leaderboard board = GameCenterManager.GetLeaderboard(leaderboard.IOSId);
            if (board != null)
            {
                return(board.GetCurrentPlayerScore(GK_TimeSpan.ALL_TIME, GK_CollectionType.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);
    }
    public long GetCurrentPlayerScore(UM_Leaderboard leaderboard)
    {
        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GK_Leaderboard board = GameCenterManager.GetLeaderboard(leaderboard.IOSId);
            if (board != null)
            {
                GK_Score score = board.GetCurrentPlayerScore(GK_TimeSpan.ALL_TIME, GK_CollectionType.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.º 4
0
    public UM_Score GetCurrentPlayerScore(UM_TimeSpan span, UM_CollectionType collection)
    {
        UM_Score umScore = null;

        if (IsValid)
        {
            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                if (UltimateMobileSettings.Instance.PlatformEngine.Equals(UM_PlatformDependencies.Android))
                {
                    GPScore gp = gp_Leaderboard.GetCurrentPlayerScore(span.Get_GP_TimeSpan(), collection.Get_GP_CollectionType());
                    if (gp != null)
                    {
                        umScore = new UM_Score(null, gp, null);
                    }
                }
                else
                {
                    GC_Score gc = gc_Leaderboard.GetCurrentPlayerScore(span.Get_GC_TimeSpan());
                    if (gc != null)
                    {
                        umScore = new UM_Score(null, null, gc);
                    }
                }
                break;

            case RuntimePlatform.IPhonePlayer:
                GK_Score gk = gk_Leaderboard.GetCurrentPlayerScore(span.Get_GK_TimeSpan(), collection.Get_GK_CollectionType());
                if (gk != null)
                {
                    umScore = new UM_Score(gk, null, null);
                }
                break;
            }
        }

        return(umScore);
    }