public void Emit(OnTrackEvent onTrackEvent) { var type = onTrackEvent.eventType; switch (type) { case OnTrackEvent.EventType.EVENT_MAIN_ADDSCORE: { return; } default: { Debug.LogError("no match type:" + type); break; } } }
//遅延命令 public void Emit(OnTrackEvent onTrackEvent) { var type = onTrackEvent.eventType; // tack events. switch (type) { case OnTrackEvent.EventType.EVENT_PARTS_MOVED: { //Undo.RecordObject(this, "Parts Moved"); //Debug.Log("Parts Moved"); parent_.NeedSave(); return; } case OnTrackEvent.EventType.EVENT_PARTS_COPY: { var activeTack = parent_.GetActiveScore().GetActiveTackPoint(); clipPos_ = activeTack.motionData_.mPos; return; } case OnTrackEvent.EventType.EVENT_PARTS_PASTE: { Undo.RecordObject(this, "Parts Paste"); var activeTack = parent_.GetActiveScore().GetActiveTackPoint(); activeTack.motionData_.mPos = clipPos_; SetupPartsData(true); return; } default: { //親に投げる ParentEmit(onTrackEvent); break; } } }
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; } } }
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"); string id = MethodBase.GetCurrentMethod().Name; TackPoint newTackPoint = activeAuto.NewTackToTimeline(targetTimelineId, targetFramePos); var delId = newTackPoint.tackId_; Action action = () => { activeAuto.PasteTackToTimeline(targetTimelineId, targetFramePos, newTackPoint); activeAuto.SqueezeTack(); }; Action undo = () => { activeAuto.DeleteObjectById(delId, false); activeAuto.SqueezeTack(); }; ARIMotionMainWindow.scoreCmd_.Do(new MotionCommand(id, action, undo)); return; } case OnTrackEvent.EventType.EVENT_TIMELINE_PASTETACK: { var targetTimelineId = onTrackEvent.activeObjectId; var targetFramePos = onTrackEvent.frame; var activeAuto = GetActiveScore(); Undo.RecordObject(this, "Paste Tack"); //activeAuto.PasteTackToTimeline(targetTimelineId, targetFramePos, clipTack_); //activeAuto.SqueezeTack(); string id = MethodBase.GetCurrentMethod().Name; TackPoint newTackPoint = clipTack_; Action action = () => { activeAuto.PasteTackToTimeline(targetTimelineId, targetFramePos, newTackPoint); activeAuto.SqueezeTack(); }; Action undo = () => { activeAuto.DeleteObjectById(newTackPoint.tackId_, false); activeAuto.SqueezeTack(); }; ARIMotionMainWindow.scoreCmd_.Do(new MotionCommand(id, action, undo)); return; } } }