Drag[en]gine Script Module DragonScript  1.23
Dragengine.Services.BaseGameServices Class Reference

Base class managing basic game services. More...

Inheritance diagram for Dragengine.Services.BaseGameServices:

Public Member Functions

void addInitializeService ()
 Increment initialize service count by 1. More...
 
void addModsService (ServiceMods service)
 Add modification service. More...
 
void addStatsService (ServiceStats service)
 Add stats service. More...
 
void addUserService (ServiceUser service)
 Add user service. More...
 
void autoInitMsgdk ()
 Automatically initialize Microsoft GDK if supported. More...
 
void autoInitServices ()
 Automatically initialize supported services. More...
 
void autoInitSteam ()
 Automatically initialize steam if supported. More...
 
void closeEos ()
 Close and dispose Eos service. More...
 
void closeModio ()
 Close and dispose Mod.io service. More...
 
void closeMsgdk ()
 Close and dispose Microsoft GDK service. More...
 
void closeSteam ()
 Close and dispose Steam service. More...
 
Array collectModsService (Block ablock)
 Collect modification services using block. More...
 
Array collectStatsService (Block ablock)
 Collect stats services using block. More...
 
Array collectUserService (Block ablock)
 Collect user services using block. More...
 
void dispose ()
 Dispose of base game services. More...
 
ServiceMods findModsService (Block ablock)
 Find modification services with block. More...
 
ServiceStats findStatsService (Block ablock)
 Find stats services with block. More...
 
ServiceUser findUserService (Block ablock)
 Find user services with block. More...
 
void forEachModsService (Block ablock)
 Visit modification services with block. More...
 
void forEachStatsService (Block ablock)
 Visit stats services with block. More...
 
void forEachUserService (Block ablock)
 Visit user services with block. More...
 
Array getAllModsServices ()
 All modification services as Array of ServiceMods. More...
 
Array getAllStatsServices ()
 All stats services as Array of ServiceStats. More...
 
Array getAllUserServices ()
 All user services as Array of ServiceUser. More...
 
ServiceEos getEos ()
 
int getInitializeServiceCount ()
 Count of services in progress of being initialized. More...
 
ServiceModio getModio ()
 
int getModsServiceCount ()
 Count of initialized modification services. More...
 
ServiceMsgdk getMsgdk ()
 Microsoft GDK service or null. More...
 
ServiceSteam getSteam ()
 Steam service or null. More...
 
Array getSupportedAuthProviders (Set ids)
 Find ServiceUser supported by another service for authentification. More...
 
int getUserServiceCount ()
 Count of initialized user services. More...
 
void initEos (ServiceEos.InitParameters params, ServiceInitListener listener)
 Initialize EOS service. More...
 
void initEos (ServiceInitListener listener)
 Initialize EOS service using parameters from configuration parameter tree. More...
 
void initModio (ServiceInitListener listener)
 Initialize Mod.io service using parameters from configuration parameter tree. More...
 
void initModio (ServiceModio.InitParameters params, ServiceInitListener listener)
 Initialize Mod.io service. More...
 
void initMsgdk ()
 Initialize Microsoft GDK service using parameters from configuration parameter tree. More...
 
void initMsgdk (ServiceMsgdk.InitParameters params)
 Initialize Microsoft GDK service. More...
 
void initSteam ()
 Initialize Steam service using parameters from configuration parameter tree. More...
 
void initSteam (ServiceSteam.InitParameters params)
 Initialize Steam service. More...
 
BaseGameServices new ()
 Create base game services instance using BaseGameApp.getApp(). More...
 
BaseGameServices new (ParameterTree configuration, Console console)
 Create base game services instance. More...
 
void removeInitializeService ()
 Decrement initialize service count by 1. More...
 
void removeModsService (ServiceMods service)
 Remove modification service if present. More...
 
void removeStatsService (ServiceStats service)
 Remove stats service if present. More...
 
void removeUserService (ServiceUser service)
 Remove user service if present. More...
 
void setActionInitialized (ActionListener listener)
 Set action to be called if all services finished initialization. More...
 

Public Attributes

ActionListener pActionInitialized
 
ParameterTree pConfiguration
 
Console pConsole
 
ServiceEos pEos
 
int pInitializeCount
 
ServiceModio pModio
 
ServiceMsgdk pMsgdk
 
ServiceSteam pSteam
 
