ISchedulerService
Interface ISchedulerService
Namespace: SwiftlyS2.Shared.Scheduler
Assembly: SwiftlyS2.CS2.dll
public interface ISchedulerServiceMethods
Delay(int, Action)
Add a delayed task to the scheduler.
CancellationTokenSource Delay(int delayTick, Action task)- CancellationTokenSource — A CancellationTokenSource that can be used to cancel the timer.
DelayAndRepeat(int, int, Action)
Add a delayed and repeated task to the scheduler.
CancellationTokenSource DelayAndRepeat(int delayTick, int periodTick, Action task)- delayTick int — The delay of the timer in ticks.
- periodTick int — The period of the timer in ticks.
- task Action — The task to execute.
- CancellationTokenSource — A CancellationTokenSource that can be used to cancel the timer.
DelayAndRepeatBySeconds(float, float, Action)
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)- delaySeconds float — The delay of the timer in seconds.
- periodSeconds float — The period of the timer in seconds.
- task Action — The task to execute.
- CancellationTokenSource — A CancellationTokenSource that can be used to cancel the timer.
DelayBySeconds(float, Action)
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)- CancellationTokenSource — A CancellationTokenSource that can be used to cancel the timer.
NextTick(Action)
Add a task to be executed on the next tick.
void NextTick(Action task)- task Action — The task to execute.
NextTick(Func<Task?>)
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)- task Func<Task?>
- InvalidOperationException — Thrown when this method is called.
NextTick<T>(Func<Task<T?>>)
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)- task Func<Task<T?>>
- T
- InvalidOperationException — Thrown when this method is called.
NextTickAsync(Action)
Add a task to be executed on the next tick asynchronously.
Task NextTickAsync(Action task)- task Action — The task to execute.
NextTickAsync(Func<Task?>)
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)- task Func<Task?>
- InvalidOperationException — Thrown when this method is called.
NextTickAsync<T>(Func<Task<T?>>)
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)- task Func<Task<T?>>
- T
- InvalidOperationException — Thrown when this method is called.
NextTickAsync<T>(Func<T>)
Add a task to be executed on the next tick asynchronously.
Task<T> NextTickAsync<T>(Func<T> task)- task Func<T> — The task to execute.
- T
NextWorldUpdate(Action)
Add a task to be executed on the next world update.
void NextWorldUpdate(Action task)- task Action — The task to execute.
NextWorldUpdate(Func<Task?>)
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)- task Func<Task?>
- InvalidOperationException — Thrown when this method is called.
NextWorldUpdate<T>(Func<Task<T?>>)
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)- task Func<Task<T?>>
- T
- InvalidOperationException — Thrown when this method is called.
NextWorldUpdateAsync(Action)
Add a task to be executed on the next world update asynchronously.
Task NextWorldUpdateAsync(Action task)- task Action — The task to execute.
NextWorldUpdateAsync(Func<Task?>)
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)- task Func<Task?>
- InvalidOperationException — Thrown when this method is called.
NextWorldUpdateAsync<T>(Func<Task<T?>>)
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)- task Func<Task<T?>>
- T
- InvalidOperationException — Thrown when this method is called.
NextWorldUpdateAsync<T>(Func<T>)
Add a task to be executed on the next world update asynchronously.
Task<T> NextWorldUpdateAsync<T>(Func<T> task)- task Func<T> — The task to execute.
- T
Repeat(int, Action)
Add a repeated task to the scheduler. This will be executed once immediately, and then every periodTick ticks.
CancellationTokenSource Repeat(int periodTick, Action task)- CancellationTokenSource — A CancellationTokenSource that can be used to cancel the timer.
RepeatBySeconds(float, Action)
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)- CancellationTokenSource — A CancellationTokenSource that can be used to cancel the timer.
StopOnMapChange(CancellationTokenSource)
Stop a timer when the map changes.
void StopOnMapChange(CancellationTokenSource cts)- cts CancellationTokenSource — The CancellationTokenSource to stop.