diff --git a/ModuleApiGameLibGameDetails.md b/ModuleApiGameLibGameDetails.md new file mode 100644 index 0000000..cfca06d --- /dev/null +++ b/ModuleApiGameLibGameDetails.md @@ -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. diff --git a/ModuleClientAPIGameLibController.md b/ModuleClientAPIGameLibController.md index f6d7995..c697fb8 100644 --- a/ModuleClientAPIGameLibController.md +++ b/ModuleClientAPIGameLibController.md @@ -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. | diff --git a/ModuleClientAPIGameLibControllerEndScreen.md b/ModuleClientAPIGameLibControllerEndScreen.md new file mode 100644 index 0000000..efd727d --- /dev/null +++ b/ModuleClientAPIGameLibControllerEndScreen.md @@ -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. | diff --git a/_Sidebar.md b/_Sidebar.md index 4c5c0df..6b96db9 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -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)