예제 #1
0
        public void RestoreCheckPoint(RoomMemento memento)
        {
            roomName = String.Copy(memento.roomName);
            roomID   = memento.roomID;
            roomSize = memento.roomSize;

            //Is an image included in the memento)?
            if (memento.roomImage != null)
            {
                roomImage.RestoreCheckPoint(memento.roomImage);
            }
            walkBoxes.RestoreCheckpoint(memento.walkBoxes);
        }
 public RoomMemento Redo(RoomMemento current)
 {
     if (redoStack.Count != 0)
     {
         // Save current memento in undo
         undoStack.Push(current);
         RoomMemento m = redoStack.Pop();
         return(m);
     }
     else
     {
         return(null);
     }
 }
예제 #3
0
        public RoomMemento CreateCheckPoint(bool includeImage = true)
        {
            RoomMemento m;

            if (includeImage)
            {
                m = new RoomMemento(roomName, roomID, roomSize, roomImage.CreateCheckPoint(), walkBoxes.CreateCheckPoint());
            }
            else
            {
                m = new RoomMemento(roomName, roomID, roomSize, null, walkBoxes.CreateCheckPoint());
            }

            return(m);
        }
 public void NewCheckPoint(RoomMemento rm)
 {
     undoStack.Push(rm);
 }