Example #1
0
        public void Draw()
        {
            if (method == null)
            {
                EditorGUILayout.HelpBox(errorMessage, MessageType.Error);
            }
            if (checkIfShouldBeDrawed != null)
            {
                if (!(bool)checkIfShouldBeDrawed.Invoke(declaringObject, null))
                {
                    return;
                }
            }

            if (attribute.Width != 0 && attribute.Height != 0)
            {
                if (attribute.Center)
                {
                    var rect = EditorUtils.GetCenteredRect(attribute.Width, attribute.Height);
                    if (HasFontAwesomeTitile)
                    {
                        if (DrawerHelper.FAButton(rect, attribute.Label))
                        {
                            Invoke();
                        }
                    }
                    else if (GUI.Button(rect, attribute.Label))
                    {
                        Invoke();
                    }
                }
                else
                {
                    if (HasFontAwesomeTitile)
                    {
                        if (DrawerHelper.FAButton(attribute.Label, FAOption.FontSize(attribute.Height)))
                        {
                            Invoke();
                        }
                    }
                    else if (GUILayout.Button(attribute.Label, GUILayout.Width(attribute.Width), GUILayout.Height(attribute.Height)))
                    {
                        Invoke();
                    }
                }
            }
            else
            {
                if (HasFontAwesomeTitile)
                {
                    if (DrawerHelper.FAButton(attribute.Label, FAOption.FontSize(18)))
                    {
                        Invoke();
                    }
                }
                else if (GUILayout.Button(attribute.Label))
                {
                    Invoke();
                }
            }

            if (HasParams)
            {
                accordion.OnGUI();
            }
        }