Пример #1
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            var settings = AddressableAssetSettingsDefaultObject.Settings;

            if (settings == null)
            {
                return(0);
            }
            var idProp = property.FindPropertyRelative("m_Id");

            return(ProfilesEditor.CalcGUIHeight(settings, label.text, idProp.stringValue));
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var settings = AddressableAssetSettingsDefaultObject.Settings;

            if (settings == null)
            {
                return;
            }
            EditorGUI.BeginProperty(position, label, property);
            var idProp = property.FindPropertyRelative("m_Id");

            idProp.stringValue = ProfilesEditor.ValueGUI(position, settings, label.text, idProp.stringValue);

            EditorGUI.EndProperty();
        }
        public void OnGUIMultiple(Rect position, SerializedProperty property, GUIContent label, bool showMixed)
        {
            var settings = AddressableAssetSettingsDefaultObject.Settings;

            if (settings == null)
            {
                return;
            }
            EditorGUI.BeginProperty(position, label, property);

            if (m_SerializedFieldInfo == null)
            {
                m_SerializedFieldInfo = GetFieldInfo(property);
            }

            EditorGUI.BeginProperty(position, label, property);
            var st = (ProfileValueReference)m_SerializedFieldInfo.GetValue(property.serializedObject.targetObject);

            bool   wasChanged         = false;
            string currentPathDisplay = st.Id;

            if (showMixed)
            {
                currentPathDisplay = "—";
            }

            var newId = ProfilesEditor.ValueGUI(position, settings, label.text, currentPathDisplay, ref wasChanged);

            if (newId != "—")
            {
                st.Id = newId; // ignore mixed value
            }
            if (wasChanged)
            {
                st = (ProfileValueReference)m_SerializedFieldInfo.GetValue(property.serializedObject.targetObject);
                if (st != null && st.OnValueChanged != null)
                {
                    st.OnValueChanged(st);
                }
            }

            EditorGUI.EndProperty();
        }