Board data
Title, columns, value formats, ranking and entries of a board.
A board is a component that implements leaderboard_source, added next to leaderboard_panel_component. Its
GetBoard method returns a leaderboard_board.
using { /Verse.org/SceneGraph }
using { LeaderboardPanel }
top_builders_board<public> := class<final_super>(component, leaderboard_source):
GetBoard<override>()<transacts>:leaderboard_board = leaderboard_board:
Title := "TOP BUILDERS"
Subtitle := "ALL TIME"
Columns := array:
leaderboard_column{Title := "BLOCKS", Format := leaderboard_format.Compact}
leaderboard_column{Title := "BEST TIME", Format := leaderboard_format.Time}
RankBy := 1
HighestFirst := true
Entries := array:
leaderboard_entry{Name := "simnJS", Values := array{125000.0, 83.4}}
leaderboard_entry{Name := "NovaRush", Values := array{98000.0, 91.2}}leaderboard_board
| Field | Default | Description |
|---|---|---|
Title | "LEADERBOARD" | Title of the panel. |
Subtitle | "" | Shown above the title. Optional. |
NameTitle | "PLAYER" | Header of the name column. |
Columns | empty | Up to 4 value columns. Place the WBP_Leaderboard_* variant with as many stats. |
Entries | empty | The rows of the board, in any order. |
RankBy | 1 | Column (1 to 4) that ranks the entries. 0 keeps the order of Entries. |
HighestFirst | true | true: the highest value comes first (points). false: the lowest comes first (times). |
MaxEntries | 0 | Shows only the best N entries. 0 shows them all. |
leaderboard_column
| Field | Default | Description |
|---|---|---|
Title | "" | Header of the column. |
Format | Integer | How its values are written. See below. |
Prefix | "" | Added before the value, for example "$". |
Suffix | "" | Added after the value, for example " pts". |
leaderboard_entry
| Field | Default | Description |
|---|---|---|
Name | "" | The name shown in the row. |
Values | empty | One value per column, in the order of Columns. |
An entry without a value for a column shows - in that cell.
Value formats
leaderboard_format sets how a column writes its values. Examples in the English number style.
| Format | Value | Shown |
|---|---|---|
Integer | 12500.0 | 12,500 |
Decimal | 12500.75 | 12,500.75 |
Compact | 12500.0 / 3400000.0 | 12.5K / 3.40M (three significant digits: K, M, B, T…) |
Time | 65.32 (seconds) | 1:05.32, or 1:02:05 from one hour |
Percent | 87.5 | 87.5% (at most one decimal) |
The number style is a setting of leaderboard_panel_component (NumberStyle):
| Style | Example |
|---|---|
English | 12,500.5 |
French | 12 500,5 |
German | 12.500,5 |
Plain | 12500.5 |
Ranking
- Entries are sorted on the
RankBycolumn: highest first, or lowest first withHighestFirst := false. - Equal values share a rank, and the next rank skips: 1, 2, 2, 4.
- Entries without a value in the ranking column come last.
- With
RankBy := 0, entries keep your order and are numbered 1, 2, 3… - The first three ranks get the podium colours.
Verse reference
leaderboard_source<public> := interface:
GetBoard<public>()<transacts>:leaderboard_board
leaderboard_format<public> := enum{Integer, Decimal, Compact, Time, Percent}
leaderboard_number_style<public> := enum{English, French, German, Plain}
# The text of a value, as the panel writes it.
FormatLeaderboardValue<public>(Value:float, Column:leaderboard_column, Style:leaderboard_number_style)<transacts>:stringOn leaderboard_panel_component, PageCount() returns the number of pages of the board, with the current rows per
page.