예제 #1
0
        private void OnGUI()
        {
            GUI.skin = EditorCore.WizardGUISkin;

            GUI.DrawTexture(new Rect(0, 0, 500, 500), EditorGUIUtility.whiteTexture);

            var currentscene = CognitiveVR_Preferences.FindCurrentScene();

            if (string.IsNullOrEmpty(UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name))
            {
                GUI.Label(steptitlerect, "DYNAMIC OBJECTS   Scene Not Saved", "steptitle");
            }
            else if (currentscene == null || string.IsNullOrEmpty(currentscene.SceneId))
            {
                GUI.Label(steptitlerect, "DYNAMIC OBJECTS   Scene Not Uploaded", "steptitle");
            }
            else
            {
                GUI.Label(steptitlerect, "DYNAMIC OBJECTS   " + currentscene.SceneName + " Version: " + currentscene.VersionNumber, "steptitle");
            }

            GUI.Label(new Rect(30, 45, 440, 440), "These are the current <color=#8A9EB7FF>Dynamic Object</color> components in your scene:", "boldlabel");

            //headers
            Rect mesh = new Rect(30, 95, 120, 30);

            GUI.Label(mesh, "Dynamic Mesh Name", "dynamicheader");
            Rect gameobject = new Rect(190, 95, 120, 30);

            GUI.Label(gameobject, "GameObject", "dynamicheader");
            //Rect ids = new Rect(320, 95, 120, 30);
            //GUI.Label(ids, "Ids", "dynamicheader");
            Rect uploaded = new Rect(380, 95, 120, 30);

            GUI.Label(uploaded, "Uploaded", "dynamicheader");


            //content
            DynamicObject[] tempdynamics    = GetDynamicObjects;
            Rect            innerScrollSize = new Rect(30, 0, 420, tempdynamics.Length * 30);

            dynamicScrollPosition = GUI.BeginScrollView(new Rect(30, 120, 440, 270), dynamicScrollPosition, innerScrollSize, false, true);

            Rect dynamicrect;

            for (int i = 0; i < tempdynamics.Length; i++)
            {
                if (tempdynamics[i] == null)
                {
                    RefreshSceneDynamics(); GUI.EndScrollView(); return;
                }
                dynamicrect = new Rect(30, i * 30, 460, 30);
                DrawDynamicObject(tempdynamics[i], dynamicrect, i % 2 == 0);
            }
            GUI.EndScrollView();
            GUI.Box(new Rect(30, 120, 425, 270), "", "box_sharp_alpha");

            //buttons

            string scenename       = "Not Saved";
            int    versionnumber   = 0;
            string buttontextstyle = "button_bluetext";

            if (currentscene == null || string.IsNullOrEmpty(currentscene.SceneId))
            {
                buttontextstyle = "button_disabledtext";
            }
            else
            {
                scenename     = currentscene.SceneName;
                versionnumber = currentscene.VersionNumber;
            }

            //TODO display uploading label for 2 frames before actually starting to upload. see init wizard implementation

            EditorGUI.BeginDisabledGroup(currentscene == null || string.IsNullOrEmpty(currentscene.SceneId));
            if (GUI.Button(new Rect(60, 400, 150, 40), new GUIContent("Upload Selected", "Export and Upload to " + scenename + " version " + versionnumber), buttontextstyle))
            {
                //dowhattever thing get scene version
                EditorCore.RefreshSceneVersion(() =>
                {
                    if (CognitiveVR_SceneExportWindow.ExportSelectedObjectsPrefab())
                    {
                        EditorCore.RefreshSceneVersion(delegate() { ManageDynamicObjects.UploadManifest(() => CognitiveVR_SceneExportWindow.UploadSelectedDynamicObjects(true)); });
                    }
                });
            }

            if (GUI.Button(new Rect(320, 400, 100, 40), new GUIContent("Upload All", "Export and Upload to " + scenename + " version " + versionnumber), buttontextstyle))
            {
                EditorCore.RefreshSceneVersion(() =>
                {
                    if (CognitiveVR_SceneExportWindow.ExportAllDynamicsInScene())
                    {
                        EditorCore.RefreshSceneVersion(delegate() { ManageDynamicObjects.UploadManifest(() => CognitiveVR_SceneExportWindow.UploadAllDynamicObjects(true)); });
                    }
                });
            }
            EditorGUI.EndDisabledGroup();

            DrawFooter();
            Repaint(); //manually repaint gui each frame to make sure it's responsive
        }
예제 #2
0
        void ListDynamicUpdate()
        {
            GUI.Label(steptitlerect, "STEP 5 - PREPARE OBJECTS", "steptitle");

            GUI.Label(new Rect(30, 45, 440, 440), "These are the active <color=#8A9EB7FF>Dynamic Object components</color> currently found in your scene.", "boldlabel");

            Rect mesh = new Rect(30, 95, 120, 30);

            GUI.Label(mesh, "Dynamic Mesh Name", "dynamicheader");
            Rect gameobject = new Rect(190, 95, 120, 30);

            GUI.Label(gameobject, "GameObject", "dynamicheader");
            Rect uploaded = new Rect(380, 95, 120, 30);

            GUI.Label(uploaded, "Uploaded", "dynamicheader");

            DynamicObject[] tempdynamics = GetDynamicObjects;


            if (tempdynamics.Length == 0)
            {
                GUI.Label(new Rect(30, 120, 420, 270), "No objects found.\n\nHave you attached any Dynamic Object components to objects?\n\nAre they active in your hierarchy?", "button_disabledtext");
            }

            Rect innerScrollSize = new Rect(30, 0, 420, tempdynamics.Length * 30);

            dynamicScrollPosition = GUI.BeginScrollView(new Rect(30, 120, 440, 270), dynamicScrollPosition, innerScrollSize, false, true);

            Rect dynamicrect;

            for (int i = 0; i < tempdynamics.Length; i++)
            {
                if (tempdynamics[i] == null)
                {
                    RefreshSceneDynamics(); GUI.EndScrollView(); return;
                }
                dynamicrect = new Rect(30, i * 30, 460, 30);
                DrawDynamicObject(tempdynamics[i], dynamicrect, i % 2 == 0);
            }

            GUI.EndScrollView();

            GUI.Box(new Rect(30, 120, 425, 270), "", "box_sharp_alpha");
            if (delayDisplayUploading > 0)
            {
                GUI.Button(new Rect(180, 400, 140, 40), "Uploading...", "button_bluetext"); //fake replacement for button
                delayDisplayUploading--;
            }
            else if (delayDisplayUploading == 0)
            {
                GUI.Button(new Rect(180, 400, 140, 40), "Uploading...", "button_bluetext"); //fake replacement for button
                CognitiveVR_SceneExportWindow.ExportAllDynamicsInScene();
                delayDisplayUploading--;
            }
            else
            {
                if (GUI.Button(new Rect(180, 400, 140, 40), "Upload All", "button_bluetext"))
                {
                    delayDisplayUploading = 2;
                }
            }
        }