private void DrawNodeParameter(SkillHsmConfigNodeData nodeData, string title) { EditorGUILayout.LabelField(title); List <SkillHsmConfigHSMParameter> parametersList = nodeData.ParameterList; Action <SkillHsmConfigHSMParameter> DelCallBack = (hSMParameter) => { if (null != HSMManager.hSMNodeAddDelParameter) { HSMManager.hSMNodeAddDelParameter(nodeData.Id, -1, hSMParameter, false); } }; Action <string> ChangeParameter = (parameterName) => { if (null != HSMManager.hSMNodeChangeParameter) { HSMManager.hSMNodeChangeParameter(nodeData.Id, -1, parameterName); } }; DrawParameter(nodeData, parametersList, DelCallBack, ChangeParameter, null); GUILayout.Space(10); EditorGUILayout.BeginVertical("box"); { DrawNodeAddParameter(nodeData); } EditorGUILayout.EndVertical(); }
private void DrawTransitionAddParameter(SkillHsmConfigNodeData nodeValue, int transitionId) { GUI.enabled = (transitionId >= 0); if (GUILayout.Button("添加条件")) { if (HSMManager.Instance.HSMTreeData.ParameterList.Count <= 0) { string msg = "没有参数可添加,请先添加参数"; if (HSMNodeWindow.window != null) { HSMNodeWindow.window.ShowNotification(msg); } } else { if (null != HSMManager.hSMNodeAddDelParameter) { SkillHsmConfigHSMParameter hSMParameter = HSMManager.Instance.HSMTreeData.ParameterList[0]; HSMManager.hSMNodeAddDelParameter(nodeValue.Id, transitionId, hSMParameter, true); } } } GUI.enabled = true; }
private void DrawTransitionParameter(SkillHsmConfigNodeData nodeData, SkillHsmConfigTransition transition, string title) { EditorGUILayout.BeginVertical("box"); { if (null != transition) { SkillHsmConfigNodeData toNode = HSMManager.Instance.GetNode(transition.ToStateId); string toNodeDescript = (null != toNode) ? toNode.Descript : string.Empty; string msg = string.Format("节点{0} -> 节点{1}", nodeData.Id, transition.ToStateId); EditorGUILayout.LabelField(msg); } } EditorGUILayout.EndVertical(); int transitionId = (null != transition) ? transition.TransitionId : -1; List <SkillHsmConfigHSMParameter> parametersList = (null != transition) ? transition.ParameterList : new List <SkillHsmConfigHSMParameter>(); Action <SkillHsmConfigHSMParameter> DelCallBack = (hSMParameter) => { if (null != HSMManager.hSMNodeAddDelParameter) { HSMManager.hSMNodeAddDelParameter(nodeData.Id, transitionId, hSMParameter, false); } }; Action <string> ChangeParameter = (parameterName) => { if (null != HSMManager.hSMNodeChangeParameter) { HSMManager.hSMNodeChangeParameter(nodeData.Id, transitionId, parameterName); } }; SkillHsmConfigTransitionGroup group = null; EditorGUILayout.BeginVertical("box"); { group = HSMTransitionGroup.DrawTransitionGroup(nodeData, transition); DrawTransitionAddGroup(nodeData, transitionId); } EditorGUILayout.EndVertical(); for (int i = 0; i < parametersList.Count; ++i) { parametersList[i].Index = i; } DrawParameter(nodeData, parametersList, DelCallBack, ChangeParameter, group); GUILayout.Space(10); EditorGUILayout.BeginVertical("box"); { DrawTransitionAddParameter(nodeData, transitionId); } EditorGUILayout.EndVertical(); }