Added neighbor
@@ -115,7 +115,15 @@ api.getUser();
|
||||
|
||||
**Return** [User](./ModuleClientAPIUser) _The user object_
|
||||
|
||||
### getModuleID **(TODO)**
|
||||
### getModuleID
|
||||
|
||||
Get the current module id.
|
||||
|
||||
```javascript
|
||||
api.getModuleID();
|
||||
```
|
||||
|
||||
**Return** string _The id of the module instance._
|
||||
|
||||
### getResolution
|
||||
|
||||
@@ -125,37 +133,138 @@ Get the scene resolution.
|
||||
api.getResolution();
|
||||
```
|
||||
|
||||
**Returns** { width:number, height:number } _Resolution of scene_
|
||||
**Returns** { width:number, height:number } _Resolution of scene._
|
||||
|
||||
### getTime **(TODO)**
|
||||
### getTime
|
||||
|
||||
### isInEditor **(TODO)**
|
||||
Get the current server time. This is a live synced time with the Getiyo server. Use this if you depend on timing so each client will be sync.
|
||||
|
||||
```javascript
|
||||
api.getTime();
|
||||
```
|
||||
|
||||
**Returns** number _The unix timestamp synced with the server._
|
||||
|
||||
### isInEditor
|
||||
|
||||
Check if the module is running in the editor.
|
||||
|
||||
```javascript
|
||||
api.isInEditor();
|
||||
```
|
||||
|
||||
**Returns** boolean _Running in editor._
|
||||
|
||||
## Snapshots
|
||||
|
||||
### onSnapshotRestore **(TODO)**
|
||||
### onSnapshotRestore
|
||||
|
||||
### onSnapshotCreate **(TODO)**
|
||||
Register a listener that will be called when a snapshot is recalled and the runtime storage is restored.
|
||||
|
||||
### getRuntimeStorage **(TODO)**
|
||||
```javascript
|
||||
api.ononSnapshotRestore(callback);
|
||||
```
|
||||
|
||||
| Argument | Type | Description |
|
||||
| -------- | -------- | ---------------------------------------------------- |
|
||||
| callback | Function | Callback will be called when a snapshot is restored. |
|
||||
|
||||
### onSnapshotCreate
|
||||
|
||||
Register a listener that will be called before a snapshot is taken, this makes it possible to add variable to the storage before the snapshot happens.
|
||||
|
||||
```javascript
|
||||
api.onSnapshotCreate(callback);
|
||||
```
|
||||
|
||||
| Argument | Type | Description |
|
||||
| -------- | -------- | ------------------------------------------------------- |
|
||||
| callback | Function | Callback will be called before the snapshot is created. |
|
||||
|
||||
### getRuntimeStorage
|
||||
|
||||
Get the variable storage object.
|
||||
|
||||
```javascript
|
||||
api.getRuntimeStorage();
|
||||
```
|
||||
|
||||
**Returns** [RuntimeStorage](./ModuleApiGameLibRuntimeStorage) _The runtime storage object._
|
||||
|
||||
## Playback
|
||||
|
||||
### onPlayStateChange **(TODO)**
|
||||
### onAudioAllowed
|
||||
|
||||
### onVolumeChange **(TODO)**
|
||||
Adds a listener for when audable audio playback is allowed.
|
||||
|
||||
### onAudioAllowed **(TODO)**
|
||||
```javascript
|
||||
api.onVolumeChange(callback);
|
||||
```
|
||||
|
||||
### getVolume **(TODO)**
|
||||
| Argument | Type | Description |
|
||||
| -------- | -------- | --------------------------------------------------------------- |
|
||||
| callback | Function | Callback will be called when audable audio playback is allowed. |
|
||||
|
||||
### getPlayState **(TODO)**
|
||||
### onVolumeChange
|
||||
|
||||
Adds a listener for volume change. Volume is a number between 0 and 1.
|
||||
|
||||
```javascript
|
||||
api.onVolumeChange(callback);
|
||||
```
|
||||
|
||||
| Argument | Type | Description |
|
||||
| -------- | --------------------- | ----------------------------------------------------------------- |
|
||||
| callback | ( value:number ):void | Callback with the new volume. Volume is a number between 0 and 1. |
|
||||
|
||||
### getVolume
|
||||
|
||||
Get the current volume of the renderer.
|
||||
|
||||
```javascript
|
||||
api.getVolume();
|
||||
```
|
||||
|
||||
**Returns** number _Volume (between 0 and 1)._
|
||||
|
||||
### onPlayStateChange
|
||||
|
||||
Adds a listener for the play state change.
|
||||
|
||||
```javascript
|
||||
api.onPlayStateChange(callback);
|
||||
```
|
||||
|
||||
| Argument | Type | Description |
|
||||
| -------- | ------------------------------------------------ | ---------------------------------------- |
|
||||
| callback | ( state: 'playing' / 'paused' / 'loading' ):void | Callback for the play state has changed. |
|
||||
|
||||
### getPlayState
|
||||
|
||||
Get the current play state of the renderer.
|
||||
|
||||
```javascript
|
||||
api.getPlayState();
|
||||
```
|
||||
|
||||
**Returns** 'playing' | 'paused' | 'loading' _Current play state._
|
||||
|
||||
## Neighbors
|
||||
|
||||
### getNeighbors **(TODO)**
|
||||
|
||||
### onNeighborMessage **(TODO)**
|
||||
### onNeighborMessage
|
||||
|
||||
Register a listener for incoming neighbor messages.
|
||||
|
||||
```javascript
|
||||
api.onNeighborMessage(header, callback);
|
||||
```
|
||||
|
||||
| Argument | Type | Description |
|
||||
| -------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
||||
| header | string | The header to listen for. |
|
||||
| callback | ( neighbor:[Neighbor](./ModuleClientAPINeighbor.md), ...args ):void | Callback for when a packet is received. Args is the data in the same order as when it was send. |
|
||||
|
||||
## Utils
|
||||
|
||||
|
||||
3
ModuleClientAPINeighbor.md
Normal file
3
ModuleClientAPINeighbor.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# ModuleClientApi - User
|
||||
|
||||
Class representing a Neighbor of the ModuleClientAPI User.
|
||||
@@ -15,6 +15,7 @@
|
||||
- [ModuleClientAPI](./ModuleClientAPI)
|
||||
- [Important Principals](./ModuleClientAPIPrincipals)
|
||||
- [User](./ModuleClientAPIUser)
|
||||
- [Neighbor](./ModuleClientAPINeighbor)
|
||||
- [GameLib](./ModuleClientAPIGameLib)
|
||||
- [Controller](./ModuleClientAPIGameLibController)
|
||||
- [ModuleServerAPI](./ModuleServerAPI)
|
||||
|
||||
Reference in New Issue
Block a user