コード例 #1
0
ファイル: CustomEnumEditor.cs プロジェクト: jrDev1/UAlive
        protected override void OnGUI(Rect position, GUIContent label)
        {
            try
            {
                BeginBlock(metadata, position, GUIContent.none);

                HUMEditor.Vertical().Box(backgroundColor.Brighten(0.05f), Color.black, new RectOffset(4, 4, 4, 4), new RectOffset(1, 1, 1, 1), () =>
                {
                    _target.title      = EditorGUILayout.TextField(new GUIContent("Enum Name"), _target.title);
                    _target.@namespace = EditorGUILayout.TextField(new GUIContent("Namespace"), _target.@namespace);
                });

                GUILayout.Space(10);

                LudiqGUI.InspectorLayout(metadata["items"], GUIContent.none);

                if (EndBlock(metadata))
                {
                    metadata.RecordUndo();
                }
            }
            catch (System.Exception e)
            {
                Debug.Log(e);
            }
        }
コード例 #2
0
ファイル: CustomClassEditor.cs プロジェクト: jrDev1/UAlive
        private void Declaration(Rect position)
        {
            HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.05f), Color.black, new RectOffset(4, 4, 4, 4), new RectOffset(1, 1, 1, 1), () =>
            {
                HUMEditor.Horizontal().Box(Styles.backgroundColor.Brighten(0.05f), Color.black, new RectOffset(4, 4, 4, 4), new RectOffset(1, 1, 1, 1), () =>
                {
                    HUMEditor.Horizontal(() => {
                        EditorGUI.BeginChangeCheck();
                        if (_target.editorData.icon == null)
                        {
                            _target.editorData.icon = Images.class_32;
                        }
                        _target.editorData.icon = (Texture2D)EditorGUILayout.ObjectField(GUIContent.none, _target.editorData.icon, typeof(Texture2D), false, GUILayout.Width(40), GUILayout.Height(40));
                        if (EditorGUI.EndChangeCheck())
                        {
                            DescribeActiveUnits();
                            var definer = _target.Definer() as ClassDefiner;
                            definer.Define();
                        }
                    });


                    HUMEditor.Horizontal(() => {
                        HUMEditor.Vertical(() =>
                        {
                            GUILayout.Label("Name");
                            GUILayout.Label("Namespace");
                        });

                        HUMEditor.Vertical(() =>
                        {
                            EditorGUI.BeginChangeCheck();
                            _target.title = EditorGUILayout.TextField(GUIContent.none, _target.title, GUILayout.MinWidth(100));
                            if (EditorGUI.EndChangeCheck())
                            {
                                DescribeActiveUnits();
                                var definer = _target.Definer() as ClassDefiner;
                                definer.Define();
                            }
                            _target.@namespace = EditorGUILayout.TextField(GUIContent.none, _target.@namespace, GUILayout.MinWidth(100));
                        });
                    });
                });

                EditorGUILayout.Space(6);

                BeginBlock(metadata, position, GUIContent.none);
                LudiqGUI.InspectorLayout(metadata["inheritance"]["type"]);
                if (EndBlock(metadata))
                {
                    var definer = _target.Definer() as ClassDefiner;
                    definer.Define();
                }
            });
        }
コード例 #3
0
 public static void IconFoldout(ref bool isOpen, string label, Texture2D icon, Action content, Color background, int padding = 4)
 {
     isOpen = HUMEditor.Foldout(isOpen, new GUIContent(label, icon),
     Styles.backgroundColor.Brighten(0.05f),
     Color.black,
     1,
     () =>
     {
         HUMEditor.Vertical().Box(background, Color.black, new RectOffset(padding, padding, padding, padding), new RectOffset(1, 1, 0, 1), () =>
         {
             content?.Invoke();
         });
     });
 }
コード例 #4
0
        private void Declaration(Rect position)
        {
            HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.05f), Color.black, new RectOffset(4, 4, 4, 4), new RectOffset(1, 1, 1, 1), () =>
            {
                _target.title      = EditorGUILayout.TextField(new GUIContent("Class Name"), _target.title);
                _target.@namespace = EditorGUILayout.TextField(new GUIContent("Namespace"), _target.@namespace);

                BeginBlock(metadata, position, GUIContent.none);
                LudiqGUI.InspectorLayout(metadata["inheritance"]["type"]);
                if (EndBlock(metadata))
                {
                    _target.Define();
                }
            });
        }
コード例 #5
0
        public static void Box(this HUMEditor.Data.Vertical vertical, Color backgroundColor, Color borderColor, RectOffset padding, RectOffset border, Action contents = null, params GUILayoutOption[] options)
        {
            var style       = new GUIStyle();
            var borderStyle = new GUIStyle();

            style.normal.background       = HUMTexture.Create(1, 1).Color(backgroundColor);
            borderStyle.normal.background = HUMTexture.Create(1, 1).Color(borderColor);
            borderStyle.padding           = border;
            style.padding = padding;

            HUMEditor.Vertical(borderStyle, () =>
            {
                HUMEditor.Vertical(style, () =>
                {
                    contents?.Invoke();
                });
            }, options);
        }
コード例 #6
0
ファイル: UATools.cs プロジェクト: stuksgens/UAlive
        private void OnGUI()
        {
            Images.Cache();

            compilationIsOpen = HUMEditor.Foldout(compilationIsOpen, new GUIContent("Compilation", Images.compilation_16), Styles.backgroundColor, Styles.borderColor, 1, () =>
            {
                HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.06f), Styles.borderColor, new RectOffset(6, 6, 6, 6), new RectOffset(1, 1, 0, 1), () => { LiveStatus(); });
            });

            searchIsOpen = HUMEditor.Foldout(searchIsOpen, new GUIContent("Search", Images.search_16), Styles.backgroundColor, Styles.borderColor, 1, () =>
            {
                EditorGUILayout.HelpBox("The search and replace functionality is not available at this time.", MessageType.Info);
            });

            explorerIsOpen = HUMEditor.Foldout(explorerIsOpen, new GUIContent("Explorer", Images.explorer_16), Styles.backgroundColor, Styles.borderColor, 1, () =>
            {
                EditorGUILayout.HelpBox("The project explorer is not available at this time.", MessageType.Info);
            });
        }
コード例 #7
0
        protected override void OnGUI(Rect position, GUIContent label)
        {
            BeginBlock(metadata, position, GUIContent.none);

            HUMEditor.Vertical().Box(backgroundColor.Brighten(0.05f), Color.black, new RectOffset(4, 4, 4, 4), new RectOffset(1, 1, 1, 1), () =>
            {
                _target.title      = EditorGUILayout.TextField(new GUIContent("Interface Name"), _target.title);
                _target.@namespace = EditorGUILayout.TextField(new GUIContent("Namespace"), _target.@namespace);
            });

            GUILayout.Space(10);

            _target.propertiesOpen = HUMEditor.Foldout(_target.propertiesOpen, new GUIContent("Properties", Images.property_16),
                                                       backgroundColor.Brighten(0.05f),
                                                       Color.black,
                                                       1,
                                                       () =>
            {
                LudiqGUI.InspectorLayout(metadata["properties"], GUIContent.none);
            });

            GUILayout.Space(10);

            _target.methodsOpen = HUMEditor.Foldout(_target.methodsOpen, new GUIContent("Methods", Images.flow_icon_16),
                                                    backgroundColor.Brighten(0.05f),
                                                    Color.black,
                                                    1,
                                                    () =>
            {
                LudiqGUI.InspectorLayout(metadata["methods"], GUIContent.none);
            });

            if (EndBlock(metadata))
            {
                metadata.RecordUndo();
            }
        }
コード例 #8
0
ファイル: CustomClassEditor.cs プロジェクト: jrDev1/UAlive
        private void Variables(Rect position)
        {
            UAGUI.IconFoldout(ref _target.editorData.customVariablesOpen, "Variables", Images.variables_16, () =>
            {
                HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.025f), Styles.borderColor, new RectOffset(4, 4, 4, 2), new RectOffset(1, 1, 0, 1), () =>
                {
                    var variables    = metadata["variables"];
                    var variablesVal = (Variables)metadata["variables"].value;

                    for (int i = 0; i < variablesVal.variables.Count; i++)
                    {
                        if (i != 0)
                        {
                            GUILayout.Space(2);
                        }

                        HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.075f), Styles.borderColor, new RectOffset(4, 4, 4, 2), new RectOffset(1, 1, 1, 1), () =>
                        {
                            var variable    = variables["variables"][i];
                            var variableVal = (Variable)variable.value;

                            HUMEditor.Vertical(() =>
                            {
                                HUMEditor.Horizontal(() =>
                                {
                                    BeginBlock(metadata["name"], position);
                                    HUMEditor.Vertical(() =>
                                    {
                                        LudiqGUI.InspectorLayout(variable["name"], GUIContent.none);
                                    });
                                    if (EndBlock(metadata["name"]))
                                    {
                                        variableVal.declaration.Changed();
                                    }
                                    GUILayout.Label(GUIContent.none, new GUIStyle()
                                    {
                                        fixedWidth = 4
                                    });

                                    HUMEditor.Vertical(() =>
                                    {
                                        LudiqGUI.InspectorLayout(variable["declaration"]["type"], GUIContent.none);
                                    });

                                    if (GUILayout.Button("-", GUILayout.Width(16), GUILayout.Height(14)))
                                    {
                                        variablesVal.variables.Remove(variableVal);
                                        variableVal.declaration.Changed();
                                        AssetDatabase.RemoveObjectFromAsset(variableVal.getter);
                                        AssetDatabase.RemoveObjectFromAsset(variableVal.setter);
                                        AssetDatabase.RemoveObjectFromAsset(variableVal);
                                        AssetDatabase.SaveAssets();
                                        AssetDatabase.Refresh();
                                        var definer = _target.Definer() as ClassDefiner;
                                        definer.Define();
                                    }
                                });

                                GUILayout.Space(2);

                                HUMEditor.Vertical(() =>
                                {
                                    LudiqGUI.InspectorLayout(variable["declaration"]["defaultValue"].Cast(variableVal.declaration.type), GUIContent.none);
                                });
                            });

                            GUILayout.Space(2);
                        });
                    }

                    if (GUILayout.Button("+ New Variable"))
                    {
                        var variable = Variable.Create(_target);
                        AssetDatabase.AddObjectToAsset(variable, _target);
                        variablesVal.variables.Add(variable);
                        var definer = _target.Definer() as ClassDefiner;
                        definer.Define();
                    }
                });
            });
        }
コード例 #9
0
ファイル: CustomClassEditor.cs プロジェクト: jrDev1/UAlive
        private void Methods(Rect position)
        {
            UAGUI.IconFoldout(ref _target.editorData.customMethodsOpen, "Methods", Images.flow_icon_16, () =>
            {
                HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.025f), Styles.borderColor, new RectOffset(4, 4, 4, 2), new RectOffset(1, 1, 0, 1), () =>
                {
                    var methods    = metadata["methods"]["custom"];
                    var methodsVal = (List <Method>)metadata["methods"]["custom"].value;

                    for (int i = 0; i < methodsVal.Count; i++)
                    {
                        if (i != 0)
                        {
                            GUILayout.Space(2);
                        }
                        var meth = methodsVal[i];

                        methodsVal[i].isOpen = HUMEditor.Foldout(methodsVal[i].isOpen, Styles.backgroundColor.Brighten(0.05f), Styles.borderColor, 1,
                                                                 () =>
                        {
                            BeginBlock(metadata["name"], position);
                            meth.name = GUILayout.TextField(meth.name);
                            meth.entry.declaration.name = meth.name;
                            if (EndBlock(metadata["name"]))
                            {
                                meth.entry.declaration.Changed();
                            }

                            if (GUILayout.Button("Edit", GUILayout.Width(42)))
                            {
                                GraphWindow.OpenActive(GraphReference.New(methodsVal[i], true));
                            }

                            if (GUILayout.Button("-", GUILayout.Width(16), GUILayout.Height(18)))
                            {
                                methodsVal.Remove(meth);
                                meth.entry.Define();
                                AssetDatabase.RemoveObjectFromAsset(meth);
                                AssetDatabase.SaveAssets();
                                AssetDatabase.Refresh();
                                var definer = _target.Definer() as ClassDefiner;
                                definer.Define();
                            }
                        },
                                                                 () =>
                        {
                            HUMEditor.Vertical(() =>
                            {
                                BeginBlock(methods[i], position, GUIContent.none);
                                HUMEditor.Horizontal(() =>
                                {
                                    HUMEditor.Vertical().Box(HUMEditorColor.DefaultEditorBackground.Darken(0.025f), Styles.borderColor, new RectOffset(8, 8, 8, 8), new RectOffset(1, 1, 0, 1), () =>
                                    {
                                        LudiqGUI.InspectorLayout(methods[i]["entry"]["declaration"]["type"], new GUIContent("Returns"));

                                        if ((Type)methods[i]["entry"]["declaration"]["type"].value == typeof(Lasm.UAlive.Void))
                                        {
                                            GUILayout.Space(6);
                                        }
                                        else
                                        {
                                            LudiqGUI.InspectorLayout(methods[i]["entry"]["declaration"]["pure"], new GUIContent("Pure"));
                                        }

                                        UAGUI.IconFoldout(ref methodsVal[i].entry.declaration.parametersOpen, "Parameters", Images.parameters_16, () =>
                                        {
                                            LudiqGUI.InspectorLayout(methods[i]["entry"]["declaration"]["parameters"], GUIContent.none);
                                        }, Styles.backgroundColor.Brighten(0.05f), 0);
                                    });
                                });
                                if (EndBlock(methods[i]))
                                {
                                    meth.entry.Define();
                                }
                            });
                        });
                    }

                    if (GUILayout.Button("+ New Method"))
                    {
                        var meth = Method.Create(_target);
                        methodsVal.Add(meth);
                        AssetDatabase.SaveAssets();
                        AssetDatabase.Refresh();
                        var definer = _target.Definer() as ClassDefiner;
                        definer.Define();
                    }
                });
            });
        }
コード例 #10
0
ファイル: CustomClassEditor.cs プロジェクト: jrDev1/UAlive
        private void Overrides(Rect position)
        {
            UAGUI.IconFoldout(ref _target.editorData.overridesOpen, "Overrides", Images.override_16, () =>
            {
                UAGUI.IconFoldout(ref _target.editorData.methodOverridesOpen, "Methods", Images.flow_icon_16, () =>
                {
                    HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.025f), Styles.borderColor, new RectOffset(4, 4, 4, 2), new RectOffset(1, 1, 0, 1), () =>
                    {
                        var overrides = metadata["methods"]["overrides"]["current"];
                        tempOverrides.Clear();

                        for (int i = 0; i < overrides.Count; i++)
                        {
                            var method = ((Method)overrides.ValueMetadata(i).value);
                            if (!method.entry.declaration.isMagic || (method.entry.declaration.isMagic && method.entry.declaration.isOverridden))
                            {
                                var _name = method.name;
                                if (position.width - 170 < GUI.skin.label.CalcSize(new GUIContent(_name)).x)
                                {
                                    if (_name.Length > 11)
                                    {
                                        _name = _name.Remove(11, _name.Length - 11) + "..";
                                    }
                                }

                                UAGUI.MethodOverride(overrides.ValueMetadata(i), new GUIContent(_name));
                                if (i < overrides.Count - 1)
                                {
                                    EditorGUILayout.Space(2);
                                }
                            }
                            else
                            {
                                var temp = ((KeyValuePair <string, Method>)overrides[i].value);
                                tempOverrides.Add(temp.Key, temp.Value);
                            }
                        }

                        GUILayout.Space(2);

                        if (GUILayout.Button("+ Message"))
                        {
                            GenericMenu menu   = new GenericMenu();
                            var keys           = tempOverrides.KeysToList();
                            var startSeparator = false;
                            for (int i = 0; i < keys.Count; i++)
                            {
                                if (startSeparator)
                                {
                                    menu.AddSeparator("");
                                    startSeparator = false;
                                }
                                var key = keys[i];
                                menu.AddItem(new GUIContent(key), false, (obj) => { tempOverrides[(string)obj].entry.declaration.isOverridden = true; }, key);
                                if (keys[i] == "OnGUI")
                                {
                                    startSeparator = true;
                                }
                            }

                            menu.ShowAsContext();
                        }
                    });
                });
            });
        }
コード例 #11
0
        private void Overrides(Rect position)
        {
            _target.overridesOpen = HUMEditor.Foldout(_target.overridesOpen, new GUIContent("Overrides", Images.override_16),
                                                      Styles.backgroundColor.Brighten(0.05f),
                                                      Color.black,
                                                      1,
                                                      () =>
            {
                HUMEditor.Vertical().Box(Styles.backgroundColor, Color.black, new RectOffset(4, 4, 4, 4), new RectOffset(1, 1, 0, 1), () =>
                {
                    _target.methodOverridesOpen = HUMEditor.Foldout(_target.methodOverridesOpen,
                                                                    new GUIContent("Methods", Images.flow_icon_16),
                                                                    Styles.backgroundColor.Brighten(0.05f),
                                                                    Styles.borderColor,
                                                                    1,
                                                                    () =>
                    {
                        HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.025f), Styles.borderColor, new RectOffset(4, 4, 4, 2), new RectOffset(1, 1, 0, 1), () =>
                        {
                            var overrides = metadata["methods"]["overrides"];

                            tempOverrides.Clear();

                            for (int i = 0; i < overrides.Count; i++)
                            {
                                var nest = ((Method)overrides.ValueMetadata(i).value);
                                if (!nest.isSpecial || (nest.isSpecial && nest.isOverridden))
                                {
                                    var _name = nest.name;
                                    if (position.width - 170 < GUI.skin.label.CalcSize(new GUIContent(_name)).x)
                                    {
                                        if (_name.Length > 11)
                                        {
                                            _name = _name.Remove(11, _name.Length - 11) + "..";
                                        }
                                    }

                                    LudiqGUI.InspectorLayout(overrides.ValueMetadata(i), new GUIContent(_name));
                                }
                                else
                                {
                                    var temp = ((KeyValuePair <string, Method>)overrides[i].value);
                                    tempOverrides.Add(temp.Key, temp.Value);
                                }
                            }

                            GUILayout.Space(6);

                            BeginBlock(metadata, position, GUIContent.none);

                            if (GUILayout.Button("+ Message"))
                            {
                                GenericMenu menu   = new GenericMenu();
                                var keys           = tempOverrides.KeysToList();
                                var startSeparator = false;
                                for (int i = 0; i < keys.Count; i++)
                                {
                                    if (startSeparator)
                                    {
                                        menu.AddSeparator("");
                                        startSeparator = false;
                                    }
                                    var key = keys[i];
                                    menu.AddItem(new GUIContent(key), false, (obj) => { tempOverrides[(string)obj].isOverridden = true; }, key);
                                    if (keys[i] == "OnGUI")
                                    {
                                        startSeparator = true;
                                    }
                                }

                                menu.ShowAsContext();
                            }

                            if (EndBlock(metadata))
                            {
                                _target.Define();
                            }
                        });
                    });
                });
            });
        }
コード例 #12
0
        private void Variables(Rect position)
        {
            _target.customVariablesOpen = HUMEditor.Foldout(_target.customVariablesOpen,
                                                            new GUIContent("Variables", Images.variables_16),
                                                            Styles.backgroundColor.Brighten(0.05f),
                                                            Styles.borderColor,
                                                            1,
                                                            () =>
            {
                HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.025f), Styles.borderColor, new RectOffset(4, 4, 4, 2), new RectOffset(1, 1, 0, 1), () =>
                {
                    var variables    = metadata["variables"];
                    var variablesVal = (Variables)metadata["variables"].value;

                    for (int i = 0; i < variablesVal.variables.Count; i++)
                    {
                        if (i != 0)
                        {
                            GUILayout.Space(2);
                        }

                        HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.075f), Styles.borderColor, new RectOffset(4, 4, 4, 2), new RectOffset(1, 1, 1, 1), () =>
                        {
                            var variable    = variables["variables"][i];
                            var variableVal = (Variable)variable.value;
                            HUMEditor.Vertical(() =>
                            {
                                HUMEditor.Horizontal(() =>
                                {
                                    HUMEditor.Vertical(() =>
                                    {
                                        LudiqGUI.InspectorLayout(variable["name"], GUIContent.none);
                                    });

                                    GUILayout.Label(GUIContent.none, new GUIStyle()
                                    {
                                        fixedWidth = 4
                                    });

                                    HUMEditor.Vertical(() =>
                                    {
                                        BeginBlock(variable["type"], position, GUIContent.none);
                                        LudiqGUI.InspectorLayout(variable["type"], GUIContent.none);
                                        if (EndBlock(variable["type"]))
                                        {
                                            variablesVal.variables[i].Changed();
                                            AssetDatabase.SaveAssets();
                                            AssetDatabase.Refresh();
                                        }
                                    });

                                    BeginBlock(metadata, position, GUIContent.none);

                                    if (GUILayout.Button("-", GUILayout.Width(16), GUILayout.Height(14)))
                                    {
                                        variablesVal.variables.Remove(variableVal);
                                        AssetDatabase.RemoveObjectFromAsset(variableVal.getter.macro);
                                        AssetDatabase.RemoveObjectFromAsset(variableVal.setter.macro);
                                        AssetDatabase.SaveAssets();
                                        AssetDatabase.Refresh();
                                    }

                                    if (EndBlock(metadata))
                                    {
                                        _target.Define();
                                    }
                                });

                                GUILayout.Space(2);

                                HUMEditor.Vertical(() =>
                                {
                                    LudiqGUI.InspectorLayout(variable["value"].Cast(variableVal.type), GUIContent.none);
                                });
                            });

                            GUILayout.Space(2);
                        });
                    }

                    BeginBlock(metadata, position, GUIContent.none);
                    if (GUILayout.Button("+ New Variable"))
                    {
                        var variable = new Variable();
                        variable.getter.Initialize();
                        variable.setter.Initialize();
                        variable.getter.showLabel       = false;
                        variable.setter.showLabel       = false;
                        variable.getter.name            = string.Empty;
                        variable.setter.name            = string.Empty;
                        variable.getter.macro.hideFlags = HideFlags.HideInHierarchy;
                        variable.setter.macro.hideFlags = HideFlags.HideInHierarchy;
                        AssetDatabase.AddObjectToAsset(variable.getter.macro, _target);
                        AssetDatabase.AddObjectToAsset(variable.setter.macro, _target);
                        variablesVal.variables.Add(variable);
                        AssetDatabase.SaveAssets();
                        AssetDatabase.Refresh();
                    }
                    if (EndBlock(metadata))
                    {
                        _target.Define();
                    }
                });
            });
        }
コード例 #13
0
        private void Methods(Rect position)
        {
            _target.customMethodsOpen = HUMEditor.Foldout(_target.customMethodsOpen,
                                                          new GUIContent("Methods", Images.flow_icon_16),
                                                          Styles.backgroundColor.Brighten(0.05f),
                                                          Styles.borderColor,
                                                          1,
                                                          () =>
            {
                HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.025f), Styles.borderColor, new RectOffset(4, 4, 4, 2), new RectOffset(1, 1, 0, 1), () =>
                {
                    var methods    = metadata["methods"]["custom"];
                    var methodsVal = (List <Method>)metadata["methods"]["custom"].value;

                    for (int i = 0; i < methodsVal.Count; i++)
                    {
                        if (i != 0)
                        {
                            GUILayout.Space(2);
                        }

                        HUMEditor.Vertical().Box(Styles.backgroundColor.Brighten(0.075f), Styles.borderColor, new RectOffset(4, 4, 4, 2), new RectOffset(1, 1, 1, 1), () =>
                        {
                            var meth        = methodsVal[i];
                            meth.name       = GUILayout.TextField(meth.name);
                            meth.macro.name = meth.name;

                            HUMEditor.Horizontal(() =>
                            {
                                HUMEditor.Vertical(() =>
                                {
                                    LudiqGUI.InspectorLayout(methods[i], GUIContent.none);
                                });

                                BeginBlock(methods, position, GUIContent.none);

                                if (GUILayout.Button("-", GUILayout.Width(16), GUILayout.Height(18)))
                                {
                                    methodsVal.Remove(meth);
                                    AssetDatabase.RemoveObjectFromAsset(meth.macro);
                                    AssetDatabase.SaveAssets();
                                    AssetDatabase.Refresh();
                                }

                                if (EndBlock(methods))
                                {
                                    _target.Define();
                                }
                            });
                        });
                    }

                    BeginBlock(metadata, position, GUIContent.none);

                    if (GUILayout.Button("+ New Method"))
                    {
                        var meth = new Method();
                        meth.Initialize();
                        meth.showLabel       = false;
                        meth.name            = string.Empty;
                        meth.macro.hideFlags = HideFlags.HideInHierarchy;
                        AssetDatabase.AddObjectToAsset(meth.macro, _target);
                        methodsVal.Add(meth);
                        AssetDatabase.SaveAssets();
                        AssetDatabase.Refresh();
                    }

                    if (EndBlock(metadata))
                    {
                        _target.Define();
                    }
                });
            });
        }