public void OnAutoMeshQualityToggleChanged() { meshQualityText.text = autoMeshQualityToggle.isOn ? "Auto" : Settings.MeshQualityValues[generalSettings.MeshQuality]; generalSettings.AutoMeshQuality = autoMeshQualityToggle.isOn; UserInterfaceEvents.RaiseGeneralSettingsUpdated(generalSettings); PlayerPrefs.SetInt(playerPrefsAutoMeshQualityKey, autoMeshQualityToggle.isOn ? 1 : 0); }
public void SetLightIntensity(int intensity) { int startLighIntensity = lightIntensity; lightIntensity = Mathf.Clamp(intensity, Settings.MinLightIntensity, Settings.MaxLightIntensity); if (lightIntensity != startLighIntensity) { lightIntensityText.text = lightIntensity.ToString(); generalSettings.LightIntensity = (float)(lightIntensity - Settings.MinLightIntensity) / (float)(Settings.MaxLightIntensity - Settings.MinLightIntensity); UserInterfaceEvents.RaiseGeneralSettingsUpdated(generalSettings); PlayerPrefs.SetInt(playerPrefsLightIntensityKey, lightIntensity); } }
public void SetMeshQuality(int meshQuality) { if (autoMeshQualityToggle.isOn || generalSettings.MeshQuality > Settings.MeshQualityValues.Length - 1 || generalSettings.MeshQuality < 0) { return; } generalSettings.MeshQuality = meshQuality; meshQualityText.text = Settings.MeshQualityValues[generalSettings.MeshQuality]; UserInterfaceEvents.RaiseGeneralSettingsUpdated(generalSettings); PlayerPrefs.SetInt(playerPrefsMeshQualityKey, generalSettings.MeshQuality); }
public void SetMoleculeMovementSpeed(int speed) { int startSpeed = moleculeMovementSpeed; moleculeMovementSpeed = Mathf.Clamp(speed, Settings.MinMoleculeMovementSpeed, Settings.MaxMoleculeMovementSpeed); if (moleculeMovementSpeed != startSpeed) { moleculeMovementSpeedText.text = moleculeMovementSpeed.ToString(); generalSettings.MoleculeInputSensitivity = (float)(moleculeMovementSpeed - Settings.MinMoleculeMovementSpeed) / (float)(Settings.MaxMoleculeMovementSpeed - Settings.MinMoleculeMovementSpeed); UserInterfaceEvents.RaiseGeneralSettingsUpdated(generalSettings); PlayerPrefs.SetInt(playerPrefsMoleculeMovementSpeedKey, moleculeMovementSpeed); } }
public void SetAutoRotateSpeed(int speed) { int startSpeed = autoRotateSpeed; autoRotateSpeed = Mathf.Clamp(speed, Settings.MinAutoRotateSpeed, Settings.MaxAutoRotateSpeed); if (autoRotateSpeed != startSpeed) { autoRotateSpeedText.text = autoRotateSpeed.ToString(); generalSettings.AutoRotateSpeed = (float)(autoRotateSpeed - Settings.MinAutoRotateSpeed) / (float)(Settings.MaxAutoRotateSpeed - Settings.MinAutoRotateSpeed); UserInterfaceEvents.RaiseGeneralSettingsUpdated(generalSettings); PlayerPrefs.SetInt(playerPrefsAutoRotateKey, autoRotateSpeed); } }
public void SetSceneSettings(GeneralSettings settings) { generalSettings = settings; if (PlayerPrefs.HasKey(playerPrefsMainLightKey)) { generalSettings.MainLightsOn = PlayerPrefs.GetInt(playerPrefsMainLightKey) > 0 ? true : false; } if (PlayerPrefs.HasKey(playerPrefsFillLightKey)) { generalSettings.FillLightsOn = PlayerPrefs.GetInt(playerPrefsFillLightKey) > 0 ? true : false; } if (PlayerPrefs.HasKey(playerPrefsAmbientLightKey)) { generalSettings.AmbientLightsOn = PlayerPrefs.GetInt(playerPrefsAmbientLightKey) > 0 ? true : false; } if (PlayerPrefs.HasKey(playerPrefsShadowsKey)) { generalSettings.ShowShadows = PlayerPrefs.GetInt(playerPrefsShadowsKey) > 0 ? true : false; } if (PlayerPrefs.HasKey(playerPrefsGroundKey)) { generalSettings.ShowGround = PlayerPrefs.GetInt(playerPrefsGroundKey) > 0 ? true : false; } if (PlayerPrefs.HasKey(playerPrefsLightIntensityKey)) { lightIntensity = PlayerPrefs.GetInt(playerPrefsLightIntensityKey); generalSettings.LightIntensity = (float)(lightIntensity - Settings.MinLightIntensity) / (float)(Settings.MaxLightIntensity - Settings.MinLightIntensity); } else { lightIntensity = (int)((generalSettings.LightIntensity * (float)(Settings.MaxLightIntensity - Settings.MinLightIntensity)) + Settings.MinLightIntensity); } if (PlayerPrefs.HasKey(playerPrefsAutoMeshQualityKey)) { generalSettings.AutoMeshQuality = PlayerPrefs.GetInt(playerPrefsAutoMeshQualityKey) > 0 ? true : false; } if (PlayerPrefs.HasKey(playerPrefsMeshQualityKey)) { generalSettings.MeshQuality = PlayerPrefs.GetInt(playerPrefsMeshQualityKey); } if (PlayerPrefs.HasKey(playerPrefsAutoRotateKey)) { autoRotateSpeed = PlayerPrefs.GetInt(playerPrefsAutoRotateKey); generalSettings.AutoRotateSpeed = (float)(autoRotateSpeed - Settings.MinAutoRotateSpeed) / (float)(Settings.MaxAutoRotateSpeed - Settings.MinAutoRotateSpeed); } else { autoRotateSpeed = (int)((generalSettings.AutoRotateSpeed * (float)(Settings.MaxAutoRotateSpeed - Settings.MinAutoRotateSpeed)) + Settings.MinAutoRotateSpeed); } if (PlayerPrefs.HasKey(playerPrefsSpaceNavigatorCameraControlKey)) { generalSettings.SpaceNavigatorCameraControlEnabled = PlayerPrefs.GetInt(playerPrefsSpaceNavigatorCameraControlKey) > 0 ? true : false; } if (PlayerPrefs.HasKey(playerPrefsSpaceNavigatorMoleculeControlKey)) { generalSettings.SpaceNavigatorMoleculeControlEnabled = PlayerPrefs.GetInt(playerPrefsSpaceNavigatorMoleculeControlKey) > 0 ? true : false; } if (PlayerPrefs.HasKey(playerPrefsMoleculeMovementSpeedKey)) { moleculeMovementSpeed = PlayerPrefs.GetInt(playerPrefsMoleculeMovementSpeedKey); generalSettings.MoleculeInputSensitivity = (float)(moleculeMovementSpeed - Settings.MinMoleculeMovementSpeed) / (float)(Settings.MaxMoleculeMovementSpeed - Settings.MinMoleculeMovementSpeed); } else { moleculeMovementSpeed = (int)((generalSettings.MoleculeInputSensitivity * (float)(Settings.MaxMoleculeMovementSpeed - Settings.MinMoleculeMovementSpeed)) + Settings.MinMoleculeMovementSpeed); } groundToggle.isOn = generalSettings.ShowGround; shadowsToggle.isOn = generalSettings.ShowShadows; mainLightsToggle.isOn = generalSettings.MainLightsOn; fillLightsToggle.isOn = generalSettings.FillLightsOn; ambientLightsToggle.isOn = generalSettings.AmbientLightsOn; lightIntensityText.text = lightIntensity.ToString(); autoRotateSpeedText.text = autoRotateSpeed.ToString(); moleculeMovementSpeedText.text = moleculeMovementSpeed.ToString(); spaceNavigatorCameraControlToggle.isOn = generalSettings.SpaceNavigatorCameraControlEnabled; spaceNavigatorMoleculeControlToggle.isOn = generalSettings.SpaceNavigatorMoleculeControlEnabled; autoMeshQualityToggle.isOn = generalSettings.AutoMeshQuality; generalSettings.MeshQuality = Mathf.Clamp(generalSettings.MeshQuality, 0, Settings.MeshQualityValues.Length - 1); meshQualityText.text = generalSettings.AutoMeshQuality ? "Auto" : Settings.MeshQualityValues[generalSettings.MeshQuality]; UserInterfaceEvents.RaiseGeneralSettingsUpdated(generalSettings); }
public void OnSpaceNavigatorMoleculeControlChanged() { generalSettings.SpaceNavigatorMoleculeControlEnabled = spaceNavigatorMoleculeControlToggle.isOn; UserInterfaceEvents.RaiseGeneralSettingsUpdated(generalSettings); PlayerPrefs.SetInt(playerPrefsSpaceNavigatorMoleculeControlKey, spaceNavigatorMoleculeControlToggle.isOn ? 1 : 0); }
public void OnAmbientLightsToggleChanged() { generalSettings.AmbientLightsOn = ambientLightsToggle.isOn; UserInterfaceEvents.RaiseGeneralSettingsUpdated(generalSettings); PlayerPrefs.SetInt(playerPrefsAmbientLightKey, ambientLightsToggle.isOn ? 1 : 0); }
public void OnFillLightsToggleChanged() { generalSettings.FillLightsOn = fillLightsToggle.isOn; UserInterfaceEvents.RaiseGeneralSettingsUpdated(generalSettings); PlayerPrefs.SetInt(playerPrefsFillLightKey, fillLightsToggle.isOn ? 1 : 0); }
public void OnShadowsToggleChanged() { generalSettings.ShowShadows = shadowsToggle.isOn; UserInterfaceEvents.RaiseGeneralSettingsUpdated(generalSettings); PlayerPrefs.SetInt(playerPrefsShadowsKey, shadowsToggle.isOn ? 1 : 0); }
public void OnGroundToggleChanged() { generalSettings.ShowGround = groundToggle.isOn; UserInterfaceEvents.RaiseGeneralSettingsUpdated(generalSettings); PlayerPrefs.SetInt(playerPrefsGroundKey, groundToggle.isOn ? 1 : 0); }