Ejemplo n.º 1
0
        protected override void OnGUI()
        {
            mainToolbar.OnGUI();
            EventType eventType = FsmEditorUtility.ReserveEvent(variableEditorRect, fsmSelectionRect, preferencesRect);

            ZoomableArea.Begin(new Rect(0f, 0f, scaledCanvasSize.width, scaledCanvasSize.height + 21), scale, IsDocked);
            Begin();

            shortcutEditor.HandleKeyEvents();
            if (FsmEditor.Active != null)
            {
                DoNodes();
            }
            else
            {
                ZoomableArea.End();
            }
            AcceptDragAndDrop();
            End();

            FsmEditorUtility.ReleaseEvent(eventType);
            PreferencesEditor.DoGUI(preferencesRect);
            shortcutEditor.DoGUI(shortcutRect);
            DoFsmSelection(fsmSelectionRect);
            variableEditor.DoGUI(variableEditorRect);
            if (centerView)
            {
                CenterView();
                centerView = false;
            }
            if (FsmEditor.Active != null)
            {
                GUI.Label(new Rect(5, 20, 300, 200), FsmEditor.Active.comment, FsmEditorStyles.instructionLabel);
            }
            else
            {
                GUI.Label(new Rect(5, 20, 300, 200), "Right click to create a state machine.", FsmEditorStyles.instructionLabel);
            }
            Event ev = Event.current;

            if (SelectedNodes.Count == 1 && ev.rawType == EventType.KeyDown && ev.keyCode == KeyCode.Delete && FsmEditor.SelectedTransition != null && EditorUtility.DisplayDialog("Delete selected transition?", FsmEditor.SelectedTransition.FromNode.Name + " -> " + FsmEditor.SelectedTransition.ToNode.Name + "\r\n\r\nYou cannot undo this action.", "Delete", "Cancel"))
            {
                Node node = SelectedTransition.FromNode;
                node.Transitions = ArrayUtility.Remove(node.Transitions, FsmEditor.SelectedTransition);
                FsmEditorUtility.DestroyImmediate(FsmEditor.SelectedTransition);
                ErrorChecker.CheckForErrors();
                EditorUtility.SetDirty(node);
            }
        }
Ejemplo n.º 2
0
		protected override void OnGUI ()
		{
			mainToolbar.OnGUI ();
			EventType eventType = FsmEditorUtility.ReserveEvent (variableEditorRect,fsmSelectionRect, preferencesRect);
			Begin ();
			shortcutEditor.HandleKeyEvents ();
			if(FsmEditor.Active != null)
			DoNodes ();
			End ();
			FsmEditorUtility.ReleaseEvent (eventType);
			PreferencesEditor.DoGUI (preferencesRect);
			shortcutEditor.DoGUI (shortcutRect);
			DoFsmSelection (fsmSelectionRect);
			variableEditor.DoGUI (variableEditorRect);

			if (centerView) {
				CenterView();	
				centerView=false;
			}
			if (FsmEditor.Active != null) {
				GUI.Label (new Rect (5, 20, 300, 200), FsmEditor.Active.comment, FsmEditorStyles.instructionLabel);
			}
		}