Beispiel #1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            DrawBaseGUI(position, property, label);

            float originY = position.y;

            position.height = EditorGUIUtility.singleLineHeight;
            
            if (property.isExpanded)
            {
                EditorGUI.indentLevel++;
                position = EditorGUI.IndentedRect(position);
                EditorGUI.indentLevel--;
                
                position.height = EditorGUIUtility.singleLineHeight;
                position.y += base.GetPropertyHeight(property, label)+ EditorGUIUtility.standardVerticalSpacing;
                EditorGUI.BeginDisabledGroup(true);
                SerializedProperty sequencerSerializedProperty = property.FindPropertyRelative("sequencer");

                string duration = "???";
                if (sequencerSerializedProperty.objectReferenceValue != null)
                {
                    AnimationSequencerController sequencer = sequencerSerializedProperty.objectReferenceValue as AnimationSequencerController;
                    duration = sequencer.Duration.ToString(CultureInfo.InvariantCulture);
                }
                EditorGUI.TextField(position, "Duration", duration);
                EditorGUI.EndDisabledGroup();
            }
            property.SetPropertyDrawerHeight(position.y - originY + EditorGUIUtility.singleLineHeight);
        }
 private void OnEnable()
 {
     sequencerController = target as AnimationSequencerController;
     reorderableList     = new ReorderableList(serializedObject, serializedObject.FindProperty("animationSteps"), true, true, true, true);
     reorderableList.drawElementCallback   += OnDrawAnimationStep;
     reorderableList.elementHeightCallback += GetAnimationStepHeight;
     reorderableList.onAddDropdownCallback += OnClickToAddNew;
     reorderableList.onRemoveCallback      += OnClickToRemove;
     reorderableList.onReorderCallback     += OnListOrderChanged;
     reorderableList.drawHeaderCallback    += OnDrawerHeader;
     CalculateTotalAnimationTime();
     Repaint();
 }
        private void UpdatePreview()
        {
            if (!isPreviewPlaying)
            {
                return;
            }

            frameDelta    = (float)(EditorApplication.timeSinceStartup - lastFrameTime);
            lastFrameTime = EditorApplication.timeSinceStartup;

            for (int i = 0; i < activeSequencers.Length; i++)
            {
                AnimationSequencerController animationSequencerController = activeSequencers[i];
                if (animationSequencerController == null)
                {
                    continue;
                }

                animationSequencerController.UpdateStep(frameDelta);
            }
        }
        private void StopPreview()
        {
            if (!Application.isPlaying)
            {
                EditorApplication.update -= EditorUpdate;
                DOTweenEditorPreview.Stop(true);
            }

            sequencerController.OnSequenceFinishedPlayingEvent -= StopPreview;
            for (int i = 0; i < activeSequencers.Length; i++)
            {
                AnimationSequencerController animationSequencerController = activeSequencers[i];
                if (animationSequencerController == null)
                {
                    continue;
                }

                animationSequencerController.Stop();
            }

            isPreviewPlaying = false;
            Repaint();
        }
Beispiel #5
0
 public void SetTarget(AnimationSequencerController newTarget)
 {
     sequencer = newTarget;
 }