void DrawFSMGraph(ref bool regen, ref bool repos) { foldoutStates = QuickGUI.DrawHeader("状态预览图", "foldout", false); if (foldoutStates) { QuickGUI.BeginContents(50); //EditorGUILayout.BeginVertical("helpbox"); //EditorGUILayout.BeginHorizontal(); //EditorGUILayout.EndHorizontal(); QuickGUI.ReportView(ref stateClipRect, stateViewPos, OnDrawFSMGraphCallback, Mathf.Max(350f, stateClipRect.width * 0.75f), 80); stateClipRectCenter = stateClipRect.size * 0.5f; EditorGUI.BeginDisabledGroup(Application.isPlaying); EditorGUILayout.BeginHorizontal(); GUILayout.Space(40); regen |= GUILayout.Button("Rebuild State Machine"); GUILayout.Space(40); EditorGUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); QuickGUI.EndContents(); //EditorGUILayout.EndVertical(); } }
private void OnGUI() { OnPrepareGraphGUI(); ProcessMouseDeltaPos(); GUI.skin.label.richText = true; GUILayout.BeginVertical(); GUILayout.BeginHorizontal("TE toolbar"); OnTitleGUI(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUI.SetNextControlName(mViewportName); QuickGUI.ReportView(ref mClipRect, mViewPos, OnDrawGUI, position.height, 100, mViewportTitle); mViewOffset = -mViewPos + new Vector2(mClipRect.size.x * 0.5f, 100f); GUILayout.EndHorizontal(); GUILayout.EndVertical(); ProcessEvent(); ProcessFocusCenter(); OnGraphGUIEnd(); if (repaint || onFocus) { Repaint(); } repaint = false; }
void DrawFSMGraph() { FStateMachineMono f = target as FStateMachineMono; fsmImpl = f.FSM; if (fsm != f) { fsm = f; fsm.IsDirty = true; } if (fsm.IsDirty) { Reposition(fsm); fsm.IsDirty = false; } foldoutStates = QuickGUI.DrawHeader("状态预览图", "foldout", false); if (foldoutStates) { QuickGUI.BeginContents(50); GUILayout.Space(10); EditorGUILayout.BeginHorizontal(); float scale = EditorGUILayout.Slider("滑动缩放视图", cellScale, 0.5f, 3f); EditorGUI.BeginDisabledGroup(Application.isPlaying); bool regen = GUILayout.Button("刷新", GUILayout.Height(20)); EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); if (regen || reloaded) { fsm.GenerateStateMachine(); fsm.IsDirty = true; reloaded = false; } if (Mathf.Abs(scale - cellScale) > 0.01f) { cellScale = scale; fsm.IsDirty = true; } if (fsm.IsDirty) { Reposition(fsm); fsm.IsDirty = false; } QuickGUI.ReportView(ref stateClipRect, stateViewPos, OnDrawFSMGraphCallback, Mathf.Max(350f, stateClipRect.width * 0.75f), 80); stateClipRectCenter = stateClipRect.size * 0.5f; QuickGUI.EndContents(); } if (fsm.IsDirty) { Reposition(fsm); fsm.IsDirty = false; } }