示例#1
0
            public override bool Draw(UltimaBatcher2D batcher, int x, int y)
            {
                ResetHueVector();

                ShaderHuesTraslator.GetHueVector(ref _hueVector, 0, false, Alpha, true);

                int middleWidth = Width - _gumpTexture[0].Width - _gumpTexture[2].Width;

                batcher.Draw2D(_gumpTexture[0], x, y, ref _hueVector);
                batcher.Draw2DTiled(_gumpTexture[1], x + _gumpTexture[0].Width, y, middleWidth, _gumpTexture[1].Height, ref _hueVector);
                batcher.Draw2D(_gumpTexture[2], x + Width - _gumpTexture[2].Width, y, ref _hueVector);

                return(base.Draw(batcher, x, y));
            }
示例#2
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();
            ShaderHueTranslator.GetHueVector(ref _hueVector, Hue);

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

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

            return(false);
        }
示例#3
0
            public override bool Draw(UltimaBatcher2D batcher, int x, int y)
            {
                ResetHueVector();

                if (_tiled)
                {
                    batcher.Draw2DTiled(_texture, x, y, Width, Height, ref HueVector);
                }
                else
                {
                    batcher.Draw2D(_texture, x, y, Width, Height, ref HueVector);
                }

                return(base.Draw(batcher, x, y));
            }
示例#4
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();

            int centerWidth  = Width - _frame[0].Width - _frame[2].Width;
            int centerHeight = Height - _frame[0].Height - _frame[6].Height;
            int line2Y       = y + _frame[0].Height;
            int line3Y       = y + Height - _frame[6].Height;

            // top row
            batcher.Draw2D(_frame[0], x, y, ref _hueVector);
            batcher.Draw2DTiled(_frame[1], x + _frame[0].Width, y, centerWidth, _frame[0].Height, ref _hueVector);
            batcher.Draw2D(_frame[2], x + Width - _frame[2].Width, y, ref _hueVector);
            // middle
            batcher.Draw2DTiled(_frame[3], x, line2Y, _frame[3].Width, centerHeight, ref _hueVector);
            batcher.Draw2DTiled(_frame[4], x + _frame[3].Width, line2Y, centerWidth, centerHeight, ref _hueVector);
            batcher.Draw2DTiled(_frame[5], x + Width - _frame[5].Width, line2Y, _frame[5].Width, centerHeight, ref _hueVector);
            // bottom
            batcher.Draw2D(_frame[6], x, line3Y, ref _hueVector);
            batcher.Draw2DTiled(_frame[7], x + _frame[6].Width, line3Y, centerWidth, _frame[6].Height, ref _hueVector);
            batcher.Draw2D(_frame[8], x + Width - _frame[8].Width, line3Y, ref _hueVector);

            return(base.Draw(batcher, x, y));
        }
示例#5
0
        private void DrawInternal(UltimaBatcher2D batcher, int x, int y, ref Vector3 color)
        {
            int offsetTop    = Math.Max(_gumpTexture[0].Height, _gumpTexture[2].Height) - _gumpTexture[1].Height;
            int offsetBottom = Math.Max(_gumpTexture[5].Height, _gumpTexture[7].Height) - _gumpTexture[6].Height;
            int offsetLeft   = Math.Max(_gumpTexture[0].Width, _gumpTexture[5].Width) - _gumpTexture[3].Width;
            int offsetRight  = Math.Max(_gumpTexture[2].Width, _gumpTexture[7].Width) - _gumpTexture[4].Width;

            for (int i = 0; i < 9; i++)
            {
                UOTexture t          = _gumpTexture[i];
                int       drawWidth  = t.Width;
                int       drawHeight = t.Height;
                int       drawX      = x;
                int       drawY      = y;

                switch (i)
                {
                case 0:

                    batcher.Draw2D(t, drawX, drawY, drawWidth, drawHeight, ref color);
                    break;

                case 1:
                    drawX    += _gumpTexture[0].Width;
                    drawWidth = Width - _gumpTexture[0].Width - _gumpTexture[2].Width;
                    batcher.Draw2DTiled(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 2:
                    drawX += Width - drawWidth;
                    drawY += offsetTop;
                    batcher.Draw2D(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 3:
                    drawX     += offsetLeft;
                    drawY     += _gumpTexture[0].Height;
                    drawHeight = Height - _gumpTexture[0].Height - _gumpTexture[5].Height;
                    batcher.Draw2DTiled(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 4:
                    drawX     += Width - drawWidth - offsetRight;
                    drawY     += _gumpTexture[2].Height;
                    drawHeight = Height - _gumpTexture[2].Height - _gumpTexture[7].Height;
                    batcher.Draw2DTiled(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 5:
                    drawY += Height - drawHeight;
                    batcher.Draw2D(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 6:
                    drawX    += _gumpTexture[5].Width;
                    drawY    += Height - drawHeight - offsetBottom;
                    drawWidth = Width - _gumpTexture[5].Width - _gumpTexture[7].Width;
                    batcher.Draw2DTiled(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 7:
                    drawX += Width - drawWidth;
                    drawY += Height - drawHeight;
                    batcher.Draw2D(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 8:
                    drawX     += _gumpTexture[0].Width;
                    drawY     += _gumpTexture[0].Height;
                    drawWidth  = Width - _gumpTexture[0].Width - _gumpTexture[2].Width;
                    drawHeight = Height - _gumpTexture[2].Height - _gumpTexture[7].Height;

                    if (OnlyCenterTransparent)
                    {
                        color.Z = 1;
                    }

                    batcher.Draw2DTiled(t, drawX, drawY, drawWidth, drawHeight, ref color);

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

            ResetHueVector();

            // draw scrollbar background
            int middleHeight = Height - _textureUpButton[0]
                               .Height - _textureDownButton[0]
                               .Height - _textureBackground[0]
                               .Height - _textureBackground[2]
                               .Height;

            if (middleHeight > 0)
            {
                batcher.Draw2D
                (
                    _textureBackground[0], x, y + _textureUpButton[0]
                    .Height, ref _hueVector
                );

                batcher.Draw2DTiled
                (
                    _textureBackground[1], x, y + _textureUpButton[0]
                    .Height + _textureBackground[0]
                    .Height, _textureBackground[0]
                    .Width, middleHeight, ref _hueVector
                );

                batcher.Draw2D
                (
                    _textureBackground[2], x, y + Height - _textureDownButton[0]
                    .Height - _textureBackground[2]
                    .Height, ref _hueVector
                );
            }
            else
            {
                middleHeight = Height - _textureUpButton[0]
                               .Height - _textureDownButton[0]
                               .Height;

                batcher.Draw2DTiled
                (
                    _textureBackground[1], x, y + _textureUpButton[0]
                    .Height, _textureBackground[0]
                    .Width, middleHeight, ref _hueVector
                );
            }

            // draw up button
            batcher.Draw2D(_btUpClicked ? _textureUpButton[1] : _textureUpButton[0], x, y, ref _hueVector);

            // draw down button
            batcher.Draw2D
            (
                _btDownClicked ? _textureDownButton[1] : _textureDownButton[0], x, y + Height - _textureDownButton[0]
                .Height, ref _hueVector
            );

            // draw slider
            if (MaxValue > MinValue && middleHeight > 0)
            {
                batcher.Draw2D
                (
                    _textureSlider, x + ((_textureBackground[0]
                                          .Width - _textureSlider.Width) >> 1), y + _textureUpButton[0]
                    .Height + _sliderPosition, ref _hueVector
                );
            }

            return(base.Draw(batcher, x, y));
        }
示例#7
0
        private void DrawInternal(UltimaBatcher2D batcher, int x, int y, ref Vector3 color)
        {
            int th_0_width = _gumpTexture[0]?.Width ?? 0;

            int th_0_height = _gumpTexture[0]?.Height ?? 0;

            int th_1_width = _gumpTexture[1]?.Width ?? 0;

            int th_1_height = _gumpTexture[1]?.Height ?? 0;

            int th_2_width = _gumpTexture[2]?.Width ?? 0;

            int th_2_height = _gumpTexture[2]?.Height ?? 0;

            int th_3_width = _gumpTexture[3]?.Width ?? 0;

            int th_3_height = _gumpTexture[3]?.Height ?? 0;

            int th_4_width = _gumpTexture[4]?.Width ?? 0;

            int th_4_height = _gumpTexture[4]?.Height ?? 0;

            int th_5_width = _gumpTexture[5]?.Width ?? 0;

            int th_5_height = _gumpTexture[5]?.Height ?? 0;

            int th_6_width = _gumpTexture[6]?.Width ?? 0;

            int th_6_height = _gumpTexture[6]?.Height ?? 0;

            int th_7_width = _gumpTexture[7]?.Width ?? 0;

            int th_7_height = _gumpTexture[7]?.Height ?? 0;

            int th_8_width = _gumpTexture[8]?.Width ?? 0;

            int th_8_height = _gumpTexture[8]?.Height ?? 0;


            int offsetTop    = Math.Max(th_0_height, th_2_height) - th_1_height;
            int offsetBottom = Math.Max(th_5_height, th_7_height) - th_6_height;
            int offsetLeft   = Math.Max(th_0_width, th_5_width) - th_2_width;
            int offsetRight  = Math.Max(th_2_width, th_7_width) - th_4_width;


            for (int i = 0; i < 9; i++)
            {
                UOTexture t = _gumpTexture[i];

                if (t == null)
                {
                    continue;
                }

                int drawWidth  = t.Width;
                int drawHeight = t.Height;
                int drawX      = x;
                int drawY      = y;

                switch (i)
                {
                case 0:

                    batcher.Draw2D
                    (
                        t,
                        drawX,
                        drawY,
                        drawWidth,
                        drawHeight,
                        ref color
                    );

                    break;

                case 1:
                    drawX    += th_0_width;
                    drawWidth = Width - th_0_width - th_2_width;

                    batcher.Draw2DTiled
                    (
                        t,
                        drawX,
                        drawY,
                        drawWidth,
                        drawHeight,
                        ref color
                    );

                    break;

                case 2:
                    drawX += Width - drawWidth;
                    drawY += offsetTop;

                    batcher.Draw2D
                    (
                        t,
                        drawX,
                        drawY,
                        drawWidth,
                        drawHeight,
                        ref color
                    );

                    break;

                case 3:
                    drawX     += offsetLeft;
                    drawY     += th_0_height;
                    drawHeight = Height - th_0_height - th_5_height;

                    batcher.Draw2DTiled
                    (
                        t,
                        drawX,
                        drawY,
                        drawWidth,
                        drawHeight,
                        ref color
                    );

                    break;

                case 4:
                    drawX     += Width - drawWidth - offsetRight;
                    drawY     += th_2_height;
                    drawHeight = Height - th_2_height - th_7_height;

                    batcher.Draw2DTiled
                    (
                        t,
                        drawX,
                        drawY,
                        drawWidth,
                        drawHeight,
                        ref color
                    );

                    break;

                case 5:
                    drawY += Height - drawHeight;

                    batcher.Draw2D
                    (
                        t,
                        drawX,
                        drawY,
                        drawWidth,
                        drawHeight,
                        ref color
                    );

                    break;

                case 6:
                    drawX    += th_5_width;
                    drawY    += Height - drawHeight - offsetBottom;
                    drawWidth = Width - th_5_width - th_7_width;

                    batcher.Draw2DTiled
                    (
                        t,
                        drawX,
                        drawY,
                        drawWidth,
                        drawHeight,
                        ref color
                    );

                    break;

                case 7:
                    drawX += Width - drawWidth;
                    drawY += Height - drawHeight;

                    batcher.Draw2D
                    (
                        t,
                        drawX,
                        drawY,
                        drawWidth,
                        drawHeight,
                        ref color
                    );

                    break;

                case 8:
                    drawX     += th_0_width;
                    drawY     += th_0_height;
                    drawWidth  = Width - th_0_width - th_2_width;
                    drawHeight = Height - th_2_height - th_7_height;

                    batcher.Draw2DTiled
                    (
                        t,
                        drawX,
                        drawY,
                        drawWidth,
                        drawHeight,
                        ref color
                    );

                    break;
                }
            }
        }
示例#8
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 : 0.0f;

            _vectorHue.X = mobile != null?Notoriety.GetHue(mobile.NotorietyFlag) : Notoriety.GetHue(NotorietyFlag.Gray);

            _vectorHue.Y = 1;
            _vectorHue.Z = alpha;

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


            const int MULTIPLER = 1;

            batcher.Draw2D(_background_texture,
                           x, y,
                           _background_texture.Width * MULTIPLER,
                           _background_texture.Height * MULTIPLER,
                           ref _vectorHue);


            _vectorHue.X = 0x21;



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

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

                batcher.Draw2DTiled(_hp_texture,
                                    x + per * MULTIPLER - offset, y,
                                    (BAR_WIDTH - per) * MULTIPLER - offset / 2,
                                    _hp_texture.Height * MULTIPLER,
                                    ref _vectorHue);
            }

            ushort hue = 90;

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

                _vectorHue.X = hue;


                batcher.Draw2DTiled(_hp_texture,
                                    x, y,
                                    per * MULTIPLER,
                                    _hp_texture.Height * MULTIPLER,
                                    ref _vectorHue);
            }
        }
示例#9
0
        private void DrawHealthLine(UltimaBatcher2D batcher, Mobile mobile, int x, int y, bool passive)
        {
            if (mobile == null)
            {
                return;
            }

            int per = mobile.HitsMax;

            if (per > 0)
            {
                per = mobile.Hits * 100 / per;

                if (per > 100)
                {
                    per = 100;
                }

                if (per < 1)
                {
                    per = 0;
                }
                else
                {
                    per = 34 * per / 100;
                }
            }

            _vectorHue.X = 0;
            _vectorHue.Y = 0;
            _vectorHue.Z = 0;

            float alpha = passive ? 0.5f : 0.0f;

            ShaderHuesTraslator.GetHueVector(ref _vectorHue, Notoriety.GetHue(mobile.NotorietyFlag), false, alpha);

            batcher.Draw2D(_background_texture,
                           x, y,
                           _background_texture.Width,
                           _background_texture.Height,
                           ref _vectorHue);

            _vectorHue.X = 0;
            _vectorHue.Y = 0;
            _vectorHue.Z = 0;

            ushort hue = 23;

            alpha = passive ? 0.5f : 0.0f;

            ShaderHuesTraslator.GetHueVector(ref _vectorHue, hue, false, alpha);

            batcher.Draw2DTiled(_hp_texture,
                                x, y,
                                BAR_WIDTH,
                                _hp_texture.Height,
                                ref _vectorHue);

            _vectorHue.X = 0;
            _vectorHue.Y = 0;
            _vectorHue.Z = 0;


            if (mobile.IsPoisoned)
            {
                hue = 63;
            }
            else if (mobile.IsYellowHits)
            {
                hue = 53;
            }
            else
            {
                hue = 90;
            }

            ShaderHuesTraslator.GetHueVector(ref _vectorHue, hue, false, alpha);

            batcher.Draw2DTiled(_hp_texture,
                                x, y,
                                per,
                                _hp_texture.Height,
                                ref _vectorHue);
        }
示例#10
0
        private void DrawInternal(UltimaBatcher2D batcher, int x, int y, Vector3 color)
        {
            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:
                    batcher.Draw2D(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 1:
                    drawX    += _gumpTexture[0].Width;
                    drawWidth = Width - _gumpTexture[0].Width - _gumpTexture[2].Width;
                    batcher.Draw2DTiled(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 2:
                    drawX += Width - drawWidth;
                    batcher.Draw2D(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 3:
                    drawY     += _gumpTexture[0].Height;
                    drawHeight = Height - _gumpTexture[0].Height - _gumpTexture[5].Height;
                    batcher.Draw2DTiled(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 4:
                    drawX     += Width - drawWidth /*- offsetRight*/;
                    drawY     += _gumpTexture[2].Height;
                    drawHeight = Height - _gumpTexture[2].Height - _gumpTexture[7].Height;
                    batcher.Draw2DTiled(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 5:
                    drawY += Height - drawHeight;
                    batcher.Draw2D(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 6:
                    drawX    += _gumpTexture[5].Width;
                    drawY    += Height - drawHeight /*- offsetBottom*/;
                    drawWidth = Width - _gumpTexture[5].Width - _gumpTexture[7].Width;
                    batcher.Draw2DTiled(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 7:
                    drawX += Width - drawWidth;
                    drawY += Height - drawHeight;
                    batcher.Draw2D(t, drawX, drawY, drawWidth, drawHeight, ref color);

                    break;

                case 8:
                    drawX     += _gumpTexture[0].Width;
                    drawY     += _gumpTexture[0].Height;
                    drawWidth  = Width - _gumpTexture[0].Width - _gumpTexture[2].Width;
                    drawHeight = Height - _gumpTexture[2].Height - _gumpTexture[7].Height;

                    //if (!OnlyCenterTransparent)
                    Vector3 c = color;

                    if (OnlyCenterTransparent)
                    {
                        c.Z = 1;
                    }

                    batcher.Draw2DTiled(t, drawX, drawY, drawWidth, drawHeight, ref c);

                    break;
                }
            }
        }