diff --git a/BetterGenshinImpact/GameTask/AutoFight/AutoFightConfig.cs b/BetterGenshinImpact/GameTask/AutoFight/AutoFightConfig.cs index 585cbc37..f3c51cc9 100644 --- a/BetterGenshinImpact/GameTask/AutoFight/AutoFightConfig.cs +++ b/BetterGenshinImpact/GameTask/AutoFight/AutoFightConfig.cs @@ -27,4 +27,10 @@ public partial class AutoFightConfig : ObservableObject /// [ObservableProperty] private bool _pickDropsAfterFightEnabled = true; + + /// + /// 战斗超时,单位秒 + /// + [ObservableProperty] + private int _timeout = 120; } diff --git a/BetterGenshinImpact/GameTask/AutoFight/AutoFightParam.cs b/BetterGenshinImpact/GameTask/AutoFight/AutoFightParam.cs index 47da06ed..b5f08de8 100644 --- a/BetterGenshinImpact/GameTask/AutoFight/AutoFightParam.cs +++ b/BetterGenshinImpact/GameTask/AutoFight/AutoFightParam.cs @@ -9,4 +9,6 @@ public class AutoFightParam(string path) : BaseTaskParam public bool FightFinishDetectEnabled { get; set; } = false; public bool PickDropsAfterFightEnabled { get; set; } = false; + + public int Timeout { get; set; } = 120; } diff --git a/BetterGenshinImpact/GameTask/AutoFight/AutoFightTask.cs b/BetterGenshinImpact/GameTask/AutoFight/AutoFightTask.cs index d2d1f954..656020ed 100644 --- a/BetterGenshinImpact/GameTask/AutoFight/AutoFightTask.cs +++ b/BetterGenshinImpact/GameTask/AutoFight/AutoFightTask.cs @@ -64,7 +64,7 @@ public class AutoFightTask : ISoloTask ct.Register(cts2.Cancel); combatScenes.BeforeTask(cts2.Token); - TimeSpan fightTimeout = TimeSpan.FromSeconds(120); // 默认战斗超时时间 + TimeSpan fightTimeout = TimeSpan.FromSeconds(_taskParam.Timeout); // 默认战斗超时时间 Stopwatch stopwatch = Stopwatch.StartNew(); //战斗前检查,可做成配置 diff --git a/BetterGenshinImpact/GameTask/AutoPathing/Handler/AutoFightHandler.cs b/BetterGenshinImpact/GameTask/AutoPathing/Handler/AutoFightHandler.cs index 2566e77a..797043f6 100644 --- a/BetterGenshinImpact/GameTask/AutoPathing/Handler/AutoFightHandler.cs +++ b/BetterGenshinImpact/GameTask/AutoPathing/Handler/AutoFightHandler.cs @@ -44,7 +44,8 @@ internal class AutoFightHandler : IActionHandler AutoFightParam autoFightParam = new AutoFightParam(GetFightStrategy(config)) { FightFinishDetectEnabled = config.FightFinishDetectEnabled, - PickDropsAfterFightEnabled = config.PickDropsAfterFightEnabled + PickDropsAfterFightEnabled = config.PickDropsAfterFightEnabled, + Timeout = config.Timeout }; return autoFightParam; diff --git a/BetterGenshinImpact/View/Pages/ScriptControlPage.xaml b/BetterGenshinImpact/View/Pages/ScriptControlPage.xaml index 1d300b88..9d7e7cb9 100644 --- a/BetterGenshinImpact/View/Pages/ScriptControlPage.xaml +++ b/BetterGenshinImpact/View/Pages/ScriptControlPage.xaml @@ -207,11 +207,11 @@ - + - + diff --git a/BetterGenshinImpact/View/Pages/TaskSettingsPage.xaml b/BetterGenshinImpact/View/Pages/TaskSettingsPage.xaml index 73c7392a..124755d4 100644 --- a/BetterGenshinImpact/View/Pages/TaskSettingsPage.xaml +++ b/BetterGenshinImpact/View/Pages/TaskSettingsPage.xaml @@ -506,6 +506,31 @@ Margin="0,0,36,0" IsChecked="{Binding Config.AutoFightConfig.PickDropsAfterFightEnabled, Mode=TwoWay}" /> + + + + + + + + + + + + + diff --git a/BetterGenshinImpact/View/Pages/View/ScriptGroupConfigView.xaml b/BetterGenshinImpact/View/Pages/View/ScriptGroupConfigView.xaml index c8bf02a6..0d08eec3 100644 --- a/BetterGenshinImpact/View/Pages/View/ScriptGroupConfigView.xaml +++ b/BetterGenshinImpact/View/Pages/View/ScriptGroupConfigView.xaml @@ -13,7 +13,7 @@ d:DesignHeight="850" d:DesignWidth="800" mc:Ignorable="d"> - + + + + + + + + + + + + + + diff --git a/BetterGenshinImpact/ViewModel/Pages/TaskSettingsPageViewModel.cs b/BetterGenshinImpact/ViewModel/Pages/TaskSettingsPageViewModel.cs index 5f010e65..aaa9af98 100644 --- a/BetterGenshinImpact/ViewModel/Pages/TaskSettingsPageViewModel.cs +++ b/BetterGenshinImpact/ViewModel/Pages/TaskSettingsPageViewModel.cs @@ -232,7 +232,8 @@ public partial class TaskSettingsPageViewModel : ObservableObject, INavigationAw var param = new AutoFightParam(path) { FightFinishDetectEnabled = Config.AutoFightConfig.FightFinishDetectEnabled, - PickDropsAfterFightEnabled = Config.AutoFightConfig.PickDropsAfterFightEnabled + PickDropsAfterFightEnabled = Config.AutoFightConfig.PickDropsAfterFightEnabled, + Timeout = Config.AutoFightConfig.Timeout }; SwitchAutoFightEnabled = true;