Exemple #1
0
        public void VideoRefresh(PlayerPreferences.VideoPrefs videoPrefs)
        {
            if (!Initialized || mRefreshingVideo || mFinished)
            {
                return;
            }

            mRefreshingVideo = true;

            VideoFullScreen.isChecked             = (videoPrefs.Fullscreen);
            VideoReduceTextureVariation.isChecked = videoPrefs.StructureReduceTextureVariation;
            VideoResolutionLabel.text             = (videoPrefs.ResolutionWidth.ToString() + " x " + videoPrefs.ResolutionHeight.ToString());
            VideoFOVLabel.text                   = videoPrefs.FieldOfView.ToString();
            VideoLighting.sliderValue            = ((float)videoPrefs.AdjustBrightness) / 100;
            VideoAmbientLightAtNight.sliderValue = videoPrefs.NightAmbientLightBooster;
            VideoVSync.isChecked                 = videoPrefs.VSync;

            #region labels
            string textureResolution = string.Empty;
            switch (videoPrefs.TextureResolution)
            {
            case 0:
                textureResolution = "Full Res";
                break;

            case 1:
                textureResolution = "Half Res";
                break;

            case 2:
                textureResolution = "Quarter Res";
                break;

            case 3:
                textureResolution = "Eighth Res";
                break;

            default:
                break;
            }
            VideoTextureResolutionLabel.text = textureResolution;

            string lodSetting = string.Empty;
            switch (videoPrefs.LodDistance)
            {
            case 0:
                lodSetting = "Very close";
                break;

            case 1:
                lodSetting = "Close";
                break;

            case 2:
                lodSetting = "Moderate";
                break;

            case 3:
                lodSetting = "Far";
                break;

            case 4:
                lodSetting = "Very Far";
                break;

            case 5:
                lodSetting = "Ultra";
                break;

            default:
                break;
            }
            VideoLODDistanceBiasLabel.text = lodSetting;

            string shadowSetting = string.Empty;
            switch (videoPrefs.Shadows)
            {
            case 0:
                shadowSetting = "Off";
                break;

            case 1:
                shadowSetting = "Low";
                break;

            case 2:
                shadowSetting = "Moderate";
                break;

            case 3:
                shadowSetting = "High";
                break;

            case 4:
                shadowSetting = "Very High";
                break;

            case 5:
                shadowSetting = "Ultra";
                break;
            }
            VideoShadowLabel.text = shadowSetting;
            #endregion

            VideoFieldOfView.sliderValue = (videoPrefs.FieldOfView - VideoFovMin) / (VideoFovMax - VideoFovMin);

            VideoTerrainTreeBillboardDistance.sliderValue = (videoPrefs.TerrainTreeBillboardDistance - TreeBillboardDistMin) / (TreeBillboardDistMax - TreeBillboardDistMin);
            VideoTerrainGrassDensity.sliderValue          = videoPrefs.TerrainGrassDensity;
            VideoTerrainGrassDistance.sliderValue         = (videoPrefs.TerrainGrassDistance - GrassDistMin) / (GrassDistMax - GrassDistMin);
            VideoTerrainTerrainDetail.sliderValue         = 1.0f - (videoPrefs.TerrainDetail - TerrainDetailMin) / (TerrainDetailMax - TerrainDetailMin);
            VideoTerrainMaxMeshTrees.sliderValue          = (float)(videoPrefs.TerrainMaxMeshTrees - MaxMeshTreesMin) / (MaxMeshTreesMax - MaxMeshTreesMin);
            VideoTerrainTreeDistance.sliderValue          = videoPrefs.TerrainTreeDistance;
            float varieties = Mathf.Clamp((float)videoPrefs.TerrainMaxDetailLayers / VideoTerrainMaxGrassVarieties.numberOfSteps, 1f / VideoTerrainMaxGrassVarieties.numberOfSteps, 1f);
            VideoTerrainMaxGrassVarieties.sliderValue = varieties;
            VideoTerrainMaxMeshTreesLabel.text        = "Max Mesh Trees: " + videoPrefs.TerrainMaxMeshTrees.ToString();
            VideoTerrainReduceTreeVariation.isChecked = TempVideoPrefs.TerrainReduceTreeVariation;
            if (Profile.Get.HasCurrentGame && Profile.Get.CurrentGame.HasStarted)
            {
                VideoTerrainReduceTreeVariationLabel.text = "(Requires restart)";
            }
            else
            {
                VideoTerrainReduceTreeVariationLabel.text = string.Empty;
            }

            VideoPostFXBloom.isChecked     = videoPrefs.PostFXBloom;
            VideoPostFXSSAO.isChecked      = videoPrefs.PostFXSSAO;
            VideoPostFXGodRays.isChecked   = videoPrefs.PostFXGodRays;
            VideoPostFXGrain.isChecked     = videoPrefs.PostFXGrain;
            VideoPostFXMBlur.isChecked     = videoPrefs.PostFXMBlur;
            VideoPostFXAA.isChecked        = videoPrefs.PostFXAA;
            VideoPostFXGlobalFog.isChecked = videoPrefs.PostFXGlobalFog;
            VideoShadowObjects.isChecked   = videoPrefs.ObjectShadows;
            VideoShadowStructure.isChecked = videoPrefs.StructureShadows;
            VideoShadowTerrain.isChecked   = videoPrefs.TerrainShadows;

            VRStaticCutsceneCamerasCheckbox.isChecked   = videoPrefs.VRStaticCameraCutscenes;
            VRStaticFastTravelCamerasCheckbox.isChecked = videoPrefs.VRStaticCameraFastTravel;
            VRDisableScreenEffectsCheckbox.isChecked    = videoPrefs.VRDisableScreenEffects;
            VRDisableExtraGrassLayersCheckbox.isChecked = videoPrefs.VRDisableExtraGrassLayers;

            OculusModeCheckbox.isChecked = videoPrefs.OculusMode;

            if (VRManager.VRDeviceAvailable)
            {
                OculusModeLabelEnabled.enabled  = true;
                OculusModeLabelDisabled.enabled = false;
                                #if UNITY_EDITOR
                if (VRManager.VRMode | VRManager.VRTestingMode)
                {
                                #else
                if (VRManager.VRMode)
                {
                                #endif
                    VRDisableScreenEffectsCheckbox.gameObject.SetActive(true);
                    VRStaticCutsceneCamerasCheckbox.gameObject.SetActive(true);
                    VRStaticFastTravelCamerasCheckbox.gameObject.SetActive(true);
                    VRDisableExtraGrassLayersCheckbox.gameObject.SetActive(true);
                }
                else
                {
                    VRDisableScreenEffectsCheckbox.gameObject.SetActive(false);
                    VRStaticCutsceneCamerasCheckbox.gameObject.SetActive(false);
                    VRStaticFastTravelCamerasCheckbox.gameObject.SetActive(false);
                    VRDisableExtraGrassLayersCheckbox.gameObject.SetActive(false);
                }
            }
            else
            {
                OculusModeLabelEnabled.enabled  = false;
                OculusModeLabelDisabled.enabled = true;
                VRDisableScreenEffectsCheckbox.gameObject.SetActive(false);
                VRStaticCutsceneCamerasCheckbox.gameObject.SetActive(false);
                VRStaticFastTravelCamerasCheckbox.gameObject.SetActive(false);
                VRDisableExtraGrassLayersCheckbox.gameObject.SetActive(false);
            }

            if (mMadeVideoChanges)
            {
                VideoApplyButton.SendMessage("SetEnabled", SendMessageOptions.DontRequireReceiver);
            }
            else
            {
                VideoApplyButton.SendMessage("SetDisabled", SendMessageOptions.DontRequireReceiver);
            }

            //Profile.Get.CurrentPreferences.Video = TempVideoPrefs;
            mRefreshingVideo = false;
        }
Exemple #2
0
        public override void PushEditObjectToNGUIObject()
        {
            VideoFovMin          = Globals.FOVMin;
            VideoFovMax          = Globals.FOVMax;
            MaxMeshTreesMin      = Globals.ChunkTerrainMaxMeshTreesMin;
            MaxMeshTreesMax      = Globals.ChunkTerrainMaxMeshTreesMax;
            TreeBillboardDistMin = Globals.ChunkTerrainTreeBillboardDistMin;
            TreeBillboardDistMax = Globals.ChunkTerrainTreeBillboardDistMax;
            GrassDistMax         = Globals.ChunkTerrainGrassDistanceMax;
            GrassDistMin         = Globals.ChunkTerrainGrassDistanceMin;
            TerrainDetailMax     = Globals.ChunkTerrainDetailMax;
            TerrainDetailMin     = Globals.ChunkTerrainDetailMin;
            VideoTerrainReduceTreeVariation.functionName = "OnTerrainSettingChange";
            VideoTerrainMaxGrassVarieties.functionName   = "OnTerrainSettingChange";

            SoundGeneral.functionName           = "OnSoundLevelChange";
            SoundMusic.functionName             = "OnSoundLevelChange";
            SoundFX.functionName                = "OnSoundLevelChange";
            SoundAmbient.functionName           = "OnSoundLevelChange";
            SoundInterface.functionName         = "OnSoundLevelChange";
            SfxSoundFootstep.functionName       = "OnSoundLevelChange";
            SfxSoundPlayerVoice.functionName    = "OnSoundLevelChange";
            SfxSoundDynamicObjects.functionName = "OnSoundLevelChange";
            SfxSoundCreaturs.functionName       = "OnSoundLevelChange";

            ImmersionCrosshairAlphaSlider.functionName          = "OnImmersionSettingChange";
            ImmersionCrosshairAlphaSlider.eventReceiver         = gameObject;
            ImmersionCrosshairInactiveAlphaSlider.functionName  = "OnImmersionSettingChange";
            ImmersionCrosshairInactiveAlphaSlider.eventReceiver = gameObject;
            ImmersionWorldItemsOverlay.functionName             = "OnImmersionSettingChange";
            ImmersionWorldItemsOverlay.eventReceiver            = gameObject;
            ImmersionPathGlowIntensitySlider.functionName       = "OnImmersionSettingChange";
            ImmersionPathGlowIntensitySlider.eventReceiver      = gameObject;
            ImmersionSpecialObjectsOverlay.functionName         = "OnImmersionSettingChange";
            ImmersionSpecialObjectsOverlay.eventReceiver        = gameObject;
            ImmersionWorldItemHUD.functionName             = "OnImmersionSettingChange";
            ImmersionWorldItemHUD.eventReceiver            = gameObject;
            ImmersionWorldItemHUDInCenter.functionName     = "OnImmersionSettingChange";
            ImmersionWorldItemHUDInCenter.eventReceiver    = gameObject;
            ImmersionPathGlowIntensitySlider.functionName  = "OnImmersionSettingChange";
            ImmersionPathGlowIntensitySlider.eventReceiver = gameObject;
            ImmersionCameraSmoothingSlider.functionName    = "OnImmersionSettingChange";
            ImmersionCameraSmoothingSlider.eventReceiver   = gameObject;

            OculusModeCheckbox.functionName                 = "OnClickVideoCheckbox";
            OculusModeCheckbox.eventReceiver                = gameObject;
            VRDisableScreenEffectsCheckbox.functionName     = "OnClickVideoCheckbox";
            VRDisableScreenEffectsCheckbox.eventReceiver    = gameObject;
            VRStaticCutsceneCamerasCheckbox.functionName    = "OnClickVideoCheckbox";
            VRStaticCutsceneCamerasCheckbox.eventReceiver   = gameObject;
            VRStaticFastTravelCamerasCheckbox.functionName  = "OnClickVideoCheckbox";
            VRStaticFastTravelCamerasCheckbox.eventReceiver = gameObject;
            VRDisableExtraGrassLayersCheckbox.functionName  = "OnClickVideoCheckbox";
            VRDisableExtraGrassLayersCheckbox.eventReceiver = gameObject;

            Tabs.Initialize(this);

            Initialized = true;

            TempVideoPrefs = ObjectClone.Clone <PlayerPreferences.VideoPrefs>(Profile.Get.CurrentPreferences.Video);
            TempVideoPrefs.RefreshPostFX();
            TempVideoPrefs.RefreshSupportedResolutions();
            VideoRefresh(TempVideoPrefs);
            SoundRefresh();
            ImmersionRefresh();
            AccessibilityRefresh();
        }