Exemple #1
0
        void OnFetchScoreSuccess(Entry[] results)
        {
            PlatformLeaderBoard tempLeaderBoard;

            if (LeaderBoards.ContainsKey(curRefreshLeaderBoardId))
            {
                tempLeaderBoard = LeaderBoards[curRefreshLeaderBoardId];
                tempLeaderBoard.Items.Clear();
            }
            else
            {
                tempLeaderBoard = new PlatformLeaderBoard();
                LeaderBoards.Add(curRefreshLeaderBoardId, tempLeaderBoard);
            }
            if (results != null)
            {
                foreach (var item in results)
                {
                    var newItem = new PlatformLeaderBoardItem()
                    {
                        Name       = item.Name,
                        Score      = item.Score,
                        GlobalRank = item.GlobalRank,
                        Id         = item.SteamId,
                    };
                    tempLeaderBoard.Items.Add(newItem);
                }
            }
            Callback_OnFatchScoreSuccess?.Invoke(tempLeaderBoard);
        }
Exemple #2
0
    //--------------------------------------
    // PUBLIC METHODS
    //--------------------------------------

    public GPLeaderBoard GetLeaderBoard(string leaderboardId)
    {
        foreach (GPLeaderBoard lb in LeaderBoards)
        {
            if (lb.Id.Equals(leaderboardId))
            {
                return(lb);
            }
        }

        GPLeaderBoard leaderboard = new GPLeaderBoard(leaderboardId, string.Empty);

        LeaderBoards.Add(leaderboard);
        return(leaderboard);
    }