Commit Graph

15 Commits

Author SHA1 Message Date
辉鸭蛋
2396daf206 #767 2024-12-29 18:07:00 +08:00
辉鸭蛋
1dbb9e3bf1 auto pathing: optimize avatar switch 2024-10-26 14:46:38 +08:00
辉鸭蛋
11ec9bc45d refactor: CancellationTokenSource -> CancellationToken 2024-10-19 01:50:21 +08:00
辉鸭蛋
5a0f7226ed update ISoloTask
更新 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` 作为参数。
2024-09-23 00:04:09 +08:00
辉鸭蛋
8bb1d728ff refactor: solo task 2024-09-22 23:56:39 +08:00
辉鸭蛋
a06f0fcdb2 auto pathing: fix not releasing the mouse and keyboard when stopping tasks
更新日志和黑名单

移除 `PathExecutor.cs` 中的无用引用,重构 `Pathing` 方法,添加 `InitializePathing` 和 `ConvertWaypoints` 方法,提取传送点处理逻辑到 `HandleTeleportWaypoint` 方法。修改 `TpTask.cs` 中的日志格式为浮点数格式。将 `TaskRunner.cs` 中的 `FireAndForgetAsync` 方法重命名为 `RunThreadAsync`,并在 `ScriptService.cs` 中相应替换调用。为 `DpiHelper.cs` 中的 `ScaleY` 属性添加注释。更新 `pick_black_lists.json`,添加新的黑名单项 `"摆放巧像"`。在 `MapPathingViewModel.cs` 中添加 `_mapViewer` 字段,并在 `OnOpenMapViewer` 方法中使用。
2024-09-09 21:57:48 +08:00
辉鸭蛋
220d6a4f9b fix multi thread ui bug & rotate with dpi
优化 DPI 处理和异步任务执行

在 `PathExecutor.cs` 中,添加了对 `BetterGenshinImpact.Helpers` 的引用,并引入了 `DpiHelper` 来调整 `_dpi` 变量。
在 `PathExecutor` 类中,添加了 `_dpi` 变量,并在 `Pathing` 方法中初始化 `_dpi` 为 `DpiHelper.ScaleY`。
修改了 `RotateTo` 方法的 `controlRatio` 参数类型,从 `int` 改为 `double`,并在调用 `Simulation.SendInput.Mouse.MoveMouseBy` 时乘以 `_dpi` 进行 DPI 缩放。
在 `TaskRunner.cs` 中,添加了 `FireAndForgetAsync` 方法,用于异步执行任务。
在 `ScriptService.cs` 中,添加了对 `BetterGenshinImpact.Helpers` 的引用。
修改了 `ScriptService` 类中调用 `TaskRunner` 的方式,从 `RunAsync` 改为 `FireAndForgetAsync`。
在 `ScriptControlViewModel.cs` 中,简化了调用 `_scriptService.RunMulti` 的方式,去掉了多余的 `Task.Run` 包装。
2024-09-09 00:44:24 +08:00
辉鸭蛋
ca6994a720 auto pathing : first version 2024-09-08 15:16:02 +08:00
辉鸭蛋
8fa071722e js : dispatcher.addTimer 2024-08-11 17:58:22 +08:00
辉鸭蛋
2c2e9c0303 supplement the mode of the runner 2024-08-11 10:41:01 +08:00
辉鸭蛋
26aa811e97 add script group runner 2024-08-11 00:09:25 +08:00
辉鸭蛋
65f2aad4c2 add tp click & fix mask window display 2024-07-31 23:44:25 +08:00
辉鸭蛋
076a7596a0 refactor some code 2024-07-21 19:21:01 +08:00
辉鸭蛋
4243972eeb script async test 2024-07-21 12:42:39 +08:00
辉鸭蛋
9a76e5ad22 add common task runner 2024-07-20 21:57:39 +08:00