private void DrawNode(NodeValue nodeValue, string title) { if (nodeValue.NodeType != (int)NODE_TYPE.CONDITION && nodeValue.NodeType != (int)NODE_TYPE.ACTION) { return; } EditorGUILayout.BeginVertical("box", GUILayout.ExpandWidth(true)); { EditorGUILayout.LabelField(title); int height = (nodeValue.parameterList.Count * 70) + 20; height = height <= 300 ? height : 300; scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(height)); { GUI.backgroundColor = new Color(0.85f, 0.85f, 0.85f, 1f); for (int i = 0; i < nodeValue.parameterList.Count; ++i) { BehaviorParameter behaviorParameter = nodeValue.parameterList[i]; Action DelCallBack = () => { if (null != BehaviorManager.behaviorNodeParameter) { BehaviorManager.behaviorNodeParameter(nodeValue.id, behaviorParameter, false); } }; EditorGUILayout.BeginVertical("box"); { string parameterName = behaviorParameter.parameterName; BehaviorParameter tempParameter = behaviorParameter.Clone(); tempParameter = DrawParameter.Draw(behaviorParameter, DrawParameterType.NODE_PARAMETER, DelCallBack); if (parameterName.CompareTo(behaviorParameter.parameterName) != 0) { if (null != BehaviorManager.behaviorNodeChangeParameter) { BehaviorManager.behaviorNodeChangeParameter(nodeValue.id, parameterName, behaviorParameter.parameterName); } } else { tempParameter.Clone(behaviorParameter); } } EditorGUILayout.EndVertical(); } GUI.backgroundColor = Color.white; } EditorGUILayout.EndScrollView(); } EditorGUILayout.EndVertical(); GUILayout.Space(10); EditorGUILayout.BeginVertical("box"); { DrawAddParameter(nodeValue); } EditorGUILayout.EndVertical(); }
private void DrawNode(NodeValue nodeValue, string title) { if (nodeValue.NodeType != (int)NODE_TYPE.CONDITION && nodeValue.NodeType != (int)NODE_TYPE.ACTION) { return; } ConditionGroup conditionGroup = DrawConditionGroup(nodeValue); for (int i = 0; i < nodeValue.parameterList.Count; ++i) { nodeValue.parameterList[i].index = i; } GUI.enabled = !BehaviorManager.Instance.CurrentOpenConfigSubTree(); EditorGUILayout.BeginVertical("box", GUILayout.ExpandWidth(true)); { EditorGUILayout.LabelField(title); int height = (nodeValue.parameterList.Count * 58); height = height <= 300 ? height : 300; scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(height)); { GUI.backgroundColor = new Color(0.85f, 0.85f, 0.85f, 1f); for (int i = 0; i < nodeValue.parameterList.Count; ++i) { BehaviorParameter behaviorParameter = nodeValue.parameterList[i]; Action DelCallBack = () => { if (null != BehaviorManager.behaviorNodeParameter) { BehaviorManager.behaviorNodeParameter(nodeValue.id, behaviorParameter, false); } }; Color color = Color.white; if (null != conditionGroup) { string name = conditionGroup.parameterList.Find(a => (a.CompareTo(behaviorParameter.parameterName) == 0)); if (!string.IsNullOrEmpty(name)) { color = colorArr[0]; } } GUI.backgroundColor = color; // new Color(0.85f, 0.85f, 0.85f, 1f); EditorGUILayout.BeginVertical("box"); { string parameterName = behaviorParameter.parameterName; BehaviorParameter tempParameter = behaviorParameter.Clone(); tempParameter = DrawParameter.Draw(behaviorParameter, DrawParameterType.NODE_PARAMETER, DelCallBack); if (parameterName.CompareTo(behaviorParameter.parameterName) != 0) { if (null != BehaviorManager.behaviorNodeChangeParameter) { BehaviorManager.behaviorNodeChangeParameter(nodeValue.id, parameterName, behaviorParameter.parameterName); } } else { behaviorParameter.CloneFrom(tempParameter); } } EditorGUILayout.EndVertical(); } GUI.backgroundColor = Color.white; } EditorGUILayout.EndScrollView(); } EditorGUILayout.EndVertical(); GUI.enabled = true; GUILayout.Space(10); EditorGUILayout.BeginVertical("box"); { DrawAddParameter(nodeValue); } EditorGUILayout.EndVertical(); }