private void GetObjsUnderPointFromList(IMapleList list, Point locationVirtualPos, ref BoardItem itemUnderPoint, ref BoardItem selectedUnderPoint, ref bool selectedItemHigher)
        {
            if (!list.IsItem)
            {
                return;
            }
            SelectionInfo sel = selectedBoard.GetUserSelectionInfo();

            if (list.ListType == ItemTypes.None)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    BoardItem item = (BoardItem)list[i];
                    if ((selectedBoard.EditedTypes & item.Type) != item.Type)
                    {
                        continue;
                    }
                    if (IsPointInsideRectangle(locationVirtualPos, item.Left, item.Top, item.Right, item.Bottom) &&
                        !(item is HaCreator.MapEditor.Input.Mouse) &&
                        item.CheckIfLayerSelected(sel) &&
                        !item.IsPixelTransparent(locationVirtualPos.X - item.Left, locationVirtualPos.Y - item.Top))
                    {
                        if (item.Selected)
                        {
                            selectedUnderPoint = item;
                            selectedItemHigher = true;
                        }
                        else
                        {
                            itemUnderPoint     = item;
                            selectedItemHigher = false;
                        }
                    }
                }
            }
            else if ((selectedBoard.EditedTypes & list.ListType) == list.ListType)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    BoardItem item = (BoardItem)list[i];
                    if (IsPointInsideRectangle(locationVirtualPos, item.Left, item.Top, item.Right, item.Bottom) &&
                        !(item is HaCreator.MapEditor.Input.Mouse) &&
                        !(item is HaCreator.MapEditor.Input.Mouse) &&
                        item.CheckIfLayerSelected(sel) &&
                        !item.IsPixelTransparent(locationVirtualPos.X - item.Left, locationVirtualPos.Y - item.Top))
                    {
                        if (item.Selected)
                        {
                            selectedUnderPoint = item;
                            selectedItemHigher = true;
                        }
                        else
                        {
                            itemUnderPoint     = item;
                            selectedItemHigher = false;
                        }
                    }
                }
            }
        }
Пример #2
0
 public virtual XNA.Color GetColor(SelectionInfo sel, bool selected)
 {
     if ((sel.editedTypes & Type) == Type && CheckIfLayerSelected(sel))
     {
         return(selected ? UserSettings.SelectedColor : XNA.Color.White);
     }
     else
     {
         return(MultiBoard.InactiveColor);
     }
 }
Пример #3
0
 public virtual bool CheckIfLayerSelected(SelectionInfo sel)
 {
     // By default, item is nonlayered
     return(true);
 }
Пример #4
0
 public virtual XNA.Color GetColor(SelectionInfo sel, bool selected)
 {
     if ((sel.editedTypes & Type) == Type && CheckIfLayerSelected(sel))
         return selected ? UserSettings.SelectedColor : XNA.Color.White;
     else return MultiBoard.InactiveColor;
 }
Пример #5
0
 public virtual bool CheckIfLayerSelected(SelectionInfo sel)
 {
     // By default, item is nonlayered
     return true;
 }
Пример #6
0
 public void RenderList(IMapleList list, SpriteBatch sprite, int xShift, int yShift, SelectionInfo sel)
 {
     if (list.ListType == ItemTypes.None)
     {
         foreach (BoardItem item in list)
         {
             if (parent.IsItemInRange(item.X, item.Y, item.Width, item.Height, xShift - item.Origin.X, yShift - item.Origin.Y) && ((sel.visibleTypes & item.Type) != 0))
             {
                 item.Draw(sprite, item.GetColor(sel, item.Selected), xShift, yShift);
             }
         }
     }
     else if ((sel.visibleTypes & list.ListType) != 0)
     {
         if (list.IsItem)
         {
             foreach (BoardItem item in list)
             {
                 if (parent.IsItemInRange(item.X, item.Y, item.Width, item.Height, xShift - item.Origin.X, yShift - item.Origin.Y))
                 {
                     item.Draw(sprite, item.GetColor(sel, item.Selected), xShift, yShift);
                 }
             }
         }
         else
         {
             foreach (MapleLine line in list)
             {
                 if (parent.IsItemInRange(Math.Min(line.FirstDot.X, line.SecondDot.X), Math.Min(line.FirstDot.Y, line.SecondDot.Y), Math.Abs(line.FirstDot.X - line.SecondDot.X), Math.Abs(line.FirstDot.Y - line.SecondDot.Y), xShift, yShift))
                 {
                     line.Draw(sprite, line.GetColor(sel), xShift, yShift);
                 }
             }
         }
     }
 }
Пример #7
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);
            }
        }
Пример #8
0
 public void RenderList(IMapleList list, SpriteBatch sprite, int xShift, int yShift, SelectionInfo sel)
 {
     if (list.ListType == ItemTypes.None)
     {
         foreach (BoardItem item in list)
         {
             if (parent.IsItemInRange(item.X, item.Y, item.Width, item.Height, xShift - item.Origin.X, yShift - item.Origin.Y) && ((sel.visibleTypes & item.Type) != 0))
                 item.Draw(sprite, item.GetColor(sel, item.Selected), xShift, yShift);
         }
     }
     else if ((sel.visibleTypes & list.ListType) != 0)
     {
         if (list.IsItem)
         {
             foreach (BoardItem item in list)
             {
                 if (parent.IsItemInRange(item.X, item.Y, item.Width, item.Height, xShift - item.Origin.X, yShift - item.Origin.Y))
                     item.Draw(sprite, item.GetColor(sel, item.Selected), xShift, yShift);
             }
         }
         else
         {
             foreach (MapleLine line in list)
             {
                 if (parent.IsItemInRange(Math.Min(line.FirstDot.X, line.SecondDot.X), Math.Min(line.FirstDot.Y, line.SecondDot.Y), Math.Abs(line.FirstDot.X - line.SecondDot.X), Math.Abs(line.FirstDot.Y - line.SecondDot.Y), xShift, yShift))
                     line.Draw(sprite, line.GetColor(sel), xShift, yShift);
             }
         }
     }
 }