コード例 #1
0
		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;

			var title = "UI.Windows Flow Screen Editor ('{0}')";
			title = string.Format(title, this.window.title);
			#if !UNITY_4
			this.view.titleContent = new GUIContent(string.Format(title, this.window.title));
			#else
			this.view.title = string.Format(title, this.window.title);
			#endif
			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();

				}

			});

		}
コード例 #2
0
		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 (string.IsNullOrEmpty(this.currentScene) == true) {

				EditorApplication.NewScene();

			} else {
				
				EditorApplication.OpenScene(this.currentScene);

			}

			SceneView.onSceneGUIDelegate -= this.OnGUI;

		}