Added scoreboarstate

2025-08-10 15:49:07 +02:00
parent 904b15b2e6
commit 48eae90fa4
3 changed files with 104 additions and 8 deletions

@@ -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. |
| -------- | ------------------------------------------------ | --------------------------------- |
| 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. |

@@ -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. |

@@ -27,6 +27,7 @@
- [Game](./ModuleServerAPIGameLibGame)
- [GamePlayer](./ModuleServerAPIGameLibGamePlayer)
- [Scoreboard](./ModuleServerAPIGameLibScoreboard)
- [Scoreboard State](./ModuleServerAPIGameLibScoreboardState)
- [GameLib CollisionSpace](./ModuleServerAPIGameLibCollisionSpace)
- [Libs](./ModuleServerAPILibs)
- [LibWebSocket](./ModuleServerAPILibsWebSocketLib)