فهرست منبع

format行为树代码

tanghai 8 سال پیش
والد
کامیت
05aa34eeff

+ 15 - 31
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorDesignerWindow.cs

@@ -17,20 +17,12 @@ namespace MyEditor
 
 
 	public class BehaviorDesignerWindow: EditorWindow
 	public class BehaviorDesignerWindow: EditorWindow
 	{
 	{
-		private GraphDesigner mGraphDesigner;
 		private PropertyDesigner mPropDesigner;
 		private PropertyDesigner mPropDesigner;
 		private RightDesigner mRightDesigner;
 		private RightDesigner mRightDesigner;
-		private static bool mShowSubWin;
 		private SubWinType mSubWinType;
 		private SubWinType mSubWinType;
 		private BehaviorTreeNodeClassPopup popUpMenu;
 		private BehaviorTreeNodeClassPopup popUpMenu;
 
 
-		public GraphDesigner GraphDesigner
-		{
-			get
-			{
-				return this.mGraphDesigner;
-			}
-		}
+		public GraphDesigner GraphDesigner { get; private set; }
 
 
 		public static BehaviorDesignerWindow Instance
 		public static BehaviorDesignerWindow Instance
 		{
 		{
@@ -40,13 +32,7 @@ namespace MyEditor
 			}
 			}
 		}
 		}
 
 
-		public static bool IsShowSubWin
-		{
-			get
-			{
-				return mShowSubWin;
-			}
-		}
+		public static bool IsShowSubWin { get; private set; }
 
 
 		public static void ShowWindow()
 		public static void ShowWindow()
 		{
 		{
@@ -56,14 +42,14 @@ namespace MyEditor
 
 
 		public void ShowSubWin(Vector2 pos, SubWinType subWinType)
 		public void ShowSubWin(Vector2 pos, SubWinType subWinType)
 		{
 		{
-			mShowSubWin = true;
+			IsShowSubWin = true;
 			popUpMenu.Show(windowRect, subWinType);
 			popUpMenu.Show(windowRect, subWinType);
 			windowRect.position = pos;
 			windowRect.position = pos;
 		}
 		}
 
 
 		public void CloseSubWin()
 		public void CloseSubWin()
 		{
 		{
-			mShowSubWin = false;
+			IsShowSubWin = false;
 		}
 		}
 
 
 		public static Rect windowRect = new Rect(400, 250, 400, 550); //子窗口的大小和位置
 		public static Rect windowRect = new Rect(400, 250, 400, 550); //子窗口的大小和位置
@@ -83,11 +69,11 @@ namespace MyEditor
 
 
 		public void Awake()
 		public void Awake()
 		{
 		{
-			mGraphDesigner = CreateInstance<GraphDesigner>();
+			this.GraphDesigner = CreateInstance<GraphDesigner>();
 			mPropDesigner = CreateInstance<PropertyDesigner>();
 			mPropDesigner = CreateInstance<PropertyDesigner>();
 			// mRightDesigner = new RightDesigner();
 			// mRightDesigner = new RightDesigner();
 			popUpMenu = new BehaviorTreeNodeClassPopup();
 			popUpMenu = new BehaviorTreeNodeClassPopup();
-			popUpMenu.GraphDesigner = mGraphDesigner;
+			popUpMenu.GraphDesigner = this.GraphDesigner;
 			//mGraphDesigner.onSelectTree();
 			//mGraphDesigner.onSelectTree();
 		}
 		}
 
 
@@ -95,9 +81,9 @@ namespace MyEditor
 		{
 		{
 			HandleEvents();
 			HandleEvents();
 			mPropDesigner?.Draw();
 			mPropDesigner?.Draw();
-			mGraphDesigner?.Draw(this.position);
+			this.GraphDesigner?.Draw(this.position);
 			//  mRightDesigner?.Draw();
 			//  mRightDesigner?.Draw();
-			if (mShowSubWin)
+			if (IsShowSubWin)
 			{
 			{
 				DrawSubWindow();
 				DrawSubWindow();
 			}
 			}
@@ -119,9 +105,7 @@ namespace MyEditor
 						BehaviorManager.Instance.SaveAll();
 						BehaviorManager.Instance.SaveAll();
 					}
 					}
 					break;
 					break;
-				case EventType.MouseDown:
-
-					break;
+				case EventType.MouseDown: break;
 			}
 			}
 		}
 		}
 
 
@@ -148,34 +132,34 @@ namespace MyEditor
 				Debug.LogError(" node list can not be null");
 				Debug.LogError(" node list can not be null");
 				return;
 				return;
 			}
 			}
-			mGraphDesigner.onSelectNode(list);
+			this.GraphDesigner.onSelectNode(list);
 			mPropDesigner.onSelectNode(list);
 			mPropDesigner.onSelectNode(list);
 			//      mRightDesigner.onSelectNode(list);
 			//      mRightDesigner.onSelectNode(list);
 		}
 		}
 
 
 		public void onStartConnect(NodeDesigner nodeDesigner, State state)
 		public void onStartConnect(NodeDesigner nodeDesigner, State state)
 		{
 		{
-			mGraphDesigner.onStartConnect(nodeDesigner, state);
+			this.GraphDesigner.onStartConnect(nodeDesigner, state);
 		}
 		}
 
 
 		public void onMouseInNode(BehaviorNodeData nodeData, NodeDesigner nodeDesigner)
 		public void onMouseInNode(BehaviorNodeData nodeData, NodeDesigner nodeDesigner)
 		{
 		{
-			mGraphDesigner.onMouseInNode(nodeData, nodeDesigner);
+			this.GraphDesigner.onMouseInNode(nodeData, nodeDesigner);
 		}
 		}
 
 
 		public void onCreateNode(string name, Vector2 pos)
 		public void onCreateNode(string name, Vector2 pos)
 		{
 		{
-			mGraphDesigner.onCreateNode(name, pos);
+			this.GraphDesigner.onCreateNode(name, pos);
 		}
 		}
 
 
 		public void onChangeNodeType(string name, Vector2 pos)
 		public void onChangeNodeType(string name, Vector2 pos)
 		{
 		{
-			mGraphDesigner.onChangeNodeType(name, pos);
+			this.GraphDesigner.onChangeNodeType(name, pos);
 		}
 		}
 
 
 		public NodeDesigner onCreateTree()
 		public NodeDesigner onCreateTree()
 		{
 		{
-			return mGraphDesigner.onCreateTree();
+			return this.GraphDesigner.onCreateTree();
 		}
 		}
 
 
 		public void onDraggingRightDesigner(float deltaX)
 		public void onDraggingRightDesigner(float deltaX)

+ 28 - 48
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorManager.cs

@@ -17,8 +17,6 @@ namespace MyEditor
 		public const int NodeIdStartIndex = 100000;
 		public const int NodeIdStartIndex = 100000;
 		private int AutoID = NodeIdStartIndex;
 		private int AutoID = NodeIdStartIndex;
 		private Dictionary<string, ClientNodeTypeProto> name2NodeProtoDict = new Dictionary<string, ClientNodeTypeProto>(); //节点类型 name索引
 		private Dictionary<string, ClientNodeTypeProto> name2NodeProtoDict = new Dictionary<string, ClientNodeTypeProto>(); //节点类型 name索引
-		private Dictionary<string, List<ClientNodeTypeProto>> classify2NodeProtoList = new Dictionary<string, List<ClientNodeTypeProto>>(); //节点分类 分类名索引
-		private static readonly BehaviorManager instance = new BehaviorManager();
 		public static List<List<long>> treePathList = new List<List<long>>();
 		public static List<List<long>> treePathList = new List<List<long>>();
 		public string selectNodeName;
 		public string selectNodeName;
 		public string selectNodeType;
 		public string selectNodeType;
@@ -32,21 +30,10 @@ namespace MyEditor
 			}
 			}
 		}
 		}
 
 
-		public static BehaviorManager Instance
-		{
-			get
-			{
-				return instance;
-			}
-		}
+		public static BehaviorManager Instance { get; } = new BehaviorManager();
 
 
-		public Dictionary<string, List<ClientNodeTypeProto>> Classify2NodeProtoList
-		{
-			get
-			{
-				return this.classify2NodeProtoList;
-			}
-		}
+		public Dictionary<string, List<ClientNodeTypeProto>> Classify2NodeProtoList { get; private set; } =
+			new Dictionary<string, List<ClientNodeTypeProto>>();
 
 
 		public List<ClientNodeTypeProto> AllNodeProtoList
 		public List<ClientNodeTypeProto> AllNodeProtoList
 		{
 		{
@@ -73,7 +60,7 @@ namespace MyEditor
 
 
 		public void FilterClassify()
 		public void FilterClassify()
 		{
 		{
-			this.classify2NodeProtoList = new Dictionary<string, List<ClientNodeTypeProto>>();
+			this.Classify2NodeProtoList = new Dictionary<string, List<ClientNodeTypeProto>>();
 			foreach (ClientNodeTypeProto nodeType in this.name2NodeProtoDict.Values)
 			foreach (ClientNodeTypeProto nodeType in this.name2NodeProtoDict.Values)
 			{
 			{
 				if (nodeType.isDeprecated)
 				if (nodeType.isDeprecated)
@@ -85,11 +72,11 @@ namespace MyEditor
 				{
 				{
 					classify = "未分类";
 					classify = "未分类";
 				}
 				}
-				if (!this.classify2NodeProtoList.ContainsKey(classify))
+				if (!this.Classify2NodeProtoList.ContainsKey(classify))
 				{
 				{
-					this.classify2NodeProtoList.Add(classify, new List<ClientNodeTypeProto>());
+					this.Classify2NodeProtoList.Add(classify, new List<ClientNodeTypeProto>());
 				}
 				}
-				this.classify2NodeProtoList[classify].Add(nodeType);
+				this.Classify2NodeProtoList[classify].Add(nodeType);
 			}
 			}
 		}
 		}
 
 
@@ -118,10 +105,7 @@ namespace MyEditor
 
 
 		public BehaviorTreeData BehaviorTreeConfigToTreeData(BehaviorTreeConfig config)
 		public BehaviorTreeData BehaviorTreeConfigToTreeData(BehaviorTreeConfig config)
 		{
 		{
-			BehaviorTreeData tree = new BehaviorTreeData
-			{
-				Root = NodeConfigToNodeData(config.RootNodeConfig)
-			};
+			BehaviorTreeData tree = new BehaviorTreeData { Root = NodeConfigToNodeData(config.RootNodeConfig) };
 			return tree;
 			return tree;
 		}
 		}
 
 
@@ -136,16 +120,16 @@ namespace MyEditor
 
 
 		public bool CheckSatisfyInput()
 		public bool CheckSatisfyInput()
 		{
 		{
-			NodeProto rootNode = NodeDataToNodeProto(CurTree.BehaviorNodeData);
+			NodeProto rootNode = this.BehaviorNodeDataToNodeProto(CurTree.BehaviorNodeData);
 			return CheckNodeInput(rootNode);
 			return CheckNodeInput(rootNode);
 		}
 		}
 
 
 		public bool CheckNodeInput(NodeProto nodeProto)
 		public bool CheckNodeInput(NodeProto nodeProto)
 		{
 		{
-			List<NodeFieldDesc> list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof (NodeInputAttribute));
+			List<NodeFieldDesc> list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof(NodeInputAttribute));
 			foreach (NodeFieldDesc desc in list)
 			foreach (NodeFieldDesc desc in list)
 			{
 			{
-				List<string> canInputList = GetCanInPutEnvKeyList(NodeProtoToNodeData(nodeProto), desc);
+				List<string> canInputList = GetCanInPutEnvKeyList(this.NodeProtoToBehaviorNodeData(nodeProto), desc);
 				string value = nodeProto.args_dict.GetTreeDictValue(desc.type, desc.name)?.ToString();
 				string value = nodeProto.args_dict.GetTreeDictValue(desc.type, desc.name)?.ToString();
 				List<string> resultList = canInputList.FindAll(str => { return str == value; });
 				List<string> resultList = canInputList.FindAll(str => { return str == value; });
 				if (resultList.Count == 0)
 				if (resultList.Count == 0)
@@ -193,11 +177,7 @@ namespace MyEditor
 			AutoID = NodeIdStartIndex;
 			AutoID = NodeIdStartIndex;
 			CurTree.Root.ResetId();
 			CurTree.Root.ResetId();
 		}
 		}
-
-		public void TransformTree(GameObject go)
-		{
-		}
-
+		
 		public void RemoveUnusedArgs(NodeProto nodeProto)
 		public void RemoveUnusedArgs(NodeProto nodeProto)
 		{
 		{
 			ClientNodeTypeProto proto = ExportNodeTypeConfig.GetNodeTypeProtoFromDll(nodeProto.name);
 			ClientNodeTypeProto proto = ExportNodeTypeConfig.GetNodeTypeProtoFromDll(nodeProto.name);
@@ -261,7 +241,7 @@ namespace MyEditor
 			}
 			}
 			try
 			try
 			{
 			{
-				config.RootNodeConfig = NodeDataToNodeConfig(tree.Root);
+				config.RootNodeConfig = this.BehaviorNodeDataToNodeConfig(tree.Root);
 			}
 			}
 			catch (Exception e)
 			catch (Exception e)
 			{
 			{
@@ -293,12 +273,12 @@ namespace MyEditor
 			return nodeData;
 			return nodeData;
 		}
 		}
 
 
-		public BehaviorNodeConfig NodeDataToNodeConfig(BehaviorNodeData nodeData)
+		public BehaviorNodeConfig BehaviorNodeDataToNodeConfig(BehaviorNodeData nodeData)
 		{
 		{
 			GameObject go = new GameObject();
 			GameObject go = new GameObject();
 			BehaviorNodeConfig nodeConfig = go.AddComponent<BehaviorNodeConfig>();
 			BehaviorNodeConfig nodeConfig = go.AddComponent<BehaviorNodeConfig>();
 			nodeConfig.id = nodeData.nodeId;
 			nodeConfig.id = nodeData.nodeId;
-			((Object) nodeConfig).name = nodeData.name;
+			nodeConfig.name = nodeData.name;
 			go.name = nodeData.name;
 			go.name = nodeData.name;
 			nodeConfig.describe = nodeData.describe;
 			nodeConfig.describe = nodeData.describe;
 			List<string> unUseList = new List<string>();
 			List<string> unUseList = new List<string>();
@@ -336,13 +316,13 @@ namespace MyEditor
 			}
 			}
 			foreach (BehaviorNodeData child in nodeData.children)
 			foreach (BehaviorNodeData child in nodeData.children)
 			{
 			{
-				BehaviorNodeConfig childConfig = NodeDataToNodeConfig(child);
+				BehaviorNodeConfig childConfig = this.BehaviorNodeDataToNodeConfig(child);
 				childConfig.gameObject.transform.parent = nodeConfig.gameObject.transform;
 				childConfig.gameObject.transform.parent = nodeConfig.gameObject.transform;
 			}
 			}
 			return nodeConfig;
 			return nodeConfig;
 		}
 		}
 
 
