Skip to content
LeaderboardMainPanelBase<T>

UI / LeaderboardMainPanelBase

LeaderboardMainPanelBase<T> Class

Leaderboard main interface

Type parameters

Textends ILeaderboardPanelView

Hierarchy

Table of contents

Properties

onClose: Action
Event called when closed

Accessors

click

Accessors

size(): Vector2
Panel size
view(): T
The interface controlled by the panel

Methods

addField(fieldId: number, fieldName: string, valueStyle?: string): LeaderboardMainPanelBase<T> other
Add a field
creatItem(): LeaderboardItemPanelBase<{ mContent: [Canvas](mw.Canvas.md) } & UIScript> other
Create an item sub UI to display a ranking information
onHide(): void other
When the UI hides call
onSelfFieldSet(rankIndex: number, fieldId: number, fieldValue: string number, textBlockIndex: number, textBlock: TextBlock): void other
Call after setting your own field content (the bottom line of the interface). Please copy if necessary
onShow(playerDataList: LeaderboardPlayerData[]): void other
When the UI displays call
onSort(dataList: LeaderboardPlayerData[]): LeaderboardPlayerData[] other
When calling for sorting, please rewrite it
setSortFields(...fieldIds: number[]): LeaderboardMainPanelBase<T> other
Set the sort field ID, you can set multi field sort, and only support sort from large to small
setStyle(title: string, fieldsAutoLayout: boolean, showPlayerNum: number, itemSpacing: number): LeaderboardMainPanelBase<T> other
Set the style of the leaderboard
showRankField(fieldName: string, valueStyle?: string, notListed?: string): LeaderboardMainPanelBase<T> other
The "Rank" field is displayed and set. It is not displayed by default
click

Methods

onAdded(): void other
Lifecycle - Triggered when added to the parent node, may be called multiple times
onAwake(): void other
Life cycle method - the construction panel is automatically triggered and will only be called call

Properties

onClose

Readonly onClose: Action

Event called when closed

Accessors

Methods

addField

addField(fieldId, fieldName, valueStyle?): LeaderboardMainPanelBase<T> other

Add a field

Parameters

fieldId numberField ID range: determined by ID length type:
fieldName stringField title range:
valueStyle? stringDisplay style of field value (example: {0} points) default: null range: unlimited

Returns

LeaderboardMainPanelBase<T>Return to yourself, which can be used for chained call

creatItem

Protected Abstract creatItem(): LeaderboardItemPanelBase<{ mContent: [Canvas](mw.Canvas.md) } & UIScript> other

Create an item sub UI to display a ranking information

Returns

LeaderboardItemPanelBase<{ mContent: [Canvas](mw.Canvas.md) } & UIScript>An item sub UI for ranking information

onHide

Protected onHide(): void other

When the UI hides call

Precautions

If you want to replicate this method, remember to call super. onHide ()


onSelfFieldSet

Protected onSelfFieldSet(rankIndex, fieldId, fieldValue, textBlockIndex, textBlock): void other

Call after setting your own field content (the bottom line of the interface). Please copy if necessary

Parameters

rankIndex numberRanking index (starting from 0) range: reasonable, no restrictions type: integer
fieldId numberField index (if it is a ranking field, this parameter is mull) range: reasonable, no restrictions type: integer
fieldValue string numberField display content: range: reasonable, no restrictions. Type: integer
textBlockIndex numberText control index range: reasonable, no restrictions. Type: integer
textBlock TextBlockText widget

onShow

Protected onShow(playerDataList): void other

When the UI displays call

Parameters

playerDataList LeaderboardPlayerData[]Player Data List

Precautions

If you want to duplicate this method, remember to call super. onShow()


onSort

Protected onSort(dataList): LeaderboardPlayerData[] other

When calling for sorting, please rewrite it

Parameters

dataList LeaderboardPlayerData[]Ranking data array

Returns

LeaderboardPlayerData[]Sorted data queue

setSortFields

setSortFields(...fieldIds): LeaderboardMainPanelBase<T> other

Set the sort field ID, you can set multi field sort, and only support sort from large to small

Parameters

...fieldIds number[]Sort Field

Returns

LeaderboardMainPanelBase<T>Return to yourself, which can be used for chained call

setStyle

setStyle(title, fieldsAutoLayout, showPlayerNum, itemSpacing): LeaderboardMainPanelBase<T> other

Set the style of the leaderboard

Parameters

title stringUI Title range: UI title information
fieldsAutoLayout booleanWhether the field is automatically layout (true - uniform distribute, false - what you put is what you get)
showPlayerNum numberThe maximum number of Player displayed range: reasonable, type: integer
itemSpacing numberThe spacing between each piece of data should be reasonable. Type: integer

Returns

LeaderboardMainPanelBase<T>Return to yourself, which can be used for chained call

showRankField

showRankField(fieldName, valueStyle?, notListed?): LeaderboardMainPanelBase<T> other

The "Rank" field is displayed and set. It is not displayed by default

Parameters

fieldName stringField title range: determined by ID length type:
valueStyle? stringField value style default: null range: no restriction
notListed? stringNot on the list (if not on the list, display "ranking", please fill in null) default: null range: no restrictions

Returns

LeaderboardMainPanelBase<T>Return to yourself, which can be used for chained call