using System; using System.Collections.Generic; using DarkTonic.MasterAudio; using Rewired; using UnityEngine; using UnityEngine.Audio; using UnityEngine.InputSystem; using UnityEngine.UI; public class SettingsManager : MonoBehaviour { private enum DisplayMode { Fullscreen = 0, Windowed = 1 } private enum QualityMode { Low = 0, Medium = 1, High = 2, VeryHigh = 3, Ultra = 4 } private enum TextureQualityMode { Ultra = 0, High = 1, Medium = 2, Low = 3 } private enum WaterQualityMode { Low = 0, Medium = 1, High = 2, Ultra = 3 } private enum VsyncMode { Off = 0, On = 1 } private enum BlurMode { Off = 0, On = 1 } private enum BloomMode { Off = 0, On = 1 } private enum ChromaticMode { Off = 0, On = 1 } private enum AAMode { Off = 0, FXAA = 1, SMAA = 2, TXAA = 3 } private enum AOMode { Off = 0, On = 1 } private enum ResidenceMusic { Off = 0, On = 1 } private enum FishCursorMode { Off = 0, On = 1 } private enum InvertMouse { Off = 0, On = 1 } private enum SmoothCamera { Off = 0, On = 1 } private enum UnitWeight { Kg = 0, Lb = 1 } private enum UnitLength { cm = 0, cals = 1, foots = 2 } private enum TimeZone { _24 = 0, _12 = 1 } private enum LightShafts { Off = 0, On = 1 } private enum TemperatureUnit { C = 0, F = 1, K = 2 } private enum ControllerSetup { LeftHand = 0, RightHand = 1 } private enum ControllerVibration { Off = 0, On = 1 } private enum ShadowOnWater { Off = 0, On = 1 } private enum RealisticLineIndicator { Off = 0, On = 1 } private enum HideChat { Off = 0, On = 1 } public Camera mCamera; public PlayerHeader playerHeader; public Image mainContentMaskImage; public GameObject ApplyButton; public Transform[] SettingsContents; public Text[] controlsLabelText; private bool isLanguageChanged; private int currentLanguageIndex; public Text displayLanguageText; public Text fovText; private float currentFov = 42f; public Slider fovSlider; private bool isDisplayChanged; private bool isGraphicsChanged; private bool isGraphicsPostprocessingChanged; private Resolution[] resolutions; public Text resolutionText; private int currentSetsresolution; private DisplayMode displayMod; public Text displayModeText; private int currentDisplayMode; private QualityMode qualityMode = QualityMode.High; public Text displayQualityText; private int currentQualityMode; private TextureQualityMode textureQualityMode; public Text displayTextureQualityText; private int currentTextureQualityMode = 3; private WaterQualityMode waterPlanarMode = WaterQualityMode.Medium; public Text waterPlanarText; private int currentWaterPlanarMode; private WaterQualityMode waterSSRMode = WaterQualityMode.Medium; public Text waterSSRText; private int currentWaterSSRMode; private VsyncMode vsyncMode = VsyncMode.On; public Text displayVsyncText; private int currentVsyncMode; private BlurMode blurMode = BlurMode.On; public Text displayBlurText; private int currentBlurMode; public Text blurUnderwaterText; public Slider blurUnderwaterSlider; private float currentBlurUnderwater; private BloomMode bloomMode = BloomMode.On; public Text displayBloomText; private int currentBloomMode; private ChromaticMode chromaticMode = ChromaticMode.On; public Text displayChromaticText; private int currentChromaticMode; private AAMode aaMode = AAMode.SMAA; public Text displayAaText; private int currentAaMode; private AOMode aoMode = AOMode.On; public Text displayAoText; private int currentAoMode; private ResidenceMusic residenceMusic = ResidenceMusic.On; public Text displayResidenceMusicText; private int currentResidenceMusicMode; private int targetMaxFPS; public Text displayMaxFps; public Button[] MaxFpsButtons; public Image MaxFpsButtonImage; private int currentMaxFPSIndex; public Text volumeText; private float currentSoundsVolume = 1f; public Slider soundVolume; private bool isSoundsChanged; public Text musicVolumeText; private float currentMusicVolume = 1f; public Slider musicVolume; public Text fxVolumeText; private float currentFxSoundsVolume = 1f; public Slider fxVolume; public Text UnderwaterVolumeText; private float currentUnderwaterSoundsVolume = 1f; public Slider UnderwaterVolume; public Text WaterVolumeText; private float currentWaterSoundsVolume = 1f; public Slider WaterVolume; public Text UIVolumeText; private float currentUISoundsVolume = 0.5f; public Slider UIVolume; public Text EnviroVolumeText; private float currentEnviroSoundsVolume = 0.5f; public Slider EnviroVolume; public Text WeatherVolumeText; private float currentWeatherSoundsVolume = 0.5f; public Slider WeatherVolume; public Text VehicleVolumeText; private float currentVehicleSoundsVolume = 0.5f; public Slider VehicleVolume; public Text intesityFogText; private float currentintesityFog = 1f; public Slider intesityFog; private float currentMouseSensitivity = 2f; private float currentCursorSensitivity = 2f; public Slider mouseSensitivity; public Slider cursorSensitivity; private FishCursorMode fishCursorMode = FishCursorMode.On; public Text displayFishCursorText; private int currentFishCursorMode; private InvertMouse invertMouseMode; private int currentInvertMouse; public Text displayInvertMouseText; private InvertMouse invertMouseXMode; private int currentInvertMouseX; public Text displayInvertMouseXText; private bool isControlsChanged; private SmoothCamera smoothcamera = SmoothCamera.On; public Text smoothCameraText; private int currentsmooothcamera; private UnitWeight unitWeight; public Text unitWeightText; private int currentunitWeight; private UnitLength unitLength; public Text unitLengthText; private int currentunitLength; private TimeZone timeZone; public Text timeZoneText; private int currenttimeZone; private LightShafts lightShafts = LightShafts.On; private int currentlightShafts; public Text displayLightShaftsText; private TemperatureUnit temperature; public Text temperatureUnitText; private int currentunitTemperature; private ControllerSetup controllerSetup = ControllerSetup.RightHand; private int currentcontrollerSetup; public Text displayControllerSetupText; private ControllerVibration controllerVibration = ControllerVibration.On; public Text controllerVibrationText; private int currentcontrollerVibration; public Text shadowDistanceText; private float currentShadowDistance = 1f; public Slider shadowDistance; private ShadowOnWater shadowOnWater = ShadowOnWater.On; private int currentShadowOnWater; public Text shadowOnWaterText; public Text floatScaleText; private float currentfloatScale = 1f; public Slider floatScaleSlider; private RealisticLineIndicator realisticLineIndicator; private int currentRealisticLineIndicator; public Text RealisticLineIndicatorText; private HideChat hideChat; private int currentHideChat; public Text hideChatText; public GameObject ControllerSetupGameObject; public GameObject ControllerVibrationGameObject; public GameObject[] HideInNormalMode; public GameObject[] HideInRealisticMode; [SerializeField] private AudioMixer enviroMixer; [SerializeField] private AudioMixer FXMixer; [SerializeField] private AudioMixer musicMixer; [SerializeField] private AudioMixer UIMixer; [SerializeField] private AudioMixer underwaterMixer; [SerializeField] private AudioMixer vehicleMixer; [SerializeField] private AudioMixer waterMixer; [SerializeField] private AudioMixer weatherMixer; private int currentSettingContent; public const string _WaterSSRModeKey = "Settings_WaterSSRMode"; public const string _WaterPlanarModeKey = "Settings_WaterPlanarMode"; private int currentMeshDetail; private int currentWaveDetail; private int currentDynamicWavesDetail; private int currentReflectionsLevel; private int currentWaterVolumetricLighting; private int currentCausticLevel; [SerializeField] private Text _MeshDetailText; [SerializeField] private Text _WaveDetailText; [SerializeField] private Text _DynamicWavesDetail; [SerializeField] private Text _ReflectionDetailText; [SerializeField] private Text _VolumetricLightingText; [SerializeField] private Text _CausticLightingText; public static event Action OnSetMeshDetail; public static event Action OnSetWavesDetail; public static event Action OnSetDynamicWaves; public static event Action OnSetReflectionsLevel; public static event Action OnSetVolumetricLighting; public static event Action OnSetCausticLevel; public static event Action OnSetReflection; public static event Action OnSettingApply; private void Start() { ReInput.userDataStore.Load(); ApplyButton.SetActive(value: false); if (FScriptsHandler.Instance != null) { playerHeader.gameObject.SetActive(value: true); mainContentMaskImage.enabled = true; mCamera.transform.SetPositionAndRotation(FScriptsHandler.Instance.m_PlayerMain.m_Camera.transform.position, FScriptsHandler.Instance.m_PlayerMain.m_Camera.transform.rotation); } else if ((bool)UnityEngine.Object.FindObjectOfType()) { playerHeader.gameObject.SetActive(value: true); mainContentMaskImage.enabled = true; mCamera.transform.SetPositionAndRotation(Camera.main.transform.position, Camera.main.transform.rotation); } else { playerHeader.gameObject.SetActive(value: false); mainContentMaskImage.enabled = false; } if (UnityEngine.Object.FindObjectsOfType().Length > 1) { mCamera.GetComponent().enabled = false; } if (Singleton.Instance.GetCurrentPlayerData().GameMode == GameManager.PlayerData.CPlayer.GameMode.Normal) { for (int i = 0; i < HideInNormalMode.Length; i++) { HideInNormalMode[i].SetActive(value: false); } } if (Singleton.Instance.GetCurrentPlayerData().GameMode == GameManager.PlayerData.CPlayer.GameMode.Realistic) { for (int j = 0; j < HideInRealisticMode.Length; j++) { HideInRealisticMode[j].SetActive(value: false); } } ShowContent(1); } private void FixedUpdate() { if (Gamepad.current != null) { ControllerSetupGameObject.SetActive(value: true); ControllerVibrationGameObject.SetActive(value: true); } else { ControllerSetupGameObject.SetActive(value: false); ControllerVibrationGameObject.SetActive(value: false); } SetupControlsPageByController(); } private void SetupControlsPageByController() { if (GameManager.Instance.controllerType == GameManager.ControllerType.KeyboardMouse) { controlsLabelText[0].text = LanguageManager.Instance.GetText("SETTINGS_MOUSE_SENSITIVE"); controlsLabelText[1].text = LanguageManager.Instance.GetText("SETTINGS_INVERT_MOUSE_AXIS"); } else { controlsLabelText[0].text = LanguageManager.Instance.GetText("SETTINGS_GAMEPAD_SENSITIVE"); controlsLabelText[1].text = LanguageManager.Instance.GetText("SETTINGS_INVERT_GAMEPAD_AXIS"); } } public void ShowContent(int index) { for (int i = 0; i < SettingsContents.Length; i++) { SettingsContents[i].gameObject.SetActive(value: false); } SettingsContents[index].gameObject.SetActive(value: true); currentSettingContent = index; if (index == 5) { ApplyButton.SetActive(value: false); } switch (index) { case 0: GetLanguageStartsSettings(); break; case 1: GetGraphicStartsSettings(); break; case 2: GetSoundsStartsSettings(); break; case 3: GetControlsStartsSettings(); break; case 4: GetDisplayStartsSettings(); break; case 6: GetGraphicWaterStartsSettings(); break; case 5: break; } } public void DefualtButton() { GameManager.Instance.CreateMessageBox("SETTINGS_RESET_TO_DEFAULT", GetComponent().transform, 12); } public void ResetsSettingsToDefault() { Singleton.Instance.ResetSettingsData(); ShowContent(currentSettingContent); } private void GetControlsStartsSettings() { currentMouseSensitivity = Singleton.Instance.SettingsData.MouseSensitivityValue; mouseSensitivity.value = currentMouseSensitivity; currentCursorSensitivity = Singleton.Instance.SettingsData.GamepadCursorSensitivityValue; cursorSensitivity.value = currentCursorSensitivity; invertMouseMode = (Singleton.Instance.SettingsData.IsMouseYInverted ? InvertMouse.On : InvertMouse.Off); currentInvertMouse = (int)invertMouseMode; if (invertMouseMode == InvertMouse.Off) { displayInvertMouseText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (invertMouseMode == InvertMouse.On) { displayInvertMouseText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } invertMouseXMode = (Singleton.Instance.SettingsData.IsMouseXInverted ? InvertMouse.On : InvertMouse.Off); currentInvertMouseX = (int)invertMouseXMode; if (invertMouseXMode == InvertMouse.Off) { displayInvertMouseXText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (invertMouseXMode == InvertMouse.On) { displayInvertMouseXText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } smoothcamera = (Singleton.Instance.SettingsData.IsSmoothCameraEnabled ? SmoothCamera.On : SmoothCamera.Off); currentsmooothcamera = (int)smoothcamera; if (smoothcamera == SmoothCamera.Off) { smoothCameraText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (smoothcamera == SmoothCamera.On) { smoothCameraText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } controllerSetup = (ControllerSetup)GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].controllerSetup; currentcontrollerSetup = (int)controllerSetup; unitWeightText.text = unitWeight.ToString(); if (controllerSetup == ControllerSetup.LeftHand) { displayControllerSetupText.text = LanguageManager.Instance.GetText("SETTINGS_CONTROLLER_LEFT_HAND"); } if (controllerSetup == ControllerSetup.RightHand) { displayControllerSetupText.text = LanguageManager.Instance.GetText("SETTINGS_CONTROLLER_RIGHT_HAND"); } controllerVibration = (Singleton.Instance.SettingsData.IsControllerVibrationEnabled ? ControllerVibration.On : ControllerVibration.Off); currentcontrollerVibration = (int)controllerVibration; if (controllerVibration == ControllerVibration.Off) { controllerVibrationText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (controllerVibration == ControllerVibration.On) { controllerVibrationText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } } private void GetSoundsStartsSettings() { currentSoundsVolume = Singleton.Instance.SettingsData.MasterVolume; SetSliderAndText(soundVolume, volumeText, currentSoundsVolume); currentMusicVolume = Singleton.Instance.SettingsData.MusicVolume; SetSliderAndText(musicVolume, musicVolumeText, currentMusicVolume); currentFxSoundsVolume = Singleton.Instance.SettingsData.FXVolume; SetSliderAndText(fxVolume, fxVolumeText, currentFxSoundsVolume); currentUnderwaterSoundsVolume = Singleton.Instance.SettingsData.UnderwaterVolume; SetSliderAndText(UnderwaterVolume, UnderwaterVolumeText, currentUnderwaterSoundsVolume); currentWaterSoundsVolume = Singleton.Instance.SettingsData.WaterVolume; SetSliderAndText(WaterVolume, WaterVolumeText, currentWaterSoundsVolume); currentUISoundsVolume = Singleton.Instance.SettingsData.UIVolume; SetSliderAndText(UIVolume, UIVolumeText, currentUISoundsVolume); currentEnviroSoundsVolume = Singleton.Instance.SettingsData.EnviroVolume; SetSliderAndText(EnviroVolume, EnviroVolumeText, currentEnviroSoundsVolume); currentWeatherSoundsVolume = Singleton.Instance.SettingsData.WeatherVolume; SetSliderAndText(WeatherVolume, WeatherVolumeText, currentWeatherSoundsVolume); currentVehicleSoundsVolume = Singleton.Instance.SettingsData.VehicleVolume; SetSliderAndText(VehicleVolume, VehicleVolumeText, currentVehicleSoundsVolume); if ((bool)displayResidenceMusicText) { residenceMusic = (Singleton.Instance.SettingsData.IsResidenceMusicEnabled ? ResidenceMusic.On : ResidenceMusic.Off); displayResidenceMusicText.text = ((residenceMusic == ResidenceMusic.Off) ? LanguageManager.Instance.GetText("SETTINGS_OFF") : LanguageManager.Instance.GetText("SETTINGS_ON")); } static void SetSliderAndText(Slider slider, Text text, float value) { if ((bool)slider && (bool)text) { slider.value = value; text.text = (value * 100f).ToString("F0") + "%"; } } } private void GetDisplayStartsSettings() { currentFov = Singleton.Instance.SettingsData.FOVValue; fovSlider.value = currentFov; fovText.text = currentFov.ToString("F0") + "°"; fishCursorMode = (Singleton.Instance.SettingsData.IsFishCursorEnabled ? FishCursorMode.On : FishCursorMode.Off); currentFishCursorMode = (int)fishCursorMode; if (fishCursorMode == FishCursorMode.Off) { displayFishCursorText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (fishCursorMode == FishCursorMode.On) { displayFishCursorText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } lightShafts = (Singleton.Instance.SettingsData.IsLightShaftEnabled ? LightShafts.On : LightShafts.Off); currentlightShafts = (int)lightShafts; if (lightShafts == LightShafts.Off) { displayLightShaftsText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (lightShafts == LightShafts.On) { displayLightShaftsText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } unitWeight = (UnitWeight)Singleton.Instance.SettingsData.WeightUnitIndex; currentunitWeight = (int)unitWeight; unitWeightText.text = unitWeight.ToString(); if (unitWeight == UnitWeight.Kg) { unitWeightText.text = LanguageManager.Instance.GetText("SETTINGS_KG"); } if (unitWeight == UnitWeight.Lb) { unitWeightText.text = LanguageManager.Instance.GetText("SETTINGS_LB"); } unitLength = (UnitLength)Singleton.Instance.SettingsData.LengthUnitIndex; currentunitLength = (int)unitLength; unitLengthText.text = unitWeight.ToString(); if (unitLength == UnitLength.cm) { unitLengthText.text = LanguageManager.Instance.GetText("SETTINGS_CM"); } if (unitLength == UnitLength.cals) { unitLengthText.text = LanguageManager.Instance.GetText("SETTINGS_INCHES"); } if (unitLength == UnitLength.foots) { unitLengthText.text = LanguageManager.Instance.GetText("SETTINGS_FOOTS"); } currentintesityFog = Singleton.Instance.SettingsData.FogIntensityValue; intesityFog.value = currentintesityFog; intesityFogText.text = (currentintesityFog * 100f).ToString("F0") + "%"; timeZone = (TimeZone)Singleton.Instance.SettingsData.TimeConventionIndex; currenttimeZone = (int)timeZone; timeZoneText.text = timeZone.ToString(); if (timeZone == TimeZone._24) { timeZoneText.text = LanguageManager.Instance.GetText("SETTINGS_24"); } if (timeZone == TimeZone._12) { timeZoneText.text = LanguageManager.Instance.GetText("SETTINGS_12"); } temperature = (TemperatureUnit)Singleton.Instance.SettingsData.TemperatureUnitIndex; currentunitTemperature = (int)temperature; temperatureUnitText.text = temperature.ToString(); if (temperature == TemperatureUnit.C) { temperatureUnitText.text = "C"; } if (temperature == TemperatureUnit.F) { temperatureUnitText.text = "F"; } if (temperature == TemperatureUnit.K) { temperatureUnitText.text = "K"; } currentfloatScale = Singleton.Instance.SettingsData.FloatSizeValue; floatScaleSlider.value = currentfloatScale; floatScaleText.text = "x" + currentfloatScale.ToString("F0"); realisticLineIndicator = (Singleton.Instance.SettingsData.IsLineIndicatorEnabledOnRealistic ? RealisticLineIndicator.On : RealisticLineIndicator.Off); currentRealisticLineIndicator = (int)realisticLineIndicator; if (currentRealisticLineIndicator == 0) { RealisticLineIndicatorText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (currentRealisticLineIndicator == 1) { RealisticLineIndicatorText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } hideChat = (Singleton.Instance.SettingsData.IsChatEnabled ? HideChat.On : HideChat.Off); currentHideChat = (int)hideChat; if (currentHideChat == 0) { hideChatText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (currentHideChat == 1) { hideChatText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } } private void GetLanguageStartsSettings() { displayLanguageText.text = LanguageManager.Instance.currentLanguage; currentLanguageIndex = LanguageManager.Instance.languagesList.IndexOf(LanguageManager.Instance.currentLanguage); } public void SetFov() { currentFov = fovSlider.value; fovText.text = currentFov.ToString("F0") + "°"; if (currentFov != Singleton.Instance.SettingsData.FOVValue) { ApplyButton.SetActive(value: true); isDisplayChanged = true; } } public void SetFishCursorMode(int arrow) { currentFishCursorMode += arrow; if (currentFishCursorMode < 0) { currentFishCursorMode = 1; } if (currentFishCursorMode == 2) { currentFishCursorMode = 0; } fishCursorMode = (FishCursorMode)currentFishCursorMode; if (fishCursorMode == FishCursorMode.Off) { displayFishCursorText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (fishCursorMode == FishCursorMode.On) { displayFishCursorText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } ApplyButton.SetActive(value: true); isDisplayChanged = true; } public void SetLanguage(int arrow) { currentLanguageIndex += arrow; if (currentLanguageIndex < 0) { currentLanguageIndex = LanguageManager.Instance.languagesList.Count - 1; } if (currentLanguageIndex == LanguageManager.Instance.languagesList.Count) { currentLanguageIndex = 0; } displayLanguageText.text = LanguageManager.Instance.languagesList[currentLanguageIndex]; ApplyButton.SetActive(value: true); isLanguageChanged = true; } public void SetCursorSensitivitySlider(float value) { cursorSensitivity.value += value; } public void SetCursorSensitivity() { currentCursorSensitivity = cursorSensitivity.value; ApplyButton.SetActive(value: true); isControlsChanged = true; } public void SetMouseSensitivitySlider(float value) { mouseSensitivity.value += value; } public void SetMouseSensitivity() { currentMouseSensitivity = mouseSensitivity.value; ApplyButton.SetActive(value: true); isControlsChanged = true; } public void SetInvertMouseMode(int arrow) { currentInvertMouse += arrow; if (currentInvertMouse < 0) { currentInvertMouse = 1; } if (currentInvertMouse == 2) { currentInvertMouse = 0; } invertMouseMode = (InvertMouse)currentInvertMouse; if (invertMouseMode == InvertMouse.Off) { displayInvertMouseText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (invertMouseMode == InvertMouse.On) { displayInvertMouseText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } ApplyButton.SetActive(value: true); isControlsChanged = true; } public void SetInvertMouseXMode(int arrow) { currentInvertMouseX += arrow; if (currentInvertMouseX < 0) { currentInvertMouseX = 1; } if (currentInvertMouseX == 2) { currentInvertMouseX = 0; } invertMouseXMode = (InvertMouse)currentInvertMouseX; if (invertMouseXMode == InvertMouse.Off) { displayInvertMouseXText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (invertMouseXMode == InvertMouse.On) { displayInvertMouseXText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } ApplyButton.SetActive(value: true); isControlsChanged = true; } public void SetSmoothCamera(int arrow) { currentsmooothcamera += arrow; if (currentsmooothcamera < 0) { currentsmooothcamera = 1; } if (currentsmooothcamera == 2) { currentsmooothcamera = 0; } smoothcamera = (SmoothCamera)currentsmooothcamera; if (smoothcamera == SmoothCamera.Off) { smoothCameraText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (smoothcamera == SmoothCamera.On) { smoothCameraText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } ApplyButton.SetActive(value: true); isControlsChanged = true; } public void SetControllerSetup(int arrow) { currentcontrollerSetup += arrow; if (currentcontrollerSetup < 0) { currentcontrollerSetup = 1; } if (currentcontrollerSetup == 2) { currentcontrollerSetup = 0; } controllerSetup = (ControllerSetup)currentcontrollerSetup; if (controllerSetup == ControllerSetup.LeftHand) { displayControllerSetupText.text = LanguageManager.Instance.GetText("SETTINGS_CONTROLLER_LEFT_HAND"); } if (controllerSetup == ControllerSetup.RightHand) { displayControllerSetupText.text = LanguageManager.Instance.GetText("SETTINGS_CONTROLLER_RIGHT_HAND"); } ApplyButton.SetActive(value: true); isControlsChanged = true; } public void SetControllerVibration(int arrow) { currentcontrollerVibration += arrow; if (currentcontrollerVibration < 0) { currentcontrollerVibration = 1; } if (currentcontrollerVibration == 2) { currentcontrollerVibration = 0; } controllerVibration = (ControllerVibration)currentcontrollerVibration; if (controllerVibration == ControllerVibration.Off) { controllerVibrationText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (controllerVibration == ControllerVibration.On) { controllerVibrationText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } ApplyButton.SetActive(value: true); isControlsChanged = true; } public void SetSoundVolume() { volumeText.text = (soundVolume.value * 100f).ToString("F0") + "%"; currentSoundsVolume = soundVolume.value; if (currentSoundsVolume != AudioListener.volume) { AudioListener.volume = currentSoundsVolume; isSoundsChanged = true; } } public void SetUIVolume() { UIVolumeText.text = (UIVolume.value * 100f).ToString("F0") + "%"; currentUISoundsVolume = UIVolume.value; float uIVolume = Singleton.Instance.SettingsData.UIVolume; if (currentUISoundsVolume != uIVolume) { Singleton.Instance.SettingsData.UIVolume = currentUISoundsVolume; isSoundsChanged = true; } float value = Mathf.Log10(Mathf.Clamp(Singleton.Instance.SettingsData.UIVolume, 0.0001f, 1f)) * 20f; UIMixer?.SetFloat("MasterVolume", value); FScriptsHandler.Instance?.AffectSoundVolume(); UnityEngine.Object.FindObjectOfType()?.AffectSoundVolume(); } public void SetUIVolumeSlider(float value) { UIVolume.value += value; } public void SetSoundVolumeSlider(float value) { soundVolume.value += value; } public void SetMusicVolume() { musicVolumeText.text = (musicVolume.value * 100f).ToString("F0") + "%"; currentMusicVolume = musicVolume.value; float num = Singleton.Instance.SettingsData.MusicVolume; if (currentMusicVolume != num) { Singleton.Instance.SettingsData.MusicVolume = currentMusicVolume; isSoundsChanged = true; } float value = Mathf.Log10(Mathf.Clamp(Singleton.Instance.SettingsData.MusicVolume, 0.0001f, 1f)) * 20f; musicMixer?.SetFloat("MasterVolume", value); FScriptsHandler.Instance?.AffectSoundVolume(); UnityEngine.Object.FindObjectOfType()?.AffectSoundVolume(); } public void SetMusicVolumeSlider(float value) { musicVolume.value += value; } public void SetFxVolume() { fxVolumeText.text = (fxVolume.value * 100f).ToString("F0") + "%"; currentFxSoundsVolume = fxVolume.value; float fXVolume = Singleton.Instance.SettingsData.FXVolume; if (currentFxSoundsVolume != fXVolume) { Singleton.Instance.SettingsData.FXVolume = currentFxSoundsVolume; isSoundsChanged = true; } float value = Mathf.Log10(Mathf.Clamp(Singleton.Instance.SettingsData.FXVolume, 0.0001f, 1f)) * 20f; enviroMixer?.SetFloat("MasterVolume", value); FXMixer?.SetFloat("MasterVolume", value); UIMixer?.SetFloat("MasterVolume", value); vehicleMixer?.SetFloat("MasterVolume", value); waterMixer?.SetFloat("MasterVolume", value); weatherMixer?.SetFloat("MasterVolume", value); FScriptsHandler.Instance?.AffectSoundVolume(); UnityEngine.Object.FindObjectOfType()?.AffectSoundVolume(); } public void SetFxVolumeSlider(float value) { fxVolume.value += value; } public void SetEnviroVolume() { EnviroVolumeText.text = (EnviroVolume.value * 100f).ToString("F0") + "%"; currentEnviroSoundsVolume = EnviroVolume.value; float enviroVolume = Singleton.Instance.SettingsData.EnviroVolume; if (currentEnviroSoundsVolume != enviroVolume) { Singleton.Instance.SettingsData.EnviroVolume = currentEnviroSoundsVolume; isSoundsChanged = true; } float value = Mathf.Log10(Mathf.Clamp(Singleton.Instance.SettingsData.EnviroVolume, 0.0001f, 1f)) * 20f; enviroMixer?.SetFloat("MasterVolume", value); FScriptsHandler.Instance?.AffectSoundVolume(); UnityEngine.Object.FindObjectOfType()?.AffectSoundVolume(); } public void SetEnviroVolumeSlider(float value) { EnviroVolume.value += value; } public void SetWeatherVolume() { WeatherVolumeText.text = (WeatherVolume.value * 100f).ToString("F0") + "%"; currentWeatherSoundsVolume = WeatherVolume.value; float weatherVolume = Singleton.Instance.SettingsData.WeatherVolume; if (currentWeatherSoundsVolume != weatherVolume) { Singleton.Instance.SettingsData.WeatherVolume = currentWeatherSoundsVolume; isSoundsChanged = true; } float value = Mathf.Log10(Mathf.Clamp(Singleton.Instance.SettingsData.WeatherVolume, 0.0001f, 1f)) * 20f; weatherMixer?.SetFloat("MasterVolume", value); FScriptsHandler.Instance?.AffectSoundVolume(); UnityEngine.Object.FindObjectOfType()?.AffectSoundVolume(); } public void SetWeatherVolumeSlider(float value) { WeatherVolume.value += value; } public void SetVehicleVolume() { VehicleVolumeText.text = (VehicleVolume.value * 100f).ToString("F0") + "%"; currentVehicleSoundsVolume = VehicleVolume.value; float vehicleVolume = Singleton.Instance.SettingsData.VehicleVolume; if (currentVehicleSoundsVolume != vehicleVolume) { Singleton.Instance.SettingsData.VehicleVolume = currentVehicleSoundsVolume; isSoundsChanged = true; } float value = Mathf.Log10(Mathf.Clamp(Singleton.Instance.SettingsData.VehicleVolume, 0.0001f, 1f)) * 20f; vehicleMixer?.SetFloat("MasterVolume", value); FScriptsHandler.Instance?.AffectSoundVolume(); UnityEngine.Object.FindObjectOfType()?.AffectSoundVolume(); } public void SetVehicleVolumeSlider(float value) { VehicleVolume.value += value; } public void SetWaterVolume() { WaterVolumeText.text = (WaterVolume.value * 100f).ToString("F0") + "%"; currentWaterSoundsVolume = WaterVolume.value; float waterVolume = Singleton.Instance.SettingsData.WaterVolume; if (currentWaterSoundsVolume != waterVolume) { Singleton.Instance.SettingsData.WaterVolume = currentWaterSoundsVolume; isSoundsChanged = true; } float value = Mathf.Log10(Mathf.Clamp(Singleton.Instance.SettingsData.WaterVolume, 0.0001f, 1f)) * 20f; waterMixer?.SetFloat("MasterVolume", value); FScriptsHandler.Instance?.AffectSoundVolume(); UnityEngine.Object.FindObjectOfType()?.AffectSoundVolume(); } public void SetWaterVolumeSlider(float value) { WaterVolume.value += value; } public void SetUnderwaterVolume() { UnderwaterVolumeText.text = (UnderwaterVolume.value * 100f).ToString("F0") + "%"; currentUnderwaterSoundsVolume = UnderwaterVolume.value; float underwaterVolume = Singleton.Instance.SettingsData.UnderwaterVolume; if (currentUnderwaterSoundsVolume != underwaterVolume) { Singleton.Instance.SettingsData.UnderwaterVolume = currentUnderwaterSoundsVolume; isSoundsChanged = true; } float value = Mathf.Log10(Mathf.Clamp(Singleton.Instance.SettingsData.UnderwaterVolume, 0.0001f, 1f)) * 20f; underwaterMixer?.SetFloat("MasterVolume", value); FScriptsHandler.Instance?.AffectSoundVolume(); UnityEngine.Object.FindObjectOfType()?.AffectSoundVolume(); } public void SetUnderwaterVolumeSlider(float value) { UnderwaterVolume.value += value; } public void SetFogInsensity() { intesityFogText.text = (intesityFog.value * 100f).ToString("F0") + "%"; currentintesityFog = intesityFog.value; ApplyButton.SetActive(value: true); isDisplayChanged = true; } public void SetFogInsensitySlider(float value) { intesityFog.value += value; ApplyButton.SetActive(value: true); isDisplayChanged = true; } public void SetShadowDistance() { shadowDistanceText.text = shadowDistance.value.ToString("F0"); currentShadowDistance = shadowDistance.value; ApplyButton.SetActive(value: true); isGraphicsChanged = true; } public void SetShadowDisnaceSlider(float value) { shadowDistance.value += value; ApplyButton.SetActive(value: true); isGraphicsChanged = true; } public void SetFloatSize() { floatScaleText.text = "x" + floatScaleSlider.value.ToString("F0"); currentfloatScale = floatScaleSlider.value; if (currentfloatScale != Singleton.Instance.SettingsData.FloatSizeValue) { ApplyButton.SetActive(value: true); isDisplayChanged = true; } } public void SetFloatSizeSlider(float value) { floatScaleSlider.value += value; } private void GetGraphicStartsSettings() { List list = new List(); resolutions = Screen.resolutions; for (int i = 0; i < resolutions.Length; i++) { if (resolutions[i].refreshRate >= 30) { list.Add(resolutions[i]); } } resolutions = list.ToArray(); int num = ((GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].LastChoosenRefreshRate != 0) ? GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].LastChoosenRefreshRate : Screen.currentResolution.refreshRate); bool flag = false; for (int j = 0; j < resolutions.Length; j++) { if (Screen.fullScreen) { if (resolutions[j].width == Screen.currentResolution.width && resolutions[j].height == Screen.currentResolution.height && (resolutions[j].refreshRate == num || Mathf.Abs(resolutions[j].refreshRate - num) <= 1)) { currentSetsresolution = j; flag = true; break; } } else if (resolutions[j].width == Screen.width && resolutions[j].height == Screen.height && resolutions[j].refreshRate == num) { currentSetsresolution = j; flag = true; break; } } if (!flag) { currentSetsresolution = resolutions.Length - 1; num = resolutions[resolutions.Length - 1].refreshRate; } resolutionText.text = (Screen.fullScreen ? (resolutions[currentSetsresolution].width + "x" + resolutions[currentSetsresolution].height + " " + num + " Hz") : (Screen.width + "x" + Screen.height + " " + num + " Hz")); displayMod = ((!Screen.fullScreen) ? DisplayMode.Windowed : DisplayMode.Fullscreen); currentDisplayMode = (int)displayMod; if (displayMod == DisplayMode.Fullscreen) { displayModeText.text = LanguageManager.Instance.GetText("SETTINGS_FULLSCREEN"); } if (displayMod == DisplayMode.Windowed) { displayModeText.text = LanguageManager.Instance.GetText("SETTINGS_WINDOWED"); } qualityMode = (QualityMode)QualitySettings.GetQualityLevel(); currentQualityMode = (int)qualityMode; displayQualityText.text = qualityMode.ToString(); if (qualityMode == QualityMode.Low) { displayQualityText.text = LanguageManager.Instance.GetText("SETTINGS_LOW"); } if (qualityMode == QualityMode.Medium) { displayQualityText.text = LanguageManager.Instance.GetText("SETTINGS_MEDIUM"); } if (qualityMode == QualityMode.High) { displayQualityText.text = LanguageManager.Instance.GetText("SETTINGS_HIGH"); } if (qualityMode == QualityMode.VeryHigh) { displayQualityText.text = LanguageManager.Instance.GetText("SETTINGS_ULTRA"); } textureQualityMode = (TextureQualityMode)Singleton.Instance.SettingsData.TextureQualityModeIndex; currentTextureQualityMode = (int)textureQualityMode; displayTextureQualityText.text = textureQualityMode.ToString(); if (textureQualityMode == TextureQualityMode.Ultra) { displayTextureQualityText.text = LanguageManager.Instance.GetText("SETTINGS_ULTRA"); } if (textureQualityMode == TextureQualityMode.High) { displayTextureQualityText.text = LanguageManager.Instance.GetText("SETTINGS_HIGH"); } if (textureQualityMode == TextureQualityMode.Medium) { displayTextureQualityText.text = LanguageManager.Instance.GetText("SETTINGS_MEDIUM"); } if (textureQualityMode == TextureQualityMode.Low) { displayTextureQualityText.text = LanguageManager.Instance.GetText("SETTINGS_LOW"); } displayMaxFps.text = GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].MaxFps[Singleton.Instance.SettingsData.MaxFpsIndex].ToString(); for (int k = 0; k < GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].MaxFps.Length - 1; k++) { if (Application.targetFrameRate == GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].MaxFps[k]) { currentMaxFPSIndex = k; break; } } vsyncMode = (Singleton.Instance.SettingsData.IsVSyncEnabled ? VsyncMode.On : VsyncMode.Off); currentVsyncMode = (int)vsyncMode; if (vsyncMode == VsyncMode.Off) { displayVsyncText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); MaxFpsButtons[0].interactable = true; MaxFpsButtons[1].interactable = true; MaxFpsButtonImage.color = Color.white; Application.targetFrameRate = GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].MaxFps[Singleton.Instance.SettingsData.MaxFpsIndex]; } if (vsyncMode == VsyncMode.On) { displayVsyncText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); MaxFpsButtons[0].interactable = false; MaxFpsButtons[1].interactable = false; MaxFpsButtonImage.color = Color.grey; } blurMode = (Singleton.Instance.SettingsData.IsBlurEnabled ? BlurMode.On : BlurMode.Off); currentBlurMode = (int)blurMode; if (blurMode == BlurMode.Off) { displayBlurText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (blurMode == BlurMode.On) { displayBlurText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } bloomMode = (Singleton.Instance.SettingsData.IsBloomEnabled ? BloomMode.On : BloomMode.Off); currentBloomMode = (int)bloomMode; if (bloomMode == BloomMode.Off) { displayBloomText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (bloomMode == BloomMode.On) { displayBloomText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } chromaticMode = (Singleton.Instance.SettingsData.IsChromaticAberrationEnabled ? ChromaticMode.On : ChromaticMode.Off); currentChromaticMode = (int)chromaticMode; if (chromaticMode == ChromaticMode.Off) { displayChromaticText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (chromaticMode == ChromaticMode.On) { displayChromaticText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } aoMode = (Singleton.Instance.SettingsData.IsAmbientOcclusionEnabled ? AOMode.On : AOMode.Off); currentAoMode = (int)aoMode; if (aoMode == AOMode.Off) { displayAoText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (aoMode == AOMode.On) { displayAoText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } aaMode = (AAMode)Singleton.Instance.SettingsData.AntiAliasingModeIndex; currentAaMode = (int)aaMode; displayAaText.text = ((aaMode == AAMode.Off) ? LanguageManager.Instance.GetText("SETTINGS_OFF") : aaMode.ToString()); currentShadowDistance = Singleton.Instance.SettingsData.ShadowDistanceValue; currentShadowDistance = Mathf.Clamp(currentShadowDistance, shadowDistance.minValue, shadowDistance.maxValue); shadowDistance.value = currentShadowDistance; shadowDistanceText.text = currentShadowDistance.ToString("F0"); } private void GetGraphicWaterStartsSettings() { currentBlurUnderwater = Singleton.Instance.SettingsData.BlurUnderwaterSetting; currentBlurUnderwater = Mathf.Clamp(currentBlurUnderwater, blurUnderwaterSlider.minValue, blurUnderwaterSlider.maxValue); blurUnderwaterSlider.value = currentBlurUnderwater; blurUnderwaterText.text = (currentBlurUnderwater * 100f).ToString("F0"); waterPlanarMode = (WaterQualityMode)PlayerPrefs.GetInt("Settings_WaterPlanarMode", 1); currentWaterPlanarMode = (int)waterPlanarMode; waterPlanarText.text = waterPlanarMode.ToString(); if (waterPlanarMode == (WaterQualityMode)4) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_ULTRA"); } if (waterPlanarMode == WaterQualityMode.Ultra) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_HIGH"); } if (waterPlanarMode == WaterQualityMode.High) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_MEDIUM"); } if (waterPlanarMode == WaterQualityMode.Medium) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_LOW"); } if (waterPlanarMode == WaterQualityMode.Low) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_VERY_LOW"); } if (waterPlanarMode == (WaterQualityMode)(-1)) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } waterSSRMode = (WaterQualityMode)PlayerPrefs.GetInt("Settings_WaterSSRMode", 1); currentWaterSSRMode = (int)waterSSRMode; waterSSRText.text = waterSSRMode.ToString(); if (waterSSRMode == (WaterQualityMode)4) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_ULTRA"); } if (waterSSRMode == WaterQualityMode.Ultra) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_HIGH"); } if (waterSSRMode == WaterQualityMode.High) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_MEDIUM"); } if (waterSSRMode == WaterQualityMode.Medium) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_LOW"); } if (waterSSRMode == WaterQualityMode.Low) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_VERY_LOW"); } if (waterSSRMode == (WaterQualityMode)(-1)) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } shadowOnWater = (GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].shadowOnWater ? ShadowOnWater.On : ShadowOnWater.Off); currentShadowOnWater = (int)shadowOnWater; if (shadowOnWater == ShadowOnWater.Off) { shadowOnWaterText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (shadowOnWater == ShadowOnWater.On) { shadowOnWaterText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } } public void SetResolution(int arrow) { currentSetsresolution += arrow; if (currentSetsresolution < 0) { currentSetsresolution = resolutions.Length - 1; } if (currentSetsresolution == resolutions.Length) { currentSetsresolution = 0; } resolutionText.text = resolutions[currentSetsresolution].width + "x" + resolutions[currentSetsresolution].height + " " + resolutions[currentSetsresolution].refreshRate + " Hz"; ApplyButton.SetActive(value: true); isGraphicsChanged = true; } public void SetDisplayMode(int arrow) { currentDisplayMode += arrow; if (currentDisplayMode < 0) { currentDisplayMode = 1; } if (currentDisplayMode > 1) { currentDisplayMode = 0; } displayMod = (DisplayMode)currentDisplayMode; if (displayMod == DisplayMode.Fullscreen) { displayModeText.text = LanguageManager.Instance.GetText("SETTINGS_FULLSCREEN"); } if (displayMod == DisplayMode.Windowed) { displayModeText.text = LanguageManager.Instance.GetText("SETTINGS_WINDOWED"); } ApplyButton.SetActive(value: true); isGraphicsChanged = true; } public void SetWaterSSR(int arrow) { currentWaterSSRMode += arrow; if (currentWaterSSRMode < -1) { currentWaterSSRMode = 4; } if (currentWaterSSRMode > 4) { currentWaterSSRMode = -1; } waterSSRMode = (WaterQualityMode)currentWaterSSRMode; if (waterSSRMode == (WaterQualityMode)4) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_ULTRA"); } if (waterSSRMode == WaterQualityMode.Ultra) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_HIGH"); } if (waterSSRMode == WaterQualityMode.High) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_MEDIUM"); } if (waterSSRMode == WaterQualityMode.Medium) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_LOW"); } if (waterSSRMode == WaterQualityMode.Low) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_VERY_LOW"); } if (waterSSRMode == (WaterQualityMode)(-1)) { waterSSRText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } ApplyButton.SetActive(value: true); } public void SetWaterPlanar(int arrow) { currentWaterPlanarMode += arrow; if (currentWaterPlanarMode < -1) { currentWaterPlanarMode = 4; } if (currentWaterPlanarMode > 4) { currentWaterPlanarMode = -1; } waterPlanarMode = (WaterQualityMode)currentWaterPlanarMode; if (waterPlanarMode == (WaterQualityMode)4) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_ULTRA"); } if (waterPlanarMode == WaterQualityMode.Ultra) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_HIGH"); } if (waterPlanarMode == WaterQualityMode.High) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_MEDIUM"); } if (waterPlanarMode == WaterQualityMode.Medium) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_LOW"); } if (waterPlanarMode == WaterQualityMode.Low) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_VERY_LOW"); } if (waterPlanarMode == (WaterQualityMode)(-1)) { waterPlanarText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } ApplyButton.SetActive(value: true); } public void SetUnderwaterBlur() { blurUnderwaterText.text = (blurUnderwaterSlider.value * 100f).ToString("F0"); currentBlurUnderwater = blurUnderwaterSlider.value; if (currentBlurUnderwater != Singleton.Instance.SettingsData.BlurUnderwaterSetting) { ApplyButton.SetActive(value: true); isGraphicsPostprocessingChanged = true; } } public void SetQualityMode(int arrow) { currentQualityMode += arrow; if (currentQualityMode < 0) { currentQualityMode = 3; } if (currentQualityMode > 3) { currentQualityMode = 0; } qualityMode = (QualityMode)currentQualityMode; if (qualityMode == QualityMode.Low) { displayQualityText.text = LanguageManager.Instance.GetText("SETTINGS_LOW"); } if (qualityMode == QualityMode.Medium) { displayQualityText.text = LanguageManager.Instance.GetText("SETTINGS_MEDIUM"); } if (qualityMode == QualityMode.High) { displayQualityText.text = LanguageManager.Instance.GetText("SETTINGS_HIGH"); } if (qualityMode == QualityMode.VeryHigh) { displayQualityText.text = LanguageManager.Instance.GetText("SETTINGS_ULTRA"); } ApplyButton.SetActive(value: true); isGraphicsChanged = true; } public void SetTextureQualityMode(int arrow) { currentTextureQualityMode += arrow; if (currentTextureQualityMode > 3) { currentTextureQualityMode = 0; } if (currentTextureQualityMode < 0) { currentTextureQualityMode = 3; } textureQualityMode = (TextureQualityMode)currentTextureQualityMode; if (textureQualityMode == TextureQualityMode.Low) { displayTextureQualityText.text = LanguageManager.Instance.GetText("SETTINGS_LOW"); } if (textureQualityMode == TextureQualityMode.Medium) { displayTextureQualityText.text = LanguageManager.Instance.GetText("SETTINGS_MEDIUM"); } if (textureQualityMode == TextureQualityMode.High) { displayTextureQualityText.text = LanguageManager.Instance.GetText("SETTINGS_HIGH"); } if (textureQualityMode == TextureQualityMode.Ultra) { displayTextureQualityText.text = LanguageManager.Instance.GetText("SETTINGS_ULTRA"); } ApplyButton.SetActive(value: true); isGraphicsChanged = true; } public void SetVsyncMode(int arrow) { currentVsyncMode += arrow; if (currentVsyncMode < 0) { currentVsyncMode = 1; } if (currentVsyncMode == 2) { currentVsyncMode = 0; } vsyncMode = (VsyncMode)currentVsyncMode; if (vsyncMode == VsyncMode.Off) { displayVsyncText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); MaxFpsButtons[0].interactable = true; MaxFpsButtons[1].interactable = true; MaxFpsButtonImage.color = Color.white; } if (vsyncMode == VsyncMode.On) { displayVsyncText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); MaxFpsButtons[0].interactable = false; MaxFpsButtons[1].interactable = false; MaxFpsButtonImage.color = Color.grey; } ApplyButton.SetActive(value: true); isGraphicsChanged = true; } public void SetBlurMode(int arrow) { currentBlurMode += arrow; if (currentBlurMode < 0) { currentBlurMode = 1; } if (currentBlurMode == 2) { currentBlurMode = 0; } blurMode = (BlurMode)currentBlurMode; if (blurMode == BlurMode.Off) { displayBlurText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (blurMode == BlurMode.On) { displayBlurText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } ApplyButton.SetActive(value: true); isGraphicsPostprocessingChanged = true; } public void SetBloomMode(int arrow) { currentBloomMode += arrow; if (currentBloomMode < 0) { currentBloomMode = 1; } if (currentBloomMode == 2) { currentBloomMode = 0; } bloomMode = (BloomMode)currentBloomMode; if (bloomMode == BloomMode.Off) { displayBloomText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (bloomMode == BloomMode.On) { displayBloomText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } ApplyButton.SetActive(value: true); isGraphicsPostprocessingChanged = true; } public void SetChromaticAbberationMode(int arrow) { currentChromaticMode += arrow; if (currentChromaticMode < 0) { currentChromaticMode = 1; } if (currentChromaticMode == 2) { currentChromaticMode = 0; } chromaticMode = (ChromaticMode)currentChromaticMode; if (chromaticMode == ChromaticMode.Off) { displayChromaticText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (chromaticMode == ChromaticMode.On) { displayChromaticText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } ApplyButton.SetActive(value: true); isGraphicsPostprocessingChanged = true; } public void SetAntiAliasingMode(int arrow) { currentAaMode += arrow; if (currentAaMode < 0) { currentAaMode = 3; } if (currentAaMode == 4) { currentAaMode = 0; } aaMode = (AAMode)currentAaMode; displayAaText.text = ((aaMode == AAMode.Off) ? LanguageManager.Instance.GetText("SETTINGS_OFF") : aaMode.ToString()); ApplyButton.SetActive(value: true); isGraphicsPostprocessingChanged = true; } public void SetAmbientOculssionMode(int arrow) { currentAoMode += arrow; if (currentAoMode < 0) { currentAoMode = 1; } if (currentAoMode == 2) { currentAoMode = 0; } aoMode = (AOMode)currentAoMode; if (aoMode == AOMode.Off) { displayAoText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (aoMode == AOMode.On) { displayAoText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } ApplyButton.SetActive(value: true); isGraphicsPostprocessingChanged = true; } public void SetUnitWeight(int arrow) { currentunitWeight += arrow; if (currentunitWeight < 0) { currentunitWeight = 1; } if (currentunitWeight == 2) { currentunitWeight = 0; } unitWeight = (UnitWeight)currentunitWeight; if (unitWeight == UnitWeight.Kg) { unitWeightText.text = LanguageManager.Instance.GetText("SETTINGS_KG"); } if (unitWeight == UnitWeight.Lb) { unitWeightText.text = LanguageManager.Instance.GetText("SETTINGS_LB"); } ApplyButton.SetActive(value: true); } public void SetUnitLength(int arrow) { currentunitLength += arrow; if (currentunitLength < 0) { currentunitLength = 2; } if (currentunitLength == 3) { currentunitLength = 0; } unitLength = (UnitLength)currentunitLength; if (unitLength == UnitLength.cm) { unitLengthText.text = LanguageManager.Instance.GetText("SETTINGS_CM"); } if (unitLength == UnitLength.cals) { unitLengthText.text = LanguageManager.Instance.GetText("SETTINGS_INCHES"); } if (unitLength == UnitLength.foots) { unitLengthText.text = LanguageManager.Instance.GetText("SETTINGS_FOOTS"); } ApplyButton.SetActive(value: true); isGraphicsPostprocessingChanged = true; } public void SetTimeZone(int arrow) { currenttimeZone += arrow; if (currenttimeZone < 0) { currenttimeZone = 1; } if (currenttimeZone == 2) { currenttimeZone = 0; } timeZone = (TimeZone)currenttimeZone; if (timeZone == TimeZone._24) { timeZoneText.text = LanguageManager.Instance.GetText("SETTINGS_24"); } if (timeZone == TimeZone._12) { timeZoneText.text = LanguageManager.Instance.GetText("SETTINGS_12"); } ApplyButton.SetActive(value: true); } public void SetUnitTemperature(int arrow) { currentunitTemperature += arrow; if (currentunitTemperature < 0) { currentunitTemperature = 2; } if (currentunitTemperature == 3) { currentunitTemperature = 0; } temperature = (TemperatureUnit)currentunitTemperature; if (temperature == TemperatureUnit.C) { temperatureUnitText.text = "C"; } if (temperature == TemperatureUnit.F) { temperatureUnitText.text = "F"; } if (temperature == TemperatureUnit.K) { temperatureUnitText.text = "K"; } ApplyButton.SetActive(value: true); } public void SetLightShaft(int arrow) { currentlightShafts += arrow; if (currentlightShafts < 0) { currentlightShafts = 1; } if (currentlightShafts == 2) { currentlightShafts = 0; } Debug.Log(currentlightShafts); lightShafts = (LightShafts)currentlightShafts; if (lightShafts == LightShafts.On) { displayLightShaftsText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } if (lightShafts == LightShafts.Off) { displayLightShaftsText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } ApplyButton.SetActive(value: true); isDisplayChanged = true; } public void SetShadowOnWater(int arrow) { currentShadowOnWater += arrow; if (currentShadowOnWater < 0) { currentShadowOnWater = 1; } if (currentShadowOnWater == 2) { currentShadowOnWater = 0; } shadowOnWater = (ShadowOnWater)currentShadowOnWater; if (shadowOnWater == ShadowOnWater.On) { shadowOnWaterText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } if (shadowOnWater == ShadowOnWater.Off) { shadowOnWaterText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } ApplyButton.SetActive(value: true); isGraphicsChanged = true; } public void SetWaterReflection(int arrow) { } public void SetLineIndicator(int arrow) { currentRealisticLineIndicator += arrow; if (currentRealisticLineIndicator < 0) { currentRealisticLineIndicator = 1; } if (currentRealisticLineIndicator == 2) { currentRealisticLineIndicator = 0; } realisticLineIndicator = (RealisticLineIndicator)currentRealisticLineIndicator; if (realisticLineIndicator == RealisticLineIndicator.On) { RealisticLineIndicatorText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } if (realisticLineIndicator == RealisticLineIndicator.Off) { RealisticLineIndicatorText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } ApplyButton.SetActive(value: true); isDisplayChanged = true; } public void SetHideChat(int arrow) { currentHideChat += arrow; if (currentHideChat < 0) { currentHideChat = 1; } if (currentHideChat == 2) { currentHideChat = 0; } hideChat = (HideChat)currentHideChat; if (hideChat == HideChat.On) { hideChatText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } if (hideChat == HideChat.Off) { hideChatText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } ApplyButton.SetActive(value: true); isDisplayChanged = true; } public void SetMaxFps(int arrow) { currentMaxFPSIndex += arrow; if (currentMaxFPSIndex >= 0) { if (currentMaxFPSIndex > GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].MaxFps.Length - 1) { currentMaxFPSIndex = 0; targetMaxFPS = -1; } else { targetMaxFPS = ((currentMaxFPSIndex >= 1) ? GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].MaxFps[currentMaxFPSIndex] : (-1)); } } else { currentMaxFPSIndex = GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].MaxFps.Length - 1; targetMaxFPS = GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].MaxFps[currentMaxFPSIndex]; } displayMaxFps.text = GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].MaxFps[currentMaxFPSIndex].ToString(); ApplyButton.SetActive(value: true); isGraphicsChanged = true; } public void SetResidenceMusicMode(int arrow) { currentResidenceMusicMode += arrow; if (currentResidenceMusicMode < 0) { currentResidenceMusicMode = 1; } if (currentResidenceMusicMode == 2) { currentResidenceMusicMode = 0; } residenceMusic = (ResidenceMusic)currentResidenceMusicMode; if (residenceMusic == ResidenceMusic.Off) { displayResidenceMusicText.text = LanguageManager.Instance.GetText("SETTINGS_OFF"); } if (residenceMusic == ResidenceMusic.On) { displayResidenceMusicText.text = LanguageManager.Instance.GetText("SETTINGS_ON"); } ApplyButton.SetActive(value: true); isSoundsChanged = true; } public void SetMeshDetail(int value) { currentMeshDetail = Mathf.Clamp(currentMeshDetail + value, 0, 3); SettingChanged(currentMeshDetail, _MeshDetailText); SettingsManager.OnSetMeshDetail?.Invoke(currentMeshDetail); } public void SetWavesDetail(int value) { currentWaveDetail = Mathf.Clamp(currentWaveDetail + value, 0, 3); SettingChanged(currentWaveDetail, _WaveDetailText); SettingsManager.OnSetWavesDetail?.Invoke(currentWaveDetail); } public void SetDynamicWavesDetail(int value) { currentDynamicWavesDetail = Mathf.Clamp(currentDynamicWavesDetail + value, 0, 3); SettingChanged(currentDynamicWavesDetail, _DynamicWavesDetail); SettingsManager.OnSetDynamicWaves?.Invoke(currentDynamicWavesDetail); } public void SetReflectionsLevel(int value) { currentReflectionsLevel = Mathf.Clamp(currentReflectionsLevel + value, 0, 3); SettingChanged(currentReflectionsLevel, _ReflectionDetailText); SettingsManager.OnSetReflectionsLevel?.Invoke(currentReflectionsLevel); } public void SetVolumetricLighting(int value) { currentWaterVolumetricLighting = Mathf.Clamp(currentWaterVolumetricLighting + value, 0, 3); SettingChanged(currentWaterVolumetricLighting, _VolumetricLightingText); SettingsManager.OnSetVolumetricLighting?.Invoke(currentWaterVolumetricLighting); } public void SetCaustic(int value) { currentCausticLevel = Mathf.Clamp(currentCausticLevel + value, 0, 3); SettingChanged(currentCausticLevel, _CausticLightingText); SettingsManager.OnSetCausticLevel?.Invoke(currentCausticLevel); } private void SettingChanged(int qualityMode, Text textMesh) { if (qualityMode == 0) { textMesh.text = LanguageManager.Instance.GetText("SETTINGS_LOW"); } if (qualityMode == 1) { textMesh.text = LanguageManager.Instance.GetText("SETTINGS_MEDIUM"); } if (qualityMode == 2) { textMesh.text = LanguageManager.Instance.GetText("SETTINGS_HIGH"); } if (qualityMode == 3) { textMesh.text = LanguageManager.Instance.GetText("SETTINGS_ULTRA"); } ApplyButton.SetActive(value: true); isGraphicsChanged = true; } public void ApplySettings() { int currentPlayerProfileIndex = GameManager.Instance._playerData.currentPlayerProfileIndex; PlayerPrefs.SetInt("Settings_WaterPlanarMode", currentWaterPlanarMode); PlayerPrefs.SetInt("Settings_WaterSSRMode", currentWaterSSRMode); if (isDisplayChanged) { Singleton.Instance.SettingsData.FOVValue = currentFov; Singleton.Instance.SettingsData.FogIntensityValue = currentintesityFog; Singleton.Instance.SettingsData.GamepadCursorSensitivityValue = currentCursorSensitivity; Singleton.Instance.SettingsData.IsFishCursorEnabled = currentFishCursorMode == 1; Singleton.Instance.SettingsData.IsLightShaftEnabled = currentlightShafts == 1; Singleton.Instance.SettingsData.IsLineIndicatorEnabledOnRealistic = currentRealisticLineIndicator == 1; Singleton.Instance.SettingsData.IsChatEnabled = currentHideChat == 1; Singleton.Instance.SettingsData.TimeConventionIndex = currenttimeZone; Singleton.Instance.SettingsData.LengthUnitIndex = currentunitLength; Singleton.Instance.SettingsData.WeightUnitIndex = currentunitWeight; Singleton.Instance.SettingsData.TemperatureUnitIndex = currentunitTemperature; Singleton.Instance.SettingsData.FloatSizeValue = currentfloatScale; if (FScriptsHandler.Instance != null) { FScriptsHandler.Instance.AffectDisplaySetting(); } isDisplayChanged = false; } if (isControlsChanged) { Singleton.Instance.SettingsData.MouseSensitivityValue = mouseSensitivity.value; Singleton.Instance.SettingsData.GamepadCursorSensitivityValue = cursorSensitivity.value; GameManager.Instance._playerData.Player[currentPlayerProfileIndex].controllerSetup = currentcontrollerSetup; Singleton.Instance.SettingsData.IsMouseYInverted = currentInvertMouse == 1; Singleton.Instance.SettingsData.IsMouseXInverted = currentInvertMouseX == 1; Singleton.Instance.SettingsData.IsSmoothCameraEnabled = currentsmooothcamera == 1; Singleton.Instance.SettingsData.IsControllerVibrationEnabled = currentcontrollerVibration == 1; if (FScriptsHandler.Instance != null) { FScriptsHandler.Instance.AffectControlsSetting(); } isControlsChanged = false; } if (isGraphicsChanged) { bool fullscreen = displayMod == DisplayMode.Fullscreen; Screen.SetResolution(resolutions[currentSetsresolution].width, resolutions[currentSetsresolution].height, fullscreen, resolutions[currentSetsresolution].refreshRate); GameManager.Instance._playerData.Player[GameManager.Instance._playerData.currentPlayerProfileIndex].LastChoosenRefreshRate = resolutions[currentSetsresolution].refreshRate; QualitySettings.SetQualityLevel(currentQualityMode); QualitySettings.masterTextureLimit = currentTextureQualityMode; QualitySettings.vSyncCount = currentVsyncMode; if (currentVsyncMode == 0) { Application.targetFrameRate = targetMaxFPS; } GameManager.Instance._playerData.Player[currentPlayerProfileIndex].shadowOnWater = currentShadowOnWater == 1; Singleton.Instance.SettingsData.TextureQualityModeIndex = currentTextureQualityMode; Singleton.Instance.SettingsData.IsVSyncEnabled = currentVsyncMode == 1; Singleton.Instance.SettingsData.ShadowDistanceValue = currentShadowDistance; Singleton.Instance.SettingsData.MaxFpsIndex = currentMaxFPSIndex; if (FScriptsHandler.Instance != null) { FScriptsHandler.Instance.AffectGraphicsSetting(); } isGraphicsChanged = false; } if (isGraphicsPostprocessingChanged) { Singleton.Instance.SettingsData.IsBlurEnabled = currentBlurMode == 1; Singleton.Instance.SettingsData.BlurUnderwaterSetting = currentBlurUnderwater; Singleton.Instance.SettingsData.IsBloomEnabled = currentBloomMode == 1; Singleton.Instance.SettingsData.IsChromaticAberrationEnabled = currentChromaticMode == 1; Singleton.Instance.SettingsData.AntiAliasingModeIndex = ((currentAaMode > 0) ? currentAaMode : 0); Singleton.Instance.SettingsData.IsAmbientOcclusionEnabled = currentAoMode == 1; if (FScriptsHandler.Instance != null) { FScriptsHandler.Instance.AffectPostProccesingFromSettings(); } isGraphicsPostprocessingChanged = false; } if (isLanguageChanged) { LanguageManager.Instance.SetLanguage(currentLanguageIndex); PlayerPrefs.SetInt("IsSetLanguageManual", currentLanguageIndex); isLanguageChanged = false; } if (isSoundsChanged) { Singleton.Instance.SettingsData.IsResidenceMusicEnabled = currentResidenceMusicMode == 1; if (Singleton.Instance.SettingsData.IsResidenceMusicEnabled) { MasterAudio.UnmuteGroup("mississippi_catfish_loop"); } else { MasterAudio.MuteGroup("mississippi_catfish_loop"); } isSoundsChanged = false; } SettingsManager.OnSettingApply?.Invoke(); ApplyButton.SetActive(value: false); } private void OnDestroy() { ReInput.userDataStore.Save(); Debug.Log("exit settings: " + isSoundsChanged); if (isSoundsChanged) { Singleton.Instance.SettingsData.MasterVolume = currentSoundsVolume; Singleton.Instance.SettingsData.MusicVolume = currentMusicVolume; Singleton.Instance.SettingsData.FXVolume = currentFxSoundsVolume; Singleton.Instance.SettingsData.UnderwaterVolume = currentUnderwaterSoundsVolume; } } }