Ejemplo n.º 1
0
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            float height = EditorGUIUtility.singleLineHeight;

            SerializedProperty targetProp = property.FindPropertyRelative("Target");
            SerializedProperty callProp   = property.FindPropertyRelative("Call");

            height += EditorGUIUtility.standardVerticalSpacing * 2;
            height += MsgEditorGUI.GetHeightMsgTargetField(targetProp, label) + MsgEditorGUI.GetHeightMsgCallField(callProp, label);

            return(height);
        }
Ejemplo n.º 2
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            position.height = EditorGUIUtility.singleLineHeight;

            EditorGUI.LabelField(position, label);

            MsgEditorGUIUtility.AdvanceLine(ref position);
            MsgEditorGUIUtility.BeginIndent(ref position);

            SerializedProperty targetProp = property.FindPropertyRelative("Target");

            MsgEditorGUI.MsgTargetField(position, targetProp, new GUIContent("Target"));

            MsgEditorGUIUtility.AdvanceLine(ref position);

            FilteredMsgTypeList list;
            int targetType = targetProp.FindPropertyRelative("Target").intValue;

            if (targetType == (int)MsgTarget.Mode.All)
            {
                list = FilteredMsgTypeList.Filtered(s_AllAttr);
            }
            else if (targetType == (int)MsgTarget.Mode.Other)
            {
                GameObject obj = targetProp.FindPropertyRelative("Object").objectReferenceValue as GameObject;
                if (obj == null)
                {
                    list = FilteredMsgTypeList.None();
                }
                else
                {
                    list = FilteredMsgTypeList.Filtered(obj, s_SingleAttr);
                }
            }
            else
            {
                Component component = property.serializedObject.targetObject as Component;
                if (component == null)
                {
                    list = FilteredMsgTypeList.Filtered(s_SingleAttr);
                }
                else
                {
                    list = FilteredMsgTypeList.Filtered(component.gameObject, s_SingleAttr);
                }
            }

            SerializedProperty callProp = property.FindPropertyRelative("Call");

            MsgEditorGUI.MsgCallField(position, callProp, new GUIContent("Message"), list);

            MsgEditorGUIUtility.EndIndent(ref position);
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            MessengerComponent component = ((MessengerComponent)target);
            MessengerImpl      m         = component.Messenger;

            if (m == null)
            {
                EditorGUILayout.HelpBox("Runtime only", MessageType.Info);
                return;
            }

            MsgEditorGUI.MsgComponent(m, ref m_SelectedTypes);
        }
Ejemplo n.º 4
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            FilterByFlag        attr = attribute as FilterByFlag;
            FilteredMsgTypeList list = null;

            if (LimitToSelf.IsDefined(fieldInfo, typeof(LimitToSelf), true))
            {
                Component c = property.serializedObject.targetObject as Component;
                if (c != null)
                {
                    list = FilteredMsgTypeList.Filtered(c.gameObject, attr);
                }
            }

            if (list == null)
            {
                list = FilteredMsgTypeList.Filtered(attr);
            }

            MsgEditorGUI.MsgTypeField(position, property, label, list);
        }
Ejemplo n.º 5
0
 public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
 {
     return(MsgEditorGUI.GetHeightMsgTypeField(property, label));
 }
Ejemplo n.º 6
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            FilteredMsgTypeList list = FilteredMsgTypeList.Filtered(s_CachedAttr);

            MsgEditorGUI.MsgCallField(position, property, label, list);
        }
Ejemplo n.º 7
0
 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
 {
     MsgEditorGUI.MsgTargetField(position, property, label);
 }