Ejemplo n.º 1
0
 // 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);
     }
 }
Ejemplo n.º 2
0
 // Token: 0x0600011E RID: 286 RVA: 0x0000AFB4 File Offset: 0x000091B4
 private void OnDraw(O9K.Core.Managers.Renderer.IRenderer renderer)
 {
     try
     {
         Vector2 vector = this.position.Value;
         foreach (Unit9 unit in this.units)
         {
             if (unit.IsValid)
             {
                 renderer.DrawTexture(unit.Name, vector, this.heroSize, 0f, 1f);
                 Rectangle9 rec = new Rectangle9(vector.X + this.heroSize.X + 1f, vector.Y, this.itemSize.X, this.itemSize.Y);
                 for (int i = 0; i < 6; i++)
                 {
                     renderer.DrawTexture("inventory_item_bg", rec + new Vector2((this.itemSize.X + 1f) * (float)i, 0f), 0f, 1f);
                 }
                 foreach (Ability9 ability in from x in unit.Abilities
                          orderby x.Id == AbilityId.item_tpscroll
                          select x)
                 {
                     if (ability.Id == AbilityId.item_tpscroll)
                     {
                         Rectangle9 rec2 = new Rectangle9(vector + new Vector2(this.heroSize.X * 0.7f, this.heroSize.Y * 0.35f), this.itemSize.X * 0.55f, this.itemSize.X * 0.55f);
                         renderer.DrawTexture("outline", rec2 + 1f, 0f, 1f);
                         renderer.DrawTexture(ability.Name + "_rounded", rec2, 0f, 1f);
                         if (this.showCooldown)
                         {
                             float remainingCooldown = ability.RemainingCooldown;
                             if (remainingCooldown > 0f)
                             {
                                 renderer.DrawTexture("inventory_tp_cd_bg", rec2, 0f, 1f);
                                 renderer.DrawText(rec2, Math.Ceiling((double)remainingCooldown).ToString("N0"), System.Drawing.Color.White, RendererFontFlags.Center | RendererFontFlags.VerticalCenter, this.size * 0.35f, "Calibri");
                             }
                         }
                     }
                     else if (ability.IsItem && ability.IsUsable)
                     {
                         Rectangle9 rec3 = rec - 4f;
                         renderer.DrawTexture(ability.Name, rec3, 0f, 1f);
                         if (this.showCharges && ability.IsDisplayingCharges)
                         {
                             string     text    = ability.BaseItem.CurrentCharges.ToString("N0");
                             Vector2    vector2 = renderer.MeasureText(text, this.size * 0.35f, "Calibri");
                             Rectangle9 rec4    = rec3.SinkToBottomRight(vector2.X * 1.1f, vector2.Y * 0.8f);
                             renderer.DrawFilledRectangle(rec4, System.Drawing.Color.Black);
                             renderer.DrawText(rec4, text, System.Drawing.Color.White, RendererFontFlags.Left, this.size * 0.35f, "Calibri");
                         }
                         if (this.showCooldown)
                         {
                             float remainingCooldown2 = ability.RemainingCooldown;
                             if (remainingCooldown2 > 0f)
                             {
                                 renderer.DrawTexture("inventory_item_cd_bg", rec3, 0f, 1f);
                                 renderer.DrawText(rec3, Math.Ceiling((double)remainingCooldown2).ToString("N0"), System.Drawing.Color.White, RendererFontFlags.Center | RendererFontFlags.VerticalCenter, this.size * 0.7f, "Calibri");
                             }
                         }
                         rec += new Vector2(this.itemSize.X + 1f, 0f);
                     }
                 }
                 vector += new Vector2(0f, (float)(this.size + 1));
             }
         }
     }
     catch (InvalidOperationException)
     {
     }
     catch (Exception exception)
     {
         Logger.Error(exception, null);
     }
 }