70 lines
1.9 KiB
C#
70 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using Svelto.Tasks.Lean;
|
|
using Svelto.Tasks.ExtraLean;
|
|
|
|
namespace GamecraftModdingAPI.Tasks
|
|
{
|
|
public static class Scheduler
|
|
{
|
|
public static Svelto.Tasks.Lean.Unity.UpdateMonoRunner leanRunnerUI
|
|
{
|
|
get
|
|
{
|
|
return RobocraftX.Schedulers.Lean.UIScheduler;
|
|
}
|
|
}
|
|
|
|
public static Svelto.Tasks.ExtraLean.Unity.UpdateMonoRunner extraLeanRunnerUI
|
|
{
|
|
get
|
|
{
|
|
return RobocraftX.Schedulers.ExtraLean.UIScheduler;
|
|
}
|
|
}
|
|
|
|
public static readonly Svelto.Tasks.ExtraLean.Unity.UpdateMonoRunner extraLeanRunner = new Svelto.Tasks.ExtraLean.Unity.UpdateMonoRunner("GamecraftModdingAPIExtraLean");
|
|
|
|
public static readonly Svelto.Tasks.Lean.Unity.UpdateMonoRunner leanRunner = new Svelto.Tasks.Lean.Unity.UpdateMonoRunner("GamecraftModdingAPILean");
|
|
|
|
public static void Schedule(ISchedulable toRun, bool extraLean = false, bool ui = false)
|
|
{
|
|
if (extraLean)
|
|
{
|
|
if (ui)
|
|
{
|
|
toRun.Run().RunOn(extraLeanRunnerUI);
|
|
}
|
|
else
|
|
{
|
|
toRun.Run().RunOn(extraLeanRunner);
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
if (ui)
|
|
{
|
|
toRun.Run().RunOn(leanRunnerUI);
|
|
}
|
|
else
|
|
{
|
|
toRun.Run().RunOn(leanRunner);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
public static void Dispose()
|
|
{
|
|
leanRunner.Stop();
|
|
extraLeanRunner.Stop();
|
|
leanRunner.Dispose();
|
|
extraLeanRunner.Dispose();
|
|
}
|
|
}
|
|
}
|