Skip to main content

LeaderboardDefinitionData

A class in Root.Township, the global namespace.

A leaderboard's settings: course name, size and whether lower scores win. A static list holds one per LeaderboardDefinition asset plus any added by the leaderboard console commands.

Constructors​

MemberWhat it is
LeaderboardDefinitionData()Creates a LeaderboardDefinitionData with default values.

Fields​

MemberWhat it is
string courseNameDisplay name of the course.
LeaderboardDefinition definitionThe asset it came from, or null if made by command.
uint hashIdentifier: the asset's hash, or the course name's hash code for command-made ones.
bool isLowestTrue if lower scores (such as times) rank higher.
int sizeNumber of entries kept.
1 private and internal field
MemberWhat it is
private static List<LeaderboardDefinitionData> mappedAll known leaderboards, from the assets plus any added with SetData or AddData.

Properties​

MemberWhat it is
string TrimmedCourseName { get; }Course name with spaces removed, used for lookups.

Methods​

MemberWhat it is
static void AddData(LeaderboardDefinitionData newData)Adds a leaderboard, replacing any with the same hash.
bool Compare(float a, float b)True if score b beats score a, taking isLowest into account.
static LeaderboardDefinitionData GetData(string courseName)Finds a leaderboard by course name, ignoring spaces and case. Null if none.
static IEnumerable<LeaderboardDefinitionDataInfo> ListAvailable() (iterator)Lists every known leaderboard as LeaderboardDefinitionDataInfo.
static LeaderboardDefinitionDataInfo op_Implicit(LeaderboardDefinitionData data)Converts to a LeaderboardDefinitionDataInfo with just the name.
static LeaderboardDefinitionData SetData(string courseName, int size, bool isLowest)Finds or creates a leaderboard by course name. Size and order only change for ones without an asset.
1 private and internal method
MemberWhat it is
private static void Prepare()On first use, fills mapped with the data of every LeaderboardDefinition asset.

Used in​

Members of other types that take, return or hold a LeaderboardDefinitionData: