protected override void OnGUI(Rect position, GUIContent label)
        {
            position = BeginBlock(metadata, position, label);

            var fieldPosition = new Rect
                                (
                position.x,
                position.y,
                position.width,
                EditorGUIUtility.singleLineHeight
                                );

            var popupLabel = StringUtility.FallbackEmpty(((LooseAssemblyName)metadata.value).name, "(No Assembly)");

            var newAssemblyName = (LooseAssemblyName)LudiqGUI.FuzzyPopup
                                  (
                fieldPosition,
                () => new LooseAssemblyNameOptionTree(),
                ((LooseAssemblyName)metadata.value),
                new GUIContent(popupLabel)
                                  );

            if (EndBlock(metadata))
            {
                metadata.RecordUndo();
                metadata.value = newAssemblyName;
            }
        }
Example #2
0
        protected override void OnControlGUI(Rect position)
        {
            EditorGUI.BeginChangeCheck();

            var popupLabel = new GUIContent("(Nothing)");
            var popupStyle = EditorStyles.popup;

            if (accessor.value != null)
            {
                popupLabel.text = (string)nameAccessor.value;

                if (LudiqCore.Configuration.humanNaming && popupLabel.text != null)
                {
                    popupLabel.text = popupLabel.text.Prettify();
                }

                try
                {
                    var member = ((Member)accessor.value);
                    popupLabel.image = member.pseudoDeclaringType.Icon()[IconSize.Small];
                    popupLabel.text  = member.info.DisplayName(action, expectingBoolean);
                }
                catch
                {
                    popupStyle = Styles.failurePopup;
                }
            }

            if (popupLabel.image != null)
            {
                popupLabel.text = " " + popupLabel.text;
            }

            var newMemberManipulator = (Member)LudiqGUI.FuzzyPopup
                                       (
                position,
                GetOptions,
                (Member)accessor.value,
                new GUIContent(popupLabel),
                popupStyle
                                       );

            if (EditorGUI.EndChangeCheck())
            {
                accessor.RecordUndo();
                accessor.value = newMemberManipulator;
            }
        }
        protected override void OnGUI(Rect position, GUIContent label)
        {
            position = BeginBlock(metadata, position, label);

            var popupLabel = new GUIContent("(Nothing)");
            var popupStyle = EditorStyles.popup;

            if (metadata.value != null)
            {
                popupLabel.text = (string)nameMetadata.value;

                if (BoltCore.Configuration.humanNaming && popupLabel.text != null)
                {
                    popupLabel.text = popupLabel.text.Prettify();
                }

                try
                {
                    var member = ((Member)metadata.value);
                    popupLabel.image = member.pseudoDeclaringType.Icon() ? [IconSize.Small];
                    popupLabel.text  = member.info.DisplayName(direction, expectingBoolean);
                }
                catch
                {
                    popupStyle = Styles.failurePopup;
                }
            }

            if (popupLabel.image != null)
            {
                popupLabel.text = " " + popupLabel.text;
            }

            var newMemberManipulator = (Member)LudiqGUI.FuzzyPopup
                                       (
                position,
                GetOptions,
                (Member)metadata.value,
                new GUIContent(popupLabel),
                popupStyle
                                       );

            if (EndBlock(metadata))
            {
                metadata.RecordUndo();
                metadata.value = newMemberManipulator;
            }
        }
        private void OnSelectorGUI(Rect selectorPosition)
        {
            EditorGUI.BeginChangeCheck();

            var newImplementation = LudiqGUI.FuzzyPopup
                                    (
                selectorPosition,
                GetImplementationOptions,
                null,
                selectorLabel
                                    );

            if (EditorGUI.EndChangeCheck())
            {
                ChangeImplementation(newImplementation);
            }
        }
        private void OnCompactSelectorGUI(Rect selectorPosition)
        {
            EditorGUI.BeginChangeCheck();

            var newImplementation = LudiqGUI.FuzzyPopup
                                    (
                selectorPosition,
                GetImplementationOptions,
                null,
                Styles.showCompactSelectorIcon ? new GUIContent(typeSelectorIcon?[IconSize.Small]) : Styles.compactSelectorWithoutIconContent,
                    Styles.compactSelector
                                    );

            if (EditorGUI.EndChangeCheck())
            {
                ChangeImplementation(newImplementation);
            }
        }