Drag[en]gine Script Module DragonScript
1.23
|
Public Member Functions | |
Constructors | |
Service | new (String name) |
Create named service. More... | |
Service | new (String name, ServiceObject data) |
Create named service with additional creation data. More... | |
Management | |
String | getName () |
Service name. More... | |
ServiceListener | getListener () |
Get listener or null. More... | |
void | setListener (ServiceListener listener) |
Set listener or null. More... | |
void | startRequest (ServiceObject request) |
Start service request. More... | |
void | startRequest (UniqueID id, ServiceObject request) |
Start service request. More... | |
void | cancelRequest (UniqueID id) |
Cancel service request if running. More... | |
ServiceObject | runAction (ServiceObject action) |
Run action returning result immediately. More... | |
static UniqueID | nextId () |
Next request identifier. More... | |
Services provide various platform or community functionality not handled by other modules. Such services are typically queried infrequently and take a certain time time complete. For this reason service request are asynchronous. Data is carried in a generic deServiceObject object. Users have to know the interface of the service. There is no support to query interface structure unless a service desires to provide these using a special service query.
Each service has a unique name across the entire game engine instance. If the name of services of different service modules collide it is undefined which service the user receives.
This is a native class.
void Dragengine.Service.cancelRequest | ( | UniqueID | id | ) |
Cancel service request if running.
id | Identifier of request to cancel. |
ServiceListener Dragengine.Service.getListener | ( | ) |
Get listener or null.
String Dragengine.Service.getName | ( | ) |
Service name.
Service Dragengine.Service.new | ( | String | name | ) |
Create named service.
EInvalidParam | Named service not supported by any loaded service module. |
name | Unique name of service to create. |
Service Dragengine.Service.new | ( | String | name, |
ServiceObject | data | ||
) |
Create named service with additional creation data.
EInvalidParam | Named service not supported by any loaded service module. |
name | Unique name of service to create. |
data | Additional data required for creating service. |
|
static |
Next request identifier.
Call this method to obtain the next global request identifier to use for calling startRequest(UniqueID,ServiceObject). The returned identifier is unique across all services for until the application is shut down.
ServiceObject Dragengine.Service.runAction | ( | ServiceObject | action | ) |
Run action returning result immediately.
Can return nullptr if action has no return value.
void Dragengine.Service.setListener | ( | ServiceListener | listener | ) |
Set listener or null.
void Dragengine.Service.startRequest | ( | ServiceObject | request | ) |
Start service request.
Assigned service listener will be called with the received answer. Depending on the service one or more responses can be received. Use this call if you are only interested in the response not which request it belongs to and if you do not need to cancel the request later on.
request | Request to send. Content depends on service and function to invoke. |
void Dragengine.Service.startRequest | ( | UniqueID | id, |
ServiceObject | request | ||
) |
Start service request.
Assigned service listener will be called with the received answer. Depending on the service one or more responses can be received. Call nextId() to obtain the next unique identifier to use for the request. This allows to identify which response has been triggered by which request by matching the identifier in the response against the identifier used in the request. Using this call is required if you have the need to potentially cancel the request.
id | Identifier to use to match responses. |
request | Request to send. Content depends on service and function to invoke. |