Advertisement
smoochy

RessourceInfo.cs

Jul 28th, 2017
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.86 KB | None | 0 0
  1. namespace Turbo.Plugins.Smoochy
  2. {  
  3.     using System;
  4.     using Turbo.Plugins.Default;
  5.  
  6.     public class EssencePlugin : BasePlugin, IInGameTopPainter
  7.     {
  8.         public TopLabelDecorator EssenceLabelDecorator { get; set; }
  9.         public TopLabelDecorator EssenceDHPriLabelDecorator  {get; set; }
  10.         public TopLabelDecorator EssenceDHSecLabelDecorator { get; set; }
  11.  
  12.         public EssencePlugin()
  13.         {
  14.             Enabled = true;
  15.         }
  16.         public override void Load(IController hud)
  17.         {
  18.             base.Load(hud);
  19.             EssenceLabelDecorator = new TopLabelDecorator(Hud)
  20.             {
  21.                 TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 175, 238, 238, true, false, false), //this configures the size of the numbers ("7") and the color in RGB ("255, 175, 238, 238") for all classes except the DemonHunter
  22.                 BackgroundTexture1 = hud.Texture.ButtonTextureBlue,
  23.                 BackgroundTexture2 = hud.Texture.BackgroundTextureBlue,
  24.                 BackgroundTextureOpacity2 = 0.5f,          
  25.                 TextFunc = () => (Math.Truncate(Hud.Game.Me.Stats.ResourceCurPri) + "/" + Hud.Game.Me.Stats.ResourceMaxPri),
  26.             };
  27.             EssenceDHPriLabelDecorator = new TopLabelDecorator(Hud)
  28.             {
  29.                 TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 175, 238, 238, true, false, false), //this configures the size of the numbers ("7") and the color in RGB ("255, 175, 238, 238") for the primary ressource of the DemonHunter
  30.                 BackgroundTexture1 = hud.Texture.ButtonTextureBlue,
  31.                 BackgroundTexture2 = hud.Texture.BackgroundTextureBlue,
  32.                 BackgroundTextureOpacity2 = 0.5f,            
  33.                 TextFunc = () => (Math.Truncate(Hud.Game.Me.Stats.ResourceCurPri) + "/" + Hud.Game.Me.Stats.ResourceMaxPri),
  34.             };
  35.             EssenceDHSecLabelDecorator = new TopLabelDecorator(Hud)
  36.             {
  37.                 TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 175, 238, 238, true, false, false), //this configures the size of the numbers ("7") and the color in RGB ("255, 175, 238, 238") for the secondary ressource of the DemonHunter
  38.                 BackgroundTexture1 = hud.Texture.ButtonTextureBlue,
  39.                 BackgroundTexture2 = hud.Texture.BackgroundTextureBlue,
  40.                 BackgroundTextureOpacity2 = 0.5f,              
  41.                 TextFunc = () => (Math.Truncate(Hud.Game.Me.Stats.ResourceCurSec) + "/" + Hud.Game.Me.Stats.ResourceMaxSec),
  42.             };
  43.  
  44.  
  45.  
  46.  
  47.         }
  48.         public void PaintTopInGame(ClipState clipState)
  49.         {
  50.             var xPos = Hud.Window.Size.Width * 0.5f; //this is the horizontal position
  51.             var yPos = Hud.Window.Size.Height * 0.5f; //this is the vertical position
  52.             var bgWidth = 90; //this is the width of the background texture
  53.             var bgHeight = 30; //this is the heigth of the background texture
  54.             var yPosDH = Hud.Window.Size.Height * 0.5f + bgHeight; //this is the vertical position for the secondary ressource of the Demon Hunter
  55.  
  56.             if (clipState == ClipState.BeforeClip)
  57.             {
  58.  
  59.                 switch (Hud.Game.Me.HeroClassDefinition.HeroClass)
  60.                 {
  61.                     case HeroClass.Barbarian:
  62.                         EssenceLabelDecorator.Paint(xPos - (bgWidth / 2), yPos, bgWidth, bgHeight, HorizontalAlign.Center);
  63.                         break;
  64.                     case HeroClass.Crusader:
  65.                         EssenceLabelDecorator.Paint(xPos - (bgWidth / 2), yPos, bgWidth, bgHeight, HorizontalAlign.Center);
  66.                         break;
  67.                     case HeroClass.DemonHunter:
  68.                         EssenceDHPriLabelDecorator.Paint(xPos - (bgWidth / 2), yPos, bgWidth, bgHeight, HorizontalAlign.Center);
  69.                         EssenceDHSecLabelDecorator.Paint(xPos - (bgWidth / 2), yPosDH, bgWidth, bgHeight, HorizontalAlign.Center);
  70.                         break;
  71.                     case HeroClass.Monk:
  72.                         EssenceLabelDecorator.Paint(xPos - (bgWidth / 2), yPos, bgWidth, bgHeight, HorizontalAlign.Center);                        
  73.                         break;
  74.                     case HeroClass.Necromancer:
  75.                         EssenceLabelDecorator.Paint(xPos - (bgWidth / 2), yPos, bgWidth, bgHeight, HorizontalAlign.Center);                        
  76.                         break;
  77.                     case HeroClass.WitchDoctor:
  78.                         EssenceLabelDecorator.Paint(xPos - (bgWidth / 2), yPos, bgWidth, bgHeight, HorizontalAlign.Center);                        
  79.                         break;
  80.                     case HeroClass.Wizard:
  81.                     EssenceLabelDecorator.Paint(xPos - (bgWidth / 2), yPos, bgWidth, bgHeight, HorizontalAlign.Center);
  82.                         break;
  83.                 }  
  84.             }
  85.         }
  86.     }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement