public static void Load() { Debug.Log("PlayerPreferences.Load"); if (PlayerPreferences.alreadyLoaded) { return; } PlayerPreferences.Preset = ((!CoopPeerStarter.DedicatedHost) ? PlayerPrefs.GetInt("Preset_v16", PlayerPreferences.Preset) : 5); PlayerPreferences.LowMemoryMode = (PlayerPrefs.GetInt("LowMemoryMode", 0) > 0); PlayerPreferences.MemorySafeSaveMode = (PlayerPrefs.GetInt("MemorySafeSaveMode", 0) > 0); PlayerPreferences.GammaWorldAndDay = PlayerPrefs.GetFloat("GammaWorldAndDay", 2f); PlayerPreferences.GammaCavesAndNight = PlayerPrefs.GetFloat("GammaCavesAndNight", 2f); PlayerPreferences.Contrast = PlayerPrefs.GetFloat("Contrast", 1f); PlayerPreferences.Volume = PlayerPrefs.GetFloat("Volume", 0.5f); PlayerPreferences.MusicVolume = PlayerPrefs.GetFloat("MusicVolume", 1f); PlayerPreferences.MicrophoneVolume = PlayerPrefs.GetFloat("MicrophoneVolume", 5f); PlayerPreferences.VoiceCount = PlayerPrefs.GetInt("VoiceCount", 128); PlayerPreferences.MouseInvert = (PlayerPrefs.GetInt("MouseInvert", 0) > 0); PlayerPreferences.MouseSensitivityX = PlayerPrefs.GetFloat("MouseSensitivity", 0.5f); PlayerPreferences.MouseSensitivityY = PlayerPrefs.GetFloat("MouseSensitivityY", PlayerPrefs.GetFloat("MouseSensitivity", 0.5f)); PlayerPreferences.MouseSmoothing = PlayerPrefs.GetFloat("MouseSmoothing2", 0.1f); PlayerPreferences.Fov = PlayerPrefs.GetFloat("Fov", 75f); PlayerPreferences.MaxFrameRate = PlayerPrefs.GetInt("MaxFrameRate2", -1); PlayerPreferences.ApplyMaxFrameRate(); PlayerPreferences.SetLowQualityPhysics(PlayerPrefs.GetInt("LowQualityPhysics", 0) > 0); PlayerPreferences.Language = PlayerPrefs.GetString("Language", "English"); PlayerPreferences.SetGhostTint(PlayerPrefs.GetInt("GhostTint", 0), PlayerPrefs.GetFloat("GhostTintOpacity", 0.0784f)); PlayerPreferences.ColorGrading = PlayerPrefs.GetInt("ColorGrading", 0); PlayerPreferences.VSync = (PlayerPrefs.GetInt("VSync", QualitySettings.vSyncCount) > 0); PlayerPreferences.ShowHud = (PlayerPrefs.GetInt("ShowHud", 1) > 0); PlayerPreferences.ShowOverlayIcons = (PlayerPrefs.GetInt("ShowOverlayIcons", 1) > 0); PlayerPreferences.OverlayIconsGrouping = (PlayerPrefs.GetInt("OverlayIconsGroupingV2", 1) > 0); PlayerPreferences.ShowProjectileReticle = (PlayerPrefs.GetInt("ShowProjectileReticle", 1) > 0); PlayerPreferences.UseXInput = (PlayerPrefs.GetInt("UseXInputV2", 1) > 0); PlayerPreferences.ShowPlayerNamesMP = (PlayerPrefs.GetInt("ShowPlayerNamesMP", 1) > 0); PlayerPreferences.ShowStealthMeter = (PlayerPrefs.GetInt("ShowStealthMeter", 1) > 0); PlayerPreferences.UseCrouchToggle = (PlayerPrefs.GetInt("UseCrouchToggle", 0) > 0); PlayerPreferences.UseSprintToggle = (PlayerPrefs.GetInt("UseSprintToggle", 0) > 0); PlayerPreferences.UseGamepadRumble = (PlayerPrefs.GetInt("UseGamepadRumble", 1) > 0); if (!CoopPeerStarter.DedicatedHost) { PlayerPreferences.TreeRegrowthLocal = (PlayerPrefs.GetInt("TreeRegrowth", 0) > 0); PlayerPreferences.NoDestructionLocal = (PlayerPrefs.GetInt("NoDestruction", 0) > 0); PlayerPreferences.AllowEnemiesCreative = (PlayerPrefs.GetInt("AllowEnemiesCreative", 0) > 0); PlayerPreferences.CheatsAllowed = (PlayerPrefs.GetInt("CheatsAllowed", 0) > 0); } PlayerPreferences.ExWallAutofill = (PlayerPrefs.GetInt("ExWallAutofill", 1) > 0); PlayerPreferences.ExFloorsAutofill = (PlayerPrefs.GetInt("ExFloorsAutofill", 1) > 0); if (!TheForestQualitySettings.Load()) { TheForestQualitySettings.CopyPreset(-1); } QualitySettings.SetQualityLevel((int)TheForestQualitySettings.UserSettings.ShadowLevel); if (!TheForestQualitySettings.Load()) { TheForestQualitySettings.CopyPreset(-1); } PlayerPreferences.ApplyValues(); PlayerPreferences.alreadyLoaded = true; }
public static void Load() { Debug.Log("PlayerPreferences.Load"); if (PlayerPreferences.alreadyLoaded) { return; } PlayerPreferences.Preset = PlayerPrefs.GetInt("Preset_v16", PlayerPreferences.Preset); PlayerPreferences.LowMemoryMode = (PlayerPrefs.GetInt("LowMemoryMode", 0) > 0); PlayerPreferences.Brightness = PlayerPrefs.GetFloat("Brightness", 0.5f); PlayerPreferences.Volume = PlayerPrefs.GetFloat("Volume", 0.5f); PlayerPreferences.MusicVolume = PlayerPrefs.GetFloat("MusicVolume", 1f); PlayerPreferences.VoiceCount = PlayerPrefs.GetInt("VoiceCount", 128); PlayerPreferences.MouseInvert = (PlayerPrefs.GetInt("MouseInvert", (!PlayerPreferences.MouseInvert) ? 0 : 1) > 0); PlayerPreferences.MouseSensitivity = PlayerPrefs.GetFloat("MouseSensitivity", 0.5f); PlayerPreferences.Fov = PlayerPrefs.GetFloat("Fov", 75f); int @int = PlayerPrefs.GetInt("MaxFrameRate2", -1); Application.targetFrameRate = @int; PlayerPreferences.MaxFrameRate = @int; PlayerPreferences.VSync = (PlayerPrefs.GetInt("VSync", QualitySettings.vSyncCount) > 0); PlayerPreferences.ShowHud = (PlayerPrefs.GetInt("ShowHud", 1) > 0); PlayerPreferences.ShowOverlayIcons = (PlayerPrefs.GetInt("ShowOverlayIcons", 1) > 0); PlayerPreferences.ShowProjectileReticle = (PlayerPrefs.GetInt("ShowProjectileReticle", 1) > 0); PlayerPreferences.UseXInput = (PlayerPrefs.GetInt("UseXInput", 0) > 0); PlayerPreferences.ShowPlayerNamesMP = (PlayerPrefs.GetInt("ShowPlayerNamesMP", 1) > 0); PlayerPreferences.ShowStealthMeter = (PlayerPrefs.GetInt("ShowStealthMeter", 1) > 0); PlayerPreferences.UseCrouchToggle = (PlayerPrefs.GetInt("UseCrouchToggle", 0) > 0); if (!TheForestQualitySettings.Load()) { TheForestQualitySettings.CopyPreset(-1); } QualitySettings.SetQualityLevel((int)TheForestQualitySettings.UserSettings.ShadowLevel); if (!TheForestQualitySettings.Load()) { TheForestQualitySettings.CopyPreset(-1); } PlayerPreferences.ApplyValues(); PlayerPreferences.alreadyLoaded = true; }
public static void Load() { UnityEngine.Debug.Log("PlayerPreferences.Load"); if (PlayerPreferences.alreadyLoaded) { return; } PlayerPreferences.Preset = PlayerPreferences.GetPreset(); PlayerPreferences.LowMemoryMode = (PlayerPrefs.GetInt("LowMemoryMode", 0) > 0); PlayerPreferences.MemorySafeSaveMode = (PlayerPrefs.GetInt("MemorySafeSaveMode", 0) > 0); PlayerPreferences.GammaWorldAndDay = PlayerPrefs.GetFloat("GammaWorldAndDay", 2f); PlayerPreferences.GammaCavesAndNight = PlayerPrefs.GetFloat("GammaCavesAndNight", 2f); PlayerPreferences.Contrast = PlayerPrefs.GetFloat("Contrast", 1f); if (ForestVR.Enabled) { PlayerPreferences.SetAudioDriver(PlayerPrefs.GetString((!ForestVR.Enabled) ? "AudioDriver" : "AudioDriverVR", string.Empty), -1); } PlayerPreferences.Volume = PlayerPrefs.GetFloat("Volume", 0.5f); PlayerPreferences.MusicVolume = PlayerPrefs.GetFloat("MusicVolume", 1f); PlayerPreferences.MicrophoneVolume = PlayerPrefs.GetFloat("MicrophoneVolume", 5f); PlayerPreferences.VoiceCount = PlayerPrefs.GetInt("VoiceCount", 128); PlayerPreferences.MouseInvert = (PlayerPrefs.GetInt("MouseInvert", 0) > 0); PlayerPreferences.MouseSensitivityX = PlayerPrefs.GetFloat("MouseSensitivity", 0.5f); PlayerPreferences.MouseSensitivityY = PlayerPrefs.GetFloat("MouseSensitivityY", PlayerPrefs.GetFloat("MouseSensitivity", 0.5f)); PlayerPreferences.MouseSmoothing = PlayerPrefs.GetFloat("MouseSmoothing2", 0.1f); PlayerPreferences.Fov = PlayerPrefs.GetFloat("Fov", 75f); PlayerPreferences.MaxFrameRate = PlayerPrefs.GetInt("MaxFrameRate2", -1); PlayerPreferences.ApplyMaxFrameRate(); PlayerPreferences.SetLowQualityPhysics(PlayerPrefs.GetInt("LowQualityPhysics", 0) > 0); PlayerPreferences.Language = PlayerPrefs.GetString("Language", "English"); PlayerPreferences.SetGhostTint(PlayerPrefs.GetInt("GhostTint", 0), PlayerPrefs.GetFloat("GhostTintOpacity", 0.0784f)); PlayerPreferences.ColorGrading = PlayerPrefs.GetInt("ColorGrading", 0); PlayerPreferences.VSync = (PlayerPrefs.GetInt("VSync", QualitySettings.vSyncCount) > 0); PlayerPreferences.ShowHud = (PlayerPrefs.GetInt("ShowHud", 1) > 0); PlayerPreferences.ShowOverlayIcons = (PlayerPrefs.GetInt("ShowOverlayIcons", 1) > 0); PlayerPreferences.OverlayIconsGrouping = (PlayerPrefs.GetInt("OverlayIconsGroupingV2", 1) > 0); PlayerPreferences.ShowProjectileReticle = (PlayerPrefs.GetInt("ShowProjectileReticle", 1) > 0); PlayerPreferences.UseXInput = (PlayerPrefs.GetInt("UseXInputV2", 1) > 0); PlayerPreferences.ShowPlayerNamesMP = (PlayerPrefs.GetInt("ShowPlayerNamesMP", 1) > 0); PlayerPreferences.ShowStealthMeter = (PlayerPrefs.GetInt("ShowStealthMeter", 1) > 0); PlayerPreferences.UseCrouchToggle = (PlayerPrefs.GetInt("UseCrouchToggle", 0) > 0); PlayerPreferences.UseSprintToggle = (PlayerPrefs.GetInt("UseSprintToggle", 0) > 0); PlayerPreferences.UseGamepadRumble = (PlayerPrefs.GetInt("UseGamepadRumble", 1) > 0); if (!CoopPeerStarter.DedicatedHost) { PlayerPreferences.TreeRegrowthLocal = (PlayerPrefs.GetInt("TreeRegrowth", 0) > 0); PlayerPreferences.NoDestructionLocal = (PlayerPrefs.GetInt("NoDestruction", 0) > 0); PlayerPreferences.AllowEnemiesCreative = (PlayerPrefs.GetInt("AllowEnemiesCreative", 0) > 0); PlayerPreferences.CheatsAllowed = (PlayerPrefs.GetInt("CheatsAllowed", 0) > 0); } PlayerPreferences.ExWallAutofill = (PlayerPrefs.GetInt("ExWallAutofill", 1) > 0); PlayerPreferences.ExFloorsAutofill = (PlayerPrefs.GetInt("ExFloorsAutofill", 1) > 0); PlayerPreferences.VRTurnSnap = PlayerPrefs.GetInt("VRTurnSnap", PlayerPreferences.VRTurnSnap); PlayerPreferences.VRMoveDarkening = (PlayerPreferences.VRMoveDarkeningTypes)PlayerPrefs.GetInt("VRMoveDarkening", (int)PlayerPreferences.VRMoveDarkening); PlayerPreferences.VRAntiAliasing = (PlayerPreferences.VRAntiAliasingTypes)PlayerPrefs.GetInt("VRAntiAliasing", (int)PlayerPreferences.VRAntiAliasing); PlayerPreferences.VRUsePhysicalCrouching = (PlayerPrefs.GetInt("VRUsePhysicalCrouching", (!PlayerPreferences.VRUsePhysicalCrouching) ? 0 : 1) > 0); PlayerPreferences.VRForwardMovement = (PlayerPreferences.VRForwardDirectionTypes)PlayerPrefs.GetInt("VRForwardMovement", (int)PlayerPreferences.VRForwardMovement); PlayerPreferences.VRAutoRun = (PlayerPrefs.GetInt("VRAutoRun", (!PlayerPreferences.VRAutoRun) ? 0 : 1) > 0); PlayerPreferences.VRUseRightHandedBow = (PlayerPrefs.GetInt("VRUseRightHandedBow", (!PlayerPreferences.VRUseRightHandedBow) ? 0 : 1) > 0); PlayerPreferences.VRUseRightHandedWeapon = (PlayerPrefs.GetInt("VRUseRightHandedWeapon", (!PlayerPreferences.VRUseRightHandedWeapon) ? 0 : 1) > 0); if (!TheForestQualitySettings.Load()) { TheForestQualitySettings.CopyPreset(-1); } TheForestQualitySettings.SetUnityQualityFromShadowLevel(TheForestQualitySettings.UserSettings.ShadowLevel); if (!TheForestQualitySettings.Load()) { TheForestQualitySettings.CopyPreset(-1); } PlayerPreferences.ApplyValues(); PlayerPreferences.alreadyLoaded = true; }