public void Dispose(bool onDestroy = false, AnimatedValues.AnimFloat progressValue = null)
        {
            System.Action close = () => {
                if (this.view != null && onDestroy == false)
                {
                    this.view.Close();
                }
                if (this.inspector != null && onDestroy == false)
                {
                    this.inspector.Close();
                }
                if (this.hierarchy != null && onDestroy == false)
                {
                    this.hierarchy.Close();
                }
                this.view      = null;
                this.inspector = null;
                this.hierarchy = null;
            };

            if (progressValue != null)
            {
                progressValue.valueChanged.AddListener(() => {
                    this.view.DrawProgress(progressValue.value);
                    //this.inspector.DrawProgress(progressValue.value);
                    //this.hierarchy.DrawProgress(progressValue.value);

                    if (progressValue.value == progressValue.target)
                    {
                        close();
                    }
                });
            }
            else
            {
                close();
            }

                        #if UNITY_5_2
            if (string.IsNullOrEmpty(this.currentScene) == false)
            {
                EditorApplication.OpenScene(this.currentScene);
            }
            else
            {
                EditorApplication.NewEmptyScene();
            }
                        #else
            if (this.currentScene.IsValid() == true)
            {
                EditorSceneManager.NewScene(NewSceneSetup.EmptyScene);
            }
            else
            {
                EditorSceneManager.OpenScene(this.currentScene.path);
            }
                        #endif

            SceneView.onSceneGUIDelegate -= this.OnGUI;
        }
