Beispiel #1
0
        public ResizePic(Graphic graphic)
        {
            CanMove = true;
            CanCloseWithRightClick = true;

            for (int i = 0; i < _gumpTexture.Length; i++)
            {
                UOTexture t = UOFileManager.Gumps.GetTexture((Graphic)(graphic + i));

                if (t == null)
                {
                    Dispose();

                    return;
                }

                if (i == 4)
                {
                    _gumpTexture[8] = t;
                }
                else if (i > 4)
                {
                    _gumpTexture[i - 1] = t;
                }
                else
                {
                    _gumpTexture[i] = t;
                }
            }

            Graphic = graphic;
        }
Beispiel #2
0
        public Checkbox
        (
            ushort inactive,
            ushort active,
            string text    = "",
            byte font      = 0,
            ushort color   = 0,
            bool isunicode = true,
            int maxWidth   = 0
        )
        {
            _textures[INACTIVE] = GumpsLoader.Instance.GetTexture(inactive);
            _textures[ACTIVE]   = GumpsLoader.Instance.GetTexture(active);

            if (_textures[0] == null || _textures[1] == null)
            {
                Dispose();

                return;
            }

            UOTexture t = _textures[INACTIVE];

            Width = t.Width;

            _text  = RenderedText.Create(text, color, font, isunicode, maxWidth: maxWidth);
            Width += _text.Width;

            Height           = Math.Max(t.Width, _text.Height);
            CanMove          = false;
            AcceptMouseInput = true;
        }
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();

            UOTexture texture_flag        = GumpsLoader.Instance.GetTexture(0x0828);
            UOTexture texture_button_up   = GumpsLoader.Instance.GetTexture(0x0824);
            UOTexture texture_button_down = GumpsLoader.Instance.GetTexture(0x0825);


            if (MaxValue != MinValue && texture_flag != null)
            {
                batcher.Draw2D(texture_flag, x, (int)(y + _sliderPosition), ref HueVector);
            }

            if (_showButtons)
            {
                if (texture_button_up != null)
                {
                    batcher.Draw2D(texture_button_up, x, y, ref HueVector);
                }

                if (texture_button_down != null)
                {
                    batcher.Draw2D(texture_button_down, x, y + Height, ref HueVector);
                }
            }

            return(base.Draw(batcher, x, y));
        }
Beispiel #4
0
        private void CreateMap()
        {
            _gumpTexture = GumpsLoader.Instance.GetTexture(_useLargeMap ? (ushort)5011 : (ushort)5010);

            int index = _useLargeMap ? 1 : 0;

            if (_blankGumpsPixels[index] == null)
            {
                int    size = _gumpTexture.Width * _gumpTexture.Height;
                uint[] data = System.Buffers.ArrayPool <uint> .Shared.Rent(size);

                try
                {
                    _gumpTexture.GetData(data, 0, size);

                    _blankGumpsPixels[index]     = new uint[size];
                    _blankGumpsPixels[index + 2] = new uint[size];

                    Array.Copy(data, 0, _blankGumpsPixels[index], 0, size);
                }
                finally
                {
                    System.Buffers.ArrayPool <uint> .Shared.Return(data, true);
                }
            }

            Width  = _gumpTexture.Width;
            Height = _gumpTexture.Height;
            CreateMiniMapTexture(true);
        }
Beispiel #5
0
            public override bool Draw(UltimaBatcher2D batcher, int x, int y)
            {
                ResetHueVector();

                ShaderHueTranslator.GetHueVector
                (
                    ref HueVector,
                    0,
                    false,
                    1.0f - _alpha / 255f,
                    true
                );

                UOTexture texture = GumpsLoader.Instance.GetTexture(Graphic);

                if (texture != null)
                {
                    if (ProfileManager.CurrentProfile != null && ProfileManager.CurrentProfile.BuffBarTime)
                    {
                        batcher.Draw2D(texture, x, y, ref HueVector);

                        return(_gText.Draw(batcher, x - 3, y + texture.Height / 2 - 3, HueVector.Z));
                    }

                    return(batcher.Draw2D(texture, x, y, ref HueVector));
                }

                return(false);
            }
Beispiel #6
0
        public ScrollBar(int x, int y, int height)
        {
            Height           = height;
            Location         = new Point(x, y);
            AcceptMouseInput = true;


            _textureUpButton      = new UOTexture[2];
            _textureUpButton[0]   = GumpsLoader.Instance.GetTexture(251);
            _textureUpButton[1]   = GumpsLoader.Instance.GetTexture(250);
            _textureDownButton    = new UOTexture[2];
            _textureDownButton[0] = GumpsLoader.Instance.GetTexture(253);
            _textureDownButton[1] = GumpsLoader.Instance.GetTexture(252);
            _textureBackground    = new UOTexture[3];
            _textureBackground[0] = GumpsLoader.Instance.GetTexture(257);
            _textureBackground[1] = GumpsLoader.Instance.GetTexture(256);
            _textureBackground[2] = GumpsLoader.Instance.GetTexture(255);
            _textureSlider        = GumpsLoader.Instance.GetTexture(254);
            Width = _textureBackground[0].Width;


            _rectDownButton    = new Rectangle(0, Height - _textureDownButton[0].Height, _textureDownButton[0].Width, _textureDownButton[0].Height);
            _rectUpButton      = new Rectangle(0, 0, _textureUpButton[0].Width, _textureUpButton[0].Height);
            _rectSlider        = new Rectangle((_textureBackground[0].Width - _textureSlider.Width) >> 1, _textureUpButton[0].Height + (int)_sliderPosition, _textureSlider.Width, _textureSlider.Height);
            _emptySpace.X      = 0;
            _emptySpace.Y      = _textureUpButton[0].Height;
            _emptySpace.Width  = _textureSlider.Width;
            _emptySpace.Height = Height - (_textureDownButton[0].Height + _textureUpButton[0].Height);
        }
Beispiel #7
0
        public QuestionGump(string message, Action <bool> result) : base(0, 0)
        {
            Add(new GumpPic(0, 0, 0x0816, 0));

            UOTexture t = FileManager.Gumps.GetTexture(0x0816);

            Width  = t.Width;
            Height = t.Height;


            Add(new Label(message, false, 0x0386, 165)
            {
                X = 33, Y = 30
            });

            Add(new Button((int)Buttons.Cancel, 0x817, 0x818, 0x0819)
            {
                X = 37, Y = 75, ButtonAction = ButtonAction.Activate
            });

            Add(new Button((int)Buttons.Ok, 0x81A, 0x81B, 0x081C)
            {
                X = 100, Y = 75, ButtonAction = ButtonAction.Activate
            });
            CanMove             = false;
            ControlInfo.IsModal = true;

            X = (Engine.WindowWidth - Width) >> 1;
            Y = (Engine.WindowHeight - Height) >> 1;

            WantUpdateSize = false;
            _result        = result;
        }
Beispiel #8
0
 private void CreateMap()
 {
     _gumpTexture = GumpsLoader.Instance.GetTexture(_useLargeMap ? (ushort)5011 : (ushort)5010);
     Width        = _gumpTexture.Width;
     Height       = _gumpTexture.Height;
     CreateMiniMapTexture(true);
 }
Beispiel #9
0
        public ResizePic(ushort graphic)
        {
            CanMove = true;
            CanCloseWithRightClick = true;

            for (int i = 0; i < _gumpTexture.Length; i++)
            {
                UOTexture t = GumpsLoader.Instance.GetTexture((ushort)(graphic + i));

                if (t == null)
                {
                    return;
                }

                if (i == 4)
                {
                    _gumpTexture[8] = t;
                }
                else if (i > 4)
                {
                    _gumpTexture[i - 1] = t;
                }
                else
                {
                    _gumpTexture[i] = t;
                }
            }

            Graphic = graphic;
        }
