Пример #1
0
        public void Draw(List <SkillHsmConfigHSMParameter> parameterList)
        {
            EditorGUILayout.LabelField("运行时变量");

            EditorGUILayout.BeginVertical("box", GUILayout.ExpandWidth(true));
            {
                EditorGUILayout.LabelField("条件参数");
                scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.ExpandHeight(true));
                {
                    GUI.backgroundColor = new Color(0.85f, 0.85f, 0.85f, 1f);
                    for (int i = 0; i < parameterList.Count; ++i)
                    {
                        SkillHsmConfigHSMParameter HSMParameter = parameterList[i];
                        EditorGUILayout.BeginVertical("box");
                        {
                            HSMParameter = HSMDrawParameter.Draw(HSMParameter, HSMDrawParameterType.RUNTIME_PARAMETER, null);
                        }
                        EditorGUILayout.EndVertical();
                    }
                    GUI.backgroundColor = Color.white;
                }
                EditorGUILayout.EndScrollView();
            }
            EditorGUILayout.EndVertical();
        }
Пример #2
0
        public void Draw(List <SkillHsmConfigHSMParameter> parameterList)
        {
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.LabelField("全部变量");
                GUILayout.Space(50);
                if (GUILayout.Button("导入变量"))
                {
                    HSMFileHandle.ImportParameter();
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginVertical("box", GUILayout.ExpandWidth(true));
            {
                EditorGUILayout.LabelField("条件参数");
                scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.ExpandHeight(true));
                {
                    GUI.backgroundColor = new Color(0.85f, 0.85f, 0.85f, 1f);
                    for (int i = 0; i < parameterList.Count; ++i)
                    {
                        SkillHsmConfigHSMParameter hsmParameter = parameterList[i];

                        Action DelCallBack = () =>
                        {
                            if (null != HSMManager.hSMNodeAddDelParameter)
                            {
                                HSMManager.parameterChange(hsmParameter, false);
                            }
                        };

                        EditorGUILayout.BeginVertical("box");
                        {
                            hsmParameter = HSMDrawParameter.Draw(hsmParameter, HSMDrawParameterType.HSM_PARAMETER, DelCallBack);
                        }
                        EditorGUILayout.EndVertical();
                    }
                    GUI.backgroundColor = Color.white;
                }
                EditorGUILayout.EndScrollView();
            }
            EditorGUILayout.EndVertical();

            GUILayout.Space(10);
            EditorGUILayout.BeginVertical("box");
            {
                DrawAddParameter();
            }
            EditorGUILayout.EndVertical();
        }
Пример #3
0
        private void DrawAddParameter()
        {
            if (null == newAddParameter)
            {
                newAddParameter = new SkillHsmConfigHSMParameter();
            }

            EditorGUILayout.BeginVertical("box");
            {
                newAddParameter = HSMDrawParameter.Draw(newAddParameter, HSMDrawParameterType.HSM_PARAMETER_ADD, null);
            }
            EditorGUILayout.EndVertical();
            GUILayout.Space(5);

            if (GUILayout.Button("添加条件"))
            {
                if (null != HSMManager.hSMNodeAddDelParameter)
                {
                    HSMManager.parameterChange(newAddParameter, true);
                }
            }
        }
Пример #4
0
        private void DrawParameter(SkillHsmConfigNodeData nodeData, List <SkillHsmConfigHSMParameter> parametersList, Action <SkillHsmConfigHSMParameter> delCallBack, Action <string> ChangeParameter, SkillHsmConfigTransitionGroup group)
        {
            EditorGUILayout.BeginVertical("box", GUILayout.ExpandWidth(true));
            {
                int height = 0;
                for (int i = 0; i < parametersList.Count; ++i)
                {
                    SkillHsmConfigHSMParameter parameter = parametersList[i];
                    height += 50;
                }

                height    = height <= 300 ? height : 300;
                scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(height));
                {
                    for (int i = 0; i < parametersList.Count; ++i)
                    {
                        SkillHsmConfigHSMParameter hSMParameter = parametersList[i];

                        Action DelCallBack = () =>
                        {
                            if (null != delCallBack)
                            {
                                delCallBack(hSMParameter);
                            }
                        };

                        Color color = Color.white;
                        if (null != group)
                        {
                            string name = group.ParameterList.Find(a => (a.CompareTo(hSMParameter.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 = hSMParameter.ParameterName;

                            SkillHsmConfigHSMParameter tempParameter = hSMParameter.Clone();
                            tempParameter = HSMDrawParameter.Draw(hSMParameter, HSMDrawParameterType.NODE_PARAMETER, DelCallBack);
                            if (parameterName.CompareTo(hSMParameter.ParameterName) != 0)
                            {
                                if (null != ChangeParameter)
                                {
                                    ChangeParameter(hSMParameter.ParameterName);
                                }
                            }
                            else
                            {
                                hSMParameter.CloneFrom(tempParameter);
                            }
                        }
                        EditorGUILayout.EndVertical();
                        GUILayout.Space(5);
                        GUI.backgroundColor = Color.white;
                    }
                }
                EditorGUILayout.EndScrollView();
            }
            EditorGUILayout.EndVertical();
        }