Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: solo task #660

Merged
merged 2 commits into from
Sep 23, 2024
Merged

refactor: solo task #660

merged 2 commits into from
Sep 23, 2024

Conversation

huiyadanli
Copy link
Member

重构所有独立任务,使用新的任务执行器

更新 Start 方法以接受 CancellationTokenSource 参数

这些更改主要是为了使 `Start` 方法能够接受 `CancellationTokenSource` 参数,从而更好地控制任务的取消操作。通过传递 `CancellationTokenSource`,可以在需要时取消正在运行的任务,提高了代码的灵活性和可控性。

具体更改包括:
- 将 `Start` 方法的签名从无参数更改为接受 `CancellationTokenSource` 参数。
- 在多个任务类(如 `AutoDomainTask.cs`、`AutoFightTask.cs`、`AutoGeniusInvokationTask.cs`、`AutoMusicGameTask.cs`、`AutoWoodTask.cs`)中,更新 `Start` 方法以接受并使用传入的 `CancellationTokenSource`。
- 在 `Duel.cs` 中,更新 `RunAsync` 和 `Run` 方法的参数以接受 `CancellationTokenSource`,并将 `Cts` 赋值为传入的 `cts`。
- 在 `ISoloTask.cs` 接口中,更新 `Start` 方法的签名以接受 `CancellationTokenSource` 参数。
- 在 `TaskRunner.cs` 中,调用 `soloTask.Start` 时传入 `CancellationContext.Instance.Cts` 作为参数。
@huiyadanli huiyadanli merged commit f182e34 into main Sep 23, 2024
2 checks passed
@huiyadanli huiyadanli deleted the feat-solo-task branch September 23, 2024 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant