Пример #1
0
    public static void Popup(Rect rect, SpriteAlignment alignment, Action <SpriteAlignment> callback)
    {
        var popup = new SpriteAlignUI();

        popup.SetData(rect, alignment, callback);
        PopupWindow.Show(rect, popup);
    }
Пример #2
0
    public static void DrawGUI(Rect position, GUIContent label, SpriteAlignment alignment, Action <SpriteAlignment> callback)
    {
        Rect rectButton = position;

        if (label != GUIContent.none)
        {
            rectButton = EditorGUI.PrefixLabel(position, label);
        }

        string text     = DisplayCamelCaseString(alignment.ToString());
        bool   didPress = GUI.Button(rectButton, text, EditorStyles.popup);

        if (didPress)
        {
            var popup = new SpriteAlignUI();
            popup.SetData(rectButton, alignment, callback);
            PopupWindow.Show(rectButton, popup);
        }
    }