Class UnityGameGraphicsService
Unity-specific implementation of game graphics service that manages quality settings, resolution, and fullscreen mode.
Namespace: Serenity.GameGraphics.Infrastructure.Services
Assembly: Serenity.UnityGameGraphics.Infrastructure.dll
Syntax
public class UnityGameGraphicsService : MonoBehaviour, IGameGraphicsService, IService, IFoundationSettings
Constructors
UnityGameGraphicsService()
Declaration
public UnityGameGraphicsService()
Properties
Guid
Declaration
public string Guid { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Id
Declaration
public string Id { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
LogService
Declaration
public ILogService LogService { get; set; }
Property Value
| Type | Description |
|---|---|
| ILogService |
Methods
GetCurrentQualityLevel()
Gets the name of the currently active quality level.
Declaration
public string GetCurrentQualityLevel()
Returns
| Type | Description |
|---|---|
| string | The current quality level name. |
GetIsFullScreen()
Gets the current fullscreen state of the application.
Declaration
public bool GetIsFullScreen()
Returns
| Type | Description |
|---|---|
| bool | True if the application is in fullscreen mode, false otherwise. |
GetQualityLevelList()
Gets the list of available quality levels from Unity's quality settings.
Declaration
public string[] GetQualityLevelList()
Returns
| Type | Description |
|---|---|
| string[] | An array of quality level names. |
GetScreenResolution()
Gets the current screen resolution as a formatted string.
Declaration
public string GetScreenResolution()
Returns
| Type | Description |
|---|---|
| string | The screen resolution in "WIDTHxHEIGHT" format. |
Initialize(IGameGraphicsSettings, IEventDispatcherService, ILogService, IGameSettingsService)
Declaration
public void Initialize(IGameGraphicsSettings settings, IEventDispatcherService eventDispatcherService, ILogService logService, IGameSettingsService gameSettingsService)
Parameters
| Type | Name | Description |
|---|---|---|
| IGameGraphicsSettings | settings | |
| IEventDispatcherService | eventDispatcherService | |
| ILogService | logService | |
| IGameSettingsService | gameSettingsService |
InitializeEventDispatcher(IEventDispatcherService)
Initializes the event dispatcher service and subscribes to relevant events.
Declaration
public void InitializeEventDispatcher(IEventDispatcherService eventDispatcherService)
Parameters
| Type | Name | Description |
|---|---|---|
| IEventDispatcherService | eventDispatcherService | The event dispatcher service to use for handling graphics events. |
InitializeService(IGameGraphicsSettings)
Initializes the graphics service with the specified settings configuration.
Declaration
public void InitializeService(IGameGraphicsSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| IGameGraphicsSettings | settings | The graphics settings configuration containing key mappings and initial values. |
SetCurrentQualityLevel(SetCurrentQualityLevelInput)
Sets the current quality level to the specified level.
Declaration
public void SetCurrentQualityLevel(SetCurrentQualityLevelInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| SetCurrentQualityLevelInput | input | Input data containing the quality level to set. |
SetEventDispatcherService(IEventDispatcherService)
Sets the event dispatcher service for graphics event handling.
Declaration
public void SetEventDispatcherService(IEventDispatcherService eventDispatcherService)
Parameters
| Type | Name | Description |
|---|---|---|
| IEventDispatcherService | eventDispatcherService | The event dispatcher service instance. |
SetIsFullScreen(GameGraphicsSetIsFullScreenInput)
Sets the fullscreen mode state for the application.
Declaration
public void SetIsFullScreen(GameGraphicsSetIsFullScreenInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| GameGraphicsSetIsFullScreenInput | input | Input data containing the fullscreen state to set. |
SetScreenResolution(SetScreenResolutionInput)
Sets the screen resolution to the specified width and height.
Declaration
public void SetScreenResolution(SetScreenResolutionInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| SetScreenResolutionInput | input | Input data containing the width and height values to set. |
SubscribeToEventDispatcherEvents()
Subscribes to event dispatcher events related to graphics settings changes.
Declaration
public void SubscribeToEventDispatcherEvents()