Exemple #1
0
        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            var graphicsObj = e.Graphics;

            var panelRect = new Rectangle(new Point(0, 0), panel1.Size);

            myMap.Draw(imageBasePos, ZoomScale, graphicsObj, panelRect);

            var highlightedNode       = FindClickedNode(myMousePos);
            var highlightedConnection = highlightedNode == null?FindClickedConnection(myMousePos) : null;

            var renderOptions = new NodeRenderOptions();

            renderOptions.BasePos               = imageBasePos;
            renderOptions.Zoom                  = ZoomScale;
            renderOptions.carriedPos            = myNodeCarriedPos;
            renderOptions.carriedNodeId         = carriedNode?.id ?? Guid.Empty;
            renderOptions.selectedNodeId        = selectedNode?.id ?? Guid.Empty;
            renderOptions.highlightedNodeId     = highlightedNode?.id ?? Guid.Empty;
            renderOptions.selectedConnection    = selectedConnection;
            renderOptions.highlightedConnection = highlightedConnection;
            renderOptions.panelSize             = panel1.Size;

            myNodeRenderer.RenderNodes(myNodeCollection.myNodes, graphicsObj, renderOptions);

            //Draw cursor
            if (myPointerState == PointerState.PlaceBlank)
            {
                myNodeRenderer.DrawCursorNode(myMousePos, NodeType.Blank, graphicsObj);
            }
            else if (myPointerState == PointerState.PlaceLock)
            {
                myNodeRenderer.DrawCursorNode(myMousePos, NodeType.Lock, graphicsObj);
            }
            else if (myPointerState == PointerState.PlaceRandom)
            {
                myNodeRenderer.DrawCursorNode(myMousePos, NodeType.RandomKey, graphicsObj);
            }
            else if (myPointerState == PointerState.PlaceEvent)
            {
                myNodeRenderer.DrawCursorNode(myMousePos, NodeType.EventKey, graphicsObj);
            }
            else if (myPointerState == PointerState.OneWay && selectedNode != null)
            {
                myNodeRenderer.DrawCursorOneWayConnection(selectedNode, myMousePos, graphicsObj);
            }
            else if (myPointerState == PointerState.TwoWay && selectedNode != null)
            {
                myNodeRenderer.DrawCursorTwoWayConnection(selectedNode, myMousePos, graphicsObj);
            }

            // var mopusepos = (myMousePos / ZoomScale) - imageBasePos;
            // DrawDebugMessage($"{mopusepos.x}, {mopusepos.y}", graphicsObj);
        }
Exemple #2
0
        /// <summary>
        /// Draw the Map
        /// </summary>
        /// <param name="gameTime">Game time</param>
        /// <param name="spriteBatch">Sprite batch to draw to</param>
        /// <param name="camera">Camera of the map</param>
        public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch, Camera camera)
        {
            UpdateCamera(camera);

            foreach (var obj in lastTiles)
            {
                obj.Draw(gameTime, spriteBatch, camera);
            }

                        #if RENDER_AREAMAP
            areamap.Draw(spriteBatch, camera);
                        #endif
        }