Exemplo n.º 1
0
        public SettingsAssetConfig GetSettingsAssetConfig()
        {
            var assetpath = assetPath + "SettingsAssetConfig.asset";
            SettingsAssetConfig asset;

            if (System.IO.File.Exists(assetpath))
            {
                asset = UnityEditor.AssetDatabase.LoadAssetAtPath <SettingsAssetConfig>(assetpath);
            }
            else
            {
                asset                   = new SettingsAssetConfig();
                asset.mSixDofMode       = SixDofMode.Head_3Dof_Ctrl_6Dof;
                asset.mSleepTimeoutMode = SleepTimeoutMode.NEVER_SLEEP;
                asset.mHeadControl      = HeadControl.GazeApplication;
                asset.mTextureQuality   = TextureQuality.Best;
                asset.mTextureMSAA      = TextureMSAA.MSAA_2X;
                UnityEditor.AssetDatabase.CreateAsset(asset, assetpath);
            }

            return(asset);
        }
Exemplo n.º 2
0
        /// @cond HIDDEN
        public override void OnInspectorGUI()
        {
            GUI.changed = false;

            GUIStyle headingStyle = new GUIStyle(GUI.skin.label);

            headingStyle.fontStyle = FontStyle.Bold;

            NxrViewer nvrViewer = (NxrViewer)target;

            EditorGUILayout.LabelField("General Settings", headingStyle);

            // 读取Config
            SettingsAssetConfig asset = NxrSDKApi.Instance.GetSettingsAssetConfig();

            nvrViewer.SixDofMode     = asset.mSixDofMode;
            nvrViewer.SleepMode      = asset.mSleepTimeoutMode;
            nvrViewer.HeadControl    = asset.mHeadControl;
            nvrViewer.TextureQuality = asset.mTextureQuality;
            nvrViewer.TextureMSAA    = asset.mTextureMSAA;
            // 读取Config

#if UNITY_ANDROID
            nvrViewer.TrackerPosition = EditorGUILayout.Toggle(trackerPositionLabel, nvrViewer.TrackerPosition);
#endif
            if (nvrViewer.TrackerPosition)
            {
                nvrViewer.DisplacementCoefficient = EditorGUILayout.Slider(displacementCoefficient, nvrViewer.DisplacementCoefficient, 0, 1);
            }

            nvrViewer.SleepMode = (SleepTimeoutMode)EditorGUILayout.EnumPopup(SleepContent, nvrViewer.SleepMode);

            nvrViewer.SplitScreenModeEnabled = EditorGUILayout.Toggle(splitModeLabel, nvrViewer.SplitScreenModeEnabled);

            nvrViewer.TextureQuality = (TextureQuality)EditorGUILayout.EnumPopup(qualityLabel, nvrViewer.TextureQuality);

            nvrViewer.RemoteDebug = EditorGUILayout.Toggle(debuggingLabel, nvrViewer.RemoteDebug);

            nvrViewer.RemoteController = EditorGUILayout.Toggle(new GUIContent("Device Remote Controller",
                                                                               "When XR device is usb connected, use XR device controller data in editor run mode."), nvrViewer.RemoteController);

            nvrViewer.ShowFPS = EditorGUILayout.Toggle("Show FPS in Scene", nvrViewer.ShowFPS);

            EditorGUILayout.LabelField("Advanced Settings", headingStyle);


            nvrViewer.HeadControl = (HeadControl)EditorGUILayout.EnumPopup(headControl, nvrViewer.HeadControl);

            if (nvrViewer.HeadControl == HeadControl.Hover)
            {
                nvrViewer.Duration = EditorGUILayout.DelayedFloatField(duration, nvrViewer.Duration);
            }

            nvrViewer.TextureMSAA = (TextureMSAA)EditorGUILayout.EnumPopup(new GUIContent("Texture MSAA",
                                                                                          "The texture Anti-aliasing"), nvrViewer.TextureMSAA);

            EditorGUILayout.LabelField("SixDof Controller Settings", headingStyle);
            nvrViewer.IsAppHandleTriggerEvent = EditorGUILayout.Toggle(new GUIContent("App Handle Controller Trigger Event", "Sets Handle Controller Trigger Event"),
                                                                       nvrViewer.IsAppHandleTriggerEvent);
#if UNITY_STANDALONE_WIN || ANDROID_REMOTE_NRR
            nvrViewer.TextureQuality = TextureQuality.Best;

            nvrViewer.TargetFrameRate = (FrameRate)EditorGUILayout.EnumPopup(new GUIContent("TargetFrameRate",
                                                                                            "The target Frame Rate in PC."), nvrViewer.TargetFrameRate);

            nvrViewer.UseThirdPartyPosition = EditorGUILayout.Toggle(use3rdPosTip, nvrViewer.UseThirdPartyPosition);
#endif

            EditorGUILayout.Separator();
            if (GUI.changed)
            {
                asset.mSleepTimeoutMode = nvrViewer.SleepMode;
                asset.mHeadControl      = nvrViewer.HeadControl;
                asset.mTextureQuality   = nvrViewer.TextureQuality;
                asset.mTextureMSAA      = nvrViewer.TextureMSAA;
                EditorUtility.SetDirty(asset);
                EditorUtility.SetDirty(nvrViewer);
            }
            // 保存序列化数据,否则会出现设置数据丢失情况
            serializedObject.ApplyModifiedProperties();
        }