UI / LeaderboardModule
LeaderboardModule Class
Instance
Editor built-in leaderboard
Table of contents
Methods
addField(fieldId : number , fieldName : string , valueStyle? : string ): typeof LeaderboardModule other |
---|
Add a field |
addPlayer(player : number Player , data? : any ): void other |
Add a player to the leaderboard |
clear(): void other |
Clear the leaderboard |
hidePanel(): void other |
Hide UI |
removePlayer(player : number Player ): void other |
Remove a player from the leaderboard |
setPlayerValue(player : number Player , fieldId : number , value : string number ): void other |
Set a field value for a player |
setSortFields(...fieldIds : number []): typeof LeaderboardModule other |
Set sorting fields |
setSortMethod(fn : (dataList : LeaderboardPlayerData []) => LeaderboardPlayerData []): typeof LeaderboardModule other |
Method for setting sorting |
setStyle(title : string , fieldsAutoLayout : boolean , showPlayerNum : number , itemSpacing : number ): typeof LeaderboardModule other |
Set Style |
showPanel(hideCallback? : () => void ): void other |
Display UI |
showRankField(fieldName : string , valueStyle? : string , notListed? : string ): typeof LeaderboardModule other |
Display ranking |
Methods
addField
• Static
addField(fieldId
, fieldName
, valueStyle?
): typeof LeaderboardModule
other
Add a field
Parameters
fieldId number | Field ID range: determined by ID length type: |
---|---|
fieldName string | Field name range: Unrestricted |
valueStyle? string | Display content style (example: {0} points) default: null range: unlimited |
Returns
typeof LeaderboardModule | Return to yourself, which can be used for chained call |
---|
addPlayer
• Static
addPlayer(player
, data?
): void
other
Add a player to the leaderboard
Parameters
player number Player | Player object Player id range: depending on ID length |
---|---|
data? any | Player data default: {} |
clear
• Static
clear(): void
other
Clear the leaderboard
hidePanel
• Static
hidePanel(): void
other
Hide UI
removePlayer
• Static
removePlayer(player
): void
other
Remove a player from the leaderboard
Parameters
player number Player | Player object Player id range: depending on ID length |
---|
setPlayerValue
• Static
setPlayerValue(player
, fieldId
, value
): void
other
Set a field value for a player
Parameters
player number Player | Player Object Player ID range: determined by ID length |
---|---|
fieldId number | Field ID range: determined by ID length type: integer |
value string number | Field value range: unlimited, one Player, one data type: integer |
setSortFields
• Static
setSortFields(...fieldIds
): typeof LeaderboardModule
other
Set sorting fields
Parameters
...fieldIds number [] | Sort field range: No length limit |
---|
Returns
typeof LeaderboardModule | Return to yourself, which can be used for chained call |
---|
Multiple field sorting can be set, only supporting sorting from large to small.
setSortMethod
• Static
setSortMethod(fn
): typeof LeaderboardModule
other
Method for setting sorting
Parameters
fn (dataList : LeaderboardPlayerData []) => LeaderboardPlayerData [] | method |
---|
Returns
typeof LeaderboardModule | Return to yourself, which can be used for chained call |
---|
setStyle
• Static
setStyle(title
, fieldsAutoLayout
, showPlayerNum
, itemSpacing
): typeof LeaderboardModule
other
Set Style
Parameters
title string | Interface title range: UI title information |
---|---|
fieldsAutoLayout boolean | Are the fields automatically laid out and evenly distributed |
showPlayerNum number | The maximum number of Player displayed range: reasonable, type: integer |
itemSpacing number | The spacing between each piece of data should be reasonable. Type: integer |
Returns
typeof LeaderboardModule | Return to yourself, which can be used for chained call |
---|
showPanel
• Static
showPanel(hideCallback?
): void
other
Display UI
Parameters
hideCallback? () => void | Panel closure callback default: null |
---|
showRankField
• Static
showRankField(fieldName
, valueStyle?
, notListed?
): typeof LeaderboardModule
other
Display ranking
Parameters
fieldName string | Field name range: determined by ID length type: |
---|---|
valueStyle? string | Field value style default: null range: no restriction |
notListed? string | Not on the list (if the ranking is displayed even if it is not on the list, please fill in null) default: null range: no restrictions |
Returns
typeof LeaderboardModule | Return to yourself, which can be used for chained call |
---|