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

            batcher.DrawRectangle
            (
                SolidColorTextureCache.GetTexture(Color.Gray),
                x - 1,
                y - 1,
                _background.Width + 1,
                _background.Height + 1,
                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);

            return(batcher.Draw2D
                   (
                       SolidColorTextureCache.GetTexture(Color.White),
                       x,
                       y,
                       Width,
                       Height,
                       ref HueVector
                   ));
        }
コード例 #3
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (_gumpTexture == null || _gumpTexture.IsDisposed || IsDisposed)
            {
                return(false);
            }

            ResetHueVector();

            batcher.Draw2D(_gumpTexture, x, y, ref HueVector);
            CreateMiniMapTexture();
            batcher.Draw2D(_mapTexture, x, y, ref HueVector);

            if (_draw)
            {
                int w = Width >> 1;
                int h = Height >> 1;

                Texture2D mobilesTextureDot = SolidColorTextureCache.GetTexture(Color.Red);

                foreach (Mobile mob in World.Mobiles)
                {
                    if (mob == World.Player)
                    {
                        continue;
                    }

                    int xx = mob.X - World.Player.X;
                    int yy = mob.Y - World.Player.Y;

                    int gx = xx - yy;
                    int gy = xx + yy;

                    HueVector.Z = 0;

                    ShaderHueTranslator.GetHueVector(ref HueVector, Notoriety.GetHue(mob.NotorietyFlag));

                    batcher.Draw2D(mobilesTextureDot, x + w + gx, y + h + gy, 2, 2, ref HueVector);
                }

                //DRAW DOT OF PLAYER
                ResetHueVector();
                batcher.Draw2D(SolidColorTextureCache.GetTexture(Color.White), x + w, y + h, 2, 2, ref HueVector);
            }

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


                Texture2D color = SolidColorTextureCache.GetTexture
                                  (
                    MouseIsOver ? Color.Yellow :
                    ProfileManager.CurrentProfile.CounterBarHighlightOnAmount &&
                    _amount < ProfileManager.CurrentProfile.CounterBarHighlightAmount && Graphic != 0 ? Color.Red : Color.Gray
                                  );

                ResetHueVector();
                batcher.DrawRectangle(color, x, y, Width, Height, ref HueVector);

                return(true);
            }
コード例 #5
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (DrawBackgroundCurrentIndex && MouseIsOver && !string.IsNullOrWhiteSpace(Text))
            {
                ResetHueVector();

                batcher.Draw2D
                (
                    SolidColorTextureCache.GetTexture(Color.Gray),
                    x,
                    y + 2,
                    Width - 4,
                    Height - 4,
                    ref HueVector
                );
            }

            return(base.Draw(batcher, x, y));
        }
コード例 #6
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            Vector3 hueVector = ShaderHueTranslator.GetHueVector(Hue, false, Alpha);

            batcher.Draw
            (
                SolidColorTextureCache.GetTexture(Color.Black),
                new Rectangle
                (
                    x,
                    y,
                    Width,
                    Height
                ),
                hueVector
            );

            return(true);
        }
コード例 #7
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            //batcher.SetBlendState(_checkerBlend.Value);
            //batcher.SetStencil(_checkerStencil.Value);

            //batcher.Draw2D(TransparentTexture, new Rectangle(position.X, position.Y, Width, Height), Vector3.Zero /*ShaderHueTranslator.GetHueVector(0, false, 0.5f, false)*/);

            //batcher.SetBlendState(null);
            //batcher.SetStencil(null);

            //return true;

            ResetHueVector();
            HueVector.Z = 0.5f;
            //batcher.SetStencil(_checkerStencil.Value);
            batcher.Draw2D(SolidColorTextureCache.GetTexture(Color.Black), x, y, Width, Height, ref HueVector);

            //batcher.SetStencil(null);
            return(true);
        }
コード例 #8
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            base.Draw(batcher, x, y);

            Vector3 hueVector = ShaderHueTranslator.GetHueVector(0);

            batcher.Draw
            (
                _mapTexture,
                new Rectangle(x + _hit.X, y + _hit.Y, _hit.Width, _hit.Height),
                hueVector
            );

            var texture = SolidColorTextureCache.GetTexture(Color.White);

            for (int i = 0; i < _container.Count; i++)
            {
                // HACK: redraw because pins are drawn when calling base.Draw(batcher, x, y);
                _container[i].Draw(batcher, x + _container[i].X, y + _container[i].Y);

                if (i + 1 >= _container.Count)
                {
                    break;
                }

                Control c0 = _container[i];
                Control c1 = _container[i + 1];

                batcher.DrawLine
                (
                    texture,
                    new Vector2(c0.ScreenCoordinateX, c0.ScreenCoordinateY),
                    new Vector2(c1.ScreenCoordinateX, c1.ScreenCoordinateY),
                    hueVector,
                    1
                );
            }

            return(true);
        }
コード例 #9
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (DrawBackgroundCurrentIndex && MouseIsOver && !string.IsNullOrWhiteSpace(Text))
            {
                Vector3 hueVector = ShaderHueTranslator.GetHueVector(0);

                batcher.Draw
                (
                    SolidColorTextureCache.GetTexture(Color.Gray),
                    new Rectangle
                    (
                        x,
                        y + 2,
                        Width - 4,
                        Height - 4
                    ),
                    hueVector
                );
            }

            return(base.Draw(batcher, x, y));
        }
コード例 #10
0
            public override bool Draw(UltimaBatcher2D batcher, int x, int y)
            {
                if (!string.IsNullOrWhiteSpace(_label.Text) && MouseIsOver)
                {
                    ResetHueVector();

                    batcher.Draw2D
                        (SolidColorTextureCache.GetTexture(Color.Gray), x + 2, y + 5, Width - 4, Height - 10, ref HueVector);
                }

                base.Draw(batcher, x, y);

                if (_entry.Items != null && _entry.Items.Count != 0)
                {
                    _moreMenuLabel.Draw
                    (
                        batcher, x + Width - _moreMenuLabel.Width, y + (Height >> 1) - (_moreMenuLabel.Height >> 1) - 1
                    );
                }

                return(true);
            }
コード例 #11
0
        public HitBox
        (
            int x,
            int y,
            int w,
            int h,
            string tooltip = null,
            float alpha    = 0.75f
        )
        {
            CanMove          = false;
            AcceptMouseInput = true;
            Alpha            = alpha;
            _texture         = SolidColorTextureCache.GetTexture(Color.White);

            X              = x;
            Y              = y;
            Width          = w;
            Height         = h;
            WantUpdateSize = false;

            SetTooltip(tooltip);
        }
コード例 #12
0
ファイル: GridLootGump.cs プロジェクト: dust765/ClassicUO
            public override bool Draw(UltimaBatcher2D batcher, int x, int y)
            {
                ResetHueVector();
                base.Draw(batcher, x, y);
                ResetHueVector();

                batcher.DrawRectangle
                    (SolidColorTextureCache.GetTexture(Color.Gray), x, y + 15, Width, Height - 15, ref HueVector);

                if (_texture.MouseIsOver)
                {
                    HueVector.Z = 0.7f;

                    batcher.Draw2D
                    (
                        SolidColorTextureCache.GetTexture(Color.Yellow), x + 1, y + 15, Width - 1, Height - 15, ref HueVector
                    );

                    HueVector.Z = 0;
                }

                return(true);
            }
コード例 #13
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();

            if (Children.Count != 0)
            {
                Children[0].Draw(batcher, x, y);
            }

            ResetHueVector();

            ShaderHueTranslator.GetHueVector(ref HueVector, Hue);

            return(batcher.Draw2D
                   (
                       SolidColorTextureCache.GetTexture(Color.White),
                       x + 3,
                       y + 3,
                       Width - 6,
                       Height - 6,
                       ref HueVector
                   ));
        }
コード例 #14
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (!IsVisible || IsDisposed)
            {
                return(false);
            }

            base.Draw(batcher, x, y);

            Vector3 hueVector = ShaderHueTranslator.GetHueVector(0);

            batcher.DrawRectangle
            (
                SolidColorTextureCache.GetTexture(Color.Gray),
                x,
                y,
                Width,
                Height,
                hueVector
            );

            return(true);
        }
