static void ToggleWindow()
        {
            HoloPlay.InitializeConfig();
            EditorWindow gameWindow = GetMainGameView(true);

            if (gameWindow != null)
            {
                gameWindow.Close();
            }
            else
            {
                MoveGameWindow(true);
                delayedMove = 1;
            }
            SavePrefs();
        }
Esempio n. 2
0
        static void ToggleWindow()
        {
            HoloPlay.LoadConfig();
            EditorWindow gameWindow = GetMainGameView(true);

            EditorApplication.update += Update;
            if (gameWindow != null)
            {
                gameWindow.Close();
            }
            else
            {
                MoveGameWindow(true);
                delayedMove = 1;
            }
            SavePrefs();
        }
Esempio n. 3
0
 void Awake()
 {
     HoloScript = RealHolo.GetComponent("HoloPlay") as HoloPlay;
 }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            Color    gizc     = Color.HSVToRGB(0.35f, 1, EditorGUIUtility.isProSkin ? 1 : 0.5f);
            HoloPlay holoPlay = ((HoloPlay)target);

            EditorGUILayout.Space();

            GUI.color = Color.HSVToRGB(0.35f, 0.3f, 1);
            EditorGUILayout.LabelField("HoloPlay " + HoloPlay.version.ToString("0.###"), EditorStyles.centeredGreyMiniLabel);
            GUI.color = Color.white;

            GUI.color = gizc;
            EditorGUILayout.LabelField("- Camera -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            EditorGUILayout.PropertyField(size);
            EditorGUILayout.PropertyField(nearClip);
            EditorGUILayout.PropertyField(farClip);

            //fix for if the user is inspecting the prefab
            if (holoPlay.Cam == null)
            {
                return;
            }

            EditorGUILayout.BeginHorizontal();
            bool ortho = holoPlay.Cam.orthographic;

            EditorGUILayout.LabelField(new GUIContent("Projection"));
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(
                    ortho ? "orthographic" : "perspective",
                    EditorStyles.miniButton,
                    GUILayout.MaxWidth(EditorGUIUtility.fieldWidth * 2)))
            {
                ortho = !ortho;
                holoPlay.Cam.orthographic = ortho;
            }
            EditorGUILayout.EndHorizontal();

            GUI.enabled = !ortho;
            EditorGUILayout.PropertyField(fov);
            GUI.enabled = true;

            EditorGUILayout.Space();

            GUI.color = gizc;
            EditorGUILayout.LabelField("- Preview -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(
                new GUIContent(
                    "Render in editor",
                    "Renders with the lenticular postprocess shader while in edit mode"
                    )
                );
            GUILayout.FlexibleSpace();
            if (
                GUILayout.Button(
                    renderInEditor.boolValue ? "on" : "off",
                    EditorStyles.miniButton,
                    GUILayout.MaxWidth(EditorGUIUtility.fieldWidth)
                    )
                )
            {
                renderInEditor.boolValue = !renderInEditor.boolValue;
            }
            EditorGUILayout.EndHorizontal();

            var currentAlignment = prefs.alignment;

            prefs.alignment = (Prefs.Alignment)EditorGUILayout.EnumPopup("Alignment", prefs.alignment);
            if (currentAlignment != prefs.alignment)
            {
                SavePrefs();
            }

            switch (prefs.alignment)
            {
            case Prefs.Alignment.Right:
                prefs.position = new Vector2(Screen.currentResolution.width, 0);
                break;

            case Prefs.Alignment.Center:
                prefs.position = Vector2.zero;
                break;

            case Prefs.Alignment.Left:
                prefs.position = new Vector2(-HoloPlay.Config.screenW, 0);
                break;

            case Prefs.Alignment.Custom:
                prefs.position = EditorGUILayout.Vector2Field("Position", prefs.position);
                break;
            }

            string previewerShortcutKey = "Ctrl + E";

#if UNITY_EDITOR_OSX
            previewerShortcutKey = "⌘E";
#endif

            if (GUILayout.Button(new GUIContent(
                                     "Toggle HoloPlay Previewer " + previewerShortcutKey,
                                     "If your HoloPlayer One is set up as a second display, " +
                                     "this will generate a game window on it to use as a " +
                                     "realtime preview")))
            {
                ToggleWindow();
            }

            EditorGUILayout.Space();

            GUI.color = gizc;
            EditorGUILayout.LabelField("- Project Settings -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            EditorGUILayout.Space();

            if (GUILayout.Button(new GUIContent(
                                     "Open HoloPlay Optimization Settings",
                                     "Open a window that will let you select project settings " +
                                     "to be optimized for best performance with HoloPlay")))
            {
                HoloPlaySettingsPrompt window = EditorWindow.GetWindow <HoloPlaySettingsPrompt>();
                window.Show();
            }

            EditorGUILayout.Space();
            serializedObject.ApplyModifiedProperties();
        }