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(); activeAuto.SetScoreInspector(); parent_.RepaintAllWindow(); 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); parent_.RepaintAllWindow(); return; } //各種タイムライン case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_POS: case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_TRANSFORM: case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_MOVE: case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_COLOR: case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_EFFECT: case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_PASSIVE: { int timelineType = 0; //各種タイムライン switch (type) { case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_POS: timelineType = (int)TimelineType.TL_POS; break; case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_TRANSFORM: timelineType = (int)TimelineType.TL_TRANSFORM; break; case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_MOVE: timelineType = (int)TimelineType.TL_MOVE; break; case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_COLOR: timelineType = (int)TimelineType.TL_COLOR; break; case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_EFFECT: timelineType = (int)TimelineType.TL_EFFECT; break; case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_PASSIVE: timelineType = (int)TimelineType.TL_PASSIVE; break; } var activeAuto = GetActiveScore(); var tackPoints = new List <TackPoint>(); var newTimeline = new TimelineTrack(activeAuto.timelineTracks_.Count, timelineType, tackPoints); var newTimelineId = newTimeline.timelineId_; Undo.RecordObject(this, "Add Timeline"); //activeAuto.timelineTracks.Add(newTimeline); string id = MethodBase.GetCurrentMethod().Name; Action action = () => { activeAuto.timelineTracks_.Add(newTimeline); }; Action undo = () => { activeAuto.DeleteObjectById(newTimelineId, false); }; ARIMotionMainWindow.scoreCmd_.Do(new MotionCommand(id, action, undo)); parent_.NeedSave(); return; } case OnTrackEvent.EventType.EVENT_SCORE_BEFORESAVE: { Undo.RecordObject(this, "Update Score Title"); return; } case OnTrackEvent.EventType.EVENT_SCORE_SAVE: { parent_.NeedSave(); return; } /* * timeline events. */ case OnTrackEvent.EventType.EVENT_TIMELINE_ADDTACK: { eventStacks_.Add(onTrackEvent.Copy()); return; } case OnTrackEvent.EventType.EVENT_TIMELINE_PASTETACK: { eventStacks_.Add(onTrackEvent.Copy()); return; } case OnTrackEvent.EventType.EVENT_TIMELINE_DELETE: { var targetTimelineId = onTrackEvent.activeObjectId; var activeAuto = GetActiveScore(); Undo.RecordObject(this, "Delete Timeline"); string id = MethodBase.GetCurrentMethod().Name; Action action = () => { activeAuto.DeleteObjectById(targetTimelineId, false); }; Action undo = () => { activeAuto.DeleteObjectById(targetTimelineId, true); }; ARIMotionMainWindow.scoreCmd_.Do(new MotionCommand(id, action, undo)); //activeAuto.DeleteObjectById(targetTimelineId); parent_.NeedSave(); return; } case OnTrackEvent.EventType.EVENT_TIMELINE_BEFORESAVE: { Undo.RecordObject(this, "Update Timeline Title"); return; } case OnTrackEvent.EventType.EVENT_TIMELINE_SAVE: { parent_.NeedSave(); 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(); parent_.NeedSave(); } return; } case OnTrackEvent.EventType.EVENT_TACK_DELETED: { var targetTackId = onTrackEvent.activeObjectId; var activeAuto = GetActiveScore(); Undo.RecordObject(this, "Delete Tack"); string id = MethodBase.GetCurrentMethod().Name; Action action = () => { activeAuto.DeleteObjectById(targetTackId, false); activeAuto.SqueezeTack(); }; Action undo = () => { activeAuto.DeleteObjectById(targetTackId, true); activeAuto.SqueezeTack(); }; ARIMotionMainWindow.scoreCmd_.Do(new MotionCommand(id, action, undo)); //Repaint(); parent_.NeedSave(); return; } case OnTrackEvent.EventType.EVENT_TACK_COPY: { var targetTackId = onTrackEvent.activeObjectId; var activeAuto = GetActiveScore(); clipTack_ = activeAuto.GetTackById(targetTackId); return; } case OnTrackEvent.EventType.EVENT_TACK_BEFORESAVE: { Undo.RecordObject(this, "Update Tack Title"); return; } case OnTrackEvent.EventType.EVENT_TACK_SAVE: { parent_.NeedSave(); return; } case OnTrackEvent.EventType.EVENT_TACK_CHANGE: { parent_.NeedSave(); parent_.subWindow_.SetupPartsData(false); //サブウインドウにも反映させる parent_.RepaintAllWindow(); return; } default: { //親に投げる ParentEmit(onTrackEvent); //Debug.LogError("no match type:" + type); break; } } }
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; } } }