public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.Inventory)
            {
                return;
            }
            if (Hud.Game.Me.CurrentLevelNormalCap != 70)
            {
                return;
            }
            if (!Hud.Inventory.InventoryMainUiElement.Visible)
            {
                return;
            }

            if (GemInvRect.IsEmpty)
            {
                var uiInvRect = Hud.Inventory.InventoryMainUiElement.Rectangle;
                GemInvRect = new RectangleF(uiInvRect.Left + (uiInvRect.Width * 0.625f), uiInvRect.Top + (uiInvRect.Height * 0.04f),
                                            GemInvTexture.Width * GemSize, GemInvTexture.Height * GemSize);
            }

            GemInvTexture.Draw(GemInvRect.X, GemInvRect.Y, GemInvRect.Width, GemInvRect.Height);

            if (Hud.Window.CursorInsideRect(GemInvRect.X, GemInvRect.Y, GemInvRect.Width, GemInvRect.Height))
            {
                ITexture texture;
                for (int y = 0; y < 5; y++)
                {
                    for (int x = 0; x < 5; x++)
                    {
                        texture = Hud.Texture.GetItemTexture(_gems[y, x]);
                        if (texture != null)
                        {
                            DrawCell(texture, x, y, CountGems(_gems[y, x]).ToString());
                        }
                    }

                    texture = Hud.Texture.GetItemTexture(_gems[y, 4]);
                    if (texture != null)
                    {
                        long total = CountGems(_gems[y, 4]) +
                                     (long)Math.Floor(
                            (Math.Floor(
                                 (Math.Floor(
                                      (Math.Floor(CountGems(_gems[y, 0]) / 3f) + CountGems(_gems[y, 1])) / 3f) + CountGems(_gems[y, 2])) / 3f) + CountGems(_gems[y, 3])) / 3f);

                        DrawCell(texture, 5, y, "?" + total.ToString());
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.Inventory)
            {
                return;
            }
            if (Hud.Game.Me.CurrentLevelNormalCap != 70)
            {
                return;
            }
            if (!Hud.Inventory.InventoryMainUiElement.Visible)
            {
                return;
            }
            var uiInvRect = Hud.Render.GetUiElement("Root.NormalLayer.inventory_dialog_mainPage");

            GemInvRect = new RectangleF(uiInvRect.Rectangle.Left + (uiInvRect.Rectangle.Width * 0.625f), uiInvRect.Rectangle.Top + (uiInvRect.Rectangle.Height * 0.04f), GemInvTexture.Width * GemSize, GemInvTexture.Height * GemSize);
            GemInvTexture.Draw(GemInvRect.X, GemInvRect.Y, GemInvRect.Width, GemInvRect.Height);
            if (Hud.Window.CursorInsideRect(GemInvRect.X, GemInvRect.Y, GemInvRect.Width, GemInvRect.Height))
            {
                Hud.Render.SetHint("显示仓库及当前英雄所有宝石总数并计算可合成最大宝石的数量(按住ALT键时总数不包括已镶嵌在装备上的宝石)");
                ITexture texture;
                for (int y = 0; y < 5; y++)
                {
                    for (int x = 0; x < 5; x++)
                    {
                        texture = Hud.Texture.GetItemTexture(_gems[y, x]);
                        if (texture != null)
                        {
                            GemBackgroundTexture.Draw(GemBackgroundRect.Left + ((GemInvRect.Width + GemSpacing) * x) - GemSpacing * 0.5f,
                                                      GemBackgroundRect.Top + ((GemInvRect.Height + GemSpacing) * y) - GemSpacing * 0.5f,
                                                      GemInvRect.Width + GemSpacing, GemInvRect.Height + GemSpacing);

                            texture.Draw(GemBackgroundRect.Left + ((GemInvRect.Width + GemSpacing) * x), GemBackgroundRect.Top + ((GemInvRect.Height + GemSpacing) * y),
                                         GemInvRect.Width, GemInvRect.Height);

                            var layout = GemQuantityFont.GetTextLayout(ValueToString(CountGems(_gems[y, x]), ValueFormat.NormalNumberNoDecimal));
                            GemQuantityFont.DrawText(layout, GemBackgroundRect.Left + ((GemInvRect.Width + GemSpacing) * x) + (GemInvRect.Width - layout.Metrics.Width) * 0.5f,
                                                     GemBackgroundRect.Top + ((GemInvRect.Height + GemSpacing) * y) + layout.Metrics.Height * 0.5f);
                        }
                    }

                    texture = Hud.Texture.GetItemTexture(_gems[y, 4]);
                    if (texture != null)
                    {
                        var x     = 5;
                        var total = CountGems(_gems[y, 4]) +
                                    Math.Floor(
                            (Math.Floor(
                                 (Math.Floor(
                                      (Math.Floor(CountGems(_gems[y, 0]) / 3f) + CountGems(_gems[y, 1])) / 3f) + CountGems(_gems[y, 2])) / 3f) + CountGems(_gems[y, 3])) / 3f);

                        GemBackgroundTexture.Draw(GemBackgroundRect.Left + ((GemInvRect.Width + GemSpacing) * x) - GemSpacing * 0.5f,
                                                  GemBackgroundRect.Top + ((GemInvRect.Height + GemSpacing) * y) - GemSpacing * 0.5f,
                                                  GemInvRect.Width + GemSpacing, GemInvRect.Height + GemSpacing);

                        texture.Draw(GemBackgroundRect.Left + ((GemInvRect.Width + GemSpacing) * x), GemBackgroundRect.Top + ((GemInvRect.Height + GemSpacing) * y),
                                     GemInvRect.Width, GemInvRect.Height);

                        var layout = GemQuantityFont.GetTextLayout("=" + total.ToString());
                        GemQuantityFont.DrawText(layout, GemBackgroundRect.Left + ((GemInvRect.Width + GemSpacing) * x) + (GemInvRect.Width - layout.Metrics.Width) * 0.5f,
                                                 GemBackgroundRect.Top + ((GemInvRect.Height + GemSpacing) * y) + layout.Metrics.Height * 0.5f);
                    }
                }
            }
        }