xna-cncnet-client icon indicating copy to clipboard operation
xna-cncnet-client copied to clipboard

Add a web label

Open 11EJDE11 opened this issue 1 month ago • 1 comments

This PR adds a label that can query JSON data from a datasource. We can use this for the online player count, for ladder ranking, or news. INI datasources are also supported.

Datasources are specified in ClientDefinitions.ini

[DataSources]
DataSourceID=URL,RefreshIntervalSeconds,TimeoutSeconds,Format ;example: TopPlayers=https://ladder.cncnet.org/api/v1/qm/ladder/rankings,300,10,json|ini

Labels then point to a datasource and can query the JSON.

[ExtraControls]
1=lblTopPlayer1:XNAClientJSONLabel

[lblTopPlayer1]
$Type=XNAClientJSONLabel
DataSourceID=TopPlayers
Template=1. {YR[0].player_name} - {YR[0].points:N0} pts
LoadingText=Loading...
FallbackText=---
FontIndex=1
RemapColor=230,230,230
Location=360,166

See INISytem.md for more info.

Excuse the crappy screenshot. image

11EJDE11 avatar Nov 17 '25 20:11 11EJDE11