コード例 #1
0
            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);
            }
コード例 #2
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);
        }
コード例 #3
0
        private void BuildGump()
        {
            Width  = 88;
            Height = 44;

            label = new Label
                    (
                _macro.Name,
                true,
                0x03b2,
                Width,
                255,
                FontStyle.BlackBorder,
                TEXT_ALIGN_TYPE.TS_CENTER
                    )
            {
                X     = 0,
                Width = Width - 10
            };

            label.Y = (Height >> 1) - (label.Height >> 1);
            Add(label);

            backgroundTexture = SolidColorTextureCache.GetTexture(new Color(30, 30, 30));
        }
コード例 #4
0
ファイル: InfoBarGump.cs プロジェクト: seand88/ClassicUO
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            base.Draw(batcher, x, y);

            ResetHueVector();

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

                batcher.Draw2D
                (
                    SolidColorTextureCache.GetTexture(Color.White), _data.ScreenCoordinateX, _data.ScreenCoordinateY,
                    _data.Width, 2, ref HueVector
                );

                batcher.Draw2D
                (
                    SolidColorTextureCache.GetTexture(Color.White), _data.ScreenCoordinateX,
                    _data.ScreenCoordinateY + Parent.Height - 2, _data.Width, 2, ref HueVector
                );
            }

            return(true);
        }
コード例 #5
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();
            HueVector.Z = 0.1f;

            batcher.Draw2D
            (
                backgroundTexture,
                x,
                y,
                Width,
                Height,
                ref HueVector
            );

            HueVector.Z = 0;

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

            base.Draw(batcher, x, y);

            return(true);
        }
コード例 #6
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);
            }
コード例 #7
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            Vector3 hueVector = ShaderHueTranslator.GetHueVector(0);

            batcher.Draw
            (
                backgroundTexture,
                new Rectangle
                (
                    x,
                    y,
                    Width,
                    Height
                ),
                hueVector
            );

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

            base.Draw(batcher, x, y);

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

            ResetHueVector();

            for (int i = 0; i < _container.Count; i++)
            {
                if (i + 1 >= _container.Count)
                {
                    break;
                }

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

                batcher.DrawLine
                (
                    SolidColorTextureCache.GetTexture(Color.White),
                    c0.ScreenCoordinateX,
                    c0.ScreenCoordinateY,
                    c1.ScreenCoordinateX,
                    c1.ScreenCoordinateY,
                    c0.ScreenCoordinateX + (c1.ScreenCoordinateX - c0.ScreenCoordinateX) / 2,
                    c0.ScreenCoordinateY + (c1.ScreenCoordinateY - c0.ScreenCoordinateY) / 2
                );
            }

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

            ShaderHueTranslator.GetHueVector(ref HueVector, Hue, false, Alpha);

            return(batcher.Draw2D(SolidColorTextureCache.GetTexture(Color.Black), x, y, Width, Height, ref HueVector));
        }
コード例 #10
0
            public LineCHB(int x, int y, int w, int h, uint color) : base(x, y, w, h, color)
            {
                LineWidth = w;
                LineColor = SolidColorTextureCache.GetTexture(new Color()
                {
                    PackedValue = color
                });

                CanMove = true;
            }
コード例 #11
0
ファイル: HoveredLabel.cs プロジェクト: seand88/ClassicUO
        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));
        }
コード例 #12
0
        public Line(int x, int y, int w, int h, uint color)
        {
            X      = x;
            Y      = y;
            Width  = w;
            Height = h;

            _texture = SolidColorTextureCache.GetTexture(new Color {
                PackedValue = color
            });
        }
コード例 #13
0
 static HealthLinesManager()
 {
     _edge        = SolidColorTextureCache.GetTexture(Color.Black);
     _back        = SolidColorTextureCache.GetTexture(Color.Red);
     _edgeHealth  = SolidColorTextureCache.GetTexture(Color.Black * _alphamodifier);
     _backHealth  = SolidColorTextureCache.GetTexture(Color.Red * _alphamodifier);
     _edgeMana    = SolidColorTextureCache.GetTexture(Color.Black * _alphamodifier);
     _backMana    = SolidColorTextureCache.GetTexture(Color.Red * _alphamodifier);
     _edgeStamina = SolidColorTextureCache.GetTexture(Color.Black * _alphamodifier);
     _backStamina = SolidColorTextureCache.GetTexture(Color.Red * _alphamodifier);
 }
コード例 #14
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ResetHueVector();

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

            return(base.Draw(batcher, x, y));
        }
コード例 #15
0
ファイル: GridLootGump.cs プロジェクト: dust765/ClassicUO
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (!IsVisible || IsDisposed)
            {
                return(false);
            }

            ResetHueVector();
            base.Draw(batcher, x, y);
            ResetHueVector();
            batcher.DrawRectangle(SolidColorTextureCache.GetTexture(Color.Gray), x, y, Width, Height, ref HueVector);

            return(true);
        }
コード例 #16
0
ファイル: AnchorableGump.cs プロジェクト: seand88/ClassicUO
        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);
        }
コード例 #17
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));
        }
コード例 #18
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);
            }
コード例 #19
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);
        }
コード例 #20
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);
        }
コード例 #21
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));
        }
コード例 #22
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);
        }
コード例 #23
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
                   ));
        }
コード例 #24
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);
        }
コード例 #25
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);
            }
コード例 #26
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;
                    }
                }
            }
コード例 #27
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);
                    }
                }
            }
        }
コード例 #28
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
                   ));
        }
コード例 #29
0
 protected override void OnMouseEnter(int x, int y)
 {
     label.Hue         = 53;
     backgroundTexture = SolidColorTextureCache.GetTexture(Color.DimGray);
     base.OnMouseEnter(x, y);
 }
コード例 #30
0
 protected override void OnMouseExit(int x, int y)
 {
     label.Hue         = 0x03b2;
     backgroundTexture = SolidColorTextureCache.GetTexture(new Color(30, 30, 30));
     base.OnMouseExit(x, y);
 }