62 lines
1.9 KiB
C#
62 lines
1.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BITKit;
|
|
using Net.BITKit.Localization;
|
|
#if UNITY_EDITOR
|
|
using FullscreenEditor;
|
|
using Types = FullscreenEditor.Types;
|
|
#endif
|
|
using Project.B.Player;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace Project.B
|
|
{
|
|
public class UnitySettingService
|
|
{
|
|
private IWrapper<PlayerSettings> _playerSettings;
|
|
|
|
private readonly ILocalizationService _localizationService;
|
|
|
|
public UnitySettingService(IWrapper<PlayerSettings> playerSettings, ILocalizationService localizationService)
|
|
{
|
|
_playerSettings = playerSettings;
|
|
_localizationService = localizationService;
|
|
|
|
_playerSettings.OnValueChanged += OnValueChanged;
|
|
}
|
|
|
|
private void OnValueChanged(PlayerSettings arg1, PlayerSettings arg2)
|
|
{
|
|
_localizationService.ChangeLanguageAsync(arg2.Language);
|
|
#if UNITY_EDITOR
|
|
if (Application.isEditor)
|
|
{
|
|
if (arg2.IsFullScreen)
|
|
{
|
|
Fullscreen.MakeFullscreen(Types.GameView);
|
|
}
|
|
else
|
|
{
|
|
foreach (var x in Fullscreen.GetAllFullscreen())
|
|
{
|
|
x.Close();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
#endif
|
|
{
|
|
Screen.SetResolution(arg2.Resolution.x,arg2.Resolution.y,arg2.IsFullScreen?FullScreenMode.FullScreenWindow:FullScreenMode.Windowed);
|
|
}
|
|
|
|
QualitySettings.globalTextureMipmapLimit = (int)arg2.GlobalMipmapLimit;
|
|
QualitySettings.realtimeReflectionProbes = arg2.RealtimeReflectionProbes;
|
|
QualitySettings.shadowmaskMode = arg2.ShadowmaskMode;
|
|
QualitySettings.realtimeGICPUUsage= (int)arg2.RealtimeGICPUUsage;
|
|
QualitySettings.vSyncCount = (int)arg2.VSyncCount;
|
|
}
|
|
}
|
|
|
|
}
|