Пример #1
0
        public void RenderBoard(SpriteBatch sprite)
        {
            if (mapInfo == null)
            {
                return;
            }
            int xShift = centerPoint.X - hScroll;
            int yShift = centerPoint.Y - vScroll;

            for (int i = 0; i < boardItems.AllItemLists.Length; i++)
            {
                RenderList(boardItems.AllItemLists[i], sprite, xShift, yShift);
            }

            /*RenderBackgroundList(sprite, xShift, yShift, false);
             * RenderList(boardItems.TileObjs, sprite, xShift, yShift);
             * RenderList(boardItems.Mobs, sprite, xShift, yShift);
             * RenderList(boardItems.NPCs, sprite, xShift, yShift);
             * //RenderList(boardItems.Lives, sprite, xShift, yShift);
             * RenderList(boardItems.Reactors, sprite, xShift, yShift);
             * RenderList(boardItems.Portals, sprite, xShift, yShift);
             * RenderBackgroundList(sprite, xShift, yShift, true);*/
            /*if ((ApplicationSettings.visibleTypes & ItemTypes.Footholds) == ItemTypes.Footholds)
             *  foreach (FootholdLine fh in footholdLines) fh.Draw(sprite, fh.GetColor(ApplicationSettings.editedTypes, selectedLayerIndex), xShift, yShift);
             * if ((ApplicationSettings.visibleTypes & ItemTypes.Ropes) == ItemTypes.Ropes)
             *  foreach (RopeLine rope in ropeLines) rope.Draw(sprite, rope.GetColor(ApplicationSettings.editedTypes, selectedLayerIndex), xShift, yShift);*/
            /*RenderList(boardItems.FHAnchors, sprite, xShift, yShift);
             * RenderList(boardItems.RopeAnchors, sprite, xShift, yShift);
             * RenderList(boardItems.Chairs, sprite, xShift, yShift);
             * RenderList(boardItems.CharacterToolTips, sprite, xShift, yShift);
             * RenderList(boardItems.ToolTips, sprite, xShift, yShift);
             * RenderList(boardItems.ToolTipDots, sprite, xShift, yShift);*/
            if (mouse.MultiSelectOngoing)
            {
                Rectangle selectionRect = InputHandler.CreateRectangle(
                    new Point(MultiBoard.VirtualToPhysical(mouse.MultiSelectStart.X, centerPoint.X, hScroll, 0), MultiBoard.VirtualToPhysical(mouse.MultiSelectStart.Y, centerPoint.Y, vScroll, 0)),
                    new Point(MultiBoard.VirtualToPhysical(mouse.X, centerPoint.X, hScroll, 0), MultiBoard.VirtualToPhysical(mouse.Y, centerPoint.Y, vScroll, 0)));
                parent.DrawRectangle(sprite, selectionRect, UserSettings.SelectSquare);
                selectionRect.X++;
                selectionRect.Y++;
                selectionRect.Width--;
                selectionRect.Height--;
                parent.FillRectangle(sprite, selectionRect, UserSettings.SelectSquareFill);
            }
            if (UserSettings.showVR && mapInfo.VR != null)
            {
                parent.DrawRectangle(sprite, new Rectangle(
                                         MultiBoard.VirtualToPhysical(mapInfo.VR.Value.X, centerPoint.X, hScroll, 0),
                                         MultiBoard.VirtualToPhysical(mapInfo.VR.Value.Y, centerPoint.Y, vScroll, 0),
                                         mapInfo.VR.Value.Width, mapInfo.VR.Value.Height), UserSettings.VRColor);
            }
            if (miniMap != null && UserSettings.useMiniMap)//here comes the cool part ^_^
            {
                parent.FillRectangle(sprite, new Rectangle(0, 0, miniMap.Width, miniMap.Height), Color.Gray);
                if (miniMapTexture == null)
                {
                    miniMapTexture = BoardItem.TextureFromBitmap(parent.Device, miniMap);
                }
                sprite.Draw(miniMapTexture, new Rectangle(0, 0, miniMap.Width, miniMap.Height), null, Color.White, 0, new Vector2(0, 0), SpriteEffects.None, 0.99999f);
                int x = hScroll / 16;
                int y = vScroll / 16;
                parent.DrawRectangle(sprite, new Rectangle(x, y, parent.Width / _mag, parent.Height / _mag), Color.Blue);
                //parent.DrawRectangle(sprite, new Rectangle(0, 0, miniMap.Width, miniMap.Height), Color.Black);
                parent.DrawLine(sprite, new Vector2(miniMap.Width + 1, 0), new Vector2(miniMap.Width + 1, miniMap.Height), Color.Black);
                parent.DrawLine(sprite, new Vector2(0, miniMap.Height), new Vector2(miniMap.Width + 1, miniMap.Height), Color.Black);
            }
        }