コード例 #15
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            base.Draw(batcher, x, y);

            if (Var != InfoBarVars.NameNotoriety && ProfileManager.CurrentProfile.InfoBarHighlightType == 1 && _warningLinesHue != 0x0481)
            {
                Vector3 hueVector = ShaderHueTranslator.GetHueVector(_warningLinesHue);

                batcher.Draw
                (
                    SolidColorTextureCache.GetTexture(Color.White),
                    new Rectangle
                    (
                        _data.ScreenCoordinateX,
                        _data.ScreenCoordinateY,
                        _data.Width,
                        2
                    ),
                    hueVector
                );

                batcher.Draw
                (
                    SolidColorTextureCache.GetTexture(Color.White),
                    new Rectangle
                    (
                        _data.ScreenCoordinateX,
                        _data.ScreenCoordinateY + Parent.Height - 2,
                        _data.Width,
                        2
                    ),
                    hueVector
                );
            }

            return(true);
        }
コード例 #16
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (Children.Count != 0)
            {
                Children[0].Draw(batcher, x, y);
            }

            Vector3 hueVector = ShaderHueTranslator.GetHueVector(Hue);

            batcher.Draw
            (
                SolidColorTextureCache.GetTexture(Color.White),
                new Rectangle
                (
                    x + 3,
                    y + 3,
                    Width - 6,
                    Height - 6
                ),
                hueVector
            );

            return(true);
        }
コード例 #17
0
        // ## BEGIN - END ## //  -- CODE BELOW IS 1:1 LIKE DrawHealthLine()
        private void DrawOldHealthLine(UltimaBatcher2D batcher, Entity entity, int x, int y, bool passive)
        {
            if (entity == null)
            {
                return;
            }

            Mobile mobile = entity as Mobile;

            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;
                }
            }
            // ## BEGIN - END ## //   -- CODE ABOVE IS 1:1 LIKE DrawHealthLine()
            Color color;

            if (ProfileManager.CurrentProfile.MultipleUnderlinesSelfParty && mobile == World.Player || ProfileManager.CurrentProfile.MultipleUnderlinesSelfParty && World.Party.Contains(mobile))
            {
                if (ProfileManager.CurrentProfile.MultipleUnderlinesSelfPartyBigBars)
                {
                    //LAYOUT BIGBAR
                    BIGBAR_WIDTH      = 50;
                    BIGBAR_HEIGHT     = 4;
                    BIGBAR_WIDTH_HALF = BIGBAR_WIDTH / 2 - 14;
                    YSPACING          = 1;
                }
                else
                {
                    BIGBAR_WIDTH      = 28;
                    BIGBAR_HEIGHT     = 3;
                    BIGBAR_WIDTH_HALF = BIGBAR_WIDTH / 2 - 14; // = BAR_WIDTH >> 1;
                    YSPACING          = 1;
                }

                (Color hpcolor, int maxhp, int maxmana, int maxstam) = UOClassicCombatCollection.CalcUnderlines(mobile);

                //HP BAR
                batcher.Draw2D(_edgeHealth, x - 1 - BIGBAR_WIDTH_HALF, y - 1, BIGBAR_WIDTH + 2, BIGBAR_HEIGHT + 1, ref _vectorHue);
                batcher.Draw2D(_backHealth, x - BIGBAR_WIDTH_HALF + maxhp, y, BIGBAR_WIDTH - maxhp, BIGBAR_HEIGHT, ref _vectorHue);
                batcher.Draw2D(SolidColorTextureCache.GetTexture(hpcolor), x - BIGBAR_WIDTH_HALF, y, maxhp, BIGBAR_HEIGHT, ref _vectorHue);

                //MANA BAR
                batcher.Draw2D(_edgeMana, x - 1 - BIGBAR_WIDTH_HALF, y + BIGBAR_HEIGHT + YSPACING - 1, BIGBAR_WIDTH + 2, BIGBAR_HEIGHT + 1, ref _vectorHue);
                batcher.Draw2D(_backMana, x - BIGBAR_WIDTH_HALF + maxmana, y + BIGBAR_HEIGHT + YSPACING, BIGBAR_WIDTH - maxmana, BIGBAR_HEIGHT, ref _vectorHue);
                batcher.Draw2D(SolidColorTextureCache.GetTexture(Color.CornflowerBlue * _alphamodifier), x - BIGBAR_WIDTH_HALF, y + BIGBAR_HEIGHT + YSPACING, maxmana, BIGBAR_HEIGHT, ref _vectorHue);

                //STAM BAR
                batcher.Draw2D(_edgeStamina, x - 1 - BIGBAR_WIDTH_HALF, y + BIGBAR_HEIGHT + BIGBAR_HEIGHT + YSPACING + YSPACING - 1, BIGBAR_WIDTH + 2, BIGBAR_HEIGHT + 2, ref _vectorHue);
                batcher.Draw2D(_backStamina, x - BIGBAR_WIDTH_HALF + maxstam, y + BIGBAR_HEIGHT + BIGBAR_HEIGHT + YSPACING + YSPACING, BIGBAR_WIDTH - maxstam, BIGBAR_HEIGHT, ref _vectorHue);
                batcher.Draw2D(SolidColorTextureCache.GetTexture(Color.CornflowerBlue * _alphamodifier), x - BIGBAR_WIDTH_HALF, y + BIGBAR_HEIGHT + BIGBAR_HEIGHT + YSPACING + YSPACING, maxstam, BIGBAR_HEIGHT, ref _vectorHue);
            }
            else
            {
                batcher.Draw2D(_edge, x - 1, y - 1, BAR_WIDTH + 2, OLD_BAR_HEIGHT + 2, ref _vectorHue);
                batcher.Draw2D(_back, x, y, BAR_WIDTH, OLD_BAR_HEIGHT, ref _vectorHue);

                if (mobile.IsParalyzed)
                {
                    color = Color.AliceBlue;
                }
                else if (mobile.IsYellowHits)
                {
                    color = Color.Orange;
                }
                else if (mobile.IsPoisoned)
                {
                    color = Color.LimeGreen;
                }
                else
                {
                    color = Color.CornflowerBlue;
                }

                batcher.Draw2D(SolidColorTextureCache.GetTexture(color), x, y, per, OLD_BAR_HEIGHT, ref _vectorHue);
            }
        }
コード例 #18
0
ファイル: Tooltip.cs プロジェクト: travis-watson1/ClassicUO
        public bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (SerialHelper.IsValid(Serial) && World.OPL.TryGetRevision(Serial, out uint revision) && _hash != revision)
            {
                _hash = revision;
                Text  = ReadProperties(Serial, out _textHTML);
            }

            if (string.IsNullOrEmpty(Text))
            {
                return(false);
            }

            if (_lastHoverTime > Time.Ticks)
            {
                return(false);
            }


            byte   font  = 1;
            float  alpha = 0.3f;
            ushort hue   = 0xFFFF;
            float  zoom  = 1;

            if (ProfileManager.CurrentProfile != null)
            {
                font  = ProfileManager.CurrentProfile.TooltipFont;
                alpha = 1f - ProfileManager.CurrentProfile.TooltipBackgroundOpacity / 100f;

                if (float.IsNaN(alpha))
                {
                    alpha = 1f;
                }

                hue  = ProfileManager.CurrentProfile.TooltipTextHue;
                zoom = ProfileManager.CurrentProfile.TooltipDisplayZoom / 100f;
            }

            FontsLoader.Instance.SetUseHTML(true);
            FontsLoader.Instance.RecalculateWidthByInfo = true;

            if (_renderedText == null)
            {
                _renderedText = RenderedText.Create
                                (
                    null,
                    font: font,
                    isunicode: true,
                    style: FontStyle.BlackBorder,
                    cell: 5,
                    isHTML: true,
                    align: TEXT_ALIGN_TYPE.TS_CENTER,
                    recalculateWidthByInfo: true,
                    hue: hue
                                );
            }

            if (_renderedText.Text != Text)
            {
                if (_maxWidth == 0)
                {
                    int width = FontsLoader.Instance.GetWidthUnicode(font, Text);

                    if (width > 600)
                    {
                        width = 600;
                    }

                    width = FontsLoader.Instance.GetWidthExUnicode
                            (
                        font,
                        Text,
                        width,
                        TEXT_ALIGN_TYPE.TS_CENTER,
                        (ushort)FontStyle.BlackBorder
                            );

                    if (width > 600)
                    {
                        width = 600;
                    }

                    _renderedText.MaxWidth = width;
                }
                else
                {
                    _renderedText.MaxWidth = _maxWidth;
                }

                _renderedText.Font = font;
                _renderedText.Hue  = hue;
                _renderedText.Text = _textHTML;
            }

            FontsLoader.Instance.RecalculateWidthByInfo = false;
            FontsLoader.Instance.SetUseHTML(false);

            if (_renderedText.Texture == null)
            {
                return(false);
            }

            int z_width  = _renderedText.Width + 8;
            int z_height = _renderedText.Height + 8;

            if (x < 0)
            {
                x = 0;
            }
            else if (x > Client.Game.Window.ClientBounds.Width - z_width)
            {
                x = Client.Game.Window.ClientBounds.Width - z_width;
            }

            if (y < 0)
            {
                y = 0;
            }
            else if (y > Client.Game.Window.ClientBounds.Height - z_height)
            {
                y = Client.Game.Window.ClientBounds.Height - z_height;
            }


            Vector3 hue_vec = Vector3.Zero;

            ShaderHueTranslator.GetHueVector(ref hue_vec, 0, false, alpha);

            batcher.Draw2D
            (
                SolidColorTextureCache.GetTexture(Color.Black),
                x - 4,
                y - 2,
                z_width * zoom,
                z_height * zoom,
                ref hue_vec
            );

            batcher.DrawRectangle
            (
                SolidColorTextureCache.GetTexture(Color.Gray),
                x - 4,
                y - 2,
                (int)(z_width * zoom),
                (int)(z_height * zoom),
                ref hue_vec
            );

            hue_vec.X = 0;
            hue_vec.Y = 0;
            hue_vec.Z = 0;

            return(batcher.Draw2D
                   (
                       _renderedText.Texture,
                       x + 3,
                       y + 3,
                       z_width * zoom,
                       z_height * zoom,
                       0,
                       0,
                       z_width,
                       z_height,
                       ref hue_vec
                   ));
        }
コード例 #19
0
 protected override void OnMouseExit(int x, int y)
 {
     label.Hue         = 0x03b2;
     backgroundTexture = SolidColorTextureCache.GetTexture(new Color(30, 30, 30));
     base.OnMouseExit(x, y);
 }
コード例 #20
0
 protected override void OnMouseEnter(int x, int y)
 {
     label.Hue         = 53;
     backgroundTexture = SolidColorTextureCache.GetTexture(Color.DimGray);
     base.OnMouseEnter(x, y);
 }
コード例 #21
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            base.Draw(batcher, x, y);

            Vector3 hueVector;

            if (ShowLock)
            {
                hueVector = ShaderHueTranslator.GetHueVector(0);

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

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

                    batcher.Draw
                    (
                        texture,
                        new Vector2(x + (Width - bounds.Width), y),
                        bounds,
                        hueVector
                    );
                }
            }

            hueVector = ShaderHueTranslator.GetHueVector(0);

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

                if (drawLoc != Location)
                {
                    Texture2D previewColor = SolidColorTextureCache.GetTexture(Color.Silver);
                    hueVector = ShaderHueTranslator.GetHueVector(0, false, 0.5f);

                    batcher.Draw
                    (
                        previewColor,
                        new Rectangle
                        (
                            drawLoc.X,
                            drawLoc.Y,
                            Width,
                            Height
                        ),
                        hueVector
                    );

                    hueVector.Z = 0;

                    // double rectangle for thicker "stroke"
                    batcher.DrawRectangle
                    (
                        previewColor,
                        drawLoc.X,
                        drawLoc.Y,
                        Width,
                        Height,
                        hueVector
                    );

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

            return(true);
        }
コード例 #22
0
            public override bool Draw(UltimaBatcher2D batcher, int x, int y)
            {
                base.Draw(batcher, x, y);

                Item item = World.Items.Get(LocalSerial);

                Vector3 hueVector;

                if (item != null)
                {
                    var texture = ArtLoader.Instance.GetStaticTexture(item.DisplayedGraphic, out var bounds);
                    var rect    = ArtLoader.Instance.GetRealArtBounds(item.DisplayedGraphic);

                    hueVector = ShaderHueTranslator.GetHueVector(item.Hue, item.ItemData.IsPartialHue, 1f);

                    Point originalSize = new Point(_hit.Width, _hit.Height);
                    Point point        = new Point();

                    if (rect.Width < _hit.Width)
                    {
                        originalSize.X = rect.Width;
                        point.X        = (_hit.Width >> 1) - (originalSize.X >> 1);
                    }

                    if (rect.Height < _hit.Height)
                    {
                        originalSize.Y = rect.Height;
                        point.Y        = (_hit.Height >> 1) - (originalSize.Y >> 1);
                    }

                    batcher.Draw
                    (
                        texture,
                        new Rectangle
                        (
                            x + point.X,
                            y + point.Y + _hit.Y,
                            originalSize.X,
                            originalSize.Y
                        ),
                        new Rectangle
                        (
                            bounds.X + rect.X,
                            bounds.Y + rect.Y,
                            rect.Width,
                            rect.Height
                        ),
                        hueVector
                    );
                }

                hueVector = ShaderHueTranslator.GetHueVector(0);

                batcher.DrawRectangle
                (
                    SolidColorTextureCache.GetTexture(Color.Gray),
                    x,
                    y + 15,
                    Width,
                    Height - 15,
                    hueVector
                );

                if (_hit.MouseIsOver)
                {
                    hueVector.Z = 0.7f;

                    batcher.Draw
                    (
                        SolidColorTextureCache.GetTexture(Color.Yellow),
                        new Rectangle
                        (
                            x + 1,
                            y + 15,
                            Width - 1,
                            Height - 15
                        ),
                        hueVector
                    );

                    hueVector.Z = 1;
                }

                return(true);
            }
コード例 #23
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);
        }
コード例 #24
0
        public void Draw(UltimaBatcher2D batcher)
        {
            //RETURN IF DISABLED
            if (!ProfileManager.CurrentProfile.UOClassicCombatLines)
            {
                return;
            }

            //POST
            Point p = World.Player.RealScreenPosition;

            p.X += (int)World.Player.Offset.X + 22;
            p.Y += (int)(World.Player.Offset.Y - World.Player.Offset.Z) + 22;

            //GET LIST FROM UI
            UOClassicCombatLines UOClassicCombatLines = UIManager.GetGump <UOClassicCombatLines>();

            //GET LAST TARGET
            Entity _lasttarget = World.Get(TargetManager.LastTargetInfo.Serial);

            //SEARCH MOBS IN LIST
            foreach (Mobile mobile in World.Mobiles)
            {
                //VAR FOR MODES
                bool  _draw = false;
                Color color = Color.White;

                if (!mobile.IsHuman)
                {
                    continue;
                }

                if (mobile == World.Player)
                {
                    continue;
                }

                switch (mobile.NotorietyFlag)
                {
                case NotorietyFlag.Innocent:

                    if (ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHuntingMmode && ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHMBlue && !World.Party.Contains(mobile.Serial))
                    {
                        _draw = true;
                    }

                    color = Color.Blue;
                    break;

                case NotorietyFlag.Ally:

                    color = Color.Green;
                    break;

                case NotorietyFlag.Criminal:

                    if (ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHuntingMmode && ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHMCriminal && !World.Party.Contains(mobile.Serial))
                    {
                        _draw = true;
                    }

                    color = Color.Gray;
                    break;

                case NotorietyFlag.Gray:

                    color = Color.Gray;
                    break;

                case NotorietyFlag.Enemy:

                    if (ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHuntingMmode && ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHMOrange && !World.Party.Contains(mobile.Serial))
                    {
                        _draw = true;
                    }

                    color = Color.Orange;
                    break;

                case NotorietyFlag.Murderer:

                    if (ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHuntingMmode && ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleHMRed && !World.Party.Contains(mobile.Serial))
                    {
                        _draw = true;
                    }

                    color = Color.Red;
                    break;

                case NotorietyFlag.Invulnerable:

                    color = Color.Yellow;
                    break;

                default:

                    color = Color.White;
                    break;
                }

                if (ProfileManager.CurrentProfile.UOClassicCombatLines_ToggleLastTarget && _lasttarget != null)
                {
                    if (mobile.Serial == _lasttarget.Serial)
                    {
                        _draw = true;
                        color = Color.White;
                    }
                }


                if (UOClassicCombatLines.entryList.Exists(mob => mob.Serial == mobile.Serial) || _draw)
                {
                    //CALC WHERE MOBILE IS
                    Point pm = mobile.RealScreenPosition;
                    pm.X += (int)mobile.Offset.X + 22;
                    pm.Y += (int)(mobile.Offset.Y - mobile.Offset.Z) + 22;

                    if (!mobile.IsDead)
                    {
                        //CALC MIDDLE
                        int ox = (pm.X + p.X) / 2;
                        int oy = (pm.Y + p.Y) / 2;
                        batcher.DrawLine(SolidColorTextureCache.GetTexture(color), pm.X, pm.Y, p.X, p.Y, ox, oy);
                    }
                }
            }
        }
コード例 #25
0
ファイル: ModernBookGump.cs プロジェクト: seand88/ClassicUO
            internal void DrawSelection(UltimaBatcher2D batcher, int x, int y, int starty, int endy)
            {
                ResetHueVector();
                HueVector.Z = 0.5f;

                int selectStart = Math.Min(Stb.SelectStart, Stb.SelectEnd);
                int selectEnd   = Math.Max(Stb.SelectStart, Stb.SelectEnd);

                if (selectStart < selectEnd)
                {
                    MultilinesFontInfo info = _rendererText.GetInfo();

                    int drawY = 1;
                    int start = 0;

                    while (info != null && selectStart < selectEnd)
                    {
                        // ok we are inside the selection
                        if (selectStart >= start && selectStart < start + info.CharCount)
                        {
                            int startSelectionIndex = selectStart - start;

                            // calculate offset x
                            int drawX = 0;

                            for (int i = 0; i < startSelectionIndex; i++)
                            {
                                drawX += _rendererText.GetCharWidth(info.Data[i].Item);
                            }

                            // selection is gone. Bye bye
                            if (selectEnd >= start && selectEnd < start + info.CharCount)
                            {
                                int count = selectEnd - selectStart;

                                int endX = 0;

                                // calculate width
                                for (int k = 0; k < count; k++)
                                {
                                    endX += _rendererText.GetCharWidth(info.Data[startSelectionIndex + k].Item);
                                }

                                if (drawY >= starty && drawY <= endy)
                                {
                                    batcher.Draw2D
                                    (
                                        SolidColorTextureCache.GetTexture(SELECTION_COLOR), x + drawX, y + drawY - starty, endX,
                                        info.MaxHeight + 1, ref HueVector
                                    );
                                }

                                break;
                            }


                            // do the whole line
                            if (drawY >= starty && drawY <= endy)
                            {
                                batcher.Draw2D
                                (
                                    SolidColorTextureCache.GetTexture(SELECTION_COLOR), x + drawX, y + drawY - starty,
                                    info.Width - drawX, info.MaxHeight + 1, ref HueVector
                                );
                            }

                            // first selection is gone. M
                            selectStart = start + info.CharCount;
                        }

                        start += info.CharCount;
                        drawY += info.MaxHeight;
                        info   = info.Next;
                    }
                }
            }
コード例 #26
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (IsDisposed)
            {
                return(false);
            }

            Vector3 hueVector = ShaderHueTranslator.GetHueVector(0);

            var texture = GumpsLoader.Instance.GetGumpTexture(_useLargeMap ? BIG_MAP_GRAPHIC : SMALL_MAP_GRAPHIC, out var bounds);

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

                return(false);
            }

            batcher.Draw
            (
                texture,
                new Vector2(x, y),
                bounds,
                hueVector
            );

            CreateMiniMapTexture();
            batcher.Draw(_mapTexture, new Vector2(x, y), hueVector);

            if (_draw)
            {
                int w = Width >> 1;
                int h = Height >> 1;

                Texture2D mobilesTextureDot = SolidColorTextureCache.GetTexture(Color.Red);

                foreach (Mobile mob in World.Mobiles.Values)
                {
                    if (mob == World.Player)
                    {
                        continue;
                    }

                    int xx = mob.X - World.Player.X;
                    int yy = mob.Y - World.Player.Y;

                    int gx = xx - yy;
                    int gy = xx + yy;

                    hueVector = ShaderHueTranslator.GetHueVector(Notoriety.GetHue(mob.NotorietyFlag));

                    batcher.Draw
                    (
                        mobilesTextureDot,
                        new Rectangle
                        (
                            x + w + gx,
                            y + h + gy,
                            2,
                            2
                        ),
                        hueVector
                    );
                }

                //DRAW PLAYER DOT
                hueVector = ShaderHueTranslator.GetHueVector(0);

                batcher.Draw
                (
                    SolidColorTextureCache.GetTexture(Color.White),
                    new Rectangle
                    (
                        x + w,
                        y + h,
                        2,
                        2
                    ),
                    hueVector
                );
            }

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