void OnGUI()
        {
            EditorGUILayout.ObjectField(instance as UnityEngine.Object, instance.GetType(), true);

            if (editorInstance == null)
            {
                editorInstance = new EditorInstance(instance);
            }

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            editorInstance.memberFilter = (MemberFilter)EditorGUILayout.EnumPopup("成员过滤", editorInstance.memberFilter);

            editorInstance.accessModifier = (AccessModifier)EditorGUILayout.EnumPopup("修饰符过滤", editorInstance.accessModifier);

            editorInstance.instanceType = (InstanceType)EditorGUILayout.EnumPopup("实例静态过滤", editorInstance.instanceType);

            editorInstance.isGet = EditorGUILayout.Toggle("Get", editorInstance.isGet);
            editorInstance.isSet = EditorGUILayout.Toggle("Set", editorInstance.isSet);

            editorInstance.searchKeyword = EditorGUILayout.TextField("搜索过滤", editorInstance.searchKeyword);

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EditorClass.GUI(editorInstance.info, editorInstance.searchKeyword.ToLower(), editorInstance.memberFilter, editorInstance.accessModifier, editorInstance.instanceType, editorInstance.isGet, editorInstance.isSet);

            EditorGUILayout.EndScrollView();
        }
예제 #2
0
        public static void GUI(EditorClass info, string searchKeyword = "", MemberFilter memberFilter = MemberFilter.All, AccessModifier accessModifier = AccessModifier.All, InstanceType instanceType = InstanceType.Instance, bool isGet = false, bool isSet = false)
        {
            EditorGUI.indentLevel = info.level;

            if (info.level != -1)
            {
                info.isFold = EditorGUILayout.Foldout(info.isFold, info.name);
            }

            if (info.isFold)
            {
                if (memberFilter == MemberFilter.All || memberFilter == MemberFilter.Fields)
                {
                    for (int i = 0; i < info.editorFields.Count; i++)
                    {
                        EditorField editorField = info.editorFields[i];

                        EditorField.GUI(editorField, searchKeyword, accessModifier, instanceType);
                    }
                }

                if (memberFilter == MemberFilter.All || memberFilter == MemberFilter.Methods)
                {
                    for (int i = 0; i < info.editorMethods.Count; i++)
                    {
                        EditorMethod editorMethod = info.editorMethods[i];

                        EditorMethod.GUI(editorMethod, searchKeyword, accessModifier, instanceType, isGet, isSet);
                    }
                }
            }
        }
예제 #3
0
        public static void GUI(EditorObject info)
        {
            EditorGUI.indentLevel = info.level;

            if (info.editorList != null)
            {
                EditorList.GUI(info.editorList);
            }
            else if (info.editorArray != null)
            {
                EditorArray.GUI(info.editorArray);
            }
            else if (info.editorClass != null)
            {
                EditorClass.GUI(info.editorClass);
            }
            else
            {
                object value = info.objectData.GetValue();

                bool isChange = false;

                InputTool.Input(info.objectData.type, info.name, ref value, ref isChange);

                if (isChange)
                {
                    info.objectData.SetValue(value);
                }
            }
        }
예제 #4
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            Refresh();

            if (editorInstance == null)
            {
                return;
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            editorInstance.memberFilter = (MemberFilter)EditorGUILayout.EnumPopup("成员过滤", editorInstance.memberFilter);

            editorInstance.accessModifier = (AccessModifier)EditorGUILayout.EnumPopup("修饰符过滤", editorInstance.accessModifier);

            editorInstance.instanceType = (InstanceType)EditorGUILayout.EnumPopup("实例静态过滤", editorInstance.instanceType);

            editorInstance.isGet = EditorGUILayout.Toggle("Get", editorInstance.isGet);
            editorInstance.isSet = EditorGUILayout.Toggle("Set", editorInstance.isSet);

            editorInstance.searchKeyword = EditorGUILayout.TextField("搜索过滤", editorInstance.searchKeyword);

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            EditorClass.GUI(editorInstance.info, editorInstance.searchKeyword.ToLower(), editorInstance.memberFilter, editorInstance.accessModifier, editorInstance.instanceType, editorInstance.isGet, editorInstance.isSet);
        }
예제 #5
0
 void RefreshValue()
 {
     if (objectData.listData != null)
     {
         if (editorList == null)
         {
             editorList = new EditorList(objectData.listData, level + 1);
         }
         else
         {
             editorList.RefreshValue(objectData.listData);
         }
     }
     else if (objectData.arrayData != null)
     {
         if (editorArray == null)
         {
             editorArray = new EditorArray(objectData.arrayData, level + 1);
         }
         else
         {
             editorArray.RefreshValue(objectData.arrayData);
         }
     }
     else if (objectData.classData != null)
     {
         if (editorClass == null)
         {
             editorClass = new EditorClass(objectData.classData, level + 1, false, name);
             editorClass.GetEditorField();
         }
         else
         {
             editorClass.RefreshValue(objectData.classData);
         }
     }
 }
예제 #6
0
 public EditorInstance(object context)
 {
     info = new EditorClass(context, context.GetType(), -1, true, context.GetType().Name);
     info.GetEditorField();
     info.GetEditorMethod();
 }