public void LoadTopScores(UM_Leaderboard leaderboard, int maxResults, UM_TimeSpan timeSpan = UM_TimeSpan.ALL_TIME, UM_CollectionType collection = UM_CollectionType.GLOBAL)
    {
        if (leaderboard == null)
        {
            return;
        }

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GameCenterManager.LoadScore(leaderboard.IOSId, 1, maxResults, timeSpan.Get_GK_TimeSpan(), collection.Get_GK_CollectionType());
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                SA_AmazonGameCircleManager.Instance.LoadTopScores(leaderboard.AmazonId, timeSpan.Get_GC_TimeSpan());
            }
            else
            {
                GooglePlayManager.Instance.LoadTopScores(leaderboard.AndroidId, timeSpan.Get_GP_TimeSpan(), collection.Get_GP_CollectionType(), maxResults);
            }
            break;
        }
    }
    public void LoadPlayerCenteredScores(UM_Leaderboard leaderboard, int maxResults, UM_TimeSpan timeSpan = UM_TimeSpan.ALL_TIME, UM_CollectionType collection = UM_CollectionType.GLOBAL)
    {
        if (leaderboard == null)
        {
            return;
        }

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:

            UM_Score score = GetCurrentPlayerScore(leaderboard, timeSpan, collection);
            int      rank  = 0;
            if (score != null)
            {
                rank = score.Rank;
            }

            int startIndex = Math.Max(1, rank - maxResults / 2);
            int endIndex   = startIndex + maxResults - 1;
            GameCenterManager.LoadScore(leaderboard.IOSId, startIndex, endIndex, timeSpan.Get_GK_TimeSpan(), collection.Get_GK_CollectionType());
            break;

        case RuntimePlatform.Android:
            if (UltimateMobileSettings.Instance.PlatformEngine == UM_PlatformDependencies.Amazon)
            {
                //Just do nothing for Amazon
            }
            else
            {
                GooglePlayManager.Instance.LoadPlayerCenteredScores(leaderboard.AndroidId, timeSpan.Get_GP_TimeSpan(), collection.Get_GP_CollectionType(), maxResults);
            }
            break;
        }
    }
Exemplo n.º 3
0
    public UM_Score GetScore(int rank, UM_TimeSpan scope, UM_CollectionType collection)
    {
        UM_Score umScore = null;

        if (IsValid)
        {
            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                GPScore gp = gp_Leaderboard.GetScore(rank, scope.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.GetScore(rank, scope.Get_GK_TimeSpan(), collection.Get_GK_CollectionType());
                if (gk != null)
                {
                    umScore = new UM_Score(gk, null);
                }
                break;
            }
        }

        return(umScore);
    }
Exemplo n.º 4
0
    public List <UM_Score> GetScoresList(UM_TimeSpan span, UM_CollectionType collection)
    {
        List <UM_Score> scores = new List <UM_Score>();

        if (IsValid)
        {
            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                List <GPScore> gp = gp_Leaderboard.GetScoresList(span.Get_GP_TimeSpan(), collection.Get_GP_CollectionType());
                foreach (GPScore score in gp)
                {
                    scores.Add(new UM_Score(null, score));
                }
                return(scores);

            case RuntimePlatform.IPhonePlayer:
                List <GK_Score> gk = gk_Leaderboard.GetScoresList(span.Get_GK_TimeSpan(), collection.Get_GK_CollectionType());
                foreach (GK_Score score in gk)
                {
                    scores.Add(new UM_Score(score, null));
                }
                return(scores);
            }
        }

        return(scores);
    }
    public void LoadPlayerCenteredScores(UM_Leaderboard leaderboard, int maxResults, UM_TimeSpan timeSpan = UM_TimeSpan.ALL_TIME, UM_CollectionType collection = UM_CollectionType.GLOBAL)
    {
        if (leaderboard == null)
        {
            return;
        }

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:

            UM_Score score = GetCurrentPlayerScore(leaderboard, timeSpan, collection);
            int      rank  = 0;
            if (score != null)
            {
                rank = score.Rank;
            }

            int startIndex = Math.Max(0, rank - maxResults / 2);
            GameCenterManager.LoadScore(leaderboard.IOSId, startIndex, maxResults, timeSpan.Get_GK_TimeSpan(), collection.Get_GK_CollectionType());



            break;

        case RuntimePlatform.Android:
            GooglePlayManager.Instance.LoadPlayerCenteredScores(leaderboard.AndroidId, timeSpan.Get_GP_TimeSpan(), collection.Get_GP_CollectionType(), maxResults);
            break;
        }
    }
    public UM_Score GetCurrentPlayerScore(UM_Leaderboard leaderboard, UM_TimeSpan timeSpan = UM_TimeSpan.ALL_TIME, UM_CollectionType collection = UM_CollectionType.GLOBAL)
    {
        if (leaderboard != null)
        {
            return(leaderboard.GetCurrentPlayerScore(timeSpan, collection));
        }

        return(null);
    }
Exemplo n.º 7
0
    public static GC_ScoreTimeSpan Get_GC_TimeSpan(this UM_TimeSpan type)
    {
        switch (type)
        {
        case UM_TimeSpan.ALL_TIME: return(GC_ScoreTimeSpan.ALL_TIME);

        case UM_TimeSpan.WEEK: return(GC_ScoreTimeSpan.WEEK);

        case UM_TimeSpan.TODAY: return(GC_ScoreTimeSpan.TODAY);

        default: return(GC_ScoreTimeSpan.ALL_TIME);
        }
    }
    public void LoadTopScores(UM_Leaderboard leaderboard, int maxResults, UM_TimeSpan timeSpan = UM_TimeSpan.ALL_TIME, UM_CollectionType collection = UM_CollectionType.GLOBAL)
    {
        if (leaderboard == null)
        {
            return;
        }

        switch (Application.platform)
        {
        case RuntimePlatform.IPhonePlayer:
            GameCenterManager.LoadScore(leaderboard.IOSId, 1, maxResults, timeSpan.Get_GK_TimeSpan(), collection.Get_GK_CollectionType());
            break;

        case RuntimePlatform.Android:
            GooglePlayManager.Instance.LoadTopScores(leaderboard.AndroidId, timeSpan.Get_GP_TimeSpan(), collection.Get_GP_CollectionType(), maxResults);
            break;
        }
    }
Exemplo n.º 9
0
    public List <UM_Score> GetScoresList(UM_TimeSpan span, UM_CollectionType collection)
    {
        List <UM_Score> scores = new List <UM_Score>();

        if (IsValid)
        {
            switch (Application.platform)
            {
            case RuntimePlatform.Android:
                if (UltimateMobileSettings.Instance.PlatformEngine.Equals(UM_PlatformDependencies.Android))
                {
                    List <GPScore> gp = gp_Leaderboard.GetScoresList(span.Get_GP_TimeSpan(), collection.Get_GP_CollectionType());
                    foreach (GPScore score in gp)
                    {
                        scores.Add(new UM_Score(null, score, null));
                    }
                    return(scores);
                }
                else
                {
                    List <GC_Score> gcScores = gc_Leaderboard.GetScoresList(span.Get_GC_TimeSpan());
                    foreach (GC_Score s in gcScores)
                    {
                        scores.Add(new UM_Score(null, null, s));
                    }
                    return(scores);
                }

            case RuntimePlatform.IPhonePlayer:
                List <GK_Score> gk = gk_Leaderboard.GetScoresList(span.Get_GK_TimeSpan(), collection.Get_GK_CollectionType());
                foreach (GK_Score score in gk)
                {
                    scores.Add(new UM_Score(score, null, null));
                }
                return(scores);
            }
        }

        return(scores);
    }
Exemplo n.º 10
0
    public UM_Score GetScore(int rank, UM_TimeSpan scope, 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.GetScore(rank, scope.Get_GP_TimeSpan(), collection.Get_GP_CollectionType());
                    if (gp != null)
                    {
                        umScore = new UM_Score(null, gp, null);
                    }
                }
                else
                {
                    GC_Score gc = gc_Leaderboard.GetScore(rank, scope.Get_GC_TimeSpan());
                    if (gc != null)
                    {
                        umScore = new UM_Score(null, null, gc);
                    }
                }
                break;

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

        return(umScore);
    }
Exemplo n.º 11
0
	public List<UM_Score> GetScoresList(UM_TimeSpan span, UM_CollectionType collection) {
		List<UM_Score> scores = new List<UM_Score>();
		
		if (IsValid) {
			switch (Application.platform) {
			case RuntimePlatform.Android:
				List<GPScore> gp = gp_Leaderboard.GetScoresList(span.Get_GP_TimeSpan(), collection.Get_GP_CollectionType());
				foreach (GPScore score in gp) {
					scores.Add(new UM_Score(null, score));
				}
				return scores;
			case RuntimePlatform.IPhonePlayer:
				List<GK_Score> gk = gk_Leaderboard.GetScoresList(span.Get_GK_TimeSpan(), collection.Get_GK_CollectionType());
				foreach (GK_Score score in gk) {
					scores.Add(new UM_Score(score, null));
				}
				return scores;
			}
		}
		
		return scores;
	}
Exemplo n.º 12
0
	public UM_Score GetScore(int rank, UM_TimeSpan scope, UM_CollectionType collection) {
		UM_Score umScore = null;
		
		if (IsValid) {
			switch (Application.platform) {
			case RuntimePlatform.Android:
				GPScore gp = gp_Leaderboard.GetScore(rank, scope.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.GetScore(rank, scope.Get_GK_TimeSpan(), collection.Get_GK_CollectionType());
				if (gk != null) {
					umScore = new UM_Score(gk, null);
				}
				break;
			}
		}
		
		return umScore;
	}
    public void LoadTopScores(string leaderboardId, int maxResults, UM_TimeSpan timeSpan = UM_TimeSpan.ALL_TIME, UM_CollectionType collection = UM_CollectionType.GLOBAL)
    {
        UM_Leaderboard leaderboard = UltimateMobileSettings.Instance.GetLeaderboardById(leaderboardId);

        LoadTopScores(leaderboard, maxResults, timeSpan, collection);
    }
 public UM_Score GetCurrentPlayerScore(string leaderBoardId, UM_TimeSpan timeSpan = UM_TimeSpan.ALL_TIME, UM_CollectionType collection = UM_CollectionType.GLOBAL)
 {
     return(GetCurrentPlayerScore(UltimateMobileSettings.Instance.GetLeaderboardById(leaderBoardId), timeSpan, collection));
 }