psychopyro212

Untitled

Feb 20th, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.61 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. namespace Turbo.Plugins.Psycho
  3. {
  4.     public class DPSMeterPlugin : BasePlugin, IInGameTopPainter
  5.     {
  6.         public TopLabelDecorator DpsLabelDecorator { get; set; }
  7.         private long HighestDPS;
  8.  
  9.         public DPSMeterPlugin()
  10.         {
  11.             Enabled = true;
  12.         }
  13.         public override void Load(IController hud)
  14.         {
  15.             base.Load(hud);
  16.             HighestDPS = 0;
  17.             DpsLabelDecorator = new TopLabelDecorator(Hud)
  18.             {
  19.                 TextFont = Hud.Render.CreateFont("tahoma", 12, 255, 255, 255, 255, true, false, false),
  20.                 BackgroundTexture1 = hud.Texture.ButtonTextureBlue,
  21.                 BackgroundTexture2 = hud.Texture.BackgroundTextureBlue,
  22.                 BackgroundTextureOpacity2 = 0.5f,
  23.  
  24.                 TextFunc = () => ValueToString(Hud.Game.Me.Damage.CurrentDps, ValueFormat.LongNumber),
  25.                 HintFunc = () => ValueToString(HighestDPS, ValueFormat.LongNumber),
  26.             };
  27.         }
  28.         public void PaintTopInGame(ClipState clipState)
  29.         {
  30.             if (Hud.Game.Me.Damage.CurrentDps > HighestDPS) HighestDPS = Hud.Game.Me.Damage.CurrentDps;
  31.  
  32.             var xPos = Hud.Window.Size.Width / 2;
  33.             var yPos = Hud.Window.Size.Height / 5;
  34.             var bgWidth = Hud.Window.Size.Width * 0.08f;
  35.             var bgHeight = Hud.Window.Size.Height * 0.04f;
  36.  
  37.             if (clipState == ClipState.BeforeClip)
  38.             {
  39.                 DpsLabelDecorator.Paint(xPos - (bgWidth / 2), yPos, bgWidth, bgHeight, HorizontalAlign.Center);
  40.             }
  41.         }
  42.     }
  43. }
Add Comment
Please, Sign In to add comment