类型 函数 库 gamecircle.* 返回值 无 版本 版本 2024.3703 关键字 排行榜、分数、获取
使用此函数可从由所提供的 GameCircle ID 确定的排行榜中获取分数。
gamecircle.Leaderboard.GetScores( id, LF_constant, callback )
String. 排行榜的 GameCircle ID。
String. 此为排行榜筛选常量,用于与 GameCircle SDK 的内部枚举器相关联。它具有四个有效值:“GLOBAL_ALL_TIME”、“GLOBAL_WEEK”、“GLOBAL_DAY”及“FRIENDS_ALL_TIME”。如果输入此参数的字符串与这四个字符串中的任何一个不匹配,则函数将使用 “GLOBAL_ALL_TIME”作为默认值。
Function. 在获取分数后调用的回调函数。回调将接收一个 GetScoresReturn 类型的单个参数。
local leaderboardId = "myFirstLeaderboard" local gamecircle = require("plugin.gamecircle") gamecircle.Init(false, true, false) function LeaderboardCallback(returnValue) if returnValue.isError == true then print("Get Scores request returned with error message: " .. returnValue.errorMessage) else print("Score information recieved for Leaderboard!") print("-Leaderboard ID" .. returnValue.id) print("-name" .. returnValue.name) print("-displayText" .. returnValue.displayText) print("-num" .. returnValue.num) print("-scoreFormat" .. returnValue.scoreFormat) print("-scores:") for i, score in ipairs(returnValue) do print("--Rank " .. score.rank) print("---" .. score.scoreString .. " by " .. score.player.alias) end end end gamecircle.Leaderboard.GetScores(leaderboardId, "GLOBAL_WEEK", LeaderboardCallback)