ISchedulerService
Interfacepublic interface ISchedulerServiceMethods
Add an advanced timer to the scheduler.
CancellationTokenSource AddTimer(Func<ITimerContext, TimerStep> task)- taskFunc<ITimerContext, TimerStep>The task to execute.
Add a delayed task to the scheduler.
CancellationTokenSource Delay(int delayTick, Action task)Add a delayed and repeated task to the scheduler.
CancellationTokenSource DelayAndRepeat(int delayTick, int periodTick, Action task)Add a delayed and repeated task to the scheduler. The timing is based on game tick, which means it becomes inaccurate when intervals approachs 1 tick (approximately 15ms).
CancellationTokenSource DelayAndRepeatBySeconds(float delaySeconds, float periodSeconds, Action task)Add a delayed task to the scheduler. The timing is based on game tick, which means it becomes inaccurate when intervals approachs 1 tick (approximately 15ms).
CancellationTokenSource DelayBySeconds(float delaySeconds, Action task)Add a task to be executed on the next tick.
void NextTick(Action task)- taskActionThe task to execute.
Never use this! you should never calls async callback in next tick, because async callback have chance to run in async context, which breaks the the synchronization safety this function gives.
[Obsolete("Please remove the async modifier on your callback for safety reason. See comments for more details.")]
void NextTick(Func<Task?> task)- InvalidOperationExceptionThrown when this method is called.
Never use this! you should never calls async callback in next tick, because async callback have chance to run in async context, which breaks the the synchronization safety this function gives.
[Obsolete("Please remove the async modifier on your callback for safety reason. See comments for more details.")]
void NextTick<T>(Func<Task<T?>> task)- InvalidOperationExceptionThrown when this method is called.
Add a task to be executed on the next tick asynchronously.
Task NextTickAsync(Action task)- taskActionThe task to execute.
Never use this! you should never calls async callback in next tick, because async callback have chance to run in async context, which breaks the the synchronization safety this function gives.
[Obsolete("Please remove the async modifier on your callback for safety reason. See comments for more details.")]
void NextTickAsync(Func<Task?> task)- InvalidOperationExceptionThrown when this method is called.
Never use this! you should never calls async callback in next tick, because async callback have chance to run in async context, which breaks the the synchronization safety this function gives.
[Obsolete("Please remove the async modifier on your callback for safety reason. See comments for more details.")]
void NextTickAsync<T>(Func<Task<T?>> task)- InvalidOperationExceptionThrown when this method is called.
Add a task to be executed on the next tick asynchronously.
Task<T> NextTickAsync<T>(Func<T> task)- taskFunc<T>The task to execute.
Add a task to be executed on the next world update.
void NextWorldUpdate(Action task)- taskActionThe task to execute.
Never use this! you should never calls async callback in next world update, because async callback have chance to run in async context, which breaks the the synchronization safety this function gives.
[Obsolete("Please remove the async modifier on your callback for safety reason. See comments for more details.")]
void NextWorldUpdate(Func<Task?> task)- InvalidOperationExceptionThrown when this method is called.
Never use this! you should never calls async callback in next world update, because async callback have chance to run in async context, which breaks the the synchronization safety this function gives.
[Obsolete("Please remove the async modifier on your callback for safety reason. See comments for more details.")]
void NextWorldUpdate<T>(Func<Task<T?>> task)- InvalidOperationExceptionThrown when this method is called.
Add a task to be executed on the next world update asynchronously.
Task NextWorldUpdateAsync(Action task)- taskActionThe task to execute.
Never use this! you should never calls async callback in next world update, because async callback have chance to run in async context, which breaks the the synchronization safety this function gives.
[Obsolete("Please remove the async modifier on your callback for safety reason. See comments for more details.")]
void NextWorldUpdateAsync(Func<Task?> task)- InvalidOperationExceptionThrown when this method is called.
Never use this! you should never calls async callback in next world update, because async callback have chance to run in async context, which breaks the the synchronization safety this function gives.
[Obsolete("Please remove the async modifier on your callback for safety reason. See comments for more details.")]
Task<T> NextWorldUpdateAsync<T>(Func<Task<T?>> task)- InvalidOperationExceptionThrown when this method is called.
Add a task to be executed on the next world update asynchronously.
Task<T> NextWorldUpdateAsync<T>(Func<T> task)- taskFunc<T>The task to execute.
Add a repeated task to the scheduler. This will be executed once immediately, and then every periodTick ticks.
CancellationTokenSource Repeat(int periodTick, Action task)Add a repeated task to the scheduler. This will be executed once immediately, and then every periodSeconds seconds. The timing is based on game tick, which means it becomes inaccurate when intervals approachs 1 tick (approximately 15ms).
CancellationTokenSource RepeatBySeconds(float periodSeconds, Action task)Stop a timer when the map changes.
void StopOnMapChange(CancellationTokenSource cts)- ctsCancellationTokenSourceThe CancellationTokenSource to stop.