Advertisement
Guest User

Untitled

a guest
Mar 9th, 2020
665
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.35 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. using Turbo.Plugins.Miqui.CustomizableActorDecorators;
  3.  
  4. namespace Turbo.Plugins.Miqui
  5. {
  6.     class PhantasmDecoratorCustomizer : BasePlugin, ICustomizer {
  7.  
  8.         private class MainSpiritBarrageDecorator: IActorDecorator
  9.         {
  10.             private WorldDecoratorCollection MainSpiritBarrageCircle { get ; set ; }
  11.  
  12.             public MainSpiritBarrageDecorator(IController hud)
  13.             {
  14.                 MainSpiritBarrageCircle = new WorldDecoratorCollection(
  15.                     new GroundCircleDecorator(hud)
  16.                     {
  17.                         Brush = hud.Render.CreateBrush(100, 130, 213, 255, 10),
  18.                         Radius = 9.5F,
  19.                     },
  20.                     new GroundLabelDecorator(hud)
  21.                     {
  22.                         CountDownFrom = 10,
  23.                         TextFont = hud.Render.CreateFont("tahoma", 9, 220, 190, 243, 255, true, false, 230, 0, 0, 0, true),
  24.                     },
  25.                     new GroundTimerDecorator(hud)
  26.                     {
  27.                         CountDownFrom = 10,
  28.                         BackgroundBrushEmpty = hud.Render.CreateBrush(128, 0, 0, 0, 0),
  29.                         BackgroundBrushFill = hud.Render.CreateBrush(100, 130, 213, 255, 0),
  30.                         Radius = 30,
  31.                     }
  32.                 );
  33.             }
  34.  
  35.             WorldDecoratorCollection IActorDecorator.getActorDecorator(IController hud, IActor actor)
  36.             {
  37.                 return MainSpiritBarrageCircle;
  38.             }
  39.         }
  40.  
  41.         private class ExplosionSpiritBarrageDecorator: IActorDecorator
  42.         {
  43.             private WorldDecoratorCollection SolidExplosionSpiritBarrageCircle { get ; set ; }
  44.             private WorldDecoratorCollection DashedExplosionSpiritBarrageCircle { get ; set ; }
  45.  
  46.             public ExplosionSpiritBarrageDecorator(IController hud)
  47.             {
  48.                 // Shown when there is > 2 seconds left before explosion
  49.                 DashedExplosionSpiritBarrageCircle = new WorldDecoratorCollection(
  50.                     new GroundCircleDecorator(hud)
  51.                     {
  52.                         Brush = hud.Render.CreateBrush(100, 130, 213, 255, 3, SharpDX.Direct2D1.DashStyle.Dash),
  53.                         Radius = 15F,
  54.                     },
  55.                     new GroundLabelDecorator(hud)
  56.                     {
  57.                         Enabled = false,
  58.                         CountDownFrom = 10,
  59.                         TextFont = hud.Render.CreateFont("tahoma", 9, 220, 190, 243, 255, true, false, 230, 0, 0, 0, true),
  60.                     },
  61.                     new GroundTimerDecorator(hud)
  62.                     {
  63.                         Enabled = false,
  64.                         CountDownFrom = 10,
  65.                         BackgroundBrushEmpty = hud.Render.CreateBrush(128, 0, 0, 0, 0),
  66.                         BackgroundBrushFill = hud.Render.CreateBrush(100, 130, 213, 255, 0),
  67.                         Radius = 30,
  68.                     }
  69.                 );
  70.  
  71.                 // Shown when there is < 2 seconds left before explosion
  72.                 SolidExplosionSpiritBarrageCircle = new WorldDecoratorCollection(
  73.                     new GroundCircleDecorator(hud)
  74.                     {
  75.                         Brush = hud.Render.CreateBrush(100, 130, 213, 255, 3),
  76.                         Radius = 15F,
  77.                     },
  78.                     new GroundLabelDecorator(hud)
  79.                     {
  80.                         Enabled = false,
  81.                         CountDownFrom = 10,
  82.                         TextFont = hud.Render.CreateFont("tahoma", 9, 220, 190, 243, 255, true, false, 230, 0, 0, 0, true),
  83.                     },
  84.                     new GroundTimerDecorator(hud)
  85.                     {
  86.                         Enabled = false,
  87.                         CountDownFrom = 10,
  88.                         BackgroundBrushEmpty = hud.Render.CreateBrush(128, 0, 0, 0, 0),
  89.                         BackgroundBrushFill = hud.Render.CreateBrush(100, 130, 213, 255, 0),
  90.                         Radius = 30,
  91.                     }
  92.                 );
  93.             }
  94.  
  95.             WorldDecoratorCollection IActorDecorator.getActorDecorator(IController hud, IActor actor)
  96.             {
  97.                 int creationTick = actor.CreatedAtInGameTick;
  98.                 int currentTick = hud.Game.CurrentGameTick;
  99.                 int elapsedTimeSinceCreation = currentTick - creationTick;
  100.  
  101.                 // 60 frames per second, 1 frame = 1 tick, so 8 seconds is 60 * 8 ticks
  102.                 if (elapsedTimeSinceCreation > 60 * 8)
  103.                     return SolidExplosionSpiritBarrageCircle;
  104.  
  105.                 return DashedExplosionSpiritBarrageCircle;
  106.             }
  107.         }
  108.  
  109.         public PhantasmDecoratorCustomizer() {
  110.             Enabled = true;
  111.         }
  112.        
  113.         public override void Load(IController hud)
  114.         {
  115.             base.Load(hud);
  116.         }
  117.  
  118.         public void Customize()
  119.         {
  120.             Hud.RunOnPlugin<CustomizableActorDecoratorsPlugin>(plugin =>
  121.             {
  122.                 plugin.AddDecorator(ActorSnoEnum._wd_spiritbarragerune_aoe_ghostmodel, new MainSpiritBarrageDecorator(Hud));
  123.                 plugin.AddDecorator(ActorSnoEnum._wd_spiritbarragerune_aoe_ghostmodel, new ExplosionSpiritBarrageDecorator(Hud));
  124.             });
  125.         }
  126.     }
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement