psychopyro212

Untitled

Mar 26th, 2017
2,783
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.  
  8.         private long HighestDPS;
  9.  
  10.         public DPSMeterPlugin()
  11.         {
  12.             Enabled = true;
  13.         }
  14.         public override void Load(IController hud)
  15.         {
  16.             base.Load(hud);
  17.  
  18.             HighestDPS = 0;
  19.  
  20.             DpsLabelDecorator = new TopLabelDecorator(Hud)
  21.             {
  22.                 TextFont = Hud.Render.CreateFont("tahoma", 12, 255, 255, 255, 255, true, false, false),
  23.                 BackgroundTexture1 = hud.Texture.ButtonTextureBlue,
  24.                 BackgroundTexture2 = hud.Texture.BackgroundTextureBlue,
  25.                 BackgroundTextureOpacity2 = 0.5f,
  26.  
  27.                 TextFunc = () => ValueToString(Hud.Game.Me.Damage.CurrentDps, ValueFormat.LongNumber),
  28.                 HintFunc = () => ValueToString(HighestDPS, ValueFormat.LongNumber),
  29.             };
  30.         }
  31.         public void PaintTopInGame(ClipState clipState)
  32.         {
  33.             if (Hud.Game.Me.Damage.CurrentDps > HighestDPS) HighestDPS = Hud.Game.Me.Damage.CurrentDps;
  34.  
  35.             var xPos = Hud.Window.Size.Width / 2;
  36.             var yPos = Hud.Window.Size.Height / 5;
  37.             var bgWidth = Hud.Window.Size.Width * 0.08f;
  38.             var bgHeight = Hud.Window.Size.Height * 0.04f;
  39.  
  40.             if (clipState == ClipState.BeforeClip)
  41.             {
  42.                 DpsLabelDecorator.Paint(xPos - (bgWidth / 2), yPos, bgWidth, bgHeight, HorizontalAlign.Center);
  43.             }
  44.         }
  45.     }
  46. }
Add Comment
Please, Sign In to add comment