示例#1
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            Vector3 hueVector = ShaderHueTranslator.GetHueVector(Hue);

            var texture = GumpsLoader.Instance.GetGumpTexture(Graphic, out var bounds);

            if (texture != null)
            {
                batcher.DrawTiled
                (
                    texture,
                    new Rectangle
                    (
                        x,
                        y,
                        Percent,
                        Height
                    ),
                    bounds,
                    hueVector
                );

                return(true);
            }

            return(false);
        }
示例#2
0
            public override bool Draw(UltimaBatcher2D batcher, int x, int y)
            {
                var texture = GumpsLoader.Instance.GetGumpTexture(_graphic, out var bounds);

                Vector3 hueVector = ShaderHueTranslator.GetHueVector(0);

                if (_tiled)
                {
                    batcher.DrawTiled
                    (
                        texture,
                        new Rectangle
                        (
                            x,
                            y,
                            Width,
                            Height
                        ),
                        new Rectangle
                        (
                            bounds.X + _rect.X,
                            bounds.Y + _rect.Y,
                            _rect.Width,
                            _rect.Height
                        ),
                        hueVector
                    );
                }
                else
                {
                    batcher.Draw
                    (
                        texture,
                        new Rectangle
                        (
                            x,
                            y,
                            Width,
                            Height
                        ),
                        new Rectangle
                        (
                            bounds.X + _rect.X,
                            bounds.Y + _rect.Y,
                            _rect.Width,
                            _rect.Height
                        ),
                        hueVector
                    );
                }

                return(base.Draw(batcher, x, y));
            }
示例#3
0
            public override bool Draw(UltimaBatcher2D batcher, int x, int y)
            {
                var texture0 = GumpsLoader.Instance.GetGumpTexture((ushort)(_graphic + 0), out var bounds0);
                var texture1 = GumpsLoader.Instance.GetGumpTexture((ushort)(_graphic + 1), out var bounds1);
                var texture2 = GumpsLoader.Instance.GetGumpTexture((ushort)(_graphic + 2), out var bounds2);

                Vector3 hueVector = ShaderHueTranslator.GetHueVector
                                    (
                    0,
                    false,
                    Alpha,
                    true
                                    );

                int middleWidth = Width - bounds0.Width - bounds2.Width;

                batcher.Draw
                (
                    texture0,
                    new Vector2(x, y),
                    bounds0,
                    hueVector
                );

                batcher.DrawTiled
                (
                    texture1,
                    new Rectangle
                    (
                        x + bounds0.Width,
                        y,
                        middleWidth,
                        bounds1.Height
                    ),
                    bounds1,
                    hueVector
                );

                batcher.Draw
                (
                    texture2,
                    new Vector2(x + Width - bounds2.Width, y),
                    bounds2,
                    hueVector
                );

                return(base.Draw(batcher, x, y));
            }
示例#4
0
        private void DrawHealthLine(UltimaBatcher2D batcher, Entity entity, int x, int y, bool passive)
        {
            if (entity == null)
            {
                return;
            }

            int per = BAR_WIDTH * entity.HitsPercentage / 100;

            Mobile mobile = entity as Mobile;


            float  alpha = passive ? 0.5f : 1.0f;
            ushort hue   = mobile != null?Notoriety.GetHue(mobile.NotorietyFlag) : Notoriety.GetHue(NotorietyFlag.Gray);

            Vector3 hueVec = ShaderHueTranslator.GetHueVector(hue, false, alpha);

            if (mobile == null)
            {
                y += 22;
            }


            const int MULTIPLER = 1;

            var texture = GumpsLoader.Instance.GetGumpTexture(BACKGROUND_GRAPHIC, out var bounds);


            batcher.Draw
            (
                texture,
                new Rectangle
                (
                    x,
                    y,
                    bounds.Width * MULTIPLER,
                    bounds.Height * MULTIPLER
                ),
                bounds,
                hueVec
            );


            hueVec.X = 0x21;


            if (entity.Hits != entity.HitsMax || entity.HitsMax == 0)
            {
                int offset = 2;

                if (per >> 2 == 0)
                {
                    offset = per;
                }

                texture = GumpsLoader.Instance.GetGumpTexture(HP_GRAPHIC, out bounds);

                batcher.DrawTiled
                (
                    texture,
                    new Rectangle
                    (
                        x + per * MULTIPLER - offset,
                        y,
                        (BAR_WIDTH - per) * MULTIPLER - offset / 2,
                        bounds.Height * MULTIPLER
                    ),
                    bounds,
                    hueVec
                );
            }

            hue = 90;

            if (per > 0)
            {
                if (mobile != null)
                {
                    if (mobile.IsPoisoned)
                    {
                        hue = 63;
                    }
                    else if (mobile.IsYellowHits)
                    {
                        hue = 53;
                    }
                }

                hueVec.X = hue;

                texture = GumpsLoader.Instance.GetGumpTexture(HP_GRAPHIC, out bounds);

                batcher.DrawTiled
                (
                    texture,
                    new Rectangle
                    (
                        x,
                        y,
                        per * MULTIPLER,
                        bounds.Height * MULTIPLER
                    ),
                    bounds,
                    hueVec
                );
            }
        }
示例#5
0
        private void DrawInternal(UltimaBatcher2D batcher, int x, int y, Vector3 color)
        {
            var texture0 = GetTexture(0, out var bounds0);
            var texture1 = GetTexture(1, out var bounds1);
            var texture2 = GetTexture(2, out var bounds2);
            var texture3 = GetTexture(3, out var bounds3);
            var texture4 = GetTexture(4, out var bounds4);
            var texture5 = GetTexture(5, out var bounds5);
            var texture6 = GetTexture(6, out var bounds6);
            var texture7 = GetTexture(7, out var bounds7);
            var texture8 = GetTexture(8, out var bounds8);

            int offsetTop    = Math.Max(bounds0.Height, bounds2.Height) - bounds1.Height;
            int offsetBottom = Math.Max(bounds5.Height, bounds7.Height) - bounds6.Height;
            int offsetLeft   = Math.Abs(Math.Max(bounds0.Width, bounds5.Width) - bounds2.Width);
            int offsetRight  = Math.Max(bounds2.Width, bounds7.Width) - bounds4.Width;



            if (texture0 != null)
            {
                batcher.Draw
                (
                    texture0,
                    new Vector2(x, y),
                    bounds0,
                    color
                );
            }

            if (texture1 != null)
            {
                batcher.DrawTiled
                (
                    texture1,
                    new Rectangle
                    (
                        x + bounds0.Width,
                        y,
                        Width - bounds0.Width - bounds2.Width,
                        bounds1.Height
                    ),
                    bounds1,
                    color
                );
            }

            if (texture2 != null)
            {
                batcher.Draw
                (
                    texture2,
                    new Vector2(x + (Width - bounds2.Width), y + offsetTop),
                    bounds2,
                    color
                );
            }

            if (texture3 != null)
            {
                batcher.DrawTiled
                (
                    texture3,
                    new Rectangle
                    (
                        x,
                        y + bounds0.Height,
                        bounds3.Width,
                        Height - bounds0.Height - bounds5.Height
                    ),
                    bounds3,
                    color
                );
            }

            if (texture4 != null)
            {
                batcher.DrawTiled
                (
                    texture4,
                    new Rectangle
                    (
                        x + (Width - bounds4.Width),
                        y + bounds2.Height,
                        bounds4.Width,
                        Height - bounds2.Height - bounds7.Height
                    ),
                    bounds4,
                    color
                );
            }

            if (texture5 != null)
            {
                batcher.Draw
                (
                    texture5,
                    new Vector2(x, y + (Height - bounds5.Height)),
                    bounds5,
                    color
                );
            }

            if (texture6 != null)
            {
                batcher.DrawTiled
                (
                    texture6,
                    new Rectangle
                    (
                        x + bounds5.Width,
                        y + (Height - bounds6.Height - offsetBottom),
                        Width - bounds5.Width - bounds7.Width,
                        bounds6.Height
                    ),
                    bounds6,
                    color
                );
            }

            if (texture7 != null)
            {
                batcher.Draw
                (
                    texture7,
                    new Vector2(x + (Width - bounds7.Width), y + (Height - bounds7.Height)),
                    bounds7,
                    color
                );
            }

            if (texture8 != null)
            {
                batcher.DrawTiled
                (
                    texture8,
                    new Rectangle
                    (
                        x + bounds0.Width,
                        y + bounds0.Height,
                        (Width - bounds0.Width - bounds2.Width) + (offsetLeft + offsetRight),
                        Height - bounds2.Height - bounds7.Height
                    ),
                    bounds8,
                    color
                );
            }
        }
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            Vector3 hueVector = ShaderHueTranslator.GetHueVector(0);

            if (Hue != 0)
            {
                hueVector.X = Hue;
                hueVector.Y = 1;
            }

            var texture = GumpsLoader.Instance.GetGumpTexture(H_BORDER, out var bounds);

            // sopra
            batcher.DrawTiled
            (
                texture,
                new Rectangle
                (
                    x,
                    y,
                    Width,
                    _borderSize
                ),
                bounds,
                hueVector
            );

            // sotto
            batcher.DrawTiled
            (
                texture,
                new Rectangle
                (
                    x,
                    y + Height - _borderSize,
                    Width,
                    _borderSize
                ),
                bounds,
                hueVector
            );

            texture = GumpsLoader.Instance.GetGumpTexture(V_BORDER, out bounds);

            //sx
            batcher.DrawTiled
            (
                texture,
                new Rectangle
                (
                    x,
                    y,
                    _borderSize,
                    Height
                ),
                bounds,
                hueVector
            );

            //dx
            batcher.DrawTiled
            (
                texture,
                new Rectangle
                (
                    x + Width - _borderSize,
                    y + (bounds.Width >> 1),
                    _borderSize,
                    Height - _borderSize
                ),
                bounds,
                hueVector
            );

            return(base.Draw(batcher, x, y));
        }
示例#7
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (Height <= 0 || !IsVisible)
            {
                return(false);
            }

            Vector3 hueVector = ShaderHueTranslator.GetHueVector(0);

            var textureUp0         = GumpsLoader.Instance.GetGumpTexture(BUTTON_UP_0, out var boundsUp0);
            var textureUp1         = GumpsLoader.Instance.GetGumpTexture(BUTTON_UP_1, out var boundsUp1);
            var textureDown0       = GumpsLoader.Instance.GetGumpTexture(BUTTON_DOWN_0, out var boundsDown0);
            var textureDown1       = GumpsLoader.Instance.GetGumpTexture(BUTTON_DOWN_1, out var boundsDown1);
            var textureBackground0 = GumpsLoader.Instance.GetGumpTexture(BACKGROUND_0, out var boundsBackground0);
            var textureBackground1 = GumpsLoader.Instance.GetGumpTexture(BACKGROUND_1, out var boundsBackground1);
            var textureBackground2 = GumpsLoader.Instance.GetGumpTexture(BACKGROUND_2, out var boundsBackground2);
            var textureSlider      = GumpsLoader.Instance.GetGumpTexture(SLIDER, out var boundsSlider);

            // draw scrollbar background
            int middleHeight = Height - boundsUp0.Height - boundsDown0.Height - boundsBackground0.Height - boundsBackground2.Height;

            if (middleHeight > 0)
            {
                batcher.Draw
                (
                    textureBackground0,
                    new Vector2(x, y + boundsUp0.Height),
                    boundsBackground0,
                    hueVector
                );

                batcher.DrawTiled
                (
                    textureBackground1,
                    new Rectangle
                    (
                        x,
                        y + boundsUp1.Height + boundsBackground0.Height,
                        boundsBackground0.Width,
                        middleHeight
                    ),
                    boundsBackground1,
                    hueVector
                );

                batcher.Draw
                (
                    textureBackground2,
                    new Vector2(x, y + Height - boundsDown0.Height - boundsBackground2.Height),
                    boundsBackground2,
                    hueVector
                );
            }
            else
            {
                middleHeight = Height - boundsUp0.Height - boundsDown0.Height;

                batcher.DrawTiled
                (
                    textureBackground1,
                    new Rectangle
                    (
                        x,
                        y + boundsUp0.Height,
                        boundsBackground0.Width,
                        middleHeight
                    ),
                    boundsBackground1,
                    hueVector
                );
            }

            // draw up button
            if (_btUpClicked)
            {
                batcher.Draw
                (
                    textureUp1,
                    new Vector2(x, y),
                    boundsUp1,
                    hueVector
                );
            }
            else
            {
                batcher.Draw
                (
                    textureUp0,
                    new Vector2(x, y),
                    boundsUp0,
                    hueVector
                );
            }

            // draw down button
            if (_btDownClicked)
            {
                batcher.Draw
                (
                    textureDown1,
                    new Vector2(x, y + Height - boundsDown0.Height),
                    boundsDown1,
                    hueVector
                );
            }
            else
            {
                batcher.Draw
                (
                    textureDown0,
                    new Vector2(x, y + Height - boundsDown0.Height),
                    boundsDown0,
                    hueVector
                );
            }

            // draw slider
            if (MaxValue > MinValue && middleHeight > 0)
            {
                batcher.Draw
                (
                    textureSlider,
                    new Vector2
                    (
                        x + ((boundsBackground0.Width - boundsSlider.Width) >> 1),
                        y + boundsUp0.Height + _sliderPosition
                    ),
                    boundsSlider,
                    hueVector
                );
            }

            return(base.Draw(batcher, x, y));
        }