类型 函数 库 gamecircle.* 返回值 无 修订版 版本 2024.3703 关键字 排行榜,获取
使用本函数可以抓取排行榜的分位数统计信息
gamecircle.Leaderboard.GetPercentileRanks( id, LF_constant, callback )
字符串. 我们希望获取其分位数统计信息的 GameCircle 排行榜 ID。
字符串. 这是排行榜筛选常量,用于关联至 GameCircle SDK 的内部枚举器。它有四个有效值:“GLOBAL_ALL_TIME”、“GLOBAL_WEEK”、“GLOBAL_DAY”及“FRIENDS_ALL_TIME”。如果向此参数中输入的不是这四个字符串之一,则该函数会默认使用“GLOBAL_ALL_TIME”。
函数. 当已抓取分位数统计信息时使用的回调函数。回调函数将收到一个类型为 PercentileReturn 的单个参数。
local leaderboardId = "myFirstLeaderboard" local gamecircle = require("plugin.gamecircle") gamecircle.Init(false, true, false) function LeaderboardCallback(returnValue) if returnValue.isError == true then print("Get Percentile request returned with error message: " .. returnValue.errorMessage) else print("Percentile information returned for leaderboard " .. returnValue.leaderboard.name) print("The local user's index in the list is : " .. returnValue.userIndex) print("-(-1 means user is not on leaderboard)") print("Here is the statistical information:") for i,stat in ipairs(returnValue) do print("#" .. i .. " " .. stat.playerAlias .. "-" .. stat.playerScore .. "-" .. percentile) end end end gamecircle.Leaderboard.GetPercentileRanks(leaderboardId, "GLOBAL_WEEK", LeaderboardCallback)