Ejemplo n.º 1
0
        private static Type GetParameterTypeAndLabel(LinkedMemberInfo linkedMemberInfo, ref GUIContent label)
        {
            GUIContentPool.Replace(ref label, linkedMemberInfo.DisplayName, linkedMemberInfo.Tooltip);
            if (label.tooltip.Length == 0)
            {
                label.tooltip = "Parameter";
            }

            var type = linkedMemberInfo.Type;

            if (type.IsByRef)            //is ref or out
            {
                                #if DEV_MODE
                Debug.Log("isByRef: " + linkedMemberInfo + ", with IsOut=" + linkedMemberInfo.ParameterInfo.IsOut + ", Type=" + StringUtils.ToString(type) + ", elementType=" + StringUtils.ToString(type.GetElementType()));
                                #endif

                type = type.GetElementType();

                if (linkedMemberInfo.ParameterInfo.IsOut)
                {
                    label.text = string.Concat("out ", label);
                }
                else
                {
                    label.text = string.Concat("ref ", label);
                }
            }

            return(type);
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public override void SetupInterface(object setValue, Type setValueType, LinkedMemberInfo setMemberInfo, IParentDrawer setParent, GUIContent setLabel, bool setReadOnly)
        {
            var      button = setMemberInfo.GetAttribute <ButtonAttribute>();
            string   setButtonText;
            GUIStyle setGUIStyle;

            if (button != null)
            {
                if (!string.IsNullOrEmpty(button.buttonText))
                {
                    setButtonText = button.buttonText;
                }
                else
                {
                    if (setLabel != null)
                    {
                        setButtonText = setLabel.text;
                    }
                    else
                    {
                        setButtonText = setMemberInfo.DisplayName;
                    }
                }

                GUIContentPool.Replace(ref setLabel, button.prefixLabelText);

                if (!string.IsNullOrEmpty(button.guiStyle))
                {
                    setGUIStyle = InspectorUtility.Preferences.GetStyle(button.guiStyle);
                    if (setGUIStyle == null)
                    {
                        setGUIStyle = InspectorPreferences.Styles.Button;
                    }
                }
                else
                {
                    setGUIStyle = InspectorPreferences.Styles.Button;
                }
            }
            else
            {
                setGUIStyle = InspectorPreferences.Styles.Button;

                if (setLabel != null)
                {
                    setButtonText = setLabel.text;
                }
                else
                {
                    setButtonText = setMemberInfo.DisplayName;
                }

                GUIContentPool.Replace(ref setLabel, "");
            }

            Setup(setMemberInfo, setParent, setLabel, GUIContentPool.Create(setButtonText), setGUIStyle, setReadOnly);
        }