public override void OnInspectorGUI()
        {
            fsm     = target as FStateMachineMono;
            fsmImpl = fsm.FSM;

            base.OnInspectorGUI();
            bool repos = false;
            bool regen = false;

            ProcessMouseDeltaPos();
            DrawFSMGraph(ref regen, ref repos);
            ProcessMouseEvent(ref regen, ref repos);
            ProcessFocusCenter();
            serializedObject.ApplyModifiedProperties();
            if (regen)
            {
                GenerateStateMachine(serializedObject);
                GetCopys();
            }
            else if (repos)
            {
                GetCopys();
            }
            if (repaint || regen || repos || Application.isPlaying)
            {
                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;
            }
        }
        public void Reposition(FStateMachineMono fsm)
        {
            stateRects = new Rect[fsm.StateLength];
            float   deltaRad      = 2f * Mathf.PI / fsm.StateLength;
            float   xdy           = (defaultCellSize.x / defaultCellSize.y + 1.6f) * 0.5f;
            Vector2 stateCellSize = defaultCellSize * cellScale;
            float   r             = Mathf.Max(50f * cellScale, stateCellSize.x * fsm.StateLength * 0.4f / Mathf.PI);

            for (int i = 0; i < stateRects.Length; i++)
            {
                float   rad    = i * deltaRad - Mathf.PI * 0.5f;
                Vector2 center = new Vector2(r * Mathf.Cos(rad) * xdy, r * Mathf.Sin(rad));
                Rect    rect   = new Rect(center - stateCellSize * 0.5f, stateCellSize);
                stateRects[i] = rect;
            }
        }