예제 #1
0
        public static void Init(Vector2 centerPosition,
                                float width,
                                string title,
                                string description,
                                string text,
                                OnSetText setTextCallback,
                                ValidationFunction validateFunc,
                                string okButtonText,
                                Styling style)
        {
            var descContent = new GUIContent(description);
            var height      = GUI.skin.label.CalcHeight(descContent, width);

            if (height > EditorGUIUtility.singleLineHeight)
            {
                height -= EditorGUIUtility.singleLineHeight;
            }

            var win  = EditorWindow.CreateInstance <TextEditPopover>();
            var size = new Vector2(width, 90 + height);
            var rect = new Rect(centerPosition.x - size.x * 0.5f, centerPosition.y - size.y * 0.5f, 0, 0);

            win.Configure(title, description, text, setTextCallback, validateFunc, okButtonText, style);
            win.ShowAsDropDown(rect, size);
        }
예제 #2
0
 void Configure(string popoverTitle,
                string description,
                string text,
                OnSetText setTextCallback,
                ValidationFunction validateFunc,
                string okButtonText,
                Styling style)
 {
     _title        = popoverTitle;
     _description  = description;
     _originalText = _text = text;
     _onSetText    = setTextCallback;
     _validateFunc = validateFunc;
     _okButton     = okButtonText;
     _style        = style;
 }
예제 #3
0
 public void SetText(string value)
 {
     OnSetText?.Invoke(value);
 }