Package com.csse3200.game.services
Class ServiceLocator
java.lang.Object
com.csse3200.game.services.ServiceLocator
A simplified implementation of the Service Locator pattern:
https://martinfowler.com/articles/injection.html#UsingAServiceLocator
Allows global access to a few core game services. Warning: global access is a trap and should be used extremely sparingly. Read the wiki for details (https://github.com/UQcsse3200/game-engine/wiki/Service-Locator).
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
clear()
Clears all transient services.static void
Deregisters the config service.static void
Deregisters the dialog service.static void
Deregisters the global resource service.static void
Deregisters the profile service.static void
Deregisters the world map service.static ConfigService
Gets the config service.static CurrencyService
Gets the currency service.static CutsceneService
Gets the cutscene service.static DialogService
Gets the dialog service.static EntityService
Gets the entity service.static ResourceService
Gets the global resource service.static InputService
Gets the input service.static ItemEffectsService
Gets the item effects service.static PhysicsService
Gets the physics service.static ProfileService
Gets the profile service.static RenderService
Gets the render service.static ResourceService
Gets the resource service.static GameTime
Gets the time source.static WorldMapService
Gets the world map service.static void
registerConfigService
(ConfigService source) Registers the config service.static void
Registers the currency service.static void
Registers cutscene servicestatic void
registerDialogService
(DialogService source) Registers the dialog service.static void
registerEntityService
(EntityService service) Registers the entity service.static void
Registers the global resource service.static void
registerInputService
(InputService source) Registers the input service.static void
Registers the item effects service.static void
registerPhysicsService
(PhysicsService service) Registers the physics service.static void
registerProfileService
(ProfileService source) Registers the profile service.static void
registerRenderService
(RenderService service) Registers the render service.static void
Registers the resource service.static void
registerTimeSource
(GameTime source) Registers the time source.static void
Registers the world map service.
-
Method Details
-
getEntityService
Gets the entity service.- Returns:
- the entity service
-
getRenderService
Gets the render service.- Returns:
- the render service
-
getPhysicsService
Gets the physics service.- Returns:
- the physics service
-
getTimeSource
Gets the time source.- Returns:
- the time source
-
getInputService
Gets the input service.- Returns:
- the input service
-
getResourceService
Gets the resource service.- Returns:
- the resource service
-
getCurrencyService
Gets the currency service.- Returns:
- the currency service
-
getConfigService
Gets the config service.- Returns:
- the config service
-
getDialogService
Gets the dialog service.- Returns:
- the dialog service
-
getGlobalResourceService
Gets the global resource service.- Returns:
- the global resource service
-
getProfileService
Gets the profile service.- Returns:
- the profile service
-
getItemEffectsService
Gets the item effects service.- Returns:
- the item effects service
-
getCutsceneService
Gets the cutscene service.- Returns:
- the cutscene service
-
getWorldMapService
Gets the world map service.- Returns:
- the world map service
-
registerEntityService
Registers the entity service.- Parameters:
service
- the entity service
-
registerRenderService
Registers the render service.- Parameters:
service
- the render service
-
registerPhysicsService
Registers the physics service.- Parameters:
service
- the physics service
-
registerTimeSource
Registers the time source.- Parameters:
source
- the time source
-
registerInputService
Registers the input service.- Parameters:
source
- the input service
-
registerResourceService
Registers the resource service.- Parameters:
source
- the resource service
-
registerGlobalResourceService
Registers the global resource service.- Parameters:
source
- the global resource service
-
deregisterGlobalResourceService
public static void deregisterGlobalResourceService()Deregisters the global resource service. -
registerCurrencyService
Registers the currency service.- Parameters:
source
- the currency service
-
registerConfigService
Registers the config service.- Parameters:
source
- the config service
-
deregisterConfigService
public static void deregisterConfigService()Deregisters the config service. -
registerDialogService
Registers the dialog service.- Parameters:
source
- the dialog service
-
registerItemEffectsService
Registers the item effects service.- Parameters:
source
- the item effects service
-
deregisterDialogService
public static void deregisterDialogService()Deregisters the dialog service. -
registerProfileService
Registers the profile service.- Parameters:
source
- the profile service
-
deregisterProfileService
public static void deregisterProfileService()Deregisters the profile service. -
registerCutsceneService
Registers cutscene service -
registerWorldMapService
Registers the world map service.- Parameters:
source
- the world map service
-
deregisterWorldMapService
public static void deregisterWorldMapService()Deregisters the world map service. -
clear
public static void clear()Clears all transient services.
-