-		public BehaviorNodeData NodeProtoToNodeData(NodeProto nodeProto)
+		public BehaviorNodeData NodeProtoToBehaviorNodeData(NodeProto nodeProto)
 		{
 		{
 			BehaviorNodeData nodeData = new BehaviorNodeData
 			BehaviorNodeData nodeData = new BehaviorNodeData
 			{
 			{
@@ -354,12 +334,12 @@ namespace MyEditor
 			};
 			};
 			foreach (NodeProto child in nodeProto.children)
 			foreach (NodeProto child in nodeProto.children)
 			{
 			{
-				nodeData.children.Add(this.NodeProtoToNodeData(child));
+				nodeData.children.Add(this.NodeProtoToBehaviorNodeData(child));
 			}
 			}
 			return nodeData;
 			return nodeData;
 		}
 		}
 
 
-		public NodeProto NodeDataToNodeProto(BehaviorNodeData nodeData)
+		public NodeProto BehaviorNodeDataToNodeProto(BehaviorNodeData nodeData)
 		{
 		{
 			NodeProto nodeProto = new NodeProto
 			NodeProto nodeProto = new NodeProto
 			{
 			{
@@ -371,7 +351,7 @@ namespace MyEditor
 			};
 			};
 			foreach (BehaviorNodeData child in nodeData.children)
 			foreach (BehaviorNodeData child in nodeData.children)
 			{
 			{
-				nodeProto.children.Add(NodeDataToNodeProto(child));
+				nodeProto.children.Add(this.BehaviorNodeDataToNodeProto(child));
 			}
 			}
 			return nodeProto;
 			return nodeProto;
 		}
 		}
