Exemplo n.º 1
0
        private RegisterToLuaBehaviour OnDrawRegisterLuaBehaviour(object obj, Type t)
        {
            if (obj == null)
            {
                obj = new RegisterToLuaBehaviour();
            }
            RegisterToLuaBehaviour luaBeh = obj as RegisterToLuaBehaviour;

            EditorGUILayout.BeginVertical();
            {
                luaBeh.name      = EditorGUILayout.TextField("Name:", luaBeh.name);
                luaBeh.behaviour = (LuaBehaviour)EditorGUILayout.ObjectField("Behaviour:", luaBeh.behaviour, typeof(LuaBehaviour), true);

                if (luaBeh.behaviour != null && string.IsNullOrEmpty(luaBeh.name))
                {
                    luaBeh.name = luaBeh.behaviour.name;
                }
                if (luaBeh.behaviour == null)
                {
                    EditorGUILayout.HelpBox("注册Behaviour不能为空", MessageType.Error);
                }
                if (string.IsNullOrEmpty(luaBeh.name))
                {
                    EditorGUILayout.HelpBox("注册Behaviour名称不能为空", MessageType.Error);
                }
                if (!string.IsNullOrEmpty(luaBeh.name) && !Regex.IsMatch(luaBeh.name, nameReg))
                {
                    EditorGUILayout.HelpBox("注册Behaviour名称只能以小写字母开关,只能包括A-Z,a-z,0-9的字符", MessageType.Error);
                }

                if (!string.IsNullOrEmpty(luaBeh.name))
                {
                    bool isNameRepeat = false;
                    foreach (RegisterToLuaBehaviour rtlb in luaBehList)
                    {
                        if (rtlb != null && rtlb != luaBeh && rtlb.name == luaBeh.name && !string.IsNullOrEmpty(luaBeh.name))
                        {
                            isNameRepeat = true;
                        }
                    }
                    if (isNameRepeat)
                    {
                        EditorGUILayout.HelpBox("注册luaObjectArr名称重复", MessageType.Error);
                    }
                }
            }
            EditorGUILayout.EndVertical();
            return(luaBeh);
        }
Exemplo n.º 2
0
        private RegisterToLuaBehaviour OnDrawRegisterLuaBehaviourInArr(object obj, Type t)
        {
            if (obj == null)
            {
                obj = new RegisterToLuaBehaviour();
            }
            RegisterToLuaBehaviour luaBeh = obj as RegisterToLuaBehaviour;

            EditorGUILayout.BeginVertical();
            {
                luaBeh.behaviour = (LuaBehaviour)EditorGUILayout.ObjectField("Behaviour:", luaBeh.behaviour, typeof(LuaBehaviour), true);
                if (luaBeh.behaviour == null)
                {
                    EditorGUILayout.HelpBox("注册Behaviour不能为空", MessageType.Error);
                }
            }
            EditorGUILayout.EndVertical();
            return(luaBeh);
        }