Beispiel #1
0
        static void Cognitive3DManager()
        {
            var found = Object.FindObjectOfType <CognitiveVR_Manager>();

            if (found != null)
            {
#if CVR_NEURABLE
                Neurable.Analytics.Portal.NeurableCognitiveMenu.InstantiateAnalyticsManager();
#endif
                Selection.activeGameObject = found.gameObject;
                return;
            }
            else
            {
                EditorCore.SpawnManager(EditorCore.DisplayValue(DisplayKey.ManagerName));
            }
        }
Beispiel #2
0
        static void Cognitive3DManager()
        {
            var found = Object.FindObjectOfType <CognitiveVR_Manager>();

            if (found != null)
            {
                Selection.activeGameObject = found.gameObject;
                return;
            }
            else
            {
                string gameobjectName = "CognitiveVR_Manager";
#if CVR_NEURABLE
                gameobjectName = "Neurable Cognitive Engine";
#endif

                EditorCore.SpawnManager(gameobjectName);
            }
        }
Beispiel #3
0
        void DrawNextButton()
        {
            bool   buttonDisabled = false;
            bool   appearDisabled = false; //used on dynamic upload page to skip step
            string text           = "Next";

            System.Action onclick    = () => currentPage++;
            Rect          buttonrect = new Rect(410, 460, 80, 30);

            switch (pageids[currentPage])
            {
            case "welcome":
                break;

            case "authenticate":
                buttonrect     = new Rect(350, 460, 140, 30);
                onclick       += () => SaveKeys();
                buttonDisabled = apikey == null || apikey.Length == 0 || developerkey == null || developerkey.Length == 0;
                if (buttonDisabled)
                {
                    text = "Keys Required";
                }
                else
                {
                    text = "Next";
                }
                break;

            case "tagdynamics":
                break;

            case "selectsdk":
                onclick += () => EditorCore.SetPlayerDefine(selectedsdks);
                onclick += () =>
                {
                    var found = Object.FindObjectOfType <CognitiveVR_Manager>();
                    if (found == null) //add cognitivevr_manager
                    {
                        string gameobjectName = "CognitiveVR_Manager";
#if CVR_NEURABLE
                        gameobjectName = "Neurable Cognitive Engine";
#endif

                        EditorCore.SpawnManager(gameobjectName);
                    }
                };
                break;

            case "listdynamics":

                var dynamics = GetDynamicObjects;
                int dynamicsFromSceneExported = 0;

                for (int i = 0; i < dynamics.Length; i++)
                {
                    if (EditorCore.GetExportedDynamicObjectNames().Contains(dynamics[i].MeshName) || !dynamics[i].UseCustomMesh)
                    {
                        dynamicsFromSceneExported++;
                    }
                }
                appearDisabled = dynamicsFromSceneExported != dynamics.Length;
                if (appearDisabled)
                {
                    onclick = () => { if (EditorUtility.DisplayDialog("Continue", "Are you sure you want to continue without uploading all Dynamic Objects?", "Yes", "No"))
                                      {
                                          currentPage++;
                                      }
                    };
                }
                if (dynamics.Length == 0 && dynamicsFromSceneExported == 0)
                {
                    text = "Skip Dynamics";
                }
                else
                {
                    text = dynamicsFromSceneExported + "/" + dynamics.Length + " Uploaded";
                }
                buttonrect = new Rect(350, 460, 140, 30);
                break;

            case "uploadscene":
                //buttonDisabled = !EditorCore.HasSceneExportFiles(CognitiveVR_Preferences.FindCurrentScene());

                buttonrect = new Rect(1000, 1000, 100, 100);
                onclick    = () => { Debug.Log("custom button"); };

                /*appearDisabled = !EditorCore.HasSceneExportFiles(CognitiveVR_Preferences.FindCurrentScene());
                 * if (appearDisabled)
                 * {
                 *  onclick = () => { if (EditorUtility.DisplayDialog("Continue", "Are you sure you want to continue without exporting this scene?", "Yes", "No")) { currentPage++; } };
                 * }*/
                break;

            case "upload":
                onclick += () => EditorCore.RefreshSceneVersion(null);
                if (understandRevealTime > EditorApplication.timeSinceStartup)
                {
                    buttonDisabled = true;
                }
                text       = "I understand, Continue";
                buttonrect = new Rect(290, 460, 200, 30);
                break;

            case "uploadsummary":

                System.Action completedmanifestupload = delegate()
                {
                    CognitiveVR_SceneExportWindow.UploadAllDynamicObjects(true);
                    currentPage = 9;
                };

                //fifth upload manifest
                System.Action completedRefreshSceneVersion = delegate()
                {
                    //TODO this might cause a race condition for uploading dynamics and manifest
                    ManageDynamicObjects.UploadManifest(completedmanifestupload);
                };

                //fourth upload dynamics
                System.Action completeSceneUpload = delegate() {
                    EditorCore.RefreshSceneVersion(completedRefreshSceneVersion); //likely completed in previous step, but just in case
                };

                //third upload scene
                System.Action completeScreenshot = delegate(){
                    CognitiveVR_Preferences.SceneSettings current = CognitiveVR_Preferences.FindCurrentScene();

                    if (current == null || string.IsNullOrEmpty(current.SceneId))
                    {
                        if (EditorUtility.DisplayDialog("Upload New Scene", "Upload " + current.SceneName + " to SceneExplorer?", "Ok", "Cancel"))
                        {
                            //new scene
                            CognitiveVR_SceneExportWindow.UploadDecimatedScene(current, completeSceneUpload);
                        }
                    }
                    else
                    {
                        //new version
                        if (EditorUtility.DisplayDialog("Upload New Version", "Upload a new version of this existing scene? Will archive previous version", "Ok", "Cancel"))
                        {
                            CognitiveVR_SceneExportWindow.UploadDecimatedScene(current, completeSceneUpload);
                        }
                    }
                };

                //second save screenshot
                System.Action completedRefreshSceneVersion1 = delegate()
                {
                    EditorCore.SaveCurrentScreenshot(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name, completeScreenshot);
                };

                //first refresh scene version
                onclick = () =>
                {
                    if (string.IsNullOrEmpty(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name)) //scene not saved. "do want save?" popup
                    {
                        if (EditorUtility.DisplayDialog("Upload Failed", "Cannot upload scene that is not saved.\n\nDo you want to save now?", "Save", "Cancel"))
                        {
                            if (UnityEditor.SceneManagement.EditorSceneManager.SaveOpenScenes())
                            {
                                EditorCore.RefreshSceneVersion(completedRefreshSceneVersion1);
                            }
                            else
                            {
                                return;//cancel from save scene window
                            }
                        }
                        else
                        {
                            return;//cancel from 'do you want to save' popup
                        }
                    }
                    else
                    {
                        EditorCore.RefreshSceneVersion(completedRefreshSceneVersion1);
                    }
                };

                buttonDisabled = !EditorCore.HasSceneExportFolder(CognitiveVR_Preferences.FindCurrentScene());

                text = "Upload";
                break;

            case "done":
                onclick = () => Close();
                text    = "Close";
                break;
            }

            if (appearDisabled)
            {
                if (GUI.Button(buttonrect, text, "button_disabled"))
                {
                    onclick.Invoke();
                }
            }
            else if (buttonDisabled)
            {
                GUI.Button(buttonrect, text, "button_disabled");
            }
            else
            {
                if (GUI.Button(buttonrect, text))
                {
                    if (onclick != null)
                    {
                        onclick.Invoke();
                    }
                }
            }
        }