Пример #2
0
        public void RenderBoard(SpriteBatch sprite)
        {
            if (mapInfo == null)
            {
                return;
            }
            int           xShift = centerPoint.X - hScroll;
            int           yShift = centerPoint.Y - vScroll;
            SelectionInfo sel    = GetUserSelectionInfo();

            // Render the object lists
            foreach (IMapleList list in boardItems.AllItemLists)
            {
                RenderList(list, sprite, xShift, yShift, sel);
            }

            // Render the user's selection square
            if (mouse.MultiSelectOngoing)
            {
                Rectangle selectionRect = InputHandler.CreateRectangle(
                    new Point(MultiBoard.VirtualToPhysical(mouse.MultiSelectStart.X, centerPoint.X, hScroll, 0), MultiBoard.VirtualToPhysical(mouse.MultiSelectStart.Y, centerPoint.Y, vScroll, 0)),
                    new Point(MultiBoard.VirtualToPhysical(mouse.X, centerPoint.X, hScroll, 0), MultiBoard.VirtualToPhysical(mouse.Y, centerPoint.Y, vScroll, 0)));
                parent.DrawRectangle(sprite, selectionRect, UserSettings.SelectSquare);
                selectionRect.X++;
                selectionRect.Y++;
                selectionRect.Width--;
                selectionRect.Height--;
                parent.FillRectangle(sprite, selectionRect, UserSettings.SelectSquareFill);
            }

            // Render VR if it exists
            if (VRRectangle != null && (sel.visibleTypes & VRRectangle.Type) != 0)
            {
                VRRectangle.Draw(sprite, xShift, yShift, sel);
            }
            // Render minimap rectangle
            if (MinimapRectangle != null && (sel.visibleTypes & MinimapRectangle.Type) != 0)
            {
                MinimapRectangle.Draw(sprite, xShift, yShift, sel);
            }

            // Render the minimap itself
            if (miniMap != null && UserSettings.useMiniMap)
            {
                // Area for the image itself
                Rectangle minimapImageArea = new Rectangle((miniMapPos.X + centerPoint.X) / _mag, (miniMapPos.Y + centerPoint.Y) / _mag, miniMap.Width, miniMap.Height);

                // Render gray area
                parent.FillRectangle(sprite, minimapArea, Color.Gray);
                // Render minimap
                if (miniMapTexture == null)
                {
                    miniMapTexture = miniMap.ToTexture2D(parent.GraphicsDevice);
                }

                sprite.Draw(miniMapTexture, minimapImageArea, null, Color.White, 0, new Vector2(0, 0), SpriteEffects.None, 0.99999f);
                // Render current location on minimap
                parent.DrawRectangle(sprite, new Rectangle(hScroll / _mag, vScroll / _mag, parent.CurrentDXWindowSize.Width / _mag, (int)parent.CurrentDXWindowSize.Height / _mag), Color.Blue);

                // Render minimap borders
                parent.DrawRectangle(sprite, minimapImageArea, Color.Black);
            }

            // Render center point if InfoMode on
            if (ApplicationSettings.InfoMode)
            {
                parent.FillRectangle(sprite, new Rectangle(MultiBoard.VirtualToPhysical(-5, centerPoint.X, hScroll, 0), MultiBoard.VirtualToPhysical(-5, centerPoint.Y, vScroll, 0), 10, 10), Color.DarkRed);
            }
        }