From 48eae90fa44ee4c940e65ba826d0901b76aec9e8 Mon Sep 17 00:00:00 2001 From: Mees van der Wijk Date: Sun, 10 Aug 2025 15:49:07 +0200 Subject: [PATCH] Added scoreboarstate --- ModuleServerAPIGameLibRoom.md | 76 +++++++++++++++++++++--- ModuleServerAPIGameLibScoreboardState.md | 35 +++++++++++ _Sidebar.md | 1 + 3 files changed, 104 insertions(+), 8 deletions(-) create mode 100644 ModuleServerAPIGameLibScoreboardState.md diff --git a/ModuleServerAPIGameLibRoom.md b/ModuleServerAPIGameLibRoom.md index 9bc723a..cd353be 100644 --- a/ModuleServerAPIGameLibRoom.md +++ b/ModuleServerAPIGameLibRoom.md @@ -9,7 +9,7 @@ Class representing the GameLib Room inside the ModuleServerAPI. Create a new game. ```javascript -room.newGame(gameDetails); +Room.newGame(gameDetails); ``` | Argument | Type | Description | @@ -23,19 +23,79 @@ room.newGame(gameDetails); Clear the queue. ```javascript -room.clearQueue(); +Room.clearQueue(); ``` ## Events -### on: endScreen +### on: playerJoinQueue -Triggers when the endscreen should be shown. +Triggers when a player join the queue. ```javascript -Controller.on('endScreen', (endScreen) => {}); +Room.on('playerJoinQueue', (player) => {}); ``` -| Argument | Type | Description | -| --------- | ------------------------------------------- | ------------------- | -| endScreen | [EndScreen](./ModuleAPIGameLibEndScreen.md) | The endscreen data. | +| Argument | Type | Description | +| -------- | ------------------------------------------------ | --------------------------------- | +| player | [GamePlayer](./ModuleServerAPIGameLibGamePlayer) | The player that joined the queue. | + +### on: playerLeaveQueue + +Triggers when a player leaves the queue. + +```javascript +Room.on('playerLeaveQueue', (player) => {}); +``` + +| Argument | Type | Description | +| -------- | ------------------------------------------------ | ------------------------------- | +| player | [GamePlayer](./ModuleServerAPIGameLibGamePlayer) | The player that left the queue. | + +### on: queueUpdate + +Triggers when the queue updates. + +```javascript +Room.on('queueUpdate', (players) => {}); +``` + +| Argument | Type | Description | +| -------- | -------------------------------------------------- | ------------------------- | +| players | [GamePlayer](./ModuleServerAPIGameLibGamePlayer)[] | The players in the queue. | + +### on: activeGameChanged + +Triggers when the active game changes. + +```javascript +Room.on('activeGameChanged', (gameDetails) => {}); +``` + +| Argument | Type | Description | +| ----------- | -------------------------------------------- | ----------------------------------- | +| gameDetails | [GameDetails](./ModuleApiGameLibGameDetails) | The details of the new active game. | + +### on: mainScoreboardUpdate + +Triggers when the queue updates. + +```javascript +Room.on('mainScoreboardUpdate', (player) => {}); +``` + +| Argument | Type | Description | +| -------- | ------------------------------------------------ | --------------------------------- | +| player | [GamePlayer](./ModuleServerAPIGameLibGamePlayer) | The player that joined the queue. | + +### on: anyScoreboardUpdate + +Triggers when the queue updates. + +```javascript +Room.on('anyScoreboardUpdate', (player) => {}); +``` + +| Argument | Type | Description | +| -------- | ------------------------------------------------ | --------------------------------- | +| player | [GamePlayer](./ModuleServerAPIGameLibGamePlayer) | The player that joined the queue. | diff --git a/ModuleServerAPIGameLibScoreboardState.md b/ModuleServerAPIGameLibScoreboardState.md new file mode 100644 index 0000000..331a3b4 --- /dev/null +++ b/ModuleServerAPIGameLibScoreboardState.md @@ -0,0 +1,35 @@ +# ModuleServerApi - GameLib Scoreboard State + +Simple object containing the state of a scoreboard. + +## Structure + +```JSON +{ + "name": "Scoreboard Name", + "gameId": "gameId", + "scoreboardId": "scoreboardId", + "entries": [ + { + "uuid": "123", + "name": "Player 1", + "displayValue": "1m 2s", + "value": 62 + }, + { + "uuid": "456", + "name": "Player 2", + "displayValue": "59s", + "value": 59 + } + ] +} + +``` + +| Attribute | Type | Description | +| ------------ | ---------------------------------------------------------------- | -------------------------------- | +| name | string | The name of the scoreboard. | +| gameId | string | The id of the active game. | +| scoreboardId | string | The id of the active scoreboard. | +| entries | { uuid:string, name:string, displayValue:string, value:number}[] | The entries in the scoreboard. | diff --git a/_Sidebar.md b/_Sidebar.md index add72d9..bca5b16 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -27,6 +27,7 @@ - [Game](./ModuleServerAPIGameLibGame) - [GamePlayer](./ModuleServerAPIGameLibGamePlayer) - [Scoreboard](./ModuleServerAPIGameLibScoreboard) + - [Scoreboard State](./ModuleServerAPIGameLibScoreboardState) - [GameLib CollisionSpace](./ModuleServerAPIGameLibCollisionSpace) - [Libs](./ModuleServerAPILibs) - [LibWebSocket](./ModuleServerAPILibsWebSocketLib)