Advertisement
Guest User

EssencePlugin - V2

a guest
Jul 29th, 2017
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 KB | None | 0 0
  1.  
  2.  
  3. namespace Turbo.Plugins.Smoochy
  4. {  
  5.     using System;
  6.     using Turbo.Plugins.Default;
  7.    
  8.     public class EssencePlugin : BasePlugin, IInGameTopPainter
  9.     {
  10.         public TopLabelDecorator EssenceLabelDecorator { 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")
  22.                 BackgroundTexture1 = hud.Texture.ButtonTextureBlue,
  23.                 BackgroundTexture2 = hud.Texture.BackgroundTextureBlue,
  24.                 BackgroundTextureOpacity2 = 0.5f,
  25.                
  26.                 TextFunc = () => (Math.Truncate(Hud.Game.Me.Stats.ResourceCurPri) + "/" + Hud.Game.Me.Stats.ResourceMaxPri),
  27.             };
  28.         }
  29.         public void PaintTopInGame(ClipState clipState)
  30.         {
  31.             var xPos = Hud.Window.Size.Width * 0.5f; //this is the horizontal position
  32.             var yPos = Hud.Window.Size.Height * 0.5f; //this is the vertical position
  33.             var bgWidth = 90; //this is the width of the background texture
  34.             var bgHeight = 30; //this is the heigth of the background texture
  35.  
  36.             if (clipState == ClipState.BeforeClip)
  37.             {
  38.                 EssenceLabelDecorator.Paint(xPos - (bgWidth / 2), yPos, bgWidth, bgHeight, HorizontalAlign.Center);
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement