protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     MethodButton = new MethodButton();
     MethodButton.CssClass = "";
     DefaultColor = "#FFFF00";
 }
Exemplo n.º 2
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     MethodButton          = new MethodButton();
     MethodButton.CssClass = String.Empty;
     DefaultColor          = "#FF0000";
 }
Exemplo n.º 3
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        if (property.name.Substring(0, 1) != "_")
        {
            Debug.Log("MethodButton should be named _[name of method]");
        }
        object component  = Introspector.GetParent(property);
        string methodName = property.name.Substring(1);
        //var value = Introspector.GetValue(component, property.name.Substring(1));
        //		label = EditorGUI.BeginProperty(position, label, property);
        MethodButton methodButton = (MethodButton)Introspector.GetValue(component, property.name);

        if (methodButton != null)
        {
            label.tooltip = methodButton.tooltip;
        }
        Rect contentPosition = EditorGUI.PrefixLabel(position, label);

        if (GUI.Button(contentPosition, new GUIContent(methodName + "()", label.tooltip)))
        {
            MethodInfo methodInfo = Introspector.GetMethod(component, methodName);
            if (methodInfo != null)
            {
                methodInfo.Invoke(component, null);
            }
        }
    }
Exemplo n.º 4
0
 protected override void OnPreRender(EventArgs e)
 {
     MethodButton.InternalRegisterButtonImages("Ed-ForeColor");
     base.OnPreRender(e);
 }