summaryrefslogtreecommitdiff
path: root/Erika/Assets/Tools/WorkflowVisualizer/Editor
diff options
context:
space:
mode:
Diffstat (limited to 'Erika/Assets/Tools/WorkflowVisualizer/Editor')
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIHelper.cs22
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIHelper.cs.meta11
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIScaleUtility.cs262
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIScaleUtility.cs.meta11
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/Node.cs50
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/SingleOutNode.cs1
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/SingleOutNode.cs.meta11
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowEditor.cs224
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowEditor.cs.meta11
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowGraph.cs19
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowGraph.cs.meta11
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowResources.cs34
-rw-r--r--Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowResources.cs.meta11
13 files changed, 648 insertions, 30 deletions
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIHelper.cs b/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIHelper.cs
new file mode 100644
index 00000000..2b3c3449
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIHelper.cs
@@ -0,0 +1,22 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEditor;
+
+namespace Workflow
+{
+
+ public static class GUIHelper
+ {
+
+ static GUIHelper()
+ {
+ }
+
+ public static bool DropdownButton(string name, float width)
+ {
+ return GUILayout.Button(name, EditorStyles.toolbarDropDown, GUILayout.Width(width));
+ }
+
+ }
+}
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIHelper.cs.meta b/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIHelper.cs.meta
new file mode 100644
index 00000000..8cebb78f
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIHelper.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1e22254b156236945beac4eb5fadf36f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIScaleUtility.cs b/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIScaleUtility.cs
new file mode 100644
index 00000000..f960bbea
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIScaleUtility.cs
@@ -0,0 +1,262 @@
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+using System;
+using System.Reflection;
+
+namespace Workflow
+{
+
+ public static class GUIScaleUtility
+ {
+ // General
+ private static bool compabilityMode;
+ private static bool initiated;
+
+ // Delegates to the reflected methods
+ private static Func<Rect> GetTopRectDelegate;
+ private static Func<Rect> topmostRectDelegate;
+
+ // Delegate accessors
+ public static Rect getTopRect { get { return (Rect)GetTopRectDelegate.Invoke(); } }
+
+ // Rect stack for manipulating groups
+ public static List<Rect> currentRectStack { get; private set; }
+ private static List<List<Rect>> rectStackGroups;
+
+ // Matrices stack
+ private static List<Matrix4x4> GUIMatrices;
+ private static List<bool> adjustedGUILayout;
+
+ #region Init
+
+ public static void CheckInit()
+ {
+ if (!initiated)
+ Init();
+ }
+
+ public static void Init()
+ {
+ // Fetch rect acessors using Reflection
+ Assembly UnityEngine = Assembly.GetAssembly(typeof(UnityEngine.GUI));
+ Type GUIClipType = UnityEngine.GetType("UnityEngine.GUIClip", true);
+
+ PropertyInfo topmostRect = GUIClipType.GetProperty("topmostRect", BindingFlags.Static | BindingFlags.Public);
+ MethodInfo GetTopRect = GUIClipType.GetMethod("GetTopRect", BindingFlags.Static | BindingFlags.NonPublic);
+ MethodInfo ClipRect = GUIClipType.GetMethod("Clip", BindingFlags.Static | BindingFlags.Public, Type.DefaultBinder, new Type[] { typeof(Rect) }, new ParameterModifier[] { });
+
+ if (GUIClipType == null || topmostRect == null || GetTopRect == null || ClipRect == null)
+ {
+ Debug.LogWarning("GUIScaleUtility cannot run on this system! Compability mode enabled. For you that means you're not able to use the Node Editor inside more than one group:( Please PM me (Seneral @UnityForums) so I can figure out what causes this! Thanks!");
+ Debug.LogWarning((GUIClipType == null ? "GUIClipType is Null, " : "") + (topmostRect == null ? "topmostRect is Null, " : "") + (GetTopRect == null ? "GetTopRect is Null, " : "") + (ClipRect == null ? "ClipRect is Null, " : ""));
+ compabilityMode = true;
+ initiated = true;
+ return;
+ }
+
+ // Create simple acessor delegates
+ GetTopRectDelegate = (Func<Rect>)Delegate.CreateDelegate(typeof(Func<Rect>), GetTopRect);
+ topmostRectDelegate = (Func<Rect>)Delegate.CreateDelegate(typeof(Func<Rect>), topmostRect.GetGetMethod());
+
+ if (GetTopRectDelegate == null || topmostRectDelegate == null)
+ {
+ Debug.LogWarning("GUIScaleUtility cannot run on this system! Compability mode enabled. For you that means you're not able to use the Node Editor inside more than one group:( Please PM me (Seneral @UnityForums) so I can figure out what causes this! Thanks!");
+ Debug.LogWarning((GUIClipType == null ? "GUIClipType is Null, " : "") + (topmostRect == null ? "topmostRect is Null, " : "") + (GetTopRect == null ? "GetTopRect is Null, " : "") + (ClipRect == null ? "ClipRect is Null, " : ""));
+ compabilityMode = true;
+ initiated = true;
+ return;
+ }
+
+ // As we can call Begin/Ends inside another, we need to save their states hierarchial in Lists (not Stack, as we need to iterate over them!):
+ currentRectStack = new List<Rect>();
+ rectStackGroups = new List<List<Rect>>();
+ GUIMatrices = new List<Matrix4x4>();
+ adjustedGUILayout = new List<bool>();
+
+ initiated = true;
+ }
+
+ #endregion
+
+ #region Scale Area
+
+ /// <summary>
+ /// Begins a scaled local area.
+ /// Returns vector to offset GUI controls with to account for zooming to the pivot.
+ /// Using adjustGUILayout does that automatically for GUILayout rects. Theoretically can be nested!
+ /// </summary>
+ public static Vector2 BeginScale(ref Rect rect, Vector2 zoomPivot, float zoom, bool adjustGUILayout)
+ {
+ Rect screenRect;
+ if (compabilityMode)
+ {
+
+ // In compability mode, we will assume only one top group and do everything manually, not using reflected calls (-> practically blind)
+ GUI.EndGroup();
+ screenRect = rect;
+ }
+
+ else
+ {
+
+ // If it's supported, we take the completely generic way using reflected calls
+ GUIScaleUtility.BeginNoClip();
+ screenRect = GUIScaleUtility.GUIToScaledSpace(rect);
+ }
+
+ rect = Scale(screenRect, screenRect.position + zoomPivot, new Vector2(zoom, zoom));
+
+ // Now continue drawing using the new clipping group
+ GUI.BeginGroup(rect);
+ rect.position = Vector2.zero; // Adjust because we entered the new group
+
+ // Because I currently found no way to actually scale to a custom pivot rather than (0, 0),
+ // we'll make use of a cheat and just offset it accordingly to let it appear as if it would scroll to the center
+ // Note, due to that, controls not adjusted are still scaled to (0, 0)
+ Vector2 zoomPosAdjust = rect.center - screenRect.size / 2 + zoomPivot;
+
+ // For GUILayout, we can make this adjustment here if desired
+ adjustedGUILayout.Add(adjustGUILayout);
+ if (adjustGUILayout)
+ {
+ GUILayout.BeginHorizontal();
+ GUILayout.Space(rect.center.x - screenRect.size.x + zoomPivot.x);
+ GUILayout.BeginVertical();
+ GUILayout.Space(rect.center.y - screenRect.size.y + zoomPivot.y);
+ }
+
+ // Take a matrix backup to restore back later on
+ GUIMatrices.Add(GUI.matrix);
+
+ // Scale GUI.matrix. After that we have the correct clipping group again.
+ GUIUtility.ScaleAroundPivot(new Vector2(1 / zoom, 1 / zoom), zoomPosAdjust);
+
+ return zoomPosAdjust;
+ }
+
+ /// <summary>
+ /// Ends a scale region previously opened with BeginScale
+ /// </summary>
+ public static void EndScale()
+ {
+ // Set last matrix and clipping group
+ if (GUIMatrices.Count == 0 || adjustedGUILayout.Count == 0)
+ throw new UnityException("GUIScaleUtility: You are ending more scale regions than you are beginning!");
+
+ GUI.matrix = GUIMatrices[GUIMatrices.Count - 1];
+ GUIMatrices.RemoveAt(GUIMatrices.Count - 1);
+
+ // End GUILayout zoomPosAdjustment
+ if (adjustedGUILayout[adjustedGUILayout.Count - 1])
+ {
+
+ GUILayout.EndVertical();
+ GUILayout.EndHorizontal();
+ }
+ adjustedGUILayout.RemoveAt(adjustedGUILayout.Count - 1);
+
+ // End the scaled group
+ GUI.EndGroup();
+
+ if (compabilityMode)
+ {
+
+ // In compability mode, we don't know the previous group rect, but as we cannot use top groups there either way, we restore the screen group
+ GUI.BeginClip(new Rect(0, 23, Screen.width, Screen.height - 23));
+ }
+
+ else
+ {
+
+ // Else, restore the clips (groups)
+ GUIScaleUtility.RestoreClips();
+ }
+ }
+
+ #endregion
+
+ #region Clips Hierarchy
+
+ /// <summary>
+ /// Begins a field without groups. They should be restored using RestoreClips. Can be nested!
+ /// </summary>
+ public static void BeginNoClip()
+ {
+ // Record and close all clips one by one, from bottom to top, until we hit the 'origin'
+ List<Rect> rectStackGroup = new List<Rect>();
+ Rect topMostClip = getTopRect;
+ while (topMostClip != new Rect(-10000, -10000, 40000, 40000))
+ {
+ rectStackGroup.Add(topMostClip);
+ GUI.EndClip();
+ topMostClip = getTopRect;
+ }
+ // Store the clips appropriately
+ rectStackGroup.Reverse();
+ rectStackGroups.Add(rectStackGroup);
+ currentRectStack.AddRange(rectStackGroup);
+ }
+
+ /// <summary>
+ /// Restores the clips removed in BeginNoClip or MoveClipsUp
+ /// </summary>
+ public static void RestoreClips()
+ {
+ if (rectStackGroups.Count == 0)
+ {
+ Debug.LogError("GUIClipHierarchy: BeginNoClip/MoveClipsUp - RestoreClips count not balanced!");
+ return;
+ }
+
+ // Read and restore clips one by one, from top to bottom
+ List<Rect> rectStackGroup = rectStackGroups[rectStackGroups.Count - 1];
+ for (int clipCnt = 0; clipCnt < rectStackGroup.Count; clipCnt++)
+ {
+ GUI.BeginClip(rectStackGroup[clipCnt]);
+ currentRectStack.RemoveAt(currentRectStack.Count - 1);
+ }
+ rectStackGroups.RemoveAt(rectStackGroups.Count - 1);
+ }
+
+ #endregion
+
+ #region Space Transformations
+
+ /// <summary>
+ /// Scales the rect around the pivot with scale
+ /// </summary>
+ public static Rect Scale(Rect rect, Vector2 pivot, Vector2 scale)
+ {
+ rect.position = Vector2.Scale(rect.position - pivot, scale) + pivot;
+ rect.size = Vector2.Scale(rect.size, scale);
+ return rect;
+ }
+
+ public static Vector2 GUIToScaledSpace(Vector2 guiPosition)
+ {
+ if (rectStackGroups == null || rectStackGroups.Count == 0)
+ return guiPosition;
+ // Iterate through the clips and add positions ontop
+ List<Rect> rectStackGroup = rectStackGroups[rectStackGroups.Count - 1];
+ for (int clipCnt = 0; clipCnt < rectStackGroup.Count; clipCnt++)
+ guiPosition += rectStackGroup[clipCnt].position;
+ return guiPosition;
+ }
+
+ /// <summary>
+ /// Transforms the rect to the new space aquired with BeginNoClip or MoveClipsUp.
+ /// DOES NOT scale the rect, only offsets it!
+ /// It's way faster to call GUIToScreenSpace before modifying the space though!
+ /// </summary>
+ public static Rect GUIToScaledSpace(Rect guiRect)
+ {
+ if (rectStackGroups == null || rectStackGroups.Count == 0)
+ return guiRect;
+ guiRect.position = GUIToScaledSpace(guiRect.position);
+ return guiRect;
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIScaleUtility.cs.meta b/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIScaleUtility.cs.meta
new file mode 100644
index 00000000..b1140efd
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/GUIScaleUtility.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c26a02a8efc38bc49aaba1525555dac0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/Node.cs b/Erika/Assets/Tools/WorkflowVisualizer/Editor/Node.cs
index d7f9fa74..ab27e02e 100644
--- a/Erika/Assets/Tools/WorkflowVisualizer/Editor/Node.cs
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/Node.cs
@@ -2,41 +2,31 @@
using System.Collections.Generic;
using UnityEngine;
-public struct NodePosition
+namespace Workflow
{
- public Vector2 position;
- public Vector2 size;
-}
-
-/// <summary>
-/// 节点
-/// </summary>
-public class Node
-{
- // 节点名(包括路径,如Animation/RootMotion)
- public virtual string name { get { return "<node>"; } }
-
- // 图标路径,相对Resources目录
- public virtual string iconPath { get { return null; } }
- // 注解
- public virtual string note { get { return null; } }
+ public struct NodePosition
+ {
+ public Vector2 position;
+ public Vector2 size;
+ }
- public List<Node> children;
+ /// <summary>
+ /// 节点
+ /// </summary>
+ public class Node : ScriptableObject
+ {
+ // 节点名(包括路径,如Animation/RootMotion)
+ public virtual string name { get { return "<node>"; } }
- public virtual void OnSerialize()
- {
+ // 图标路径,相对Resources目录
+ public virtual string iconPath { get { return null; } }
- }
+ // 注解
+ public virtual string note { get { return null; } }
- public virtual void OnDeserialize()
- {
+ public List<Node> children;
- }
+ }
- public virtual void OnCustomGUI()
- {
-
- }
-
-} \ No newline at end of file
+}
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/SingleOutNode.cs b/Erika/Assets/Tools/WorkflowVisualizer/Editor/SingleOutNode.cs
new file mode 100644
index 00000000..5f282702
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/SingleOutNode.cs
@@ -0,0 +1 @@
+ \ No newline at end of file
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/SingleOutNode.cs.meta b/Erika/Assets/Tools/WorkflowVisualizer/Editor/SingleOutNode.cs.meta
new file mode 100644
index 00000000..76262c25
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/SingleOutNode.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d2d9b579e0562b2418478a1b97b77e13
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowEditor.cs b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowEditor.cs
new file mode 100644
index 00000000..03034b53
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowEditor.cs
@@ -0,0 +1,224 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEditor;
+
+namespace Workflow
+{
+ public class WorkflowEditor : EditorWindow
+ {
+ [MenuItem("Erika/Workflow")]
+ static void OpenWorkflow()
+ {
+ var w = EditorWindow.CreateInstance<WorkflowEditor>();
+ w.titleContent = new GUIContent("Workflow");
+ w.Show();
+ }
+
+ public const float kToolbarButtonWidth = 50f;
+ public const float kToolbarHeight = 20f;
+ public static float minZoom = 1f;
+ public static float maxZoom = 4f;
+ public static float panSpeed = 1.2f;
+ public static float zoomDelta = 0.1f;
+
+ private Vector2 m_ZoomAdjustment;
+
+ /// <summary>
+ /// The size of the window.
+ /// </summary>
+ public Rect Size
+ {
+ get { return new Rect(Vector2.zero, position.size); }
+ }
+
+ public Vector2 panOffset = Vector2.zero;
+
+ private Vector2 m_Zoom = Vector2.one;
+ public float zoomScale
+ {
+ get { return m_Zoom.x; }
+ set
+ {
+ float z = Mathf.Clamp(value, minZoom, maxZoom);
+ m_Zoom.Set(z, z);
+ }
+ }
+
+
+ private void OnGUI()
+ {
+ DrawNodeArea();
+
+ EditorGUILayout.BeginHorizontal("Toolbar");
+
+ if(GUIHelper.DropdownButton("File", kToolbarButtonWidth))
+ {
+ CreateFileMenu();
+ }
+
+ if (GUIHelper.DropdownButton("Edit", kToolbarButtonWidth))
+ {
+ CreateEditMenu();
+ }
+
+ if (GUIHelper.DropdownButton("View", kToolbarButtonWidth))
+ {
+ CreateViewMenu();
+ }
+
+ if (GUIHelper.DropdownButton("Settings", kToolbarButtonWidth + 10f))
+ {
+ CreateSettingsMenu();
+ }
+
+ if (GUIHelper.DropdownButton("Tools", kToolbarButtonWidth))
+ {
+ CreateToolsMenu();
+ }
+
+ // Make the toolbar extend all throughout the window extension.
+ GUILayout.FlexibleSpace();
+
+ EditorGUILayout.EndHorizontal();
+
+ if(Event.current.type == EventType.MouseDrag && Event.current.button == 2)
+ {
+ this.Pan(Event.current.delta);
+ this.Repaint();
+ }
+
+ if(Event.current.type == EventType.ScrollWheel && Event.current.button == 2)
+ {
+ this.Zoom(Event.current.delta.y);
+ this.Repaint();
+ }
+ }
+
+ private void CreateFileMenu()
+ {
+ var menu = new GenericMenu();
+
+ menu.AddItem(new GUIContent("Create New"), false, null);
+ menu.AddItem(new GUIContent("Load"), false, null);
+
+ menu.AddSeparator("");
+ menu.AddItem(new GUIContent("Save"), false, null);
+ menu.AddItem(new GUIContent("Save As"), false, null);
+
+ menu.DropDown(new Rect(5f, kToolbarHeight, 0f, 0f));
+ }
+
+
+ private void CreateEditMenu()
+ {
+ var menu = new GenericMenu();
+
+ menu.AddItem(new GUIContent("Undo"), false, null);
+ menu.AddItem(new GUIContent("Redo"), false, null);
+
+ menu.DropDown(new Rect(55f, kToolbarHeight, 0f, 0f));
+ }
+
+ private void CreateViewMenu()
+ {
+ var menu = new GenericMenu();
+
+ menu.AddItem(new GUIContent("Home"), false, null);
+ //menu.AddItem(new GUIContent("Zoom In"), false, () => { editor.Zoom(-1); });
+ //menu.AddItem(new GUIContent("Zoom Out"), false, () => { editor.Zoom(1); });
+
+ menu.DropDown(new Rect(105f, kToolbarHeight, 0f, 0f));
+ }
+
+ private void CreateSettingsMenu()
+ {
+ var menu = new GenericMenu();
+
+ //menu.AddItem(new GUIContent("Show Guide"), editor.bDrawGuide, editor.ToggleDrawGuide);
+
+ menu.DropDown(new Rect(155f, kToolbarHeight, 0f, 0f));
+ }
+
+ private void CreateToolsMenu()
+ {
+ var menu = new GenericMenu();
+
+ //menu.AddItem(new GUIContent("Add Test Nodes"), false, addTestNodes);
+ //menu.AddItem(new GUIContent("Clear Nodes"), false, clearNodes);
+
+ menu.DropDown(new Rect(215f, kToolbarHeight, 0f, 0f));
+ }
+
+ public void Pan(Vector2 delta)
+ {
+ panOffset += delta * zoomScale * panSpeed;
+ }
+
+
+ public void Zoom(float zoomDirection)
+ {
+ float scale = (zoomDirection < 0f) ? (1f - zoomDelta) : (1f + zoomDelta);
+
+ m_Zoom *= scale;
+
+ float cap = Mathf.Clamp(m_Zoom.x, minZoom, maxZoom);
+ m_Zoom.Set(cap, cap);
+ }
+
+ //-------------------------------------------------------------------------------
+ // Node area
+ //-------------------------------------------------------------------------------
+
+ void DrawNodeArea()
+ {
+ if (Event.current.type == EventType.Repaint)
+ {
+ DrawGrid();
+ }
+ }
+
+ void DrawGrid()
+ {
+ var size = this.Size.size;
+ var center = size / 2f;
+
+ float zoom = zoomScale;
+
+ // Offset from origin in tile units
+ float xOffset = -(center.x * zoom + panOffset.x) / Res.gridTex.width;
+ float yOffset = ((center.y - size.y) * zoom + panOffset.y) / Res.gridTex.height;
+
+ Vector2 tileOffset = new Vector2(xOffset, yOffset);
+
+ // Amount of tiles
+ float tileAmountX = Mathf.Round(size.x * zoom) / Res.gridTex.width;
+ float tileAmountY = Mathf.Round(size.y * zoom) / Res.gridTex.height;
+
+ Vector2 tileAmount = new Vector2(tileAmountX, tileAmountY);
+
+ // Draw tiled background
+ GUI.DrawTextureWithTexCoords(Size, Res.gridTex, new Rect(tileOffset, tileAmount));
+ }
+
+
+ private void DrawGraphContents()
+ {
+ Rect graphRect = Size;
+ var center = graphRect.size / 2f;
+
+ m_ZoomAdjustment = GUIScaleUtility.BeginScale(ref graphRect, center, zoomScale, false);
+
+ //drawGridOverlay();
+ //drawConnectionPreview();
+ //drawConnections();
+ //drawNodes();
+
+ GUIScaleUtility.EndScale();
+ }
+
+
+ }
+
+}
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowEditor.cs.meta b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowEditor.cs.meta
new file mode 100644
index 00000000..61e8f2ac
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowEditor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 5e6a9c7b5a66f8a4c823aba68e915031
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowGraph.cs b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowGraph.cs
new file mode 100644
index 00000000..bb50bff2
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowGraph.cs
@@ -0,0 +1,19 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEditor;
+
+namespace Workflow
+{
+
+ /// <summary>
+ /// 流程图
+ /// </summary>
+ public class WorkflowGraph : ScriptableObject
+ {
+
+
+
+ }
+
+}
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowGraph.cs.meta b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowGraph.cs.meta
new file mode 100644
index 00000000..7f449997
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowGraph.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8d15234d39bd47e4d93a5d48161055be
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowResources.cs b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowResources.cs
new file mode 100644
index 00000000..faae1246
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowResources.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Workflow
+{
+
+ public static class Res
+ {
+
+ public static Texture2D gridTex;
+
+ public static bool loaded = false;
+
+ static Res()
+ {
+ }
+
+ [UnityEditor.Callbacks.DidReloadScripts]
+ static void LoadAllResources()
+ {
+ if (loaded)
+ return ;
+
+ gridTex = UnityEngine.Resources.Load<Texture2D>("WorkflowVisualizer/Grid");
+
+ loaded = true;
+ }
+
+
+ }
+
+} \ No newline at end of file
diff --git a/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowResources.cs.meta b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowResources.cs.meta
new file mode 100644
index 00000000..766c4386
--- /dev/null
+++ b/Erika/Assets/Tools/WorkflowVisualizer/Editor/WorkflowResources.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2b7cb6867f9cf974182376aa9ed2a1e2
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: