// Token: 0x060000C1 RID: 193 RVA: 0x00007934 File Offset: 0x00005B34
 public void Draw(O9K.Core.Managers.Renderer.IRenderer renderer, Rectangle9 position, float cooldownSize)
 {
     if (!this.Ability.IsUsable)
     {
         return;
     }
     try
     {
         renderer.DrawTexture(this.Ability.Name, position, 0f, 1f);
         if (this.Ability.IsCasting || this.Ability.IsChanneling)
         {
             renderer.DrawRectangle(position - 3f, System.Drawing.Color.LightGreen, 3f);
         }
         else
         {
             renderer.DrawRectangle(position - 1f, System.Drawing.Color.Black, 1f);
         }
         if (this.displayLevel)
         {
             uint level = this.Ability.Level;
             if (level == 0u)
             {
                 renderer.DrawTexture("ability_0lvl_bg", position, 0f, 1f);
                 return;
             }
             string     text   = level.ToString("N0");
             Vector2    vector = renderer.MeasureText(text, position.Width * 0.45f, "Calibri");
             Rectangle9 rec    = position.SinkToBottomLeft(vector.X, vector.Y * 0.8f);
             renderer.DrawTexture("ability_lvl_bg", rec, 0f, 1f);
             renderer.DrawText(rec, text, System.Drawing.Color.White, RendererFontFlags.VerticalCenter, position.Width * 0.45f, "Calibri");
         }
         if (this.displayCharges)
         {
             string     text2   = this.Ability.BaseItem.CurrentCharges.ToString("N0");
             Vector2    vector2 = renderer.MeasureText(text2, position.Width * 0.45f, "Calibri");
             Rectangle9 rec2    = position.SinkToBottomRight(vector2.X * 1.1f, vector2.Y * 0.8f);
             renderer.DrawTexture("ability_lvl_bg", rec2, 0f, 1f);
             renderer.DrawText(rec2, text2, System.Drawing.Color.White, RendererFontFlags.VerticalCenter, position.Width * 0.45f, "Calibri");
         }
         if (!this.Ability.IsChanneling)
         {
             float remainingCooldown = this.Ability.RemainingCooldown;
             if (remainingCooldown > 0f)
             {
                 renderer.DrawTexture("ability_cd_bg", position, 0f, 1f);
                 renderer.DrawText(position * 2f, Math.Ceiling((double)remainingCooldown).ToString("N0"), System.Drawing.Color.White, RendererFontFlags.Center | RendererFontFlags.VerticalCenter, cooldownSize, "Calibri");
             }
             else if (this.Ability.ManaCost > this.Ability.Owner.Mana)
             {
                 renderer.DrawTexture("ability_mana_bg", position, 0f, 1f);
                 renderer.DrawText(position * 2f, Math.Ceiling((double)((this.Ability.ManaCost - this.Ability.Owner.Mana) / this.Ability.Owner.ManaRegeneration)).ToString("N0"), System.Drawing.Color.White, RendererFontFlags.Center | RendererFontFlags.VerticalCenter, cooldownSize, "Calibri");
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, null);
     }
 }
Beispiel #2
0
        public void Draw(Rectangle9 position, float cooldownSize)
        {
            try
            {
                RendererManager.DrawTexture(this.Ability.TextureName, position, TextureType.Ability);

                if (this.Ability.IsCasting || this.Ability.IsChanneling)
                {
                    RendererManager.DrawRectangle(position - 3f, Color.LightGreen, 3);
                }
                else
                {
                    RendererManager.DrawRectangle(position - 1, Color.Black);
                }

                if (this.displayLevel)
                {
                    var level = this.Ability.Level;
                    if (level == 0)
                    {
                        RendererManager.DrawTexture("o9k.ability_0lvl_bg", position);
                        return;
                    }

                    var levelText     = level.ToString("N0");
                    var levelSize     = RendererManager.MeasureText(levelText, position.Width * 0.45f);
                    var levelPosition = position.SinkToBottomLeft(levelSize.X, levelSize.Y * 0.8f);

                    RendererManager.DrawTexture("o9k.ability_lvl_bg", levelPosition);
                    RendererManager.DrawText(levelText, levelPosition, Color.White, FontFlags.VerticalCenter, position.Width * 0.45f);
                }

                if (this.Ability.IsDisplayingCharges)
                {
                    var chargesText     = this.Ability.Charges.ToString("N0");
                    var chargesPosition = position.SinkToBottomRight(position.Width * 0.5f, position.Height * 0.5f);
                    RendererManager.DrawTexture("o9k.charge_bg", chargesPosition);
                    RendererManager.DrawTexture("o9k.outline_green", chargesPosition * 1.07f);
                    RendererManager.DrawText(chargesText, chargesPosition, Color.White, FontFlags.Center, position.Width * 0.45f);
                }

                if (this.Ability.IsChanneling)
                {
                    return;
                }

                var cooldown = this.Ability.RemainingCooldown;
                if (cooldown > 0)
                {
                    RendererManager.DrawTexture("o9k.ability_cd_bg", position);
                    RendererManager.DrawText(
                        Math.Ceiling(cooldown).ToString("N0"),
                        position,
                        Color.White,
                        FontFlags.Center | FontFlags.VerticalCenter,
                        cooldownSize);
                }
                else if (this.Ability.ManaCost > this.Ability.Owner.Mana)
                {
                    RendererManager.DrawTexture("o9k.ability_mana_bg", position);
                    RendererManager.DrawText(
                        Math.Ceiling((this.Ability.ManaCost - this.Ability.Owner.Mana) / this.Ability.Owner.ManaRegeneration)
                        .ToString("N0"),
                        position,
                        Color.White,
                        FontFlags.Center | FontFlags.VerticalCenter,
                        cooldownSize);
                }
                else if (!this.Ability.IsUsable)
                {
                    RendererManager.DrawTexture("o9k.ability_0lvl_bg", position);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }