Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.42 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. using System.Globalization;
  6.  
  7. namespace Turbo.Plugins.Resu
  8. {
  9.  
  10.     public class ParagonPercentagePlugin : BasePlugin, IInGameTopPainter
  11.     {
  12.  
  13.         public TopLabelDecorator ParagonPercentageDecorator { get; set; }
  14.        
  15.  
  16.         public ParagonPercentagePlugin()
  17.         {
  18.             Enabled = true;
  19.         }
  20.    
  21.            
  22.         public override void Load(IController hud)
  23.         {
  24.             base.Load(hud);
  25.            
  26.            
  27.             ParagonPercentageDecorator = new TopLabelDecorator(Hud)
  28.             {
  29.                
  30.                 BackgroundTexture1 = Hud.Texture.Button2TextureBrown,
  31.                 BackgroundTextureOpacity1 = 1.0f,
  32.                 TextFont = Hud.Render.CreateFont("Segoe UI Light", 7, 250, 87, 137, 255, false, false, true),
  33.                  
  34.                  TextFunc = () => Hud.Game.Me.CurrentLevelParagonFloat.ToString("F3").Substring(Hud.Game.Me.CurrentLevelParagonFloat.ToString("F3").Length-3).Insert(2, ".")+"%",
  35.                          
  36.                                
  37.                 HintFunc = () => "Paragon percentage",
  38.             };
  39.         }
  40.        
  41.         public void PaintTopInGame(ClipState clipState)
  42.         {
  43.             if (Hud.Render.UiHidden) return;
  44.             if (clipState != ClipState.BeforeClip) return;
  45.            
  46.  
  47.             var uiRect = Hud.Render.GetUiElement("*portrait-bottom").Rectangle;
  48.  
  49.             if (Hud.Game.NumberOfPlayersInGame == 1)
  50.                 {
  51.             ParagonPercentageDecorator.Paint(uiRect.Left + uiRect.Width * 0.14f, uiRect.Top + uiRect.Height * 0.905f, uiRect.Width * 0.72f, uiRect.Height * 0.1f, HorizontalAlign.Center);
  52.                 };
  53.                
  54.             if (Hud.Game.NumberOfPlayersInGame == 2)
  55.                 {
  56.             ParagonPercentageDecorator.Paint(uiRect.Left + uiRect.Width * 0.14f, uiRect.Top + uiRect.Height * -0.145f, uiRect.Width * 0.72f, uiRect.Height * 0.1f, HorizontalAlign.Center);
  57.                 }; 
  58.                
  59.             if (Hud.Game.NumberOfPlayersInGame == 3)
  60.                 {
  61.             ParagonPercentageDecorator.Paint(uiRect.Left + uiRect.Width * 0.14f, uiRect.Top + uiRect.Height * -1.190f, uiRect.Width * 0.72f, uiRect.Height * 0.1f, HorizontalAlign.Center);
  62.                 };     
  63.                        
  64.             if (Hud.Game.NumberOfPlayersInGame == 4)
  65.                 {
  66.             ParagonPercentageDecorator.Paint(uiRect.Left + uiRect.Width * 0.14f, uiRect.Top + uiRect.Height * -2.24f, uiRect.Width * 0.72f, uiRect.Height * 0.1f, HorizontalAlign.Center);
  67.                 }; 
  68.                
  69.                
  70.                
  71.         }
  72.  
  73.     }
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement