mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-04-24 22:19:49 +08:00
add more interrupt operation
在 KeyMouseMacroPlayer 类中添加取消请求检查
在 `KeyMouseMacroPlayer` 类中添加了一个检查取消请求的功能。
在处理每个宏事件之前,增加了以下代码:
if (ct.IsCancellationRequested)
{
return;
}
这段代码用于在取消请求被触发时,立即终止宏事件的重放。
This commit is contained in:
@@ -51,6 +51,11 @@ public class KeyMouseMacroPlayer
|
||||
var startTime = DateTime.UtcNow;
|
||||
foreach (var e in macroEvents)
|
||||
{
|
||||
if (ct.IsCancellationRequested)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var timeToWait = (int)(e.Time - (DateTime.UtcNow - startTime).TotalMilliseconds);
|
||||
if (timeToWait < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user