当前位置: 首页>>代码示例>>C#>>正文


C# SerializedProperty.GetParent方法代码示例

本文整理汇总了C#中UnityEditor.SerializedProperty.GetParent方法的典型用法代码示例。如果您正苦于以下问题:C# SerializedProperty.GetParent方法的具体用法?C# SerializedProperty.GetParent怎么用?C# SerializedProperty.GetParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEditor.SerializedProperty的用法示例。


在下文中一共展示了SerializedProperty.GetParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Begin

        public override void Begin(Rect position, SerializedProperty property, GUIContent label)
        {
            base.Begin(position, property, label);

            noFieldLabel = ((CustomAttributeBase)attribute).NoFieldLabel;
            noPrefixLabel = ((CustomAttributeBase)attribute).NoPrefixLabel;
            noIndex = ((CustomAttributeBase)attribute).NoIndex;
            prefixLabel = ((CustomAttributeBase)attribute).PrefixLabel;
            disableOnPlay = ((CustomAttributeBase)attribute).DisableOnPlay;
            disableOnStop = ((CustomAttributeBase)attribute).DisableOnStop;
            scrollbarThreshold = Screen.width - position.width > 19 ? 298 : 313;
            indentLevel = EditorGUI.indentLevel;
            currentEvent = Event.current;

            EditorGUI.BeginDisabledGroup((Application.isPlaying && disableOnPlay) || (!Application.isPlaying && disableOnStop));

            if (fieldInfo.FieldType.IsArray) {
                index = AttributeUtility.GetIndexFromLabel(label);
                arrayProperty = property.GetParent();

                if (noIndex) {
                    if (string.IsNullOrEmpty(prefixLabel)) {
                        label.text = label.text.Substring(0, label.text.Length - 2);
                    }
                }
                else if (!string.IsNullOrEmpty(prefixLabel)) {
                    prefixLabel += " " + index;
                }
            }

            if (drawPrefixLabel) {
                if (!noPrefixLabel) {
                    if (!string.IsNullOrEmpty(prefixLabel)) {
                        label.text = prefixLabel;
                    }
                    position = EditorGUI.PrefixLabel(position, label);
                }
            }
            else {
                if (noPrefixLabel) label.text = "";
                else if (!string.IsNullOrEmpty(prefixLabel)) label.text = prefixLabel;
            }

            currentPosition = position;
            currentLabel = label;
        }
开发者ID:Dracir,项目名称:Tarata-tesseract,代码行数:46,代码来源:CustomAttributePropertyDrawerBase.cs

示例2: Initialize

        public override void Initialize(SerializedProperty property, GUIContent label)
        {
            base.Initialize(property, label);

            CustomAttributeBase customAttribute = (CustomAttributeBase)attribute;

            noFieldLabel = customAttribute.NoFieldLabel;
            noPrefixLabel = customAttribute.NoPrefixLabel;
            noIndex = customAttribute.NoIndex;
            prefixLabel = customAttribute.PrefixLabel;
            disableOnPlay = customAttribute.DisableOnPlay;
            disableOnStop = customAttribute.DisableOnStop;
            disableBool = customAttribute.DisableBool;
            indent = customAttribute.Indent;
            beforeSeparator = customAttribute.BeforeSeparator;
            afterSeparator = customAttribute.AfterSeparator;

            bool inverseBool = false;

            if (!string.IsNullOrEmpty(disableBool))
            {
                inverseBool = disableBool.StartsWith("!");

                string boolPath = property.GetParent().FindPropertyRelative(inverseBool ? disableBool.Substring(1) : disableBool).GetAdjustedPath();

                boolDisabled = property.serializedObject.targetObject.GetValueFromMemberAtPath<bool>(boolPath);
            }

            boolDisabled = inverseBool ? !boolDisabled : boolDisabled;
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:30,代码来源:CustomAttributePropertyDrawerBase.cs

示例3: InitializeParameters

        void InitializeParameters(SerializedProperty property, GUIContent label)
        {
            CustomAttributeBase customAttribute = (CustomAttributeBase)attribute;

            noFieldLabel = customAttribute.NoFieldLabel;
            noPrefixLabel = customAttribute.NoPrefixLabel;
            noIndex = customAttribute.NoIndex;
            prefixLabel = customAttribute.PrefixLabel;
            disableOnPlay = customAttribute.DisableOnPlay;
            disableOnStop = customAttribute.DisableOnStop;
            disableBool = customAttribute.DisableBool;
            indent = customAttribute.Indent;
            beforeSeparator = customAttribute.BeforeSeparator;
            afterSeparator = customAttribute.AfterSeparator;
            isArray = typeof(IList).IsAssignableFrom(fieldInfo.FieldType);

            if (isArray) {
                index = AttributeUtility.GetIndexFromLabel(label);
                arrayProperty = property.GetParent();
            }

            bool inverseBool = !string.IsNullOrEmpty(disableBool) && disableBool.StartsWith("!");
            boolDisabled = !string.IsNullOrEmpty(disableBool) && property.serializedObject.targetObject.GetValueFromMemberAtPath<bool>(inverseBool ? disableBool.Substring(1) : disableBool);
            boolDisabled = inverseBool ? !boolDisabled : boolDisabled;
        }
开发者ID:Dracir,项目名称:Final-bablititi,代码行数:25,代码来源:CustomAttributePropertyDrawerBase.cs

示例4: Initialize

        public virtual void Initialize(SerializedProperty property, GUIContent label)
        {
            _initialized = true;
            _isArray = typeof(IList).IsAssignableFrom(fieldInfo.FieldType);
            _lineHeight = EditorGUIUtility.singleLineHeight;

            if (_isArray)
            {
                _index = AttributeUtility.GetIndexFromLabel(label);
                _arrayProperty = property.GetParent();
            }
        }
开发者ID:Magicolo,项目名称:No-Love-No-Gain,代码行数:12,代码来源:CustomPropertyDrawerBase.cs


注:本文中的UnityEditor.SerializedProperty.GetParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。