Advertisement
zjqyf

GLQ_GRProgressionToTime2

Aug 5th, 2017
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. using Turbo.Plugins.Default;
  2. namespace Turbo.Plugins.glq
  3. {
  4. public class GLQ_GRProgressionToTime : BasePlugin, IInGameTopPainter
  5. {
  6. public IFont TimeFont { get; set; }
  7. public GLQ_GRProgressionToTime()
  8. {
  9. Enabled = true;
  10. }
  11. public override void Load(IController hud)
  12. {
  13. base.Load(hud);
  14. }
  15. public void PaintTopInGame(ClipState clipState)
  16. {
  17. var ui = Hud.Render.GreaterRiftBarUiElement;
  18. if (clipState == ClipState.BeforeClip && Hud.Game.SpecialArea == SpecialArea.GreaterRift && ui.Visible)
  19. {
  20. var secondsLeft = (Hud.Game.CurrentTimedEventEndTick - (double)Hud.Game.CurrentGameTick) / 60.0d;
  21. var percent = Hud.Game.RiftPercentage;
  22. if (secondsLeft > 0)
  23. {
  24. var a = 9000000000 / ui.Rectangle.Width;
  25. var currentX = ui.Rectangle.Left + ui.Rectangle.Width / 100.0f * percent;
  26. var timeX = ui.Rectangle.Right - (float)(ui.Rectangle.Width / 900.0f * secondsLeft);
  27. var b = (currentX - timeX) * a;
  28. var text = "";
  29. if (b <= 0)
  30. {
  31. text = "- " + ValueToString((long)b, ValueFormat.LongTime);
  32. TimeFont = Hud.Render.CreateFont("tahoma", 7, 255, 250, 100, 100, true, false, 160, 0, 0, 0, true);
  33. }
  34. else
  35. {
  36. text = "+ " + ValueToString((long)b, ValueFormat.LongTime);
  37. TimeFont = Hud.Render.CreateFont("tahoma", 7, 255, 128, 255, 0, true, false, 160, 0, 0, 0, true);
  38. }
  39. var textLayout = TimeFont.GetTextLayout(text.ToString());
  40. var x = (float)currentX - textLayout.Metrics.Width / 2;
  41. var y = ui.Rectangle.Top - ui.Rectangle.Height * 0.1f - textLayout.Metrics.Height;
  42. TimeFont.DrawText(textLayout, x, y);
  43.  
  44.  
  45. }
  46. }
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement