Ejemplo n.º 1
0
        /************************************************************************************************************************/

        /// <summary>
        /// Calculates the number of vertical pixels the `property` will occupy when it is drawn.
        /// </summary>
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            using (var context = Context.Get(property))
            {
                var height = AnimancerGUI.LineHeight;

                var count = Math.Max(1, context.Times.Count);
                for (int i = 0; i < count; i++)
                {
                    height += CalculateEventHeight(context, i) * GetVisibility(context, i).faded;
                }

                var events = context.Sequence?.InitializedEvents;
                if (events != null)
                {
                    height += EventSequenceDrawer.Get(events).CalculateHeight(events) + AnimancerGUI.StandardSpacing;
                }

                return(height);
            }
        }
Ejemplo n.º 2
0
        /************************************************************************************************************************/

        /// <summary>Draws the GUI for the `property`.</summary>
        public override void OnGUI(Rect area, SerializedProperty property, GUIContent label)
        {
            using (var context = Context.Get(property))
            {
                DoHeaderGUI(ref area, label, context);

                if (!property.hasMultipleDifferentValues)
                {
                    EditorGUI.indentLevel++;
                    DoAllEventsGUI(ref area, context);
                    EditorGUI.indentLevel--;
                }

                var sequence = context.Sequence?.InitializedEvents;
                if (sequence != null)
                {
                    using (ObjectPool.Disposable.AcquireContent(out label, "Runtime Events",
                                                                $"The runtime {nameof(AnimancerEvent)}.{nameof(Sequence)} created from the serialized data above"))
                    {
                        EventSequenceDrawer.Get(sequence).Draw(ref area, sequence, label);
                    }
                }
            }
        }