Added more specs

2025-08-09 17:29:22 +02:00
parent 0bdc98cc33
commit 05abced165
4 changed files with 155 additions and 4 deletions

@@ -0,0 +1,34 @@
# ModuleApi - GameLib GameDetails
The game details decribe basic information about the game and specifies how the controller should behave.
## Structure
```JSON
{
"name": "Game Name",
"description": "Game Description.",
"hints" : [
"Hint A",
"Hint B"
],
"icon": "/addressOfGameIcon",
"controls": [
control
]
}
```
| Attribute | Type | Description |
| --------------- | ---------------------------------------------- | ----------------------------------------- |
| name | string | The name of the game. |
| description | string | The description of the game. |
| hints | string[] | List of hints for the game. |
| (Optional) icon | string | Path to the icon of the module. |
| controls | [Control](ModuleApiGameLibGameDetails#Control) | Statistics rows to show on the endscreen. |
## Control
Specifies an possible control to the controller.

@@ -6,10 +6,98 @@ Class representing the GameLib Controller inside the ModuleClientAPI.
### call
Send a controller action to the active game.
```javascript
Controller.call(action, mode, intensity?);
```
| Argument | Type | Description |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| action | "left" / "right" / "up" / "down" / "upleft" / "upright" / "downleft" / "downright" / "start" / "select" / "back" / "identify" | The action to send. |
| mode | "on" / "off" | The ID of the controller. |
| (Optional) intensity | number | The intensity of the button press (between 0 and 1). |
### callCustom
Send a controller action to the active game.
```javascript
Controller.callCustom(action, mode, intensity?);
```
| Argument | Type | Description |
| -------------------- | ------------ | ---------------------------------------------------- |
| action | string | The action to send. |
| mode | "on" / "off" | The ID of the controller. |
| (Optional) intensity | number | The intensity of the button press (between 0 and 1). |
### joinQueue
Join the queue of the room.
```javascript
Controller.joinQueue();
```
## Events
### on
### on: outsideRoom
Triggers when the user goes outside of the room.
```javascript
Controller.on('outsideRoom', () => {});
```
### on: insideGame
Triggers when the user is requested from the queue.
```javascript
Controller.on('insideGame', () => {});
```
### on: insideQueue
Triggers when the user joins the room of the queue.
```javascript
Controller.on('insideQueue', () => {});
```
### on: endScreen
Triggers when the endscreen should be shown.
```javascript
Controller.on('endScreen', (endScreen) => {});
```
| Argument | Type | Description |
| --------- | -------------------------------------------------------- | ------------------- |
| endScreen | [EndScreen](./ModuleClientAPIGameLibControllerEndScreen) | The endscreen data. |
### on: queuePositionUpdate
Triggers when the queue position updates.
```javascript
Controller.on('queuePositionUpdate', (position) => {});
```
| Argument | Type | Description |
| -------- | ------ | ------------------------------ |
| position | number | The new position in the queue. |
### on: activeGameChanged
Triggers when the queue position updates.
```javascript
Controller.on('activeGameChanged', (gameDetails) => {});
```
| Argument | Type | Description |
| ----------- | -------------------------------------------- | -------------------------------------------- |
| gameDetails | [GameDetails](./ModuleApiGameLibGameDetails) | The game details of the current active game. |

@@ -0,0 +1,30 @@
# ModuleClientApi - GameLib Controller EndScreen
The endscreen can be shown to the user after they have been removed a game. It can be used to display information like statistics or give feedback.
## Structure
```JSON
{
"gameIcon": "/addressOfGameIcon",
"gameName": "Game Name",
"title" : "Title text to show",
"text": "Sub text to show",
"stats": [
{ "name": "Reason", "value": "You've died" },
{ "name": "Score", "value": 15 }
],
"footer": "Footer text to show"
}
```
| Attribute | Type | Description |
| ----------------- | -------------------------------------- | ----------------------------------------- |
| gameIcon | string | Path to the icon of the game. |
| gameName | string | The name of the game. |
| title | string | The title of the endscreen. |
| (Optional) text | string | Text to show on the endscreen. |
| stats | { name:string, value: number / string} | Statistics rows to show on the endscreen. |
| (Optional) footer | string | The footer of the endscreen. |

@@ -4,9 +4,6 @@
- [Config](./Config)
- Module Development
- [Module Structure](./ModuleStructure)
- Important Principals
- [ModuleClientAPI Principals](./ModuleClientAPIPrincipals)
- [ModuleServerAPI Principals](./ModuleServerAPIPrincipals)
- [Module.json](./ModuleJSON)
- [Property](./ModuleJSONProperty)
- [Trigger](./ModuleTrigger)
@@ -25,6 +22,8 @@
- [Libs](./ModuleServerAPILibs)
- [LibWebSocket](./ModuleServerAPILibsWebSocketLib)
- [Axios](https://axios-http.com/docs/instance)
- ModuleApi Shared
- [GameLib GameDetails](./ModuleApiGameLibGameDetails)
- [Module Debugging](./ModuleDebugging)
- [ModuleStore](./ModuleStore)
- [Bug/Feature Reporting](./Reporting)