示例#1
0
 public Map(int breedte, int hoogte, Canvas canvas)
 {
     CurrentMap = new MapModel(breedte, hoogte);
     MapCanvas = canvas;
     QueueList = new Queue<Queue>();
     UndoHistory = new Stack<RedoUndo>();
     RedoHistory = new Stack<RedoUndo>();
 }
示例#2
0
        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();

                    //}
                }

            }
        }
示例#3
0
        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;

                }

            }
        }
示例#4
0
 public void QueueTask()
 {
     Queue q = new Queue(X,Y,OriginalValue);
     currentMap.QueueList.Enqueue(q);
 }