MainThreadUpdateRegister.cs 667 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. namespace XGame.Framework.ThreadScheduler
  3. {
  4. public static class MainThreadUpdateRegister
  5. {
  6. private static Action<int> _update;
  7. public static event Action<int> update
  8. {
  9. add
  10. {
  11. _update += value;
  12. }
  13. remove
  14. {
  15. _update -= value;
  16. }
  17. }
  18. public static void Update(int millisecond)
  19. {
  20. try
  21. {
  22. _update?.Invoke(millisecond);
  23. }
  24. catch (Exception ex)
  25. {
  26. Log.Exception(ex);
  27. }
  28. }
  29. }
  30. }