Beispiel #1
0
 private bool DoAction(TrackWriter track, GameLine beforeact, GameLine afteract)
 {
     if (beforeact == null && afteract == null)
     {
         throw new ArgumentNullException(
                   "undo action with no values");
     }
     // remove line
     if (afteract == null)
     {
         track.RemoveLine(beforeact);
     }
     // add line
     else if (beforeact == null)
     {
         track.AddLine(afteract.Clone());
     }
     // Replace line
     else if (beforeact.Type != afteract.Type)
     {
         track.RemoveLine(beforeact);
         track.AddLine(afteract);
     }
     //move action
     else
     {
         track.ReplaceLine(beforeact, afteract.Clone());
     }
     return(!(beforeact is SceneryLine));
 }
Beispiel #2
0
            public void Redo(TrackWriter track)
            {
                bool physchanged = false;

                for (int i = 0; i < States.Count - 1; i += 2)
                {
                    physchanged |= DoAction(track, States[i], States[i + 1]);
                }
                if (physchanged)
                {
                    track.NotifyTrackChanged();
                }
            }
Beispiel #3
0
 public TrackWriter CreateTrackWriter()
 {
     return(TrackWriter.AcquireWrite(_tracksync, _track, _renderer, UndoManager, Timeline, _cells));
 }