Class ServiceLocator

java.lang.Object
com.csse3200.game.services.ServiceLocator

public class ServiceLocator extends Object
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 Details

    • getEntityService

      public static EntityService getEntityService()
      Gets the entity service.
      Returns:
      the entity service
    • getRenderService

      public static RenderService getRenderService()
      Gets the render service.
      Returns:
      the render service
    • getPhysicsService

      public static PhysicsService getPhysicsService()
      Gets the physics service.
      Returns:
      the physics service
    • getTimeSource

      public static GameTime getTimeSource()
      Gets the time source.
      Returns:
      the time source
    • getInputService

      public static InputService getInputService()
      Gets the input service.
      Returns:
      the input service
    • getResourceService

      public static ResourceService getResourceService()
      Gets the resource service.
      Returns:
      the resource service
    • getCurrencyService

      public static CurrencyService getCurrencyService()
      Gets the currency service.
      Returns:
      the currency service
    • getConfigService

      public static ConfigService getConfigService()
      Gets the config service.
      Returns:
      the config service
    • getDialogService

      public static DialogService getDialogService()
      Gets the dialog service.
      Returns:
      the dialog service
    • getGlobalResourceService

      public static ResourceService getGlobalResourceService()
      Gets the global resource service.
      Returns:
      the global resource service
    • getProfileService

      public static ProfileService getProfileService()
      Gets the profile service.
      Returns:
      the profile service
    • getItemEffectsService

      public static ItemEffectsService getItemEffectsService()
      Gets the item effects service.
      Returns:
      the item effects service
    • getCutsceneService

      public static CutsceneService getCutsceneService()
      Gets the cutscene service.
      Returns:
      the cutscene service
    • getWorldMapService

      public static WorldMapService getWorldMapService()
      Gets the world map service.
      Returns:
      the world map service
    • registerEntityService

      public static void registerEntityService(EntityService service)
      Registers the entity service.
      Parameters:
      service - the entity service
    • registerRenderService

      public static void registerRenderService(RenderService service)
      Registers the render service.
      Parameters:
      service - the render service
    • registerPhysicsService

      public static void registerPhysicsService(PhysicsService service)
      Registers the physics service.
      Parameters:
      service - the physics service
    • registerTimeSource

      public static void registerTimeSource(GameTime source)
      Registers the time source.
      Parameters:
      source - the time source
    • registerInputService

      public static void registerInputService(InputService source)
      Registers the input service.
      Parameters:
      source - the input service
    • registerResourceService

      public static void registerResourceService(ResourceService source)
      Registers the resource service.
      Parameters:
      source - the resource service
    • registerGlobalResourceService

      public static void registerGlobalResourceService(ResourceService source)
      Registers the global resource service.
      Parameters:
      source - the global resource service
    • deregisterGlobalResourceService

      public static void deregisterGlobalResourceService()
      Deregisters the global resource service.
    • registerCurrencyService

      public static void registerCurrencyService(CurrencyService source)
      Registers the currency service.
      Parameters:
      source - the currency service
    • registerConfigService

      public static void registerConfigService(ConfigService source)
      Registers the config service.
      Parameters:
      source - the config service
    • deregisterConfigService

      public static void deregisterConfigService()
      Deregisters the config service.
    • registerDialogService

      public static void registerDialogService(DialogService source)
      Registers the dialog service.
      Parameters:
      source - the dialog service
    • registerItemEffectsService

      public static void registerItemEffectsService(ItemEffectsService source)
      Registers the item effects service.
      Parameters:
      source - the item effects service
    • deregisterDialogService

      public static void deregisterDialogService()
      Deregisters the dialog service.
    • registerProfileService

      public static void registerProfileService(ProfileService source)
      Registers the profile service.
      Parameters:
      source - the profile service
    • deregisterProfileService

      public static void deregisterProfileService()
      Deregisters the profile service.
    • registerCutsceneService

      public static void registerCutsceneService(CutsceneService source)
      Registers cutscene service
    • registerWorldMapService

      public static void registerWorldMapService(WorldMapService source)
      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.