mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-04-28 22:59:45 +08:00
战斗配置增加超时,调度器增加清空功能
This commit is contained in:
@@ -27,4 +27,10 @@ public partial class AutoFightConfig : ObservableObject
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _pickDropsAfterFightEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// 战斗超时,单位秒
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private int _timeout = 120;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
//战斗前检查,可做成配置
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -207,11 +207,11 @@
|
||||
</ui:DropDownButton.Flyout>
|
||||
</ui:DropDownButton>
|
||||
<Separator Width="10" Opacity="0" />
|
||||
<ui:DropDownButton Content="更多功能" Icon="{ui:SymbolIcon Add24}">
|
||||
<ui:DropDownButton Content="更多功能">
|
||||
<ui:DropDownButton.Flyout>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="清空" Command="{Binding ClearTasksCommand}" />
|
||||
<MenuItem Header="根据文件夹更新" Command="{Binding UpdateTasksCommand}" />
|
||||
<!--<MenuItem Header="根据文件夹更新" Command="{Binding UpdateTasksCommand}" />-->
|
||||
</ContextMenu>
|
||||
</ui:DropDownButton.Flyout>
|
||||
</ui:DropDownButton>
|
||||
|
||||
@@ -506,6 +506,31 @@
|
||||
Margin="0,0,36,0"
|
||||
IsChecked="{Binding Config.AutoFightConfig.PickDropsAfterFightEnabled, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="战斗超时(秒)"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="当战斗超过一定时间后,自动停止战斗"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="120"
|
||||
Text="{Binding Config.AutoFightConfig.Timeout}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
d:DesignHeight="850"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Height="800">
|
||||
<StackPanel Margin="42,16,42,12">
|
||||
|
||||
<ui:CardExpander Margin="0,0,0,12"
|
||||
@@ -401,6 +401,31 @@
|
||||
Margin="0,0,36,0"
|
||||
IsChecked="{Binding PathingConfig.AutoFightConfig.PickDropsAfterFightEnabled, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
FontTypography="Body"
|
||||
Text="战斗超时(秒)"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBlock Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Foreground="{ui:ThemeResource TextFillColorTertiaryBrush}"
|
||||
Text="当战斗超过一定时间后,自动停止战斗"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:TextBox Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
MinWidth="120"
|
||||
Text="{Binding PathingConfig.AutoFightConfig.Timeout}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</ui:CardExpander>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user