Beispiel #10
0
        // ## BEGIN - END ## //

        protected static void DrawLand
        (
            UltimaBatcher2D batcher,
            ushort graphic,
            int x,
            int y,
            ref Rectangle rectangle,
            ref Vector3 n0,
            ref Vector3 n1,
            ref Vector3 n2,
            ref Vector3 n3,
            ref Vector3 hue
        )
        {
            UOTexture texture = TexmapsLoader.Instance.GetTexture(TileDataLoader.Instance.LandData[graphic].TexID);

            if (texture != null)
            {
                texture.Ticks = Time.Ticks;

                batcher.DrawSpriteLand(texture, x, y, ref rectangle, ref n0, ref n1, ref n2, ref n3, ref hue);
            }
            else
            {
                DrawStatic(batcher, graphic, x, y, ref hue);
            }
        }
Beispiel #11
0
        public QuestionGump(string message, Action <bool> result) : base(0, 0)
        {
            CanCloseWithRightClick = true;
            Add(new GumpPic(0, 0, 0x0816, 0));

            UOTexture t = GumpsLoader.Instance.GetTexture(0x0816);

            Width  = t.Width;
            Height = t.Height;


            Add(new Label(message, true, 1, 165)
            {
                X = 33, Y = 30
            });

            Add(new Button((int)Buttons.Cancel, 0x817, 0x818, 0x0819)
            {
                X = 37, Y = 75, ButtonAction = ButtonAction.Activate
            });

            Add(new Button((int)Buttons.Ok, 0x81A, 0x81B, 0x081C)
            {
                X = 100, Y = 75, ButtonAction = ButtonAction.Activate
            });
            CanMove             = false;
            ControlInfo.IsModal = true;

            X = (Client.Game.Window.ClientBounds.Width - Width) >> 1;
            Y = (Client.Game.Window.ClientBounds.Height - Height) >> 1;

            WantUpdateSize = false;
            _result        = result;
        }
        public ClickableColorBox(int x, int y, int w, int h, ushort hue, uint color) : base(w, h, hue, color)
        {
            X = x + 3;
            Y = y + 3;
            WantUpdateSize = false;

            _background = GumpsLoader.Instance.GetTexture(0x00D4);
        }
Beispiel #13
0
        public ClickableColorBox(int x, int y, int w, int h, ushort hue, uint color) : base(w, h, hue, color)
        {
            X = x + 3;
            Y = y + 3;
            WantUpdateSize = false;

            _background = UOFileManager.Gumps.GetTexture(0x00D4);
        }
Beispiel #14
0
        public void SetMapTexture(UOTexture texture)
        {
            _textureControl.Texture?.Dispose();
            _textureControl.WantUpdateSize = true;
            _textureControl.Texture        = texture;

            WantUpdateSize = true;
        }
Beispiel #15
0
        public Button
        (
            int buttonID,
            ushort normal,
            ushort pressed,
            ushort over      = 0,
            string caption   = "",
            byte font        = 0,
            bool isunicode   = true,
            ushort normalHue = ushort.MaxValue,
            ushort hoverHue  = ushort.MaxValue
        )
        {
            ButtonID = buttonID;
            _gumpGraphics[NORMAL]  = normal;
            _gumpGraphics[PRESSED] = pressed;
            _gumpGraphics[OVER]    = over;
            _textures[NORMAL]      = GumpsLoader.Instance.GetTexture(normal);
            _textures[PRESSED]     = GumpsLoader.Instance.GetTexture(pressed);

            if (over > 0)
            {
                _textures[OVER] = GumpsLoader.Instance.GetTexture(over);
            }

            UOTexture t = _textures[NORMAL];

            if (t == null)
            {
                Dispose();

                return;
            }

            Width    = t.Width;
            Height   = t.Height;
            FontHue  = normalHue == ushort.MaxValue ? (ushort)0 : normalHue;
            HueHover = hoverHue == ushort.MaxValue ? normalHue : hoverHue;

            if (!string.IsNullOrEmpty(caption) && normalHue != ushort.MaxValue)
            {
                _fontTexture = new RenderedText[2];

                _caption = caption;

                _fontTexture[0] = RenderedText.Create(caption, FontHue, font, isunicode);

                if (hoverHue != ushort.MaxValue)
                {
                    _fontTexture[1] = RenderedText.Create(caption, HueHover, font, isunicode);
                }
            }

            CanMove          = false;
            AcceptMouseInput = true;
            //CanCloseWithRightClick = false;
            CanCloseWithEsc = false;
        }
Beispiel #16
0
 internal GumpPicTiled(int x, int y, int width, int heigth, UOTexture texture)
 {
     CanMove          = true;
     AcceptMouseInput = true;
     X       = x;
     Y       = y;
     Width   = width;
     Height  = heigth;
     Graphic = 0xFFFF;
 }
Beispiel #17
0
 internal GumpPicTiled(int x, int y, int width, int heigth, UOTexture texture)
 {
     CanMove          = true;
     AcceptMouseInput = true;
     X       = x;
     Y       = y;
     Width   = width;
     Height  = heigth;
     Graphic = _lastGraphic = Graphic.INVALID;
     Texture = texture;
 }
Beispiel #18
0
        // ## BEGIN - END ## //
        protected static void DrawLandWF(UltimaBatcher2D batcher, ushort graphic, int x, int y, ref Vector3 hue, bool isImpassable)
        {
            UOTexture texture = ArtLoader.Instance.GetLandTextureWF(graphic, isImpassable);

            if (texture != null)
            {
                texture.Ticks = Time.Ticks;

                batcher.DrawSprite(texture, x, y, false, ref hue);
            }
        }
Beispiel #19
0
        public GumpPic(int x, int y, UOTexture texture, Hue hue)
        {
            X       = x;
            Y       = y;
            Graphic = Graphic.INVALID;

            Hue = hue;

            Texture = texture;
            Width   = Texture.Width;
            Height  = Texture.Height;
        }
        public override bool Contains(int x, int y)
        {
            UOTexture texture_flag = GumpsLoader.Instance.GetTexture(0x0828);

            if (texture_flag == null)
            {
                return(false);
            }

            y -= _sliderPosition;

            return(GumpsLoader.Instance.PixelCheck(0x0828, x, y));
        }
Beispiel #21
0
        public static void CalculateContainerPosition(ushort g)
        {
            UOTexture texture = GumpsLoader.Instance.GetTexture(g);

            int passed = 0;

            for (int i = 0; i < 4 && passed == 0; i++)
            {
                if (X + texture.Width + Constants.CONTAINER_RECT_STEP > Client.Game.Window.ClientBounds.Width)
                {
                    X = Constants.CONTAINER_RECT_DEFAULT_POSITION;

                    if (Y + texture.Height + Constants.CONTAINER_RECT_LINESTEP > Client.Game.Window.ClientBounds.Height)
                    {
                        Y = Constants.CONTAINER_RECT_DEFAULT_POSITION;
                    }
                    else
                    {
                        Y += Constants.CONTAINER_RECT_LINESTEP;
                    }
                }
                else if (Y + texture.Height + Constants.CONTAINER_RECT_STEP > Client.Game.Window.ClientBounds.Height)
                {
                    if (X + texture.Width + Constants.CONTAINER_RECT_LINESTEP > Client.Game.Window.ClientBounds.Width)
                    {
                        X = Constants.CONTAINER_RECT_DEFAULT_POSITION;
                    }
                    else
                    {
                        X += Constants.CONTAINER_RECT_LINESTEP;
                    }

                    Y = Constants.CONTAINER_RECT_DEFAULT_POSITION;
                }
                else
                {
                    passed = i + 1;
                }
            }

            if (passed == 0)
            {
                X = DefaultX;
                Y = DefaultY;
            }
            else if (passed == 1)
            {
                X += Constants.CONTAINER_RECT_STEP;
                Y += Constants.CONTAINER_RECT_STEP;
            }
        }
Beispiel #22
0
        public static void CalculateContainerPosition(Graphic g)
        {
            UOTexture texture = UOFileManager.Gumps.GetTexture(g);

            int passed = 0;

            for (int i = 0; i < 4 && passed == 0; i++)
            {
                if (X + texture.Width + Constants.CONTAINER_RECT_STEP > CUOEnviroment.Client.Window.ClientBounds.Width)
                {
                    X = Constants.CONTAINER_RECT_DEFAULT_POSITION;

                    if (Y + texture.Height + Constants.CONTAINER_RECT_LINESTEP > CUOEnviroment.Client.Window.ClientBounds.Height)
                    {
                        Y = Constants.CONTAINER_RECT_DEFAULT_POSITION;
                    }
                    else
                    {
                        Y += Constants.CONTAINER_RECT_LINESTEP;
                    }
                }
                else if (Y + texture.Height + Constants.CONTAINER_RECT_STEP > CUOEnviroment.Client.Window.ClientBounds.Height)
                {
                    if (X + texture.Width + Constants.CONTAINER_RECT_LINESTEP > CUOEnviroment.Client.Window.ClientBounds.Width)
                    {
                        X = Constants.CONTAINER_RECT_DEFAULT_POSITION;
                    }
                    else
                    {
                        X += Constants.CONTAINER_RECT_LINESTEP;
                    }

                    Y = Constants.CONTAINER_RECT_DEFAULT_POSITION;
                }
                else
                {
                    passed = i + 1;
                }
            }

            if (passed == 0)
            {
                X = DefaultX;
                Y = DefaultY;
            }
            else if (passed == 1)
            {
                X += Constants.CONTAINER_RECT_STEP;
                Y += Constants.CONTAINER_RECT_STEP;
            }
        }
Beispiel #23
0
        private void GenerateVirtualTextures()
        {
            _shopGumpParts = new UOTexture[12];
            UOTexture t = GumpsLoader.Instance.GetTexture(0x0870);

            UOTexture[][] splits = new UOTexture[4][];

            splits[0] = Utility.GraphicHelper.SplitTexture16(t,
                                                             new int[3, 4]
            {
                { 0, 0, t.Width, 64 },
                { 0, 64, t.Width, 124 },
                { 0, 124, t.Width, t.Height - 124 }
            });
            t = GumpsLoader.Instance.GetTexture(0x0871);

            splits[1] = Utility.GraphicHelper.SplitTexture16(t,
                                                             new int[3, 4]
            {
                { 0, 0, t.Width, 64 },
                { 0, 64, t.Width, 94 },
                { 0, 94, t.Width, t.Height - 94 }
            });
            t = GumpsLoader.Instance.GetTexture(0x0872);

            splits[2] = Utility.GraphicHelper.SplitTexture16(t,
                                                             new int[3, 4]
            {
                { 0, 0, t.Width, 64 },
                { 0, 64, t.Width, 124 },
                { 0, 124, t.Width, t.Height - 124 }
            });
            t = GumpsLoader.Instance.GetTexture(0x0873);

            splits[3] = Utility.GraphicHelper.SplitTexture16(t,
                                                             new int[3, 4]
            {
                { 0, 0, t.Width, 64 },
                { 0, 64, t.Width, 94 },
                { 0, 94, t.Width, t.Height - 94 }
            });

            for (int i = 0, idx = 0; i < splits.Length; i++)
            {
                for (int ii = 0; ii < splits[i].Length; ii++)
                {
                    _shopGumpParts[idx++] = splits[i][ii];
                }
            }
        }
Beispiel #24
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();
            ShaderHueTranslator.GetHueVector(ref HueVector, Hue);

            UOTexture texture = GumpsLoader.Instance.GetTexture(Graphic);

            if (texture != null)
            {
                return(batcher.Draw2DTiled(texture, x, y, Percent, Height, ref HueVector));
            }

            return(false);
        }
Beispiel #25
0
        /// <summary>
        ///     Splits a texture into an array of smaller textures of the specified size.
        /// </summary>
        /// <param name="original">The texture to be split into smaller textures</param>
        /// <param name="partXYplusWidthHeight">
        ///     We must specify here an array with size of 'parts' for the first dimension,
        ///     for each part, in the second dimension, we specify:
        ///     starting x and y, plus width and height for that specified part (4 as size in second dimension).
        /// </param>
        internal static UOTexture[] SplitTexture16(UOTexture original, int[,] partXYplusWidthHeight)
        {
            if (partXYplusWidthHeight.GetLength(0) == 0 || partXYplusWidthHeight.GetLength(1) < 4)
            {
                return(null);
            }

            UOTexture[] r       = new UOTexture[partXYplusWidthHeight.GetLength(0)];
            int         pwidth  = original.Width;  //((original.Width + 1) >> 1) << 1;
            int         pheight = original.Height; //((original.Height + 1) >> 1) << 1;

            uint[] originalData = original.Data;

            int index = 0;

            for (int p = 0; p < partXYplusWidthHeight.GetLength(0); p++)
            {
                int x      = partXYplusWidthHeight[p, 0],
                    y      = partXYplusWidthHeight[p, 1],
                    width  = partXYplusWidthHeight[p, 2],
                    height = partXYplusWidthHeight[p, 3];

                UOTexture part     = new UOTexture(width, height);
                uint[]    partData = new uint[width * height];

                for (int py = 0; py < height; py++)
                {
                    for (int px = 0; px < width; px++)
                    {
                        int partIndex = px + py * width;

                        //If a part goes outside of the source texture, then fill the overlapping part with transparent
                        if (y + py >= pheight || x + px >= pwidth)
                        {
                            partData[partIndex] = 0;
                        }
                        else
                        {
                            partData[partIndex] = originalData[x + px + (y + py) * pwidth];
                        }
                    }
                }

                part.PushData(partData);
                r[index++] = part;
            }

            return(r);
        }
Beispiel #26
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            base.Draw(batcher, x, y);

            if (ShowLock)
            {
                ResetHueVector();

                UOTexture lock_texture = GumpsLoader.Instance.GetTexture(0x082C);

                if (lock_texture != null)
                {
                    lock_texture.Ticks = Time.Ticks;

                    if (UIManager.MouseOverControl != null && (UIManager.MouseOverControl == this ||
                                                               UIManager.MouseOverControl.RootParent == this))
                    {
                        HueVector.X = 34;
                        HueVector.Y = 1;
                    }

                    batcher.Draw2D(lock_texture, x + (Width - lock_texture.Width), y, ref HueVector);
                }
            }

            ResetHueVector();

            if (_anchorCandidate != null)
            {
                Point drawLoc = UIManager.AnchorManager.GetCandidateDropLocation(this, _anchorCandidate);

                if (drawLoc != Location)
                {
                    Texture2D previewColor = SolidColorTextureCache.GetTexture(Color.Silver);
                    ResetHueVector();
                    HueVector.Z = 0.5f;
                    batcher.Draw2D(previewColor, drawLoc.X, drawLoc.Y, Width, Height, ref HueVector);

                    HueVector.Z = 0;
                    // double rectangle for thicker "stroke"
                    batcher.DrawRectangle(previewColor, drawLoc.X, drawLoc.Y, Width, Height, ref HueVector);

                    batcher.DrawRectangle
                        (previewColor, drawLoc.X + 1, drawLoc.Y + 1, Width - 2, Height - 2, ref HueVector);
                }
            }

            return(true);
        }
Beispiel #27
0
        public HSliderBar(int x, int y, int w, int min, int max, int value, HSliderBarStyle style, bool hasText = false, byte font = 0, ushort color = 0, bool unicode = true, bool drawUp = false)
        {
            X = x;
            Y = y;

            if (hasText)
            {
                _text   = RenderedText.Create(string.Empty, color, font, unicode);
                _drawUp = drawUp;
            }

            MinValue         = min;
            MaxValue         = max;
            BarWidth         = w;
            _style           = style;
            AcceptMouseInput = true;


            if (_gumpWidget == null)
            {
                switch (_style)
                {
                case HSliderBarStyle.MetalWidgetRecessedBar:

                    _gumpSpliderBackground = new UOTexture[3]
                    {
                        GumpsLoader.Instance.GetTexture(213), GumpsLoader.Instance.GetTexture(214), GumpsLoader.Instance.GetTexture(215)
                    };
                    _gumpWidget = GumpsLoader.Instance.GetTexture(216);

                    break;

                case HSliderBarStyle.BlueWidgetNoBar:
                    _gumpWidget = GumpsLoader.Instance.GetTexture(0x845);

                    break;
                }

                Width = BarWidth;
                if (_gumpWidget != null)
                {
                    Height = _gumpWidget.Height;
                }
                //RecalculateSliderX();
                CalculateOffset();
            }

            Value = value;
        }
Beispiel #28
0
        public ScrollFlag()
        {
            AcceptMouseInput = true;

            Texture = FileManager.Gumps.GetTexture(0x0828);
            Width   = Texture.Width;
            Height  = Texture.Height;

            _upButton   = FileManager.Gumps.GetTexture(0x0824);
            _downButton = FileManager.Gumps.GetTexture(0x0825);

            _rectUpButton   = new Rectangle(0, 0, _upButton.Width, _upButton.Height);
            _rectDownButton = new Rectangle(0, Height, _downButton.Width, _downButton.Height);

            WantUpdateSize = false;
        }
Beispiel #29
0
        private static bool PixelsInXY(UOTexture texture, int x, int y, int width = 0, int height = 0)
        {
            if (x < 0 || y < 0 || (width > 0 && x >= width) || (height > 0 && y >= height))
            {
                return(false);
            }

            int textureWidth  = texture.Width;
            int textureHeight = texture.Height;

            if (width == 0)
            {
                width = textureWidth;
            }

            if (height == 0)
            {
                height = textureHeight;
            }


            while (x > textureWidth && width > textureWidth)
            {
                x     -= textureWidth;
                width -= textureWidth;
            }

            if (x < 0 || x > width)
            {
                return(false);
            }

            while (y > textureHeight && height > textureHeight)
            {
                y      -= textureHeight;
                height -= textureHeight;
            }

            if (y < 0 || y > height)
            {
                return(false);
            }

            return(texture.Contains(x, y));
        }
Beispiel #30
0
        private static bool PixelsInXY(UOTexture texture, ushort graphic, int x, int y, int width = 0, int height = 0)
        {
            if (x < 0 || y < 0 || width > 0 && x >= width || height > 0 && y >= height)
            {
                return(false);
            }

            int textureWidth  = texture.Width;
            int textureHeight = texture.Height;

            if (width == 0)
            {
                width = textureWidth;
            }

            if (height == 0)
            {
                height = textureHeight;
            }


            while (x >= textureWidth && width >= textureWidth)
            {
                x     -= textureWidth;
                width -= textureWidth;
            }

            if (x < 0 || x > width)
            {
                return(false);
            }

            while (y >= textureHeight && height >= textureHeight)
            {
                y      -= textureHeight;
                height -= textureHeight;
            }

            if (y < 0 || y > height)
            {
                return(false);
            }

            return(GumpsLoader.Instance.PixelCheck(graphic, x, y));
        }