Ver Fonte

整理代码,删除不用的变量

tanghai há 8 anos atrás
pai
commit
35596323d0

+ 1 - 0
.gitignore

@@ -35,3 +35,4 @@ _ReSharper.CSharp/
 /Unity/CSharp60Support/compilation.log
 /.vs
 /Unity/.vs/
+/Unity/*.sln

+ 1 - 3
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorManager.cs

@@ -508,13 +508,11 @@ namespace MyEditor
 			}
 			return resultList;
 		}
-
-		private BehaviorNodeData selectedNode;
+		
 		private List<string> inputValueList;
 
 		public void SelectNode(BehaviorNodeData node)
 		{
-			selectedNode = node;
 			NodeProto nodeProto = this.BehaviorNodeDataToNodeProto(node);
 			inputValueList = GetSelectNodeInputValueList(nodeProto);
 		}

+ 2 - 2
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorNodeConfigExtension.cs

@@ -34,9 +34,9 @@ namespace Model
 					}
 					fieldValueinfo.SetValue(comp, fieldValue);
 				}
-				catch (Exception ex)
+				catch (Exception e)
 				{
-					throw new GameException($"transform failed,nodeName:{nodeData.name}  fieldName:{args.Key} fieldType:{originType}");
+					throw new GameException($"transform failed,nodeName:{nodeData.name}  fieldName:{args.Key} fieldType:{originType} {e}");
 				}
 			}
 			foreach (NodeProto child in nodeData.children)

+ 1 - 7
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeNodeClassPopup.cs

@@ -41,7 +41,6 @@ namespace MyEditor
 			GUILayout.EndHorizontal();
 			//
 			toolbarRect = new Rect(0f, 15f + 20, mWidth, 25f);
-			Rect boxRect = new Rect(0f, toolbarRect.height, this.mWidth, (Screen.height - toolbarRect.height) - 21f + 10);
 			GUILayout.BeginArea(toolbarRect, EditorStyles.toolbar);
 			GUILayout.BeginHorizontal();
 
@@ -135,12 +134,7 @@ namespace MyEditor
 			}
 			return result2;
 		}
-
-		//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 textHighLightColor = new Color(100f / 255f, 100f / 255f, 0f, 1);
-
+		
 		public GUIStyle GetButtonStyle()
 		{
 			GUIStyle style = new GUIStyle();

+ 2 - 6
Unity/Assets/Editor/BehaviorTreeEditor/BehaviorTreeOperateUtility.cs

@@ -97,7 +97,7 @@ namespace MyEditor
 			{
 				GameObject go = new GameObject();
 				BehaviorTreeConfig newConfig = go.AddComponent<BehaviorTreeConfig>();
-				BehaviorNodeConfig root = newConfig.AddRootNode(rootNodeName);
+				newConfig.AddRootNode(rootNodeName);
 
 				prefab = PrefabUtility.CreatePrefab($"{path}/BT_{desc}.prefab", go, ReplacePrefabOptions.ReplaceNameBased);
 				EditorUtility.SetDirty(newConfig);
@@ -110,11 +110,7 @@ namespace MyEditor
 			}
 			return prefab;
 		}
-
-		private static void SortBehaviorTree(BehaviorNodeConfig nodeConfig)
-		{
-		}
-
+		
 		public static BehaviourTreeNodeProxy<T> AddNodeToLast<T>(BehaviorTreeConfig tree) where T : Node
 		{
 			BehaviorNodeConfig parent = tree.RootNodeConfig;

+ 3 - 11
Unity/Assets/Editor/BehaviorTreeEditor/GraphDesigner.cs

@@ -458,27 +458,19 @@ namespace MyEditor
 			{
 				Log.Error("字符串输入参数有误");
 			}
-			return string.Compare(clientNodeType1.name, clientNodeType2.name);
+			return String.CompareOrdinal(clientNodeType1.name, clientNodeType2.name);
 		}
 
 		public void AutoSort()
 		{
 			RootNode?.AutoSort();
 		}
-
-		private void AddNodeMenuCallback(object obj)
-		{
-			string nodeType = (string) obj;
-			ClientNodeTypeProto nodeProto = BehaviorManager.Instance.GetNodeTypeProto(nodeType);
-			BehaviorNodeData nodeData = BehaviorManager.Instance.CreateNode((int) BehaviorManager.Instance.CurTree.Id, nodeProto.name);
-			NodeDesigner node = CreateNode(nodeData, MousePosToGraphPos(mMousePos));
-		}
-
+		
 		private void CreateNode()
 		{
 			ClientNodeTypeProto nodeProto = BehaviorManager.Instance.GetNodeTypeProto(BehaviorManager.Instance.selectNodeName);
 			BehaviorNodeData nodeData = BehaviorManager.Instance.CreateNode((int) BehaviorManager.Instance.CurTree.Id, nodeProto.name);
-			NodeDesigner node = CreateNode(nodeData, MousePosToGraphPos(mMousePos));
+			CreateNode(nodeData, MousePosToGraphPos(mMousePos));
 		}
 
 		public void CopyNode()

+ 1 - 6
Unity/Assets/Editor/BehaviorTreeEditor/NodeDesigner.cs

@@ -84,8 +84,7 @@ namespace MyEditor
 		}
 
 		public Rect Size;
-
-		private bool mShowValue;
+		
 		private Texture2D mBoxTex;
 		private Texture2D mLeftConnectTex;
 		private Texture2D mRightConnectTex;
@@ -94,10 +93,6 @@ namespace MyEditor
 		{
 			NodeData.Proto = BehaviorManager.Instance.GetNodeTypeProto(NodeData.name);
 			string[] arr = NodeData.Proto.style.Split('/');
-			if (arr.Length > 1 && arr[1] == "value")
-			{
-				mShowValue = true;
-			}
 			string style = arr.Length > 0? arr[0] : "";
 			if (style == "")
 			{

+ 4 - 15
Unity/Assets/Editor/BehaviorTreeEditor/PropertyDesigner.cs

@@ -145,9 +145,7 @@ namespace MyEditor
 			DrawSearchList(offset);
 			DrawNodeFunctions(offset);
 		}
-
-		private int mNodeTypeSelection;
-		private string[] mNodeTypeToolbarStrings = { "All", "Composite", "Decorator", "Action", "Condition", "Root", "DataTrans" };
+		
 		private int mEnumNodeTypeSelection;
 		string[] mEnumNodeTypeArr;
 
@@ -159,7 +157,6 @@ namespace MyEditor
 			GUILayout.EndHorizontal();
 
 			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.BeginHorizontal();
 
@@ -287,13 +284,8 @@ namespace MyEditor
 				}
 			}
 		}
-
-		private string searchNodeName = "";
-		private BehaviorTreeConfig searchTree;
+		
 		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 void ShowResult()
@@ -310,9 +302,7 @@ namespace MyEditor
 			GUI.EndScrollView();
 			GUILayout.EndArea();
 		}
-
-		private BehaviorTreeConfig treeConfig;
-
+		
 		public GameObject BehaviourTreeField(string desc, GameObject value)
 		{
 			EditorGUILayout.BeginHorizontal();
@@ -681,9 +671,8 @@ namespace MyEditor
 				oldValue = GetDefaultEnumValue(desc.type);
 			}
 			Enum oldValueEnum = (Enum) Enum.Parse(desc.type, oldValue);
-			Enum newValueEnum;
 			EditorGUILayout.LabelField(desc.type.ToString());
-			newValueEnum = EditorGUILayout.EnumPopup(oldValueEnum);
+			Enum newValueEnum = EditorGUILayout.EnumPopup(oldValueEnum);
 			return newValueEnum.ToString();
 		}
 

+ 1 - 1
Unity/Assets/Editor/ReferenceCollectorEditor/ReferenceCollectorEditor.cs

@@ -115,7 +115,7 @@ public class ReferenceCollectorEditor: Editor
 			dataProperty.DeleteArrayElementAtIndex(i);
 		}
 		serializedObject.ApplyModifiedProperties();
-		serializedObject.UpdateIfDirtyOrScript();
+		serializedObject.UpdateIfRequiredOrScript();
 	}
 
 	private void AddReference(SerializedProperty dataProperty, string key, Object obj)

+ 30 - 38
Unity/Assets/Editor/SDKPorter/XCodeEditor/ZipHelper.cs

@@ -38,60 +38,52 @@ namespace cn.sharesdk.unity3d
 
 		private void UnzipFile(ZipEntry zip, ZipInputStream zipInStream, string dirPath)
 		{
-			try
+			//文件名不为空  
+			if (!string.IsNullOrEmpty(zip.Name))
 			{
-				//文件名不为空  
-				if (!string.IsNullOrEmpty(zip.Name))
-				{
-					string filePath = dirPath;
-					filePath += ("/" + zip.Name);
+				string filePath = dirPath;
+				filePath += ("/" + zip.Name);
 
-					//如果是一个新的文件路径 这里需要创建这个文件路径  
-					if (IsDirectory(filePath))
+				//如果是一个新的文件路径 这里需要创建这个文件路径  
+				if (IsDirectory(filePath))
+				{
+					if (!Directory.Exists(filePath))
 					{
-						if (!Directory.Exists(filePath))
-						{
-							Directory.CreateDirectory(filePath);
-						}
+						Directory.CreateDirectory(filePath);
+					}
+				}
+				else
+				{
+					FileStream fs = null;
+					//当前文件夹下有该文件  删掉  重新创建  
+					if (File.Exists(filePath))
+					{
+						File.Delete(filePath);
 					}
-					else
+					fs = File.Create(filePath);
+					int size = 2048;
+					byte[] data = new byte[2048];
+					//每次读取2MB  直到把这个内容读完  
+					while (true)
 					{
-						FileStream fs = null;
-						//当前文件夹下有该文件  删掉  重新创建  
-						if (File.Exists(filePath))
+						size = zipInStream.Read(data, 0, data.Length);
+						//小于0, 也就读完了当前的流  
+						if (size > 0)
 						{
-							File.Delete(filePath);
+							fs.Write(data, 0, size);
 						}
-						fs = File.Create(filePath);
-						int size = 2048;
-						byte[] data = new byte[2048];
-						//每次读取2MB  直到把这个内容读完  
-						while (true)
+						else
 						{
-							size = zipInStream.Read(data, 0, data.Length);
-							//小于0, 也就读完了当前的流  
-							if (size > 0)
-							{
-								fs.Write(data, 0, size);
-							}
-							else
-							{
-								break;
-							}
+							break;
 						}
-						fs.Close();
 					}
+					fs.Close();
 				}
 			}
-			catch (Exception e)
-			{
-				throw new Exception();
-			}
 		}
 			
 		private bool IsDirectory(string path)
 		{
-
 			if (path[path.Length - 1] == '/')
 			{
 				return true;