类型 事件 版本 发行版 2024.3703 关键词 steam, steamworks, 排行榜, leaderboardInfo 另请参阅 steamworks.requestLeaderboardInfo() steamworks.*
提供有关某个排行榜信息(例如其条目计数、显示/值类型、排序顺序等)的事件。
此事件只能由已传递给 steamworks.requestLeaderboardInfo() 函数的 函数 监听器接收。
local steamworks = require( "plugin.steamworks" )
-- Called by the "steamworks.requestLeaderboardInfo()" function with the result
local function onReceivedLeaderboardInfo( event )
if ( event.isError ) then
-- Request failed; typically happens when there is no Internet access
print( "Failed to fetch leaderboard info." )
else
-- Print the received leaderboard information to the log
print( "Leaderboard Name: " .. event.leaderboardName )
print( "Entry Count: " .. tostring(event.entryCount) )
print( "Sort Method: " .. event.sortMethod )
print( "Display Type: " .. event.displayType )
end
end
-- Fetch information about one leaderboard
-- Requires an active Internet connection to succeed
-- Will provide the requested result to the given listener function
local requestSettings =
{
leaderboardName = "My Leaderboard Name",
listener = onReceivedLeaderboardInfo,
}
steamworks.requestLeaderboardInfo( requestSettings )