public void DrawOnMap(Block blok, Point click) { if (QueueChecked) { //checkbox is checked if (CurrentMap.GetElement(blok.X, blok.Y) != Convert.ToInt32(blok.TypeBlock)) { RedoUndo newAction = new RedoUndo(blok, this); UndoHistory.Push(newAction); Queue tempQueue = new Queue(blok.X, blok.Y, Convert.ToInt32(blok.TypeBlock), this); tempQueue.QueueTask(); } } else { if (CurrentMap.GetElement(blok.X, blok.Y) != Convert.ToInt32(blok.TypeBlock)) { RedoUndo newAction = new RedoUndo(blok, this); UndoHistory.Push(newAction); CurrentMap.SetElement(blok.X, blok.Y, Convert.ToInt32(blok.TypeBlock)); //if ((int)click.X % BlockScale == 0 || (int)click.Y % BlockScale == 0) //{ RenderMap(); //} } } }
public void redoAction() { if (currentMap.RedoHistory.Count > 0) { RedoUndo redoAction = currentMap.RedoHistory.Pop(); currentMap.UndoHistory.Push(redoAction); currentMap.CurrentMap.SetElement(redoAction.X, redoAction.Y, redoAction.typeBlock); currentMap.RenderMap(); } }
public void undoAction() { if (currentMap.UndoHistory.Count > 0) { RedoUndo lastaction = currentMap.UndoHistory.Pop(); currentMap.RedoHistory.Push(lastaction); currentMap.CurrentMap.SetElement(lastaction.X, lastaction.Y, lastaction.OriginalValue); if (currentMap.QueueList.Count > 0 && currentMap.QueueChecked) { currentMap.QueueList.Dequeue(); } currentMap.RenderMap(); } }
public void DrawOnMap(customRectangle rectangle, Point click) { int defaultY = rectangle.Y; if (QueueChecked) { for (int x = 0; x < rectangle.Width; x++) { for (int y = 0; y < rectangle.Height; y++) { RedoUndo newAction = new RedoUndo(rectangle, this); undoHistory.Push(newAction); Queue tempQueue = new Queue(rectangle.X, rectangle.Y, Convert.ToInt32(rectangle.TypeBlock), this); tempQueue.QueueTask(); rectangle.Y += 1; } rectangle.Y = defaultY; rectangle.X += 1; } } else { for (int x = 0; x < rectangle.Width; x++) { for (int y = 0; y < rectangle.Height; y++) { RedoUndo newAction = new RedoUndo(rectangle, this); undoHistory.Push(newAction); currentMap.SetElement(rectangle.X, rectangle.Y, Convert.ToInt32(rectangle.TypeBlock)); RenderMap(); rectangle.Y += 1; } rectangle.Y = defaultY; rectangle.X += 1; } } }