Example #1
0
        //private static Texture2D _edge;


        private void Pick(SpriteTexture texture, Rectangle area, Vector3 drawPosition, MouseOverList list)
        {
            int x;

            if (IsFlipped)
            {
                x = (int)drawPosition.X + area.X + 44 - list.MousePosition.X;
            }
            else
            {
                x = list.MousePosition.X - (int)drawPosition.X + area.X;
            }
            int y = list.MousePosition.Y - ((int)drawPosition.Y - area.Y);

            if (texture.Contains(x, y))
            {
                list.Add(this, drawPosition);
            }
        }
Example #2
0
        protected override bool Contains(int x, int y)
        {
            for (int i = 0; i < 9; i++)
            {
                SpriteTexture t          = _gumpTexture[i];
                int           drawWidth  = t.Width;
                int           drawHeight = t.Height;
                int           drawX      = X;
                int           drawY      = Y;

                switch (i)
                {
                case 0:
                    if (t.Contains(x, y))
                    {
                        return(true);
                    }

                    break;

                case 1:
                    drawX += _gumpTexture[0].Width;

                    int startX = drawX;
                    int maxW   = drawX + (Width - _gumpTexture[0].Width - _gumpTexture[2].Width);
                    int maxH   = drawY + drawHeight;


                    while (drawX < maxW)
                    {
                        if (t.Contains(Mouse.Position.X - drawX - ParentX, Mouse.Position.Y - drawY - ParentY))
                        {
                            return(true);
                        }

                        drawX += drawWidth;

                        if (drawX > maxW)
                        {
                            drawX  = startX;
                            drawY += drawHeight;

                            if (drawY > maxH)
                            {
                                break;
                            }
                        }
                    }

                    break;

                case 2:
                    drawX += Width - drawWidth;
                    if (t.Contains(Mouse.Position.X - drawX - ParentX, Mouse.Position.Y - drawY - ParentY))
                    {
                        return(true);
                    }

                    break;

                case 3:
                    drawY += _gumpTexture[0].Height;

                    startX = drawX;
                    maxW   = drawX + drawWidth;
                    maxH   = drawY + (Height - _gumpTexture[0].Height - _gumpTexture[5].Height);

                    while (drawX < maxW)
                    {
                        if (t.Contains(Mouse.Position.X - drawX - ParentX, Mouse.Position.Y - drawY - ParentY))
                        {
                            return(true);
                        }

                        drawX += drawWidth;

                        if (drawX > maxW)
                        {
                            drawX  = startX;
                            drawY += drawHeight;

                            if (drawY > maxH)
                            {
                                break;
                            }
                        }
                    }
                    break;

                case 4:
                    drawX += Width - drawWidth /*- offsetRight*/;
                    drawY += _gumpTexture[2].Height;

                    startX = drawX;
                    maxW   = drawX + drawWidth;
                    maxH   = drawY + (Height - _gumpTexture[2].Height - _gumpTexture[7].Height);


                    while (drawX < maxW)
                    {
                        if (t.Contains(Mouse.Position.X - drawX - ParentX, Mouse.Position.Y - drawY - ParentY))
                        {
                            return(true);
                        }

                        drawX += drawWidth;

                        if (drawX > maxW)
                        {
                            drawX  = startX;
                            drawY += drawHeight;

                            if (drawY > maxH)
                            {
                                break;
                            }
                        }
                    }
                    break;

                case 5:
                    drawY += Height - drawHeight;
                    if (t.Contains(Mouse.Position.X - drawX - ParentX, Mouse.Position.Y - drawY - ParentY))
                    {
                        return(true);
                    }
                    break;

                case 6:
                    drawX += _gumpTexture[5].Width;
                    drawY += Height - drawHeight /*- offsetBottom*/;

                    startX = drawX;
                    maxW   = drawX + (Width - _gumpTexture[5].Width - _gumpTexture[7].Width);
                    maxH   = drawY + drawHeight;


                    while (drawX < maxW)
                    {
                        if (t.Contains(Mouse.Position.X - drawX - ParentX, Mouse.Position.Y - drawY - ParentY))
                        {
                            return(true);
                        }

                        drawX += drawWidth;

                        if (drawX > maxW)
                        {
                            drawX  = startX;
                            drawY += drawHeight;

                            if (drawY > maxH)
                            {
                                break;
                            }
                        }
                    }
                    break;

                case 7:
                    drawX += Width - drawWidth;
                    drawY += Height - drawHeight;
                    if (t.Contains(Mouse.Position.X - drawX - ParentX, Mouse.Position.Y - drawY - ParentY))
                    {
                        return(true);
                    }
                    break;

                case 8:
                    drawX += _gumpTexture[0].Width;
                    drawY += _gumpTexture[0].Height;

                    startX = drawX;
                    maxW   = drawX + (Width - _gumpTexture[0].Width - _gumpTexture[2].Width);
                    maxH   = drawY + (Height - _gumpTexture[2].Height - _gumpTexture[7].Height);


                    while (drawX < maxW)
                    {
                        if (t.Contains(Mouse.Position.X - drawX - ParentX, Mouse.Position.Y - drawY - ParentY))
                        {
                            return(true);
                        }

                        drawX += drawWidth;

                        if (drawX > maxW)
                        {
                            drawX  = startX;
                            drawY += drawHeight;

                            if (drawY > maxH)
                            {
                                break;
                            }
                        }
                    }

                    break;
                }
            }


            return(false);
        }