Class UnityGameModeService
Unity MonoBehaviour implementation of IGameModeService.
Inheritance
UnityGameModeService
Assembly: Serenity.UnityGameMode.Infrastructure.dll
Syntax
public class UnityGameModeService : MonoBehaviour, IGameModeService, IService, IFoundationSettings
Constructors
UnityGameModeService()
Declaration
public UnityGameModeService()
Fields
LOG_CATEGORY
Declaration
protected const string LOG_CATEGORY = "GameModeService"
Field Value
_currentMode
Declaration
protected GameMode _currentMode
Field Value
_eventDispatcher
Declaration
protected IEventDispatcherService _eventDispatcher
Field Value
_gameWrapper
Declaration
protected GameObject _gameWrapper
Field Value
| Type |
Description |
| GameObject |
|
_gameplayReadinessGate
Declaration
protected IGameplayReadinessGate _gameplayReadinessGate
Field Value
_gameplaySceneName
Declaration
protected string _gameplaySceneName
Field Value
_guid
Declaration
Field Value
_id
Declaration
Field Value
_isGameplaySceneLoaded
Tracks whether the gameplay scene is currently loaded.
Declaration
protected bool _isGameplaySceneLoaded
Field Value
_isSceneTransitioning
Whether a scene loading/unloading operation is in progress.
Declaration
protected bool _isSceneTransitioning
Field Value
_loadingOverlay
Declaration
protected IGameplayLoadingOverlayView _loadingOverlay
Field Value
_logService
Declaration
protected ILogService _logService
Field Value
Declaration
protected IMenuService _menuService
Field Value
_pauseAction
Declaration
protected InputAction _pauseAction
Field Value
| Type |
Description |
| InputAction |
|
_pauseStrategy
Declaration
protected IPauseStrategy _pauseStrategy
Field Value
Declaration
protected IPlayerInputService _playerInputService
Field Value
_previousMode
Declaration
protected GameMode _previousMode
Field Value
_sceneContentContainer
Container for GameObjects loaded from the gameplay scene.
Declaration
protected GameObject _sceneContentContainer
Field Value
| Type |
Description |
| GameObject |
|
_settings
Declaration
protected IGameModeSettingsDefinition _settings
Field Value
_viewRouter
Declaration
protected IViewRouter _viewRouter
Field Value
Properties
CurrentMode
Declaration
public GameMode CurrentMode { get; }
Property Value
Guid
Declaration
public string Guid { get; set; }
Property Value
Id
Declaration
public string Id { get; set; }
Property Value
IsPaused
Declaration
public bool IsPaused { get; }
Property Value
IsSceneTransitioning
Whether a scene transition is currently in progress.
Declaration
public bool IsSceneTransitioning { get; }
Property Value
LogService
Declaration
public ILogService LogService { get; set; }
Property Value
PreviousMode
Declaration
public GameMode PreviousMode { get; }
Property Value
Methods
EnterGame()
Declaration
public virtual void EnterGame()
Declaration
public virtual void EnterMenu()
InitializeService(IGameModeSettingsDefinition, IPauseStrategy, IPlayerInputService, IMenuService, IEventDispatcherService, ILogService, GameObject, string, IGameplayReadinessGate, IGameplayLoadingOverlayView, IViewRouter)
Initializes the game mode service with required dependencies.
Declaration
public virtual void InitializeService(IGameModeSettingsDefinition settings, IPauseStrategy pauseStrategy, IPlayerInputService playerInputService, IMenuService menuService, IEventDispatcherService eventDispatcher, ILogService logService, GameObject gameWrapper, string gameplaySceneName, IGameplayReadinessGate gameplayReadinessGate = null, IGameplayLoadingOverlayView loadingOverlay = null, IViewRouter viewRouter = null)
Parameters
| Type |
Name |
Description |
| IGameModeSettingsDefinition |
settings |
The game mode settings definition.
|
| IPauseStrategy |
pauseStrategy |
The pause strategy for time scale manipulation.
|
| IPlayerInputService |
playerInputService |
The player input service for action map switching.
|
| IMenuService |
menuService |
The menu service for showing/hiding menus.
|
| IEventDispatcherService |
eventDispatcher |
The event dispatcher service for dispatching signals.
|
| ILogService |
logService |
The log service for logging.
|
| GameObject |
gameWrapper |
The GameWrapper GameObject for parenting loaded scene content.
|
| string |
gameplaySceneName |
The name of the gameplay scene to load additively.
|
| IGameplayReadinessGate |
gameplayReadinessGate |
Optional gate controlling when gameplay content becomes visible. Gameplay-side code should call MarkReady() once its initialization is complete.
|
| IGameplayLoadingOverlayView |
loadingOverlay |
Optional view responsible for rendering the fullscreen loading overlay while gameplay initializes.
|
| IViewRouter |
viewRouter |
|
SetMode(GameMode)
Declaration
public virtual void SetMode(GameMode mode)
Parameters
TogglePause()
Declaration
public virtual void TogglePause()
Implements