예제 #1
0
        float EventGUI(Rect position, SerializedProperty property, bool draw)
        {
            float height             = 0;
            float standardFieldX     = AnalyticsEventTrackerEditor.StandardFieldX(position);
            float standardFieldWidth = AnalyticsEventTrackerEditor.StandardFieldWidth(position);

            var m_StandardEventType = property.FindPropertyRelative("m_StandardEventType");

            eventType = m_StandardEventType.stringValue;

            int selectedIndex = Array.IndexOf(eventTypes, eventType);

            Rect eventTypeRect = new Rect(
                standardFieldX,
                position.y,
                standardFieldWidth,
                EditorGUIUtility.singleLineHeight
                );

            if (selectedIndex > -1)
            {
                if (draw)
                {
                    if (GUI.Button(eventTypeRect, new GUIContent(selectedIndex < 0 ? k_CustomEvent : eventTypes[selectedIndex]), EditorStyles.popup))
                    {
                        BuildEventsMenu(property, selectedIndex);
                        eventsMenu.DropDown(new Rect(eventTypeRect.x, eventTypeRect.y - EditorGUIUtility.singleLineHeight - 2f, eventTypeRect.width, eventTypeRect.height));
                    }
                    eventType = eventTypes[selectedIndex];
                }
                height += AnalyticsEventTrackerEditor.k_LineMargin;
            }

            return(height);
        }
예제 #2
0
        float NameGUI(Rect position, SerializedProperty property, bool disable, bool foldout, bool draw)
        {
            if (draw)
            {
                SerializedProperty m_Name = property.FindPropertyRelative("m_Name");

                if (foldout)
                {
                    Rect nameLabelRect = new Rect(position.x, position.y,
                                                  AnalyticsEventTrackerEditor.k_LeftLabelMargin, EditorGUIUtility.singleLineHeight);
                    EditorGUI.LabelField(nameLabelRect, nameLabelContent);
                }

                float standardFieldX     = AnalyticsEventTrackerEditor.StandardFieldX(position);
                float standardFieldWidth = AnalyticsEventTrackerEditor.StandardFieldWidth(position);

                nameFieldRect = new Rect(
                    standardFieldX,
                    position.y,
                    standardFieldWidth,
                    EditorGUIUtility.singleLineHeight
                    );

                GUI.SetNextControlName("event_name_textfield");
                string eventName = m_Name.stringValue;

                EditorGUI.BeginDisabledGroup(disable);
                eventName = EditorGUI.TextField(nameFieldRect, eventName);
                ShowEventNameTooltip(property, nameFieldRect);
                EditorGUI.EndDisabledGroup();

                if (eventName != m_Name.stringValue)
                {
                    UpdateEventName(property, eventName);
                }
                if (eventNameFieldMarkedDirty)
                {
                    RemoveFocus();
                }
            }
            return(EditorGUIUtility.singleLineHeight);
        }
예제 #3
0
        float LifecycleGUI(Rect position, SerializedProperty lifecycleProperty, bool draw)
        {
            if (draw)
            {
                Rect labelRect = new Rect(
                    position.x,
                    position.y,
                    AnalyticsEventTrackerEditor.k_LeftLabelMargin,
                    EditorGUIUtility.singleLineHeight
                    );
                EditorGUI.LabelField(labelRect, lifecycleLabelContent);

                Rect propRect = new Rect(
                    AnalyticsEventTrackerEditor.StandardFieldX(position),
                    labelRect.y,
                    AnalyticsEventTrackerEditor.StandardFieldWidth(position),
                    EditorGUIUtility.singleLineHeight
                    );

                EditorGUI.PropertyField(propRect, lifecycleProperty, GUIContent.none);
            }
            return(EditorGUI.GetPropertyHeight(lifecycleProperty) + AnalyticsEventTrackerEditor.k_LineMargin);
        }
예제 #4
0
        float PropertyListGUI(Rect position, SerializedProperty property, bool draw)
        {
            SerializedProperty m_ApplyRules = property.FindPropertyRelative("m_ApplyRules");
            float height             = 0f;
            float standardFieldWidth = AnalyticsEventTrackerEditor.StandardFieldWidth(position);
            float standardFieldX     = AnalyticsEventTrackerEditor.StandardFieldX(position);
            Rect  applyRulesRect     = new Rect(position.x,
                                                position.y,
                                                AnalyticsEventTrackerEditor.k_LeftLabelMargin,
                                                EditorGUIUtility.singleLineHeight
                                                );
            Rect repetitionsLabelRect = new Rect(
                position.x,
                applyRulesRect.y + applyRulesRect.height + AnalyticsEventTrackerEditor.k_LineMargin,
                AnalyticsEventTrackerEditor.k_LeftLabelMargin,
                EditorGUIUtility.singleLineHeight
                );
            Rect repetitionsFieldRect = new Rect(
                standardFieldX,
                repetitionsLabelRect.y,
                standardFieldWidth,
                repetitionsLabelRect.height
                );
            Rect boolLabelRect = new Rect(
                position.x,
                repetitionsLabelRect.y + EditorGUIUtility.singleLineHeight,
                AnalyticsEventTrackerEditor.k_LeftLabelMargin,
                EditorGUIUtility.singleLineHeight
                );
            Rect boolRect = new Rect(
                standardFieldX,
                boolLabelRect.y,
                standardFieldWidth,
                EditorGUIUtility.singleLineHeight
                );
            Rect rulesRect = new Rect(
                position.x,
                boolRect.y + boolRect.height + AnalyticsEventTrackerEditor.k_LineMargin,
                position.width,
                position.height
                );


            EditorGUI.BeginChangeCheck();
            {
                height += applyRulesRect.height;
                bool applyRules = m_ApplyRules.boolValue;
                if (draw)
                {
                    applyRules = EditorGUI.ToggleLeft(applyRulesRect, applyRulesLabelContent, m_ApplyRules.boolValue);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    m_ApplyRules.boolValue = applyRules;
                }
            }

            if (m_ApplyRules.boolValue)
            {
                EditorGUI.BeginChangeCheck();
                {
                    SerializedProperty m_Repetitions = property.FindPropertyRelative("m_Repetitions");
                    if (draw)
                    {
                        EditorGUI.LabelField(repetitionsLabelRect, repetitionsLabelContent);
                    }
                    int repetitions = m_Repetitions.intValue;
                    if (draw)
                    {
                        repetitions = EditorGUI.IntField(repetitionsFieldRect, m_Repetitions.intValue);
                    }
                    height += repetitionsLabelRect.height + AnalyticsEventTrackerEditor.k_LineMargin;
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_Repetitions.intValue = repetitions;
                    }
                }
                height += boolLabelRect.height;
                if (draw)
                {
                    EditorGUI.LabelField(boolLabelRect, boolLabelContent);
                }
                height += boolRect.height;

                if (draw)
                {
                    EditorGUI.PropertyField(boolRect, property.FindPropertyRelative("m_TriggerBool"), GUIContent.none);
                    EditorGUI.PropertyField(rulesRect, property.FindPropertyRelative("m_Rules"), true);
                }
                height += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("m_Rules"));
            }
            return
                (height + AnalyticsEventTrackerEditor.k_LineMargin);
        }
예제 #5
0
        float TimerGUI(Rect position, SerializedProperty property, GUIContent label, bool draw)
        {
            float height = 0;

            SerializedProperty m_InitTime   = property.FindPropertyRelative("m_InitTime");
            SerializedProperty m_RepeatTime = property.FindPropertyRelative("m_RepeatTime");

            EditorGUI.BeginChangeCheck();
            {
                float standardFieldWidth = AnalyticsEventTrackerEditor.StandardFieldWidth(position);
                float standardFieldX     = AnalyticsEventTrackerEditor.StandardFieldX(position);

                Rect initTimeRect = new Rect(position.x, position.y + height + AnalyticsEventTrackerEditor.k_LineMargin, AnalyticsEventTrackerEditor.k_LeftLabelMargin, EditorGUIUtility.singleLineHeight);
                if (draw)
                {
                    EditorGUI.LabelField(initTimeRect, initTimeLabelContent);
                }

                Rect  initTimeFieldRect = new Rect(standardFieldX, initTimeRect.y, standardFieldWidth, initTimeRect.height);
                float initTime          = m_InitTime.floatValue;

                if (draw)
                {
                    initTime = EditorGUI.FloatField(initTimeFieldRect, m_InitTime.floatValue);
                }
                height += initTimeRect.height + AnalyticsEventTrackerEditor.k_LineMargin;


                Rect repeatTimeLabelRect = new Rect(
                    position.x,
                    initTimeRect.y + initTimeRect.height + AnalyticsEventTrackerEditor.k_LineMargin,
                    AnalyticsEventTrackerEditor.k_LeftLabelMargin,
                    EditorGUIUtility.singleLineHeight
                    );
                if (draw)
                {
                    EditorGUI.LabelField(repeatTimeLabelRect, repeatTimeLabelContent);
                }

                Rect repeatTimeFieldRect = new Rect(
                    standardFieldX,
                    repeatTimeLabelRect.y,
                    standardFieldWidth,
                    repeatTimeLabelRect.height
                    );
                float repeatTime = m_RepeatTime.floatValue;
                if (draw)
                {
                    repeatTime = EditorGUI.FloatField(repeatTimeFieldRect, m_RepeatTime.floatValue);
                }
                height += repeatTimeLabelRect.height + AnalyticsEventTrackerEditor.k_LineMargin;

                if (EditorGUI.EndChangeCheck())
                {
                    m_InitTime.floatValue   = initTime;
                    m_RepeatTime.floatValue = repeatTime;
                }
            }

            return(height);
        }