A stable modding interface between Techblox and mods https://mod.exmods.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Scheduler.cs 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Svelto.Tasks.Lean;
  7. using Svelto.Tasks.ExtraLean;
  8. namespace GamecraftModdingAPI.Tasks
  9. {
  10. public static class Scheduler
  11. {
  12. public static Svelto.Tasks.Lean.Unity.UpdateMonoRunner leanRunnerUI
  13. {
  14. get
  15. {
  16. return RobocraftX.Schedulers.Lean.UIScheduler;
  17. }
  18. }
  19. public static Svelto.Tasks.ExtraLean.Unity.UpdateMonoRunner extraLeanRunnerUI
  20. {
  21. get
  22. {
  23. return RobocraftX.Schedulers.ExtraLean.UIScheduler;
  24. }
  25. }
  26. public static readonly Svelto.Tasks.ExtraLean.Unity.UpdateMonoRunner extraLeanRunner = new Svelto.Tasks.ExtraLean.Unity.UpdateMonoRunner("GamecraftModdingAPIExtraLean");
  27. public static readonly Svelto.Tasks.Lean.Unity.UpdateMonoRunner leanRunner = new Svelto.Tasks.Lean.Unity.UpdateMonoRunner("GamecraftModdingAPILean");
  28. public static void Schedule(ISchedulable toRun, bool extraLean = false, bool ui = false)
  29. {
  30. if (extraLean)
  31. {
  32. if (ui)
  33. {
  34. toRun.Run().RunOn(extraLeanRunnerUI);
  35. }
  36. else
  37. {
  38. toRun.Run().RunOn(extraLeanRunner);
  39. }
  40. }
  41. else
  42. {
  43. if (ui)
  44. {
  45. toRun.Run().RunOn(leanRunnerUI);
  46. }
  47. else
  48. {
  49. toRun.Run().RunOn(leanRunner);
  50. }
  51. }
  52. }
  53. public static void Dispose()
  54. {
  55. leanRunner.Stop();
  56. extraLeanRunner.Stop();
  57. leanRunner.Dispose();
  58. extraLeanRunner.Dispose();
  59. }
  60. }
  61. }