コード例 #1
0
    //--------------------------------------
    // PUBLIC METHODS
    //--------------------------------------



    public GPScore GetScore(int rank, GPBoardTimeSpan timeSpan, GPCollectionType collection)
    {
        GPScoreCollection col = GlobalCollection;

        switch (collection)
        {
        case GPCollectionType.GLOBAL:
            col = GlobalCollection;
            break;

        case GPCollectionType.FRIENDS:
            col = SocsialCollection;
            break;
        }


        Dictionary <int, GPScore> scoreDict = col.AllTimeScores;

        switch (timeSpan)
        {
        case GPBoardTimeSpan.ALL_TIME:
            scoreDict = col.AllTimeScores;
            break;

        case GPBoardTimeSpan.TODAY:
            scoreDict = col.TodayScores;
            break;

        case GPBoardTimeSpan.WEEK:
            scoreDict = col.WeekScores;
            break;
        }


        if (scoreDict.ContainsKey(rank))
        {
            return(scoreDict[rank]);
        }
        else
        {
            return(null);
        }
    }
コード例 #2
0
    public void UpdateScore(GPScore score)
    {
        GPScoreCollection col = GlobalCollection;

        switch (score.collection)
        {
        case GPCollectionType.GLOBAL:
            col = GlobalCollection;
            break;

        case GPCollectionType.FRIENDS:
            col = SocsialCollection;
            break;
        }


        Dictionary <int, GPScore> scoreDict = col.AllTimeScores;

        switch (score.timeSpan)
        {
        case GPBoardTimeSpan.ALL_TIME:
            scoreDict = col.AllTimeScores;
            break;

        case GPBoardTimeSpan.TODAY:
            scoreDict = col.TodayScores;
            break;

        case GPBoardTimeSpan.WEEK:
            scoreDict = col.WeekScores;
            break;
        }

        if (scoreDict.ContainsKey(score.rank))
        {
            scoreDict[score.rank] = score;
        }
        else
        {
            scoreDict.Add(score.rank, score);
        }
    }
コード例 #3
0
ファイル: GPLeaderBoard.cs プロジェクト: kknet/AnimalBook
    public List <GPScore> GetScoresList(GPBoardTimeSpan timeSpan, GPCollectionType collection)
    {
        GPScoreCollection col = GlobalCollection;

        switch (collection)
        {
        case GPCollectionType.GLOBAL:
            col = GlobalCollection;
            break;

        case GPCollectionType.FRIENDS:
            col = SocsialCollection;
            break;
        }


        Dictionary <int, GPScore> scoreDict = col.AllTimeScores;

        switch (timeSpan)
        {
        case GPBoardTimeSpan.ALL_TIME:
            scoreDict = col.AllTimeScores;
            break;

        case GPBoardTimeSpan.TODAY:
            scoreDict = col.TodayScores;
            break;

        case GPBoardTimeSpan.WEEK:
            scoreDict = col.WeekScores;
            break;
        }

        List <GPScore> scores = new List <GPScore>();

        scores.AddRange(scoreDict.Values);


        return(scores);
    }