當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。