mirror of
https://github.com/babalae/better-genshin-impact
synced 2025-01-08 11:57:53 +08:00
fixed #837
This commit is contained in:
parent
99c8cd450e
commit
f3e16fbb77
@ -14,6 +14,11 @@ namespace BetterGenshinImpact.GameTask;
|
||||
/// </summary>
|
||||
public class RunnerContext : Singleton<RunnerContext>
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否是连续执行配置组的场景
|
||||
/// </summary>
|
||||
public bool IsContinuousRunGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前使用队伍名称
|
||||
/// 游戏内定义的队伍名称
|
||||
@ -42,6 +47,7 @@ public class RunnerContext : Singleton<RunnerContext>
|
||||
_combatScenes = null;
|
||||
}
|
||||
}
|
||||
|
||||
return _combatScenes;
|
||||
}
|
||||
|
||||
@ -50,9 +56,27 @@ public class RunnerContext : Singleton<RunnerContext>
|
||||
_combatScenes = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 任务结束后的清理
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
// 连续执行配置组的情况下,不清理当前队伍
|
||||
if (!IsContinuousRunGroup)
|
||||
{
|
||||
PartyName = null;
|
||||
}
|
||||
|
||||
_combatScenes = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 彻底恢复到初始状态
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
IsContinuousRunGroup = false;
|
||||
PartyName = null;
|
||||
_combatScenes = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -23,6 +23,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.Controls;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
@ -579,6 +580,7 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware
|
||||
return;
|
||||
}
|
||||
|
||||
RunnerContext.Instance.Reset();
|
||||
await _scriptService.RunMulti(SelectedScriptGroup.Projects, SelectedScriptGroup.Name);
|
||||
}
|
||||
|
||||
@ -692,11 +694,13 @@ public partial class ScriptControlViewModel : ObservableObject, INavigationAware
|
||||
|
||||
_logger.LogInformation("开始连续执行选中配置组:{Names}", string.Join(",", selectedGroups.Select(x => x.Name)));
|
||||
|
||||
RunnerContext.Instance.IsContinuousRunGroup = true;
|
||||
foreach (var scriptGroup in selectedGroups)
|
||||
{
|
||||
await _scriptService.RunMulti(scriptGroup.Projects, scriptGroup.Name);
|
||||
await Task.Delay(2000);
|
||||
}
|
||||
RunnerContext.Instance.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user