psychopyro212

Untitled

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