Пример #1
0
        public override void Uninstall()
        {
            this.Remove <WaveVR_DevicePoseTracker>();
            var render = GetComponent <WaveVR_Render>();

            if (render != null && render.isExpanded)
            {
                WaveVR_Render.Collapse(render);
                render.Destroy();
            }

            base.Uninstall();
        }
Пример #2
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        if (logo)
        {
            // Logo need have aspect rate 2:1
            int bannerWidth, bannerHeight;
            bannerWidth  = Screen.width - 35;
            bannerHeight = (int)(bannerWidth / (float)2);
            if (bannerHeight > bannerHeightMax)
            {
                bannerHeight = bannerHeightMax;
                bannerWidth  = bannerHeight * 2;
            }
            var rect = GUILayoutUtility.GetRect(bannerWidth, bannerHeight, GUI.skin.box);
            GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);
        }
        EditorGUILayout.PropertyField(script);

        EditorGUILayout.PropertyField(CameraGaze);

        //EditorGUILayout.PropertyField(useSingleBuffer);
        //EditorGUILayout.PropertyField(useCompositor);
        //EditorGUILayout.PropertyField(prediction);
        //EditorGUILayout.PropertyField(textureExpand);
        //EditorGUILayout.PropertyField(targetFPS);
        EditorGUILayout.PropertyField(_origin);
        EditorGUILayout.PropertyField(needTimeControl);
        //EditorGUILayout.PropertyField(useATW);

        if (!Application.isPlaying)
        {
            var expand   = false;
            var collapse = false;

            foreach (WaveVR_Render target in targets)
            {
                if (AssetDatabase.Contains(target))
                {
                    continue;
                }
                if (target.isExpanded)
                {
                    collapse = true;
                }
                else
                {
                    expand = true;
                }
            }

            if (expand)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Expand"))
                {
                    foreach (WaveVR_Render target in targets)
                    {
                        if (AssetDatabase.Contains(target))
                        {
                            continue;
                        }
                        if (!target.isExpanded)
                        {
                            WaveVR_Render.Expand(target);
                            EditorUtility.SetDirty(target);
                        }
                    }
                }
                GUILayout.Space(18);
                GUILayout.EndHorizontal();
            }

            if (collapse)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Collapse"))
                {
                    foreach (WaveVR_Render target in targets)
                    {
                        if (AssetDatabase.Contains(target))
                        {
                            continue;
                        }
                        if (target.isExpanded)
                        {
                            WaveVR_Render.Collapse(target);
                            EditorUtility.SetDirty(target);
                        }
                    }
                }
                GUILayout.Space(18);
                GUILayout.EndHorizontal();
            }
        }
        serializedObject.ApplyModifiedProperties();
    }
Пример #3
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        if (logo)
        {
            // Logo need have aspect rate 2:1
            int bannerWidth, bannerHeight;
            bannerWidth  = Screen.width - 35;
            bannerHeight = (int)(bannerWidth / (float)2);
            if (bannerHeight > bannerHeightMax)
            {
                bannerHeight = bannerHeightMax;
                bannerWidth  = bannerHeight * 2;
            }
            var rect = GUILayoutUtility.GetRect(bannerWidth, bannerHeight, GUI.skin.box);
            GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);
        }

        if (!Application.isPlaying)
        {
            var expand   = false;
            var collapse = false;

            if (render.isExpanded)
            {
                collapse = true;
            }
            else
            {
                expand = true;
            }

            if (expand)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Expand"))
                {
                    if (!render.isExpanded)
                    {
                        WaveVR_Render.Expand(render);
                        EditorUtility.SetDirty(render);
                    }
                }
                GUILayout.EndHorizontal();
            }

            if (collapse)
            {
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Collapse"))
                {
                    if (render.isExpanded)
                    {
                        WaveVR_Render.Collapse(render);
                        EditorUtility.SetDirty(render);
                    }
                }
                GUILayout.EndHorizontal();
            }
        }
        serializedObject.ApplyModifiedProperties();

        EditorGUI.BeginChangeCheck();
        DrawDefaultInspector();
        if (EditorGUI.EndChangeCheck())
        {
            Validate();
        }
    }