Ejemplo n.º 1
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.º 2
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.º 3
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            FilteredMsgTypeList list = FilteredMsgTypeList.Filtered(s_CachedAttr);

            MsgEditorGUI.MsgCallField(position, property, label, list);
        }