No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

45 líneas
1023 B

  1. using System;
  2. namespace RenderHookAPI.Hook
  3. {
  4. public class TextDisplay
  5. {
  6. long _startTickCount = 0;
  7. public TextDisplay()
  8. {
  9. _startTickCount = DateTime.Now.Ticks;
  10. Display = true;
  11. }
  12. /// <summary>
  13. /// Must be called each frame
  14. /// </summary>
  15. public void Frame()
  16. {
  17. if (Display && Math.Abs(DateTime.Now.Ticks - _startTickCount) > Duration.Ticks)
  18. {
  19. Display = false;
  20. }
  21. }
  22. public bool Display { get; set; }
  23. public String Text { get; set; }
  24. public TimeSpan Duration { get; set; }
  25. public float Remaining
  26. {
  27. get
  28. {
  29. if (Display)
  30. {
  31. return (float)Math.Abs(DateTime.Now.Ticks - _startTickCount) / (float)Duration.Ticks;
  32. }
  33. else
  34. {
  35. return 0;
  36. }
  37. }
  38. }
  39. }
  40. }