示例#1
0
        private void EmitAfterDraw(OnTrackEvent onTrackEvent)
        {
            var type = onTrackEvent.eventType;

            switch (type)
            {
            case OnTrackEvent.EventType.EVENT_TIMELINE_ADDTACK: {
                var targetTimelineId = onTrackEvent.activeObjectId;
                var targetFramePos   = onTrackEvent.frame;

                var activeAuto = GetActiveScore();

                Undo.RecordObject(this, "Add Tack");

                activeAuto.AddNewTackToTimeline(targetTimelineId, targetFramePos);
                return;
            }
            }
        }
示例#2
0
        private void Emit(OnTrackEvent onTrackEvent)
        {
            var type = onTrackEvent.eventType;

            // tack events.
            switch (type)
            {
            case OnTrackEvent.EventType.EVENT_UNSELECTED: {
                manipulateTargets = new ManipulateTargets(new List <string>());

                Undo.RecordObject(this, "Unselect");

                var activeAuto = GetActiveScore();
                activeAuto.DeactivateAllObjects();
                Repaint();
                return;
            }

            case OnTrackEvent.EventType.EVENT_OBJECT_SELECTED: {
                manipulateTargets = new ManipulateTargets(new List <string> {
                        onTrackEvent.activeObjectId
                    });

                var activeAuto = GetActiveScore();

                Undo.RecordObject(this, "Select");
                activeAuto.ActivateObjectsAndDeactivateOthers(manipulateTargets.activeObjectIds);
                Repaint();
                return;
            }

            /*
             *      auto events.
             */
            case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE: {
                var activeAuto  = GetActiveScore();
                var tackPoints  = new List <TackPoint>();
                var newTimeline = new TimelineTrack(activeAuto.timelineTracks.Count, "New Timeline", tackPoints);

                Undo.RecordObject(this, "Add Timeline");

                activeAuto.timelineTracks.Add(newTimeline);
                return;
            }


            /*
             *      timeline events.
             */
            case OnTrackEvent.EventType.EVENT_TIMELINE_ADDTACK: {
                eventStacks.Add(onTrackEvent.Copy());
                return;
            }

            case OnTrackEvent.EventType.EVENT_TIMELINE_DELETE: {
                var targetTimelineId = onTrackEvent.activeObjectId;
                var activeAuto       = GetActiveScore();

                Undo.RecordObject(this, "Delete Timeline");

                activeAuto.DeleteObjectById(targetTimelineId);
                Repaint();
                SaveData();
                return;
            }

            case OnTrackEvent.EventType.EVENT_TIMELINE_BEFORESAVE: {
                Undo.RecordObject(this, "Update Timeline Title");
                return;
            }

            case OnTrackEvent.EventType.EVENT_TIMELINE_SAVE: {
                SaveData();
                return;
            }


            /*
             *      tack events.
             */
            case OnTrackEvent.EventType.EVENT_TACK_MOVING: {
                var movingTackId = onTrackEvent.activeObjectId;

                var activeAuto = GetActiveScore();

                activeAuto.SetMovingTackToTimelimes(movingTackId);
                break;
            }

            case OnTrackEvent.EventType.EVENT_TACK_MOVED: {
                Undo.RecordObject(this, "Move Tack");

                return;
            }

            case OnTrackEvent.EventType.EVENT_TACK_MOVED_AFTER: {
                var targetTackId = onTrackEvent.activeObjectId;

                var activeAuto          = GetActiveScore();
                var activeTimelineIndex = activeAuto.GetTackContainedTimelineIndex(targetTackId);
                if (0 <= activeTimelineIndex)
                {
                    activeAuto.timelineTracks[activeTimelineIndex].UpdateByTackMoved(targetTackId);

                    Repaint();
                    SaveData();
                }
                return;
            }

            case OnTrackEvent.EventType.EVENT_TACK_DELETED: {
                var targetTackId = onTrackEvent.activeObjectId;
                var activeAuto   = GetActiveScore();

                Undo.RecordObject(this, "Delete Tack");

                activeAuto.DeleteObjectById(targetTackId);
                Repaint();
                SaveData();
                return;
            }

            case OnTrackEvent.EventType.EVENT_TACK_BEFORESAVE: {
                Undo.RecordObject(this, "Update Tack Title");
                return;
            }

            case OnTrackEvent.EventType.EVENT_TACK_SAVE: {
                SaveData();
                return;
            }

            default: {
                Debug.LogError("no match type:" + type);
                break;
            }
            }
        }