Example #2
0
        public static void SetControl(FlowSystemEditorWindow rootWindow, FlowWindow window, System.Action <float> onProgress)
        {
            if (EditorApplication.SaveCurrentSceneIfUserWantsTo() == true)
            {
                FlowSceneView.editAnimation = new UnityEditor.AnimatedValues.AnimFloat(0f, () => {
                    onProgress(FlowSceneView.editAnimation.value);
                });
                FlowSceneView.editAnimation.value  = 0f;
                FlowSceneView.editAnimation.speed  = 2f;
                FlowSceneView.editAnimation.target = 1f;

                FlowSceneView.currentItem = new FlowSceneItem(rootWindow, window, FlowSceneView.editAnimation);
                FlowSceneView.isActive    = true;
            }
        }
        public static void Reset(System.Action <float> onProgress, bool onDestroy = false)
        {
            FlowSceneView.editAnimation = new UnityEditor.AnimatedValues.AnimFloat(1f, () => {
                onProgress(FlowSceneView.editAnimation.value);
            });
            FlowSceneView.editAnimation.value  = 1f;
            FlowSceneView.editAnimation.speed  = 2f;
            FlowSceneView.editAnimation.target = 0f;

            if (FlowSceneView.currentItem != null)
            {
                FlowSceneView.currentItem.Dispose(onDestroy, FlowSceneView.editAnimation);
            }
            FlowSceneView.currentItem = null;

            FlowSceneView.isActive = false;
        }
        public static void SetControl(FlowSystemEditorWindow rootWindow, FD.FlowWindow window, System.Action <float> onProgress)
        {
                        #if UNITY_5_2
            if (EditorApplication.SaveCurrentSceneIfUserWantsTo() == true)
            {
                        #else
            if (UnityEditor.SceneManagement.EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo() == true)
            {
                        #endif

                FlowSceneView.editAnimation = new UnityEditor.AnimatedValues.AnimFloat(0f, () => {
                    onProgress(FlowSceneView.editAnimation.value);
                });
                FlowSceneView.editAnimation.value  = 0f;
                FlowSceneView.editAnimation.speed  = 2f;
                FlowSceneView.editAnimation.target = 1f;

                FlowSceneView.currentItem = new FlowSceneItem(rootWindow, window, FlowSceneView.editAnimation);
                FlowSceneView.isActive    = true;
            }
        }
        public FlowSceneItem(FlowSystemEditorWindow rootWindow, FD.FlowWindow window, AnimatedValues.AnimFloat progressValue)
        {
            this.isLocked = false;

            this.rootWindow = rootWindow;
            this.window     = window;
                        #if UNITY_5_2
            this.currentScene = EditorApplication.currentScene;
                        #else
            this.currentScene = EditorSceneManager.GetActiveScene();
                        #endif
            this.layouts      = new List <WindowLayout>();
            this.layoutPrefab = null;

            this.screens      = new List <WindowBase>();
            this.screenPrefab = null;

                        #if UNITY_5_2
            EditorApplication.NewEmptyScene();
                        #else
            EditorSceneManager.NewScene(UnityEditor.SceneManagement.NewSceneSetup.EmptyScene);
                        #endif

            var popupOffset = 100f;
            var popupSize   = new Vector2(rootWindow.position.width - popupOffset * 2f, rootWindow.position.height - popupOffset * 2f);
            var popupRect   = new Rect(rootWindow.position.x + popupOffset, rootWindow.position.y + popupOffset, popupSize.x, popupSize.y);

            this.view = FlowSceneViewWindow.CreateInstance <FlowSceneViewWindow>();
            FlowSceneView.recompileChecker = this.view;

            var title = "UI.Windows Flow Screen Editor ('{0}')";
            title = string.Format(title, this.window.title);
            this.view.titleContent = new GUIContent(string.Format(title, this.window.title));
            this.view.position     = popupRect;
            this.view.rootWindow   = rootWindow;

            this.Show();

            this.view.Repaint();
            this.view.Focus();

            this.autoloadedScreen = false;
            this.ReloadScreens();
            this.autoloadedLayout = false;
            this.ReloadLayouts();

            this.defaultRects = false;

            progressValue.valueChanged.AddListener(() => {
                this.view.DrawProgress(progressValue.value);

                if (progressValue.value == progressValue.target)
                {
                    this.view.Repaint();
                    this.view.Focus();
                }
            });
        }
        public FlowSceneItem(FlowSystemEditorWindow rootWindow, FlowWindow window, AnimatedValues.AnimFloat progressValue)
        {
            this.isLocked = false;

            this.rootWindow   = rootWindow;
            this.window       = window;
            this.currentScene = EditorApplication.currentScene;
            this.layouts      = new List <WindowLayout>();
            this.layoutPrefab = null;

            this.screens      = new List <WindowBase>();
            this.screenPrefab = null;

                        #if UNITY_5_0
            EditorApplication.NewEmptyScene();
                        #else
            EditorApplication.NewScene();
                        #endif

            var popupOffset = 100f;
            var popupSize   = new Vector2(rootWindow.position.width - popupOffset * 2f, rootWindow.position.height - popupOffset * 2f);
            var popupRect   = new Rect(rootWindow.position.x + popupOffset, rootWindow.position.y + popupOffset, popupSize.x, popupSize.y);

            this.view = FlowSceneViewWindow.CreateInstance <FlowSceneViewWindow>();
            FlowSceneView.recompileChecker = this.view;

            this.view.title      = "UI.Windows Flow Screen Editor ('" + this.window.title + "')";
            this.view.position   = popupRect;
            this.view.rootWindow = rootWindow;

            /*this.inspector = FlowInspectorWindow.CreateInstance<FlowInspectorWindow>();
             * this.inspector.position = popupRect;
             * this.inspector.rootWindow = rootWindow;
             * this.inspector.Repaint();
             * this.inspector.Focus();
             *
             * this.hierarchy = FlowHierarchyWindow.CreateInstance<FlowHierarchyWindow>();
             * this.hierarchy.position = popupRect;
             * this.hierarchy.rootWindow = rootWindow;
             * this.hierarchy.Repaint();
             * this.hierarchy.Focus();*/

            this.Show();

            //this.inspector.Repaint();
            //this.inspector.Focus();
            //this.hierarchy.Repaint();
            //this.hierarchy.Focus();
            this.view.Repaint();
            this.view.Focus();

            this.autoloadedScreen = false;
            this.ReloadScreens();
            this.autoloadedLayout = false;
            this.ReloadLayouts();

            this.defaultRects = false;

            progressValue.valueChanged.AddListener(() => {
                this.view.DrawProgress(progressValue.value);
                //this.inspector.DrawProgress(progressValue.value);
                //this.hierarchy.DrawProgress(progressValue.value);

                if (progressValue.value == progressValue.target)
                {
                    this.view.Repaint();
                    this.view.Focus();
                }
            });
        }
		public static void Reset(System.Action<float> onProgress, bool onDestroy = false) {
			
			FlowSceneView.editAnimation = new UnityEditor.AnimatedValues.AnimFloat(1f, () => {
				
				onProgress(FlowSceneView.editAnimation.value);
				
			});
			FlowSceneView.editAnimation.value = 1f;
			FlowSceneView.editAnimation.speed = 2f;
			FlowSceneView.editAnimation.target = 0f;

			if (FlowSceneView.currentItem != null) FlowSceneView.currentItem.Dispose(onDestroy, FlowSceneView.editAnimation);
			FlowSceneView.currentItem = null;
			
			FlowSceneView.isActive = false;
			
		}
		public static void SetControl(FlowSystemEditorWindow rootWindow, FlowWindow window, System.Action<float> onProgress) {

			if (EditorApplication.SaveCurrentSceneIfUserWantsTo() == true) {
				
				FlowSceneView.editAnimation = new UnityEditor.AnimatedValues.AnimFloat(0f, () => {

					onProgress(FlowSceneView.editAnimation.value);

				});
				FlowSceneView.editAnimation.value = 0f;
				FlowSceneView.editAnimation.speed = 2f;
				FlowSceneView.editAnimation.target = 1f;

				FlowSceneView.currentItem = new FlowSceneItem(rootWindow, window, FlowSceneView.editAnimation);
				FlowSceneView.isActive = true;

			}

		}
		public static void SetControl(FlowSystemEditorWindow rootWindow, FD.FlowWindow window, System.Action<float> onProgress) {

			#if UNITY_5_2
			if (EditorApplication.SaveCurrentSceneIfUserWantsTo() == true) {
			#else
			if (UnityEditor.SceneManagement.EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo() == true) {
			#endif

				FlowSceneView.editAnimation = new UnityEditor.AnimatedValues.AnimFloat(0f, () => {

					onProgress(FlowSceneView.editAnimation.value);

				});
				FlowSceneView.editAnimation.value = 0f;
				FlowSceneView.editAnimation.speed = 2f;
				FlowSceneView.editAnimation.target = 1f;

				FlowSceneView.currentItem = new FlowSceneItem(rootWindow, window, FlowSceneView.editAnimation);
				FlowSceneView.isActive = true;

			}

		}