gamecircle.Leaderboard.GetLeaderboards

类型 函数
gamecircle.*
返回值
版本 2024.3703 版
关键词 排行榜,获取

概述

使用此函数获取与特定应用关联的所有排行榜。

语法

gamecircle.Leaderboard.GetLeaderboards( callback )
callback (必需)

函数。当获取分数时使用的回调函数。回调将接收一个 GetLeaderboardsReturn 类型的参数。

示例

local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(false, true, false)  
function LeaderboardCallback(returnValue)  
    if returnValue.isError == true then  
        print("Get Leaderboards request returned with error message: " .. returnValue.errorMessage)  
    else  
        print("Leaderboard information recieved!")  
        print("-num" .. returnValue.num)  
        for i, leaderboard in ipairs(returnValue) do  
            print("-Leaderboard ID" .. leaderboard.id)  
            print("--name" .. leaderboard.name)  
            print("--displayText" .. leaderboard.displayText)  
            print("--scoreFormat" .. leaderboard.scoreFormat)  
            print("--imageURL" .. leaderboard.imageURL)  
            print("--imageURL may be blank, as warned by Amazon's SDK documentation, when propegated outside basic GetLeaderboards function")  
        end  
    end  
end  
gamecircle.Leaderboard.GetLeaderboards(LeaderboardCallback)