@@ -475,8 +455,8 @@ namespace MyEditor
 
 
 		public List<string> GetNodeOutPutEnvKeyList(BehaviorNodeData nodeData, NodeFieldDesc desc = null)
 		public List<string> GetNodeOutPutEnvKeyList(BehaviorNodeData nodeData, NodeFieldDesc desc = null)
 		{
 		{
-			NodeProto rootNode = NodeDataToNodeProto(CurTree.Root);
-			NodeProto inputNode = NodeDataToNodeProto(nodeData);
+			NodeProto rootNode = this.BehaviorNodeDataToNodeProto(CurTree.Root);
+			NodeProto inputNode = this.BehaviorNodeDataToNodeProto(nodeData);
 			List<NodeFieldDesc> descList = _GetNodeOutPutEnvKeyList(rootNode, inputNode, desc);
 			List<NodeFieldDesc> descList = _GetNodeOutPutEnvKeyList(rootNode, inputNode, desc);
 			List<string> list = new List<string>();
 			List<string> list = new List<string>();
 			foreach (NodeFieldDesc item in descList)
 			foreach (NodeFieldDesc item in descList)
@@ -497,11 +477,11 @@ namespace MyEditor
 
 
 			if (desc == null)
 			if (desc == null)
 			{
 			{
-				list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof (NodeOutputAttribute));
+				list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof(NodeOutputAttribute));
 			}
 			}
 			else
 			else
 			{
 			{
-				list = ExportNodeTypeConfig.GetNodeFieldInOutPutFilterDescList(nodeProto.name, typeof (NodeOutputAttribute), desc.envKeyType);
+				list = ExportNodeTypeConfig.GetNodeFieldInOutPutFilterDescList(nodeProto.name, typeof(NodeOutputAttribute), desc.envKeyType);
 			}
 			}
 			for (int i = 0; i < list.Count; i++)
 			for (int i = 0; i < list.Count; i++)
 			{
 			{
@@ -519,7 +499,7 @@ namespace MyEditor
 		public List<string> GetSelectNodeInputValueList(NodeProto nodeProto)
 		public List<string> GetSelectNodeInputValueList(NodeProto nodeProto)
 		{
 		{
 			List<string> resultList = new List<string>();
 			List<string> resultList = new List<string>();
-			List<NodeFieldDesc> list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof (NodeInputAttribute));
+			List<NodeFieldDesc> list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof(NodeInputAttribute));
 
 
 			foreach (NodeFieldDesc desc in list)
 			foreach (NodeFieldDesc desc in list)
 			{
 			{
@@ -535,14 +515,14 @@ namespace MyEditor
 		public void SelectNode(BehaviorNodeData node)
 		public void SelectNode(BehaviorNodeData node)
 		{
 		{
 			selectedNode = node;
 			selectedNode = node;
-			NodeProto nodeProto = NodeDataToNodeProto(node);
+			NodeProto nodeProto = this.BehaviorNodeDataToNodeProto(node);
 			inputValueList = GetSelectNodeInputValueList(nodeProto);
 			inputValueList = GetSelectNodeInputValueList(nodeProto);
 		}
 		}
 
 
 		public bool IsHighLight(BehaviorNodeData node)
 		public bool IsHighLight(BehaviorNodeData node)
 		{
 		{
-			NodeProto nodeProto = NodeDataToNodeProto(node);
-			List<NodeFieldDesc> list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof (NodeOutputAttribute));
+			NodeProto nodeProto = this.BehaviorNodeDataToNodeProto(node);
+			List<NodeFieldDesc> list = ExportNodeTypeConfig.GetNodeFieldInOutPutDescList(nodeProto.name, typeof(NodeOutputAttribute));
 			foreach (NodeFieldDesc desc in list)
 			foreach (NodeFieldDesc desc in list)
 			{
 			{
 				if (!nodeProto.args_dict.ContainsKey(desc.name))
 				if (!nodeProto.args_dict.ContainsKey(desc.name))

+ 2 - 14
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorNodeData.cs

@@ -30,8 +30,6 @@ namespace MyEditor
 		/// </summary>
 		/// </summary>
 		public string error = "";
 		public string error = "";
 
 
-		private string mClassify = "";
-
 		public NodeDesigner NodeDesigner { get; set; }
 		public NodeDesigner NodeDesigner { get; set; }
 
 
 		public Vector2 Pos;
 		public Vector2 Pos;
@@ -50,17 +48,7 @@ namespace MyEditor
 
 
 		public BehaviorNodeData Parent { get; set; }
 		public BehaviorNodeData Parent { get; set; }
 
 
-		public string Classify
-		{
-			get
-			{
-				return mClassify;
-			}
-			set
-			{
-				mClassify = value;
-			}
-		}
+		public string Classify { get; set; } = "";
 
 
 		public BehaviorNodeData(string proto_name)
 		public BehaviorNodeData(string proto_name)
 		{
 		{
@@ -71,7 +59,7 @@ namespace MyEditor
 				this.Proto = BehaviorManager.Instance.GetNodeTypeProto("Unknow");
 				this.Proto = BehaviorManager.Instance.GetNodeTypeProto("Unknow");
 				return;
 				return;
 			}
 			}
-			mClassify = this.Proto.classify;
+			this.Classify = this.Proto.classify;
 
 
 			foreach (NodeFieldDesc args_desc in this.Proto.new_args_desc)
 			foreach (NodeFieldDesc args_desc in this.Proto.new_args_desc)
 			{
 			{

+ 1 - 1
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeConfigEditor.cs

@@ -4,7 +4,7 @@ using UnityEngine;
 
 
 namespace MyEditor
 namespace MyEditor
 {
 {
-	[CustomEditor(typeof (BehaviorTreeConfig))]
+	[CustomEditor(typeof(BehaviorTreeConfig))]
 	public class BehaviorTreeConfigEditor: Editor
 	public class BehaviorTreeConfigEditor: Editor
 	{
 	{
 		public override void OnInspectorGUI()
 		public override void OnInspectorGUI()

+ 4 - 3
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeNodeClassPopup.cs

@@ -46,7 +46,7 @@ namespace MyEditor
 			GUILayout.BeginHorizontal();
 			GUILayout.BeginHorizontal();
 
 
 			GUILayout.Label("Filter");
 			GUILayout.Label("Filter");
-			Array strArr = Enum.GetValues(typeof (NodeClassifyType));
+			Array strArr = Enum.GetValues(typeof(NodeClassifyType));
 			List<string> strList = new List<string>();
 			List<string> strList = new List<string>();
 			strList.Add("All");
 			strList.Add("All");
 			foreach (object str in strArr)
 			foreach (object str in strArr)
@@ -66,7 +66,7 @@ namespace MyEditor
 			GUILayout.BeginArea(new Rect(0, 0, windowRect.width, windowRect.height));
 			GUILayout.BeginArea(new Rect(0, 0, windowRect.width, windowRect.height));
 			float topSpace = 60;
 			float topSpace = 60;
 			this.mTreeScrollPos = GUI.BeginScrollView(new Rect(0f, topSpace, windowRect.width, windowRect.height - topSpace), this.mTreeScrollPos,
 			this.mTreeScrollPos = GUI.BeginScrollView(new Rect(0f, topSpace, windowRect.width, windowRect.height - topSpace), this.mTreeScrollPos,
-					new Rect(0f, 0f, windowRect.width - 20f, nodeNameList.Count * 19), false, true);
+			                                          new Rect(0f, 0f, windowRect.width - 20f, nodeNameList.Count * 19), false, true);
 
 
 			foreach (string name in nodeNameList)
 			foreach (string name in nodeNameList)
 			{
 			{
@@ -108,7 +108,7 @@ namespace MyEditor
 			}
 			}
 			else
 			else
 			{
 			{
-				selectType = Enum.GetName(typeof (NodeClassifyType), mEnumNodeTypeSelection - 1);
+				selectType = Enum.GetName(typeof(NodeClassifyType), mEnumNodeTypeSelection - 1);
 				foreach (string name in list)
 				foreach (string name in list)
 				{
 				{
 					ClientNodeTypeProto proto = ExportNodeTypeConfig.GetNodeTypeProtoFromDll(name);
 					ClientNodeTypeProto proto = ExportNodeTypeConfig.GetNodeTypeProtoFromDll(name);
@@ -138,6 +138,7 @@ namespace MyEditor
 
 
 		//private readonly Color textColor = new Color(200f / 255f, 200f / 255f, 200f / 255f);
 		//private readonly Color textColor = new Color(200f / 255f, 200f / 255f, 200f / 255f);
 		private readonly Color textColor = new Color(100f / 255f, 100f / 255f, 0f, 1);
 		private readonly Color textColor = new Color(100f / 255f, 100f / 255f, 0f, 1);
+
 		private readonly Color textHighLightColor = new Color(100f / 255f, 100f / 255f, 0f, 1);
 		private readonly Color textHighLightColor = new Color(100f / 255f, 100f / 255f, 0f, 1);
 
 
 		public GUIStyle GetButtonStyle()
 		public GUIStyle GetButtonStyle()

+ 5 - 5
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeOperateUtility.cs

@@ -16,7 +16,7 @@ namespace MyEditor
 
 
 		public BehaviourTreeNodeProxy(NodeProto p)
 		public BehaviourTreeNodeProxy(NodeProto p)
 		{
 		{
-			Node = (T) Activator.CreateInstance(typeof (T), p);
+			Node = (T) Activator.CreateInstance(typeof(T), p);
 			Proto = p;
 			Proto = p;
 			UpdateData();
 			UpdateData();
 		}
 		}
@@ -44,7 +44,7 @@ namespace MyEditor
 		{
 		{
 			foreach (KeyValuePair<string, ValueBase> argsItem in Proto.args_dict.Dict())
 			foreach (KeyValuePair<string, ValueBase> argsItem in Proto.args_dict.Dict())
 			{
 			{
-				FieldInfo fieldInfo = typeof (T).GetField(argsItem.Key, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
+				FieldInfo fieldInfo = typeof(T).GetField(argsItem.Key, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
 				fieldInfo.SetValue(Node, argsItem.Value.GetValue());
 				fieldInfo.SetValue(Node, argsItem.Value.GetValue());
 			}
 			}
 		}
 		}
@@ -66,7 +66,7 @@ namespace MyEditor
 		public static GameObject CreateTreeWithType<T>(string path, string desc = "默认行为树")
 		public static GameObject CreateTreeWithType<T>(string path, string desc = "默认行为树")
 		{
 		{
 			desc = desc.Replace("BT_", "");
 			desc = desc.Replace("BT_", "");
-			return CreateTree(path, typeof (T).Name, desc);
+			return CreateTree(path, typeof(T).Name, desc);
 		}
 		}
 
 
 		public static GameObject CreateTree(string path, string rootNodeName, string desc = "默认行为树")
 		public static GameObject CreateTree(string path, string rootNodeName, string desc = "默认行为树")
@@ -118,7 +118,7 @@ namespace MyEditor
 		public static BehaviourTreeNodeProxy<T> AddNodeToLast<T>(BehaviorTreeConfig tree) where T : Node
 		public static BehaviourTreeNodeProxy<T> AddNodeToLast<T>(BehaviorTreeConfig tree) where T : Node
 		{
 		{
 			BehaviorNodeConfig parent = tree.RootNodeConfig;
 			BehaviorNodeConfig parent = tree.RootNodeConfig;
-			string name = typeof (T).Name;
+			string name = typeof(T).Name;
 			BehaviorNodeConfig p = tree.AddChild(parent, name);
 			BehaviorNodeConfig p = tree.AddChild(parent, name);
 			BehaviourTreeNodeProxy<T> proxy = new BehaviourTreeNodeProxy<T>(p.ToNodeProto());
 			BehaviourTreeNodeProxy<T> proxy = new BehaviourTreeNodeProxy<T>(p.ToNodeProto());
 			return proxy;
 			return proxy;
@@ -127,7 +127,7 @@ namespace MyEditor
 		public static BehaviourTreeNodeProxy<T> CreateNode<T>() where T : Node
 		public static BehaviourTreeNodeProxy<T> CreateNode<T>() where T : Node
 		{
 		{
 			NodeProto p = new NodeProto();
 			NodeProto p = new NodeProto();
-			p.name = typeof (T).Name;
+			p.name = typeof(T).Name;
 			BehaviourTreeNodeProxy<T> proxy = new BehaviourTreeNodeProxy<T>(p);
 			BehaviourTreeNodeProxy<T> proxy = new BehaviourTreeNodeProxy<T>(p);
 			return proxy;
 			return proxy;
 		}
 		}

+ 1 - 1
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeToolWindow.cs

@@ -17,7 +17,7 @@ namespace MyEditor
 		public static void ShowWindow()
 		public static void ShowWindow()
 		{
 		{
 			Type[] a = new Type[1];
 			Type[] a = new Type[1];
-			a[0] = typeof (BehaviorDesignerWindow);
+			a[0] = typeof(BehaviorDesignerWindow);
 			//BehaviorDesignerWindow target = GetWindow<BehaviorDesignerWindow>(false, "行为树编辑器",a);
 			//BehaviorDesignerWindow target = GetWindow<BehaviorDesignerWindow>(false, "行为树编辑器",a);
 			BehaviorTreeToolWindow target = GetWindow<BehaviorTreeToolWindow>("工具箱", true, a);
 			BehaviorTreeToolWindow target = GetWindow<BehaviorTreeToolWindow>("工具箱", true, a);
 			target.ShowTab();
 			target.ShowTab();

+ 1 - 3
Unity/Assets/Editor/BehaviorTreeEditor/Event/BehaviorTreeRunTreeEvent_ShowDebugInfo.cs

@@ -1,6 +1,5 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using Model;
 using Model;
-using MyEditor;
 
 
 namespace MyEditor
 namespace MyEditor
 {
 {
@@ -9,8 +8,7 @@ namespace MyEditor
 	{
 	{
 		public void Run(BehaviorTree tree, List<long> pathList)
 		public void Run(BehaviorTree tree, List<long> pathList)
 		{
 		{
-			if (BehaviorManager.Instance.BehaviorTreeConfig != null &&
-			    tree.behaviorTreeConfig.name == BehaviorManager.Instance.BehaviorTreeConfig.name)
+			if (BehaviorManager.Instance.BehaviorTreeConfig != null && tree.behaviorTreeConfig.name == BehaviorManager.Instance.BehaviorTreeConfig.name)
 			{
 			{
 				BehaviorManager.treePathList.Add(pathList);
 				BehaviorManager.treePathList.Add(pathList);
 				BehaviorManager.Instance.ClearDebugState();
 				BehaviorManager.Instance.ClearDebugState();

+ 7 - 7
Unity/Assets/Editor/BehaviorTreeEditor/ExportNodeTypeConfig.cs

@@ -60,12 +60,12 @@ namespace MyEditor
 
 
 		public static ClientNodeTypeProto GetNodeTypeProtoFromType(Type type)
 		public static ClientNodeTypeProto GetNodeTypeProtoFromType(Type type)
 		{
 		{
-			object[] nodeAttrs = type.GetCustomAttributes(typeof (NodeAttribute), false);
+			object[] nodeAttrs = type.GetCustomAttributes(typeof(NodeAttribute), false);
 			if (nodeAttrs.Length == 0)
 			if (nodeAttrs.Length == 0)
 			{
 			{
 				return null;
 				return null;
 			}
 			}
-			object[] nodeDeprecatedAttrs = type.GetCustomAttributes(typeof (NodeDeprecatedAttribute), false);
+			object[] nodeDeprecatedAttrs = type.GetCustomAttributes(typeof(NodeDeprecatedAttribute), false);
 			NodeAttribute nodeAttribute = nodeAttrs[0] as NodeAttribute;
 			NodeAttribute nodeAttribute = nodeAttrs[0] as NodeAttribute;
 			NodeDeprecatedAttribute nodeDeprecatedAttribute = null;
 			NodeDeprecatedAttribute nodeDeprecatedAttribute = null;
 			if (nodeDeprecatedAttrs.Length != 0)
 			if (nodeDeprecatedAttrs.Length != 0)
@@ -83,9 +83,9 @@ namespace MyEditor
 				proto.deprecatedDesc = nodeDeprecatedAttribute.Desc;
 				proto.deprecatedDesc = nodeDeprecatedAttribute.Desc;
 			}
 			}
 
 
-			proto.new_args_desc.AddRange(GetNodeFieldDesc(type, typeof (NodeInputAttribute)));
-			proto.new_args_desc.AddRange(GetNodeFieldDesc(type, typeof (NodeOutputAttribute)));
-			proto.new_args_desc.AddRange(GetNodeFieldDesc(type, typeof (NodeFieldAttribute)));
+			proto.new_args_desc.AddRange(GetNodeFieldDesc(type, typeof(NodeInputAttribute)));
+			proto.new_args_desc.AddRange(GetNodeFieldDesc(type, typeof(NodeOutputAttribute)));
+			proto.new_args_desc.AddRange(GetNodeFieldDesc(type, typeof(NodeFieldAttribute)));
 
 
 			proto.child_limit = NodeTypeCountDict[nodeAttribute.ClassifytType];
 			proto.child_limit = NodeTypeCountDict[nodeAttribute.ClassifytType];
 			proto.classify = nodeAttribute.ClassifytType.ToString();
 			proto.classify = nodeAttribute.ClassifytType.ToString();
@@ -135,12 +135,12 @@ namespace MyEditor
 					desc.value = GetDefaultValue(field.FieldType, attri);
 					desc.value = GetDefaultValue(field.FieldType, attri);
 					desc.attributeType = fieldAttributeType;
 					desc.attributeType = fieldAttributeType;
 					desc.envKeyType = attri.envKeyType;
 					desc.envKeyType = attri.envKeyType;
-					if ((typeof (NodeInputAttribute) == fieldAttributeType || typeof (NodeInputAttribute) == fieldAttributeType) && desc.envKeyType == null)
+					if ((typeof(NodeInputAttribute) == fieldAttributeType || typeof(NodeInputAttribute) == fieldAttributeType) && desc.envKeyType == null)
 					{
 					{
 						Log.Error($"Node:{type.Name} Field:{desc.name}  _envKeyType can not be null");
 						Log.Error($"Node:{type.Name} Field:{desc.name}  _envKeyType can not be null");
 						return null;
 						return null;
 					}
 					}
-					object[] constraints = field.GetCustomAttributes(typeof (NodeFieldConstraintAttribute), false);
+					object[] constraints = field.GetCustomAttributes(typeof(NodeFieldConstraintAttribute), false);
 					if (constraints.Length > 0)
 					if (constraints.Length > 0)
 					{
 					{
 						NodeFieldConstraintAttribute constraint = constraints[0] as NodeFieldConstraintAttribute;
 						NodeFieldConstraintAttribute constraint = constraints[0] as NodeFieldConstraintAttribute;

+ 3 - 15
Unity/Assets/Editor/BehaviorTreeEditor/FoldoutNode.cs

@@ -11,7 +11,7 @@ namespace MyEditor
 
 
 		private readonly DelegateMethod mCallback;
 		private readonly DelegateMethod mCallback;
 
 
-		public string Text { get; } = "...";
+		public string Text { get; }
 
 
 		public bool Hide { get; set; } = false;
 		public bool Hide { get; set; } = false;
 
 
@@ -52,25 +52,13 @@ namespace MyEditor
 
 
 	public class FoldoutFolder //折叠的目录
 	public class FoldoutFolder //折叠的目录
 	{
 	{
-		private bool mHide;
-
 		public delegate void DelegateMethod(FoldoutFolder self);
 		public delegate void DelegateMethod(FoldoutFolder self);
 
 
 		private readonly DelegateMethod mCallback;
 		private readonly DelegateMethod mCallback;
 
 
-		public string Text { get; } = "...";
+		public string Text { get; }
 
 
-		public bool Hide
-		{
-			get
-			{
-				return mHide;
-			}
-			set
-			{
-				mHide = value;
-			}
-		}
+		public bool Hide { get; set; }
 
 
 		public bool Fold { get; set; }
 		public bool Fold { get; set; }
 
 

+ 5 - 17
Unity/Assets/Editor/BehaviorTreeEditor/GraphDesigner.cs

@@ -33,7 +33,7 @@ namespace MyEditor
 		{
 		{
 			mBorderRect = new Rect(mLeftWidth, 0, windowRect.width - mLeftWidth - 16 - mRightWidth, windowRect.height - 16);
 			mBorderRect = new Rect(mLeftWidth, 0, windowRect.width - mLeftWidth - 16 - mRightWidth, windowRect.height - 16);
 			mScrollPosition = GUI.BeginScrollView(new Rect(mBorderRect.x, mBorderRect.y, mBorderRect.width + 15f, mBorderRect.height + 15f), mScrollPosition,
 			mScrollPosition = GUI.BeginScrollView(new Rect(mBorderRect.x, mBorderRect.y, mBorderRect.width + 15f, mBorderRect.height + 15f), mScrollPosition,
-					mGraphRect, true, true);
+			                                      mGraphRect, true, true);
 
 
 			DrawBackground();
 			DrawBackground();
 			DrawConnectingLine();
 			DrawConnectingLine();
@@ -248,7 +248,7 @@ namespace MyEditor
 		public void DrawMouseIcon(string resName)
 		public void DrawMouseIcon(string resName)
 		{
 		{
 			GUI.DrawTexture(new Rect(Event.current.mousePosition.x - 10, Event.current.mousePosition.y - 20, 17, 20),
 			GUI.DrawTexture(new Rect(Event.current.mousePosition.x - 10, Event.current.mousePosition.y - 20, 17, 20),
-					BehaviorDesignerUtility.GetTexture(resName));
+			                BehaviorDesignerUtility.GetTexture(resName));
 		}
 		}
 
 
 		public void CheckMouseInNode()
 		public void CheckMouseInNode()
@@ -417,7 +417,7 @@ namespace MyEditor
 				else
 				else
 				{
 				{
 					string menuName = string.Format($"替换成{selectNodeName}");
 					string menuName = string.Format($"替换成{selectNodeName}");
-					NodeClassifyType value = (NodeClassifyType) Enum.Parse(typeof (NodeClassifyType), selectNodeType);
+					NodeClassifyType value = (NodeClassifyType) Enum.Parse(typeof(NodeClassifyType), selectNodeType);
 					int count = ExportNodeTypeConfig.NodeTypeCountDict[value];
 					int count = ExportNodeTypeConfig.NodeTypeCountDict[value];
 					if (selectNodeType == NodeClassifyType.Root.ToString() || (count == 0 && mSelectedNode.NodeData.Proto.child_limit > 0))
 					if (selectNodeType == NodeClassifyType.Root.ToString() || (count == 0 && mSelectedNode.NodeData.Proto.child_limit > 0))
 					{
 					{
@@ -596,22 +596,11 @@ namespace MyEditor
 		/// 节点逻辑相关
 		/// 节点逻辑相关
 		private readonly List<NodeDesigner> mDetachedNodes = new List<NodeDesigner>();
 		private readonly List<NodeDesigner> mDetachedNodes = new List<NodeDesigner>();
 
 
-		private NodeDesigner mRootNode;
 		private NodeDesigner mSelectedNode;
 		private NodeDesigner mSelectedNode;
 		private NodeDesigner mCopyNode;
 		private NodeDesigner mCopyNode;
 		private NodeDesigner mCutNode;
 		private NodeDesigner mCutNode;
 
 
-		public NodeDesigner RootNode
-		{
-			get
-			{
-				return mRootNode;
-			}
-			set
-			{
-				mRootNode = value;
-			}
-		}
+		public NodeDesigner RootNode { get; set; }
 
 
 		public NodeDesigner CreateNode(BehaviorNodeData nodeData, Vector2 pos)
 		public NodeDesigner CreateNode(BehaviorNodeData nodeData, Vector2 pos)
 		{
 		{
@@ -684,8 +673,7 @@ namespace MyEditor
 				case State.Normal:
 				case State.Normal:
 					ClickNode(dstNode);
 					ClickNode(dstNode);
 					break;
 					break;
-				case State.Drag:
-					break;
+				case State.Drag: break;
 				case State.Shift:
 				case State.Shift:
 					ShiftNode(dstNode);
 					ShiftNode(dstNode);
 					break;
 					break;

+ 3 - 12
Unity/Assets/Editor/BehaviorTreeEditor/NodeDesigner.cs

@@ -7,7 +7,6 @@ namespace MyEditor
 {
 {
 	public class NodeDesigner
 	public class NodeDesigner
 	{
 	{
-		private NodeDesigner mParent;
 		private Texture2D mBoxHighLight;
 		private Texture2D mBoxHighLight;
 		private Texture2D mBoxSelectHighLight;
 		private Texture2D mBoxSelectHighLight;
 		private bool isSelected;
 		private bool isSelected;
@@ -25,17 +24,7 @@ namespace MyEditor
 
 
 		public List<NodeDesigner> Children { get; } = new List<NodeDesigner>();
 		public List<NodeDesigner> Children { get; } = new List<NodeDesigner>();
 
 
-		public NodeDesigner Parent
-		{
-			get
-			{
-				return mParent;
-			}
-			set
-			{
-				mParent = value;
-			}
-		}
+		public NodeDesigner Parent { get; set; }
 
 
 		public void UpdateChildren()
 		public void UpdateChildren()
 		{
 		{
@@ -58,8 +47,10 @@ namespace MyEditor
 		}
 		}
 
 
 		public BehaviorNodeData NodeData { get; set; }
 		public BehaviorNodeData NodeData { get; set; }
+
 		//坐标位置相关
 		//坐标位置相关
 		public float Width;
 		public float Width;
+
 		public float Height;
 		public float Height;
 		public Vector2 Pos = Vector2.zero; //中心点
 		public Vector2 Pos = Vector2.zero; //中心点
 
 

+ 6 - 6
Unity/Assets/Editor/BehaviorTreeEditor/NodeExtension.cs

@@ -46,7 +46,7 @@ namespace Model
 
 
 		public T CreateNode<T>(Node parent) where T : Node
 		public T CreateNode<T>(Node parent) where T : Node
 		{
 		{
-			T node = (T) Activator.CreateInstance(typeof (T), new NodeProto());
+			T node = (T) Activator.CreateInstance(typeof(T), new NodeProto());
 			AddChild(node, parent);
 			AddChild(node, parent);
 			return node;
 			return node;
 		}
 		}
@@ -84,7 +84,7 @@ namespace Model
 			{
 			{
 				sourceTree = source.AddComponent<BehaviorTreeConfig>();
 				sourceTree = source.AddComponent<BehaviorTreeConfig>();
 			}
 			}
-			Node root = (Node) Activator.CreateInstance(typeof (T), new NodeProto());
+			Node root = (Node) Activator.CreateInstance(typeof(T), new NodeProto());
 			BTEditorTree tree = new BTEditorTree(root, sourceTree);
 			BTEditorTree tree = new BTEditorTree(root, sourceTree);
 			return tree;
 			return tree;
 		}
 		}
@@ -106,7 +106,7 @@ namespace Model
 			while (nodeStack.Count > 0)
 			while (nodeStack.Count > 0)
 			{
 			{
 				Node c = nodeStack.Dequeue();
 				Node c = nodeStack.Dequeue();
-				if (c.GetType() == typeof (T))
+				if (c.GetType() == typeof(T))
 				{
 				{
 					return c as T;
 					return c as T;
 				}
 				}
@@ -132,7 +132,7 @@ namespace Model
 			while (nodeStack.Count > 0)
 			while (nodeStack.Count > 0)
 			{
 			{
 				Node c = nodeStack.Dequeue();
 				Node c = nodeStack.Dequeue();
-				if (c.GetType() == typeof (T))
+				if (c.GetType() == typeof(T))
 				{
 				{
 					list.Add(c as T);
 					list.Add(c as T);
 				}
 				}
@@ -196,7 +196,7 @@ namespace Model
 				Node c = nodeStack.Dequeue();
 				Node c = nodeStack.Dequeue();
 				foreach (Node child in c.GetChildren)
 				foreach (Node child in c.GetChildren)
 				{
 				{
-					if (child.GetType() == typeof (T))
+					if (child.GetType() == typeof(T))
 					{
 					{
 						return child as T;
 						return child as T;
 					}
 					}
@@ -216,7 +216,7 @@ namespace Model
 				Node c = nodeStack.Dequeue();
 				Node c = nodeStack.Dequeue();
 				foreach (Node child in c.GetChildren)
 				foreach (Node child in c.GetChildren)
 				{
 				{
-					if (child.GetType() == typeof (T))
+					if (child.GetType() == typeof(T))
 					{
 					{
 						list.Add(child as T);
 						list.Add(child as T);
 					}
 					}

+ 9 - 9
Unity/Assets/Editor/BehaviorTreeEditor/PropertyDesigner.cs

@@ -164,7 +164,7 @@ namespace MyEditor
 			GUILayout.BeginHorizontal();
 			GUILayout.BeginHorizontal();
 
 
 			GUILayout.Label("Filter");
 			GUILayout.Label("Filter");
-			Array strArr = Enum.GetValues(typeof (NodeClassifyType));
+			Array strArr = Enum.GetValues(typeof(NodeClassifyType));
 			List<string> strList = new List<string>();
 			List<string> strList = new List<string>();
 			strList.Add("All");
 			strList.Add("All");
 			foreach (object str in strArr)
 			foreach (object str in strArr)
@@ -182,7 +182,7 @@ namespace MyEditor
 
 
 			GUILayout.BeginArea(new Rect(0f, 15f + 20, this.mWidth, Screen.height - offset));
 			GUILayout.BeginArea(new Rect(0f, 15f + 20, this.mWidth, Screen.height - offset));
 			this.mTreeScrollPos = GUI.BeginScrollView(new Rect(0f, 0f, this.mWidth, Screen.height - offset), this.mTreeScrollPos,
 			this.mTreeScrollPos = GUI.BeginScrollView(new Rect(0f, 0f, this.mWidth, Screen.height - offset), this.mTreeScrollPos,
-					new Rect(0f, 0f, this.mWidth - 20f, mNodeCount * 19), false, false);
+			                                          new Rect(0f, 0f, this.mWidth - 20f, mNodeCount * 19), false, false);
 			mNodeFoldout.Draw();
 			mNodeFoldout.Draw();
 			GUI.EndScrollView();
 			GUI.EndScrollView();
 			GUILayout.EndArea();
 			GUILayout.EndArea();
@@ -259,7 +259,7 @@ namespace MyEditor
 				}
 				}
 				else
 				else
 				{
 				{
-					selectType = Enum.GetName(typeof (NodeClassifyType), mEnumNodeTypeSelection - 1);
+					selectType = Enum.GetName(typeof(NodeClassifyType), mEnumNodeTypeSelection - 1);
 				}
 				}
 
 
 				if (selectType == folder.Text || selectType == "All")
 				if (selectType == folder.Text || selectType == "All")
@@ -316,7 +316,7 @@ namespace MyEditor
 		public GameObject BehaviourTreeField(string desc, GameObject value)
 		public GameObject BehaviourTreeField(string desc, GameObject value)
 		{
 		{
 			EditorGUILayout.BeginHorizontal();
 			EditorGUILayout.BeginHorizontal();
-			value = (GameObject) EditorGUILayout.ObjectField(desc, value, typeof (GameObject), false);
+			value = (GameObject) EditorGUILayout.ObjectField(desc, value, typeof(GameObject), false);
 			if (value.GetComponent<BehaviorTreeConfig>() != null && GUILayout.Button("打开行为树"))
 			if (value.GetComponent<BehaviorTreeConfig>() != null && GUILayout.Button("打开行为树"))
 			{
 			{
 				BehaviorManager.Instance.OpenBehaviorEditor(value);
 				BehaviorManager.Instance.OpenBehaviorEditor(value);
@@ -354,9 +354,9 @@ namespace MyEditor
 
 
 		private void DrawAllValue(ClientNodeTypeProto proto)
 		private void DrawAllValue(ClientNodeTypeProto proto)
 		{
 		{
-			List<NodeFieldDesc> paramFieldList = GetFieldDescList(proto.new_args_desc, typeof (NodeFieldAttribute));
-			List<NodeFieldDesc> inputFieldList = GetFieldDescList(proto.new_args_desc, typeof (NodeInputAttribute));
-			List<NodeFieldDesc> outputFieldList = GetFieldDescList(proto.new_args_desc, typeof (NodeOutputAttribute));
+			List<NodeFieldDesc> paramFieldList = GetFieldDescList(proto.new_args_desc, typeof(NodeFieldAttribute));
+			List<NodeFieldDesc> inputFieldList = GetFieldDescList(proto.new_args_desc, typeof(NodeInputAttribute));
+			List<NodeFieldDesc> outputFieldList = GetFieldDescList(proto.new_args_desc, typeof(NodeOutputAttribute));
 			mFoldParam = EditorGUILayout.Foldout(mFoldParam, "参数");
 			mFoldParam = EditorGUILayout.Foldout(mFoldParam, "参数");
 			if (mFoldParam)
 			if (mFoldParam)
 			{
 			{
@@ -622,7 +622,7 @@ namespace MyEditor
 			}
 			}
 			else
 			else
 			{
 			{
-				enumValueArr = BehaviorTreeInOutConstrain.GetEnvKeyEnum(typeof (BTEnvKey));
+				enumValueArr = BehaviorTreeInOutConstrain.GetEnvKeyEnum(typeof(BTEnvKey));
 				if (enumValueArr.Length == 0)
 				if (enumValueArr.Length == 0)
 				{
 				{
 					enumValueArr = new string[1] { BTEnvKey.None };
 					enumValueArr = new string[1] { BTEnvKey.None };
@@ -731,7 +731,7 @@ namespace MyEditor
 			float offset = 55f;
 			float offset = 55f;
 			GUILayout.BeginArea(new Rect(0f, 20f, this.mWidth, Screen.height - offset));
 			GUILayout.BeginArea(new Rect(0f, 20f, this.mWidth, Screen.height - offset));
 			this.mTreeScrollPos = GUI.BeginScrollView(new Rect(0f, 0f, this.mWidth, Screen.height - offset), this.mTreeScrollPos,
 			this.mTreeScrollPos = GUI.BeginScrollView(new Rect(0f, 0f, this.mWidth, Screen.height - offset), this.mTreeScrollPos,
-					new Rect(0f, 0f, this.mWidth - 20f, BehaviorManager.treePathList.Count * 22), false, false);
+			                                          new Rect(0f, 0f, this.mWidth - 20f, BehaviorManager.treePathList.Count * 22), false, false);
 
 
 			for (int i = 0; i < BehaviorManager.treePathList.Count; i++)
 			for (int i = 0; i < BehaviorManager.treePathList.Count; i++)
 			{
 			{

+ 6 - 15
Unity/Assets/Editor/BehaviorTreeEditor/RightDesigner.cs

@@ -16,10 +16,9 @@ namespace MyEditor
 		private string mSearchNode = "";
 		private string mSearchNode = "";
 		private FoldoutNode mCurNode;
 		private FoldoutNode mCurNode;
 
 
-		private int mNodeTypeSelection;
-		private string[] mNodeTypeToolbarStrings = { "All", "Composite", "Decorator", "Action", "Condition", "Root", "DataTrans" };
 		private int mEnumNodeTypeSelection;
 		private int mEnumNodeTypeSelection;
-		string[] mEnumNodeTypeArr;
+
+		private string[] mEnumNodeTypeArr;
 		// private FoldoutFolder mNodeFoldout;
 		// private FoldoutFolder mNodeFoldout;
 
 
 		private Vector2 mTreeScrollPos = Vector2.zero;
 		private Vector2 mTreeScrollPos = Vector2.zero;
@@ -74,12 +73,7 @@ namespace MyEditor
 			DrawNodeFunctions(offset);
 			DrawNodeFunctions(offset);
 		}
 		}
 
 
-		private string searchNodeName = "";
-		private BehaviorTreeConfig searchTree;
 		private readonly GameObject[] searchGoArr = new GameObject[0];
 		private readonly GameObject[] searchGoArr = new GameObject[0];
-		private Rect mBorderRect; //边框
-		private Vector2 mScrollPosition = Vector2.zero;
-		private Rect mGraphRect = new Rect(0, 0, 50, 50); //绘图区域
 		private Vector2 scrollPosition = Vector2.zero;
 		private Vector2 scrollPosition = Vector2.zero;
 
 
 		private void DrawTools()
 		private void DrawTools()
@@ -101,12 +95,10 @@ namespace MyEditor
 			GUILayout.EndArea();
 			GUILayout.EndArea();
 		}
 		}
 
 
-		private BehaviorTreeConfig treeConfig;
-
 		public GameObject BehaviourTreeField(string desc, GameObject value)
 		public GameObject BehaviourTreeField(string desc, GameObject value)
 		{
 		{
 			EditorGUILayout.BeginHorizontal();
 			EditorGUILayout.BeginHorizontal();
-			value = (GameObject) EditorGUILayout.ObjectField(desc, value, typeof (GameObject), false);
+			value = (GameObject) EditorGUILayout.ObjectField(desc, value, typeof(GameObject), false);
 			if (value.GetComponent<BehaviorTreeConfig>() != null && GUILayout.Button("打开行为树"))
 			if (value.GetComponent<BehaviorTreeConfig>() != null && GUILayout.Button("打开行为树"))
 			{
 			{
 				BehaviorManager.Instance.OpenBehaviorEditor(value);
 				BehaviorManager.Instance.OpenBehaviorEditor(value);
@@ -129,12 +121,11 @@ namespace MyEditor
 			GUILayout.EndHorizontal();
 			GUILayout.EndHorizontal();
 
 
 			toolbarRect = new Rect(0f, 15f, mWidth, 25f);
 			toolbarRect = new Rect(0f, 15f, mWidth, 25f);
-			Rect boxRect = new Rect(0f, toolbarRect.height, this.mWidth, (Screen.height - toolbarRect.height) - 21f + 10);
 			GUILayout.BeginArea(toolbarRect, EditorStyles.toolbar);
 			GUILayout.BeginArea(toolbarRect, EditorStyles.toolbar);
 			GUILayout.BeginHorizontal();
 			GUILayout.BeginHorizontal();
 
 
 			GUILayout.Label("Filter");
 			GUILayout.Label("Filter");
-			Array strArr = Enum.GetValues(typeof (NodeClassifyType));
+			Array strArr = Enum.GetValues(typeof(NodeClassifyType));
 			List<string> strList = new List<string>();
 			List<string> strList = new List<string>();
 			strList.Add("All");
 			strList.Add("All");
 			foreach (object str in strArr)
 			foreach (object str in strArr)
@@ -152,7 +143,7 @@ namespace MyEditor
 
 
 			GUILayout.BeginArea(new Rect(0f, 15f + 20, this.mWidth, Screen.height - offset));
 			GUILayout.BeginArea(new Rect(0f, 15f + 20, this.mWidth, Screen.height - offset));
 			this.mTreeScrollPos = GUI.BeginScrollView(new Rect(0f, 0f, this.mWidth, Screen.height - offset), this.mTreeScrollPos,
 			this.mTreeScrollPos = GUI.BeginScrollView(new Rect(0f, 0f, this.mWidth, Screen.height - offset), this.mTreeScrollPos,
-					new Rect(0f, 0f, this.mWidth - 20f, mNodeCount * 19), false, false);
+			                                          new Rect(0f, 0f, this.mWidth - 20f, mNodeCount * 19), false, false);
 			mNodeFoldout.Draw();
 			mNodeFoldout.Draw();
 			GUI.EndScrollView();
 			GUI.EndScrollView();
 			GUILayout.EndArea();
 			GUILayout.EndArea();
@@ -250,7 +241,7 @@ namespace MyEditor
 				}
 				}
 				else
 				else
 				{
 				{
-					selectType = Enum.GetName(typeof (NodeClassifyType), mEnumNodeTypeSelection - 1);
+					selectType = Enum.GetName(typeof(NodeClassifyType), mEnumNodeTypeSelection - 1);
 				}
 				}
 
 
 				if (selectType == folder.Text || selectType == "All")
 				if (selectType == folder.Text || selectType == "All")

+ 2 - 6
Unity/Assets/Scripts/BehaviorTree/ClientNodeTypeProto.cs

@@ -16,7 +16,7 @@ namespace Model
 		public Type envKeyType;
 		public Type envKeyType;
 	}
 	}
 
 
-	public class ClientNodeTypeProto: AConfig
+	public class ClientNodeTypeProto
 	{
 	{
 		public string type = "";
 		public string type = "";
 		public string name = "";
 		public string name = "";
@@ -32,11 +32,7 @@ namespace Model
 		public List<string> game_object_desc = new List<string>();
 		public List<string> game_object_desc = new List<string>();
 		public bool isDeprecated;
 		public bool isDeprecated;
 		public string deprecatedDesc;
 		public string deprecatedDesc;
-
-		public ClientNodeTypeProto(): base(EntityType.Config)
-		{
-		}
-
+		
 		public override string ToString()
 		public override string ToString()
 		{
 		{
 			return $"Type:{type}, Desc:{describe}";
 			return $"Type:{type}, Desc:{describe}";

+ 3 - 1
Unity/Unity.sln

@@ -1,6 +1,8 @@
 
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2017
+# Visual Studio 15
+VisualStudioVersion = 15.0.26430.12
+MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Plugins", "Unity.Plugins.csproj", "{D1FDB199-0FB7-099D-3771-C6A942E4E326}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Plugins", "Unity.Plugins.csproj", "{D1FDB199-0FB7-099D-3771-C6A942E4E326}"
 EndProject
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Unity.csproj", "{CF118143-7E37-744F-BE45-3F55345FEC40}"
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Unity.csproj", "{CF118143-7E37-744F-BE45-3F55345FEC40}"