Array pUser
 

Detailed Description

Base class managing basic game services.

Version
1.23

Stores list of basic game services. User can request instances of supported services to be created. The user can either request them individually or all automatically. Supports services of implementing these interfaces:

  • ServiceUser: Authenticate user and managing user account
  • ServiceStats: Manage user statistics and achievements
  • ServiceMods: Manage game modifications

See the documentation of the respective service create function for the parameters required to successfully start the service. The information is stored in the game configuration parameter tree. Supports being used by BaseGameApp and other base classes as long as the required object instances can be provided on construction time.

The user can set an action listener using setActionInitialized() to be notified once all services have finished initialize. If all services are already initialized the provided action is immediately run.

Make sue to call dispose() upon closing the game to properly clean up all service resources.

Member Function Documentation

◆ addInitializeService()

void Dragengine.Services.BaseGameServices.addInitializeService ( )

Increment initialize service count by 1.

◆ addModsService()

void Dragengine.Services.BaseGameServices.addModsService ( ServiceMods  service)

Add modification service.

◆ addStatsService()

void Dragengine.Services.BaseGameServices.addStatsService ( ServiceStats  service)

Add stats service.

◆ addUserService()

void Dragengine.Services.BaseGameServices.addUserService ( ServiceUser  service)

Add user service.

◆ autoInitMsgdk()

void Dragengine.Services.BaseGameServices.autoInitMsgdk ( )

Automatically initialize Microsoft GDK if supported.

Initializes Microsoft GDK if all of the following conditions are fulfilled:

  • Microsoft GDK service module is present and running
  • Has configuration parameters:
    • msgdk.pathGameConfig

Failure to initialize is only logged and does not throw an exception.

◆ autoInitServices()

void Dragengine.Services.BaseGameServices.autoInitServices ( )

Automatically initialize supported services.

Uses presence of configuration options and command line parameters to initialize all supported services.

Some service are asynchronously initialized and will be only available in the type specific lists once successfully initialized. Use getInitializeServiceCount() to know if there are still service initializing. Once all services finished initializing it is safe to examine which services are actually usable.

Failure to initialize services is only logged and does not throw exceptions.

The following services are supported:

Mod.io (ServiceModio)

Requires configuration parameters:

  • modio.gameid
  • modio.appkey

The user can set an action listener using setActionInitialized() to be notified once all services have finished initialize. If all services are already initialized the provided action is immediately run.

◆ autoInitSteam()

void Dragengine.Services.BaseGameServices.autoInitSteam ( )

Automatically initialize steam if supported.

Initializes Steam if all of the following conditions are fulfilled:

  • Steam service module is present and running
  • Steam is running
  • Has configuration parameters:
    • steam.appid

Failure to initialize is only logged and does not throw an exception.

◆ closeEos()

void Dragengine.Services.BaseGameServices.closeEos ( )

Close and dispose Eos service.

Does nothing if service is not initialized.

◆ closeModio()

void Dragengine.Services.BaseGameServices.closeModio ( )

Close and dispose Mod.io service.

Does nothing if service is not initialized.

◆ closeMsgdk()

void Dragengine.Services.BaseGameServices.closeMsgdk ( )

Close and dispose Microsoft GDK service.

Does nothing if service is not initialized.

◆ closeSteam()

void Dragengine.Services.BaseGameServices.closeSteam ( )

Close and dispose Steam service.

Does nothing if service is not initialized.

◆ collectModsService()

Array Dragengine.Services.BaseGameServices.collectModsService ( Block  ablock)

Collect modification services using block.

Block receives as parameter ServiceMods and has to return true to include the service in the returned list or false to not include.

◆ collectStatsService()

Array Dragengine.Services.BaseGameServices.collectStatsService ( Block  ablock)

Collect stats services using block.

Block receives as parameter ServiceStats and has to return true to include the service in the returned list or false to not include.

◆ collectUserService()

Array Dragengine.Services.BaseGameServices.collectUserService ( Block  ablock)

Collect user services using block.

Block receives as parameter ServiceUser and has to return true to include the service in the returned list or false to not include.

◆ dispose()

void Dragengine.Services.BaseGameServices.dispose ( )

Dispose of base game services.

◆ findModsService()

ServiceMods Dragengine.Services.BaseGameServices.findModsService ( Block  ablock)

Find modification services with block.

Block receives as parameter ServiceMods and has to return true if found or false otherwise.

◆ findStatsService()

ServiceStats Dragengine.Services.BaseGameServices.findStatsService ( Block  ablock)

Find stats services with block.

Block receives as parameter ServiceStats and has to return true if found or false otherwise.

◆ findUserService()

ServiceUser Dragengine.Services.BaseGameServices.findUserService ( Block  ablock)

Find user services with block.

Block receives as parameter ServiceUser and has to return true if found or false otherwise.

◆ forEachModsService()

void Dragengine.Services.BaseGameServices.forEachModsService ( Block  ablock)

Visit modification services with block.

Block receives as parameter ServiceMods.

◆ forEachStatsService()

void Dragengine.Services.BaseGameServices.forEachStatsService ( Block  ablock)

Visit stats services with block.

Block receives as parameter ServiceStats.

◆ forEachUserService()

void Dragengine.Services.BaseGameServices.forEachUserService ( Block  ablock)

Visit user services with block.

Block receives as parameter ServiceUser.

◆ getAllModsServices()

Array Dragengine.Services.BaseGameServices.getAllModsServices ( )

All modification services as Array of ServiceMods.

◆ getAllStatsServices()

Array Dragengine.Services.BaseGameServices.getAllStatsServices ( )

All stats services as Array of ServiceStats.

◆ getAllUserServices()

Array Dragengine.Services.BaseGameServices.getAllUserServices ( )

All user services as Array of ServiceUser.

◆ getEos()

ServiceEos Dragengine.Services.BaseGameServices.getEos ( )

EOS service or null.

◆ getInitializeServiceCount()

int Dragengine.Services.BaseGameServices.getInitializeServiceCount ( )

Count of services in progress of being initialized.

◆ getModio()

ServiceModio Dragengine.Services.BaseGameServices.getModio ( )

Mod.io service or null.

◆ getModsServiceCount()

int Dragengine.Services.BaseGameServices.getModsServiceCount ( )

Count of initialized modification services.

◆ getMsgdk()

ServiceMsgdk Dragengine.Services.BaseGameServices.getMsgdk ( )

Microsoft GDK service or null.

◆ getSteam()

ServiceSteam Dragengine.Services.BaseGameServices.getSteam ( )

Steam service or null.

◆ getSupportedAuthProviders()

Array Dragengine.Services.BaseGameServices.getSupportedAuthProviders ( Set  ids)

Find ServiceUser supported by another service for authentification.

Returns Array of ServiceUser.

Parameters
idsSet of String authentication provider identifiers. Get this set from feature instances obtained from the respective service.

◆ getUserServiceCount()

int Dragengine.Services.BaseGameServices.getUserServiceCount ( )

Count of initialized user services.

◆ initEos() [1/2]

void Dragengine.Services.BaseGameServices.initEos ( ServiceEos.InitParameters  params,
ServiceInitListener  listener 
)

Initialize EOS service.

Once initialized successfully the service will be added to following type specific service lists:

Parameters
paramsInitialization parameters.
listenerListener to call if initialization finished or null.
Exceptions
EInvalidParamOne or more parameter is invalid.
EInvalidActionEOS is already initialized.

◆ initEos() [2/2]

void Dragengine.Services.BaseGameServices.initEos ( ServiceInitListener  listener)

Initialize EOS service using parameters from configuration parameter tree.

Requires these configuration parameters to be present:

  • eos.productName: String value containing product name.
  • eos.productVersion: String value containing product version.
  • eos.productId: String value containing product identifier.
  • eos.sandboxId: String value containing sandbox identifier.
  • eos.deploymentId: String value containing deployment identifier.

Optional configuration paramenets:

  • eos.clientId: String value containing client identifier.
  • eos.clientSecret: String value containing client secret.

Once initialized successfully the service will be added to following type specific service lists:

Parameters
listenerListener to call if initialization finished or null.
Exceptions
EInvalidParamOne or more required configuration parameter is missing.
EInvalidActionEOS is already initialized.

◆ initModio() [1/2]

void Dragengine.Services.BaseGameServices.initModio ( ServiceInitListener  listener)

Initialize Mod.io service using parameters from configuration parameter tree.

Requires these configuration parameters to be present:

  • modio.gameid: String value containing Mod.io gameid.
  • modio.appkey: String value containing Mod.io appkey.

Optional configuration parameters:

  • modio.user: String value containing local user name to use. Default "user"

Portal is chosen depending on the initialized user services.

Once initialized successfully the service will be added to following type specific service lists:

Parameters
listenerListener to call if initialization finished or null.
Exceptions
EInvalidParamOne or more required configuration parameter is missing.
EInvalidActionMod.io is already initialized.

◆ initModio() [2/2]

void Dragengine.Services.BaseGameServices.initModio ( ServiceModio.InitParameters  params,
ServiceInitListener  listener 
)

Initialize Mod.io service.

Once initialized successfully the service will be added to following type specific service lists:

Parameters
paramsInitialization parameters
listenerListener to call if initialization finished or null.
Exceptions
EInvalidParamOne or more parameter is invalid.
EInvalidActionMod.io is already initialized.

◆ initMsgdk() [1/2]

void Dragengine.Services.BaseGameServices.initMsgdk ( )

Initialize Microsoft GDK service using parameters from configuration parameter tree.

Requires these configuration parameters to be present:

  • msgdk.pathGameConfig: String value containing path to Microsoft game config.

Service will be added to the following type specific service lists:

Exceptions
EInvalidParamOne or more required configuration parameter is missing.
EInvalidActionMicrosoft GDK is already initialized.

◆ initMsgdk() [2/2]

void Dragengine.Services.BaseGameServices.initMsgdk ( ServiceMsgdk.InitParameters  params)

Initialize Microsoft GDK service.

Service will be added to the following type specific service lists:

Exceptions
EInvalidParamOne or more parameter is invalid.
EInvalidActionMicrosoft GDK is already initialized.

◆ initSteam() [1/2]

void Dragengine.Services.BaseGameServices.initSteam ( )

Initialize Steam service using parameters from configuration parameter tree.

Requires these configuration parameters to be present:

  • steam.appid: String value containing Steam appid.

Service will be added to the following type specific service lists:

Exceptions
EInvalidParamOne or more required configuration parameter is missing.
EInvalidActionSteam is already initialized.

◆ initSteam() [2/2]

void Dragengine.Services.BaseGameServices.initSteam ( ServiceSteam.InitParameters  params)

Initialize Steam service.

Service will be added to the following type specific service lists:

Exceptions
EInvalidParamOne or more parameter is invalid.
EInvalidActionSteam is already initialized.

◆ new() [1/2]

BaseGameServices Dragengine.Services.BaseGameServices.new ( )

Create base game services instance using BaseGameApp.getApp().

◆ new() [2/2]

BaseGameServices Dragengine.Services.BaseGameServices.new ( ParameterTree  configuration,
Console  console 
)

Create base game services instance.

◆ removeInitializeService()

void Dragengine.Services.BaseGameServices.removeInitializeService ( )

Decrement initialize service count by 1.

◆ removeModsService()

void Dragengine.Services.BaseGameServices.removeModsService ( ServiceMods  service)

Remove modification service if present.

◆ removeStatsService()

void Dragengine.Services.BaseGameServices.removeStatsService ( ServiceStats  service)

Remove stats service if present.

◆ removeUserService()

void Dragengine.Services.BaseGameServices.removeUserService ( ServiceUser  service)

Remove user service if present.

◆ setActionInitialized()

void Dragengine.Services.BaseGameServices.setActionInitialized ( ActionListener  listener)

Set action to be called if all services finished initialization.

If all services are already initialized the provided action is immediately run. Listener can be null in which case the listener is cleared.

Member Data Documentation

◆ pActionInitialized

ActionListener Dragengine.Services.BaseGameServices.pActionInitialized

◆ pConfiguration

ParameterTree Dragengine.Services.BaseGameServices.pConfiguration

◆ pConsole

Console Dragengine.Services.BaseGameServices.pConsole

◆ pEos

ServiceEos Dragengine.Services.BaseGameServices.pEos

◆ pInitializeCount

int Dragengine.Services.BaseGameServices.pInitializeCount

◆ pModio

ServiceModio Dragengine.Services.BaseGameServices.pModio

◆ pMsgdk

ServiceMsgdk Dragengine.Services.BaseGameServices.pMsgdk

◆ pSteam

ServiceSteam Dragengine.Services.BaseGameServices.pSteam

◆ pUser

Array Dragengine.Services.BaseGameServices.pUser

The documentation for this class was generated from the following file: