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

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.

Referenced by initEos().

◆ addModsService()

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

Add modification service.

Referenced by initSteam().

◆ addStatsService()

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

Add stats service.

Referenced by findModsService().

◆ addUserService()

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

Add user service.

Referenced by findUserService().

◆ 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.

References pConsole, and pSteam.

Referenced by setActionInitialized().

◆ 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.

References initEos(), and pConfiguration.

Referenced by setActionInitialized().

◆ 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.

Referenced by getModio(), and setActionInitialized().

◆ closeEos()

void Dragengine.Services.BaseGameServices.closeEos ( )

Close and dispose Eos service.

Does nothing if service is not initialized.

References pInitializeCount, and removeInitializeService().

Referenced by removeUserService(), and setActionInitialized().

◆ closeModio()

void Dragengine.Services.BaseGameServices.closeModio ( )

Close and dispose Mod.io service.

Does nothing if service is not initialized.

References getEos(), initEos(), pConfiguration, and pEos.

Referenced by removeUserService(), and setActionInitialized().

◆ closeMsgdk()

void Dragengine.Services.BaseGameServices.closeMsgdk ( )

Close and dispose Microsoft GDK service.

Does nothing if service is not initialized.

References pConsole, pSteam, and pUser.

Referenced by removeUserService(), and setActionInitialized().

◆ closeSteam()

void Dragengine.Services.BaseGameServices.closeSteam ( )

Close and dispose Steam service.

Does nothing if service is not initialized.

References removeModsService().

Referenced by getModio(), initModio(), and removeUserService().

◆ 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.

Referenced by initEos().

◆ 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.

Referenced by initSteam().

◆ 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.

References pUser.

Referenced by findStatsService().

◆ dispose()

void Dragengine.Services.BaseGameServices.dispose ( )

Dispose of base game services.

References pConfiguration, pConsole, and pUser.

Referenced by removeUserService().

◆ 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.

References addStatsService().

Referenced by getEos().

◆ 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.

References collectUserService(), and pUser.

Referenced by getSteam().

◆ 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.

References addUserService(), getUserServiceCount(), and pUser.

Referenced by forEachStatsService().

◆ forEachModsService()

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

Visit modification services with block.

Block receives as parameter ServiceMods.

Referenced by getEos().

◆ forEachStatsService()

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

Visit stats services with block.

Block receives as parameter ServiceStats.

References findUserService(), and pUser.

Referenced by removeInitializeService().

◆ forEachUserService()

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

Visit user services with block.

Block receives as parameter ServiceUser.

References pActionInitialized, and pUser.

Referenced by removeStatsService().

◆ getAllModsServices()

Array Dragengine.Services.BaseGameServices.getAllModsServices ( )

All modification services as Array of ServiceMods.

References removeStatsService().

Referenced by initEos().

◆ getAllStatsServices()

Array Dragengine.Services.BaseGameServices.getAllStatsServices ( )

All stats services as Array of ServiceStats.

References getAllUserServices(), and pUser.

Referenced by initSteam().

◆ getAllUserServices()

Array Dragengine.Services.BaseGameServices.getAllUserServices ( )

All user services as Array of ServiceUser.

References pUser, and removeUserService().

Referenced by getAllStatsServices().

◆ getEos()

ServiceEos Dragengine.Services.BaseGameServices.getEos ( )

EOS service or null.

References findModsService(), and forEachModsService().

Referenced by closeModio().

◆ getInitializeServiceCount()

int Dragengine.Services.BaseGameServices.getInitializeServiceCount ( )

Count of services in progress of being initialized.

Referenced by initEos().

◆ getModio()

ServiceModio Dragengine.Services.BaseGameServices.getModio ( )

Mod.io service or null.

References autoInitSteam(), closeSteam(), initSteam(), pConfiguration, and pConsole.

Referenced by setActionInitialized().

◆ getModsServiceCount()

int Dragengine.Services.BaseGameServices.getModsServiceCount ( )

Count of initialized modification services.

Referenced by initSteam().

◆ getMsgdk()

ServiceMsgdk Dragengine.Services.BaseGameServices.getMsgdk ( )

Microsoft GDK service or null.

References getSteam(), and pSteam.

Referenced by setActionInitialized().

◆ getSteam()

ServiceSteam Dragengine.Services.BaseGameServices.getSteam ( )

Steam service or null.

References findStatsService().

Referenced by getMsgdk().

◆ 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.

Referenced by removeModsService().

◆ getUserServiceCount()

int Dragengine.Services.BaseGameServices.getUserServiceCount ( )

Count of initialized user services.

Referenced by findUserService().

◆ 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.

References addInitializeService(), and pInitializeCount.

◆ 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.

References collectModsService(), getAllModsServices(), getInitializeServiceCount(), and pInitializeCount.

Referenced by autoInitServices(), closeModio(), and setActionInitialized().

◆ 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.

References closeSteam(), pSteam, and pUser.

Referenced by setActionInitialized().

◆ 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.

References pSteam.

◆ 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.

References initSteam(), and pConfiguration.

Referenced by setActionInitialized().

◆ 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.

References initSteam().

◆ 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.

References collectStatsService(), and getAllStatsServices().

Referenced by getModio(), initMsgdk(), and initMsgdk().

◆ 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.

References addModsService(), and getModsServiceCount().

◆ new() [1/2]

BaseGameServices Dragengine.Services.BaseGameServices.new ( )

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

References new().

Referenced by new(), and new().

◆ new() [2/2]

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

Create base game services instance.

References new().

◆ removeInitializeService()

void Dragengine.Services.BaseGameServices.removeInitializeService ( )

Decrement initialize service count by 1.

References forEachStatsService().

Referenced by closeEos().

◆ removeModsService()

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

Remove modification service if present.

References getSupportedAuthProviders(), and pUser.

Referenced by closeSteam().

◆ removeStatsService()

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

Remove stats service if present.

References forEachUserService(), and pUser.

Referenced by getAllModsServices().

◆ removeUserService()

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

Remove user service if present.

References closeEos(), closeModio(), closeMsgdk(), closeSteam(), and dispose().

Referenced by getAllUserServices().

◆ 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.

References autoInitMsgdk(), autoInitServices(), autoInitSteam(), closeEos(), closeModio(), closeMsgdk(), getModio(), getMsgdk(), initEos(), initModio(), initMsgdk(), pActionInitialized, pConfiguration, pConsole, pEos, pInitializeCount, pModio, pMsgdk, pSteam, pUser, and setActionInitialized().

Referenced by setActionInitialized().

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

Referenced by closeModio(), and setActionInitialized().

◆ pInitializeCount

int Dragengine.Services.BaseGameServices.pInitializeCount

◆ pModio

ServiceModio Dragengine.Services.BaseGameServices.pModio

Referenced by setActionInitialized().

◆ pMsgdk

ServiceMsgdk Dragengine.Services.BaseGameServices.pMsgdk

Referenced by setActionInitialized().

◆ pSteam

ServiceSteam Dragengine.Services.BaseGameServices.pSteam

◆ pUser


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