public void SetNoteType(Note.NoteType type) { List <ActionHistory.Action> actions = new List <ActionHistory.Action>(); foreach (ChartObject chartObject in editor.currentSelectedObjects) { if (chartObject.classID == (int)SongObject.ID.Note) { Note note = chartObject as Note; // Need to record the whole chord Note unmodified = (Note)note.Clone(); Note[] chord = note.GetChord(); ActionHistory.Action[] deleteRecord = new ActionHistory.Action[chord.Length]; for (int i = 0; i < deleteRecord.Length; ++i) { deleteRecord[i] = new ActionHistory.Delete(chord[i]); } note.SetType(type); //SetNoteType(note as Note, type); chord = note.GetChord(); ActionHistory.Action[] addRecord = new ActionHistory.Action[chord.Length]; for (int i = 0; i < addRecord.Length; ++i) { addRecord[i] = new ActionHistory.Add(chord[i]); } if (note.flags != unmodified.flags) { actions.AddRange(deleteRecord); actions.AddRange(addRecord); } foreach (Note chordNote in note.chord) { if (chordNote.controller) { chordNote.controller.SetDirty(); } } } if (chartObject.controller) { chartObject.controller.SetDirty(); } } if (actions.Count > 0) { editor.actionHistory.Insert(actions.ToArray()); } ChartEditor.isDirty = true; }
protected override void AddObject() { ActionHistory.Add action; string debugMessage = string.Empty; // Add song event Event globalEvent = new Event(songEvent); editor.currentSong.Add(globalEvent); action = new ActionHistory.Add(globalEvent); debugMessage = "Added Song Event \""; debugMessage += globalEvent.title + "\""; Debug.Log(debugMessage); editor.actionHistory.Insert(action); editor.currentSelectedObject = globalEvent; }
protected override void AddObject() { ActionHistory.Add action; string debugMessage = string.Empty; // Add chart event ChartEvent chartEvent = new ChartEvent(this.chartEvent); editor.currentChart.Add(chartEvent); action = new ActionHistory.Add(chartEvent); debugMessage = "Added Chart Event \""; debugMessage += chartEvent.eventName + "\""; Debug.Log(debugMessage); editor.actionHistory.Insert(action); editor.currentSelectedObject = chartEvent; }