Advertisement
Guest User

Untitled

a guest
Apr 12th, 2017
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.04 KB | None | 0 0
  1. using System.Globalization;
  2.  
  3. namespace Turbo.Plugins.DM
  4. {
  5.     using System.Linq;
  6.     using Turbo.Plugins.Default;
  7.    
  8.     public class DisplayCraftingMaterialPlugin : BasePlugin, IInGameTopPainter
  9.     {
  10.  
  11.         public TopLabelDecorator YellowDecorator { get; set; }
  12.         public TopLabelDecorator TealDecorator { get; set; }
  13.         public TopLabelDecorator BlueDecorator { get; set; }
  14.         public TopLabelDecorator WhiteDecorator { get; set; }
  15.         public TopLabelDecorator OrangeDecorator { get; set; }
  16.         public string PickItem { get; set; }
  17.        
  18.         public DisplayCraftingMaterialPlugin()
  19.         {
  20.             Enabled = true;
  21.         }
  22.  
  23.         public override void Load(IController hud)
  24.         {
  25.             base.Load(hud);
  26.            
  27.             YellowDecorator = new TopLabelDecorator(Hud)
  28.             {
  29.                 TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 200, 205, 50, false, false, false),
  30.                 BackgroundTexture1 = Hud.Texture.ButtonTextureGray,
  31.                 BackgroundTexture2 = Hud.Texture.BackgroundTextureOrange,
  32.                 BackgroundTextureOpacity1 = 1.0f,
  33.                 BackgroundTextureOpacity2 = 1.0f,
  34.                 TextFunc = () => Hud.Game.Me.Materials.VeiledCrystal.ToString("D", CultureInfo.InvariantCulture),
  35.                 HintFunc = () => "Amount of Veiled Crystals",
  36.             };
  37.            
  38.             TealDecorator = new TopLabelDecorator(Hud)
  39.             {
  40.                 TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 50, 200, 205, false, false, false),
  41.                 BackgroundTexture1 = Hud.Texture.ButtonTextureGray,
  42.                 BackgroundTexture2 = Hud.Texture.BackgroundTextureOrange,
  43.                 BackgroundTextureOpacity1 = 1.0f,
  44.                 BackgroundTextureOpacity2 = 1.0f,
  45.                 TextFunc = () => Hud.Game.Me.Materials.DeathsBreath.ToString("D", CultureInfo.InvariantCulture),
  46.                 HintFunc = () => "Amount of Death's Breaths",
  47.             };
  48.            
  49.             BlueDecorator = new TopLabelDecorator(Hud)
  50.             {
  51.                 TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 50, 122, 205, false, false, false),
  52.                 BackgroundTexture1 = Hud.Texture.ButtonTextureGray,
  53.                 BackgroundTexture2 = Hud.Texture.BackgroundTextureOrange,
  54.                 BackgroundTextureOpacity1 = 1.0f,
  55.                 BackgroundTextureOpacity2 = 1.0f,
  56.                 TextFunc = () => Hud.Game.Me.Materials.ArcaneDust.ToString("D", CultureInfo.InvariantCulture),
  57.                 HintFunc = () => "Amount of Acrane Dusts",
  58.             };
  59.            
  60.             WhiteDecorator = new TopLabelDecorator(Hud)
  61.             {
  62.                 TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 255, 255, 255, false, false, false),
  63.                 BackgroundTexture1 = Hud.Texture.ButtonTextureGray,
  64.                 BackgroundTexture2 = Hud.Texture.BackgroundTextureOrange,
  65.                 BackgroundTextureOpacity1 = 1.0f,
  66.                 BackgroundTextureOpacity2 = 1.0f,
  67.                 TextFunc = () => Hud.Game.Me.Materials.ReusableParts.ToString("D", CultureInfo.InvariantCulture),
  68.                 HintFunc = () => "Amount of Reusable Parts",
  69.             };
  70.            
  71.             OrangeDecorator = new TopLabelDecorator(Hud)
  72.             {
  73.                 TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 205, 133, 50, false, false, false),
  74.                 BackgroundTexture1 = Hud.Texture.ButtonTextureGray,
  75.                 BackgroundTexture2 = Hud.Texture.BackgroundTextureOrange,
  76.                 BackgroundTextureOpacity1 = 1.0f,
  77.                 BackgroundTextureOpacity2 = 1.0f,
  78.                 TextFunc = () => Hud.Game.Me.Materials.ForgottenSoul.ToString("D", CultureInfo.InvariantCulture),
  79.                 HintFunc = () => "Amount of Forgotten Souls",
  80.             };
  81.  
  82.         }
  83.  
  84.         public void PaintTopInGame(ClipState clipState)
  85.         {
  86.             if (Hud.Render.UiHidden) return;
  87.             if (clipState != ClipState.BeforeClip) return;
  88.  
  89.             var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.game_dialog_backgroundScreenPC.game_window_hud_overlay").Rectangle;
  90.        
  91.             var decorator = DecoratorSelect(PickItem);
  92.            
  93.             decorator.Paint(uiRect.Left + uiRect.Width * 0.607f, uiRect.Top + uiRect.Height * 0.88f, uiRect.Width * 0.038f, uiRect.Height * 0.12f, HorizontalAlign.Center);
  94.            
  95.         }      
  96.        
  97.         public TopLabelDecorator DecoratorSelect(string Item)
  98.         {
  99.             switch (Item) {
  100.                 case "ReusableParts":
  101.                     return WhiteDecorator;
  102.                 case "ArcaneDust":
  103.                     return BlueDecorator;
  104.                 case "VeiledCrystal":
  105.                     return YellowDecorator;
  106.                 case "DeathsBreath":
  107.                     return TealDecorator;
  108.                 case "ForgottenSoul":
  109.                     return OrangeDecorator;
  110.                 default:
  111.                     return OrangeDecorator;
  112.             }        
  113.         }
  114.        
  115.     }
  116.  
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement