Advertisement
JackCeparou

GLQ_RedDoorMarker

Jul 31st, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.60 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Turbo.Plugins.Default;
  4.  
  5. namespace Turbo.Plugins.glq
  6. {
  7.     public class GLQ_RedDoorMarker : BasePlugin, IInGameWorldPainter, INewAreaHandler, IInGameTopPainter
  8.     {
  9.         public WorldDecoratorCollection MarkerDecorator { get; set; }
  10.         public TopLabelWithTitleDecorator FinishedDecorator { get; set; }
  11.         public TopLabelWithTitleDecorator TimesDecorator { get; set; }
  12.  
  13.         private bool redDoor0;
  14.         private bool redDoor1;
  15.         private bool redDoor2;
  16.         private bool redDoor3;
  17.         private bool finished;
  18.         private int times;
  19.         private HashSet<uint> _actorSnoList = new HashSet<uint>();
  20.  
  21.         public GLQ_RedDoorMarker()
  22.         {
  23.             Enabled = true;
  24.         }
  25.  
  26.         public override void Load(IController hud)
  27.         {
  28.             base.Load(hud);
  29.  
  30.             MarkerDecorator = new WorldDecoratorCollection(
  31.                 new GroundLabelDecorator(Hud)
  32.                 {
  33.                     BackgroundBrush = Hud.Render.CreateBrush(255, 255, 0, 0, 0),
  34.                     BorderBrush = Hud.Render.CreateBrush(192, 255, 255, 255, 1),
  35.                     TextFont = Hud.Render.CreateFont("tahoma", 10f, 255, 255, 255, 255, true, false, false),
  36.                 }
  37.             );
  38.  
  39.             FinishedDecorator = new TopLabelWithTitleDecorator(Hud)
  40.             {
  41.                 TextFont = Hud.Render.CreateFont("tahoma", 9, 255, 255, 0, 0, true, false, true),
  42.             };
  43.  
  44.             TimesDecorator = new TopLabelWithTitleDecorator(Hud)
  45.             {
  46.                 TextFont = Hud.Render.CreateFont("tahoma", 8, 255, 239, 220, 129, false, false, true),
  47.             };
  48.  
  49.             _actorSnoList.Add(258384); //Uber_PortalSpot0
  50.             _actorSnoList.Add(258385); //Uber_PortalSpot1
  51.             _actorSnoList.Add(258386); //Uber_PortalSpot2
  52.             _actorSnoList.Add(366533); //Uber_PortalSpot3
  53.         }
  54.  
  55.         public void OnNewArea(bool newGame, ISnoArea area)
  56.         {
  57.             if (newGame)
  58.             {
  59.                 redDoor0 = false;
  60.                 redDoor1 = false;
  61.                 redDoor2 = false;
  62.                 redDoor3 = false;
  63.                 finished = false;
  64.             }
  65.             else
  66.             {
  67.                 if (area.Sno == 256767) redDoor0 = true;
  68.                 if (area.Sno == 256106) redDoor1 = true;
  69.                 if (area.Sno == 256742) redDoor2 = true;
  70.                 if (area.Sno == 374239) redDoor3 = true;
  71.  
  72.                 if (redDoor0 && redDoor1 && redDoor2 && redDoor3 && !finished)
  73.                 {
  74.                     times++;
  75.                     finished = true;
  76.                 }
  77.             }
  78.         }
  79.  
  80.         public void PaintWorld(WorldLayer layer)
  81.         {
  82.             if (layer != WorldLayer.Ground) return;
  83.  
  84.             var actors = Hud.Game.Actors.Where(actor => actor.DisplayOnOverlay && _actorSnoList.Contains(actor.SnoActor.Sno));
  85.             foreach (var actor in actors)
  86.             {
  87.                 if (redDoor0 && actor.SnoActor.Sno == 258384) MarkerDecorator.Paint(layer, actor, actor.FloorCoordinate.Offset(0, 0, 6f), "A1装置已进入过");
  88.                 if (redDoor1 && actor.SnoActor.Sno == 258385) MarkerDecorator.Paint(layer, actor, actor.FloorCoordinate.Offset(0, 0, 6f), "A2装置已进入过");
  89.                 if (redDoor2 && actor.SnoActor.Sno == 258386) MarkerDecorator.Paint(layer, actor, actor.FloorCoordinate.Offset(0, 0, 6f), "A3装置已进入过");
  90.                 if (redDoor3 && actor.SnoActor.Sno == 366533) MarkerDecorator.Paint(layer, actor, actor.FloorCoordinate.Offset(0, 0, 6f), "A4装置已进入过");
  91.             }
  92.         }
  93.  
  94.         public void PaintTopInGame(ClipState clipState)
  95.         {
  96.             if (clipState != ClipState.BeforeClip) return;
  97.  
  98.             var ui = Hud.Render.GetUiElement("Root.NormalLayer.minimap_dialog_backgroundScreen.minimap_dialog_pve.BoostWrapper.BoostsDifficultyStackPanel.clock");
  99.             var ui2 = Hud.Render.GetUiElement("Root.NormalLayer.minimap_dialog_backgroundScreen.minimap_dialog_pve.minimap_pve_main");
  100.             var w = 0;
  101.             var h = ui.Rectangle.Height;
  102.             var XPos = ui2.Rectangle.Left + ui2.Rectangle.Width / 3.5f;
  103.             var YPos = ui.Rectangle.Top;
  104.  
  105.             if (finished)
  106.             {
  107.                 FinishedDecorator.Paint(XPos, YPos - h, w, h, "当前房间所有红门已进入过");
  108.             }
  109.  
  110.             if (times != 0)
  111.             {
  112.                 TimesDecorator.Paint(XPos, YPos, w, h, "地狱火护符任务已完成:" + times);
  113.             }
  114.         }
  115.     }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement