Merge pull request #1240 from physligl/main

feat: add _autoPickEnabled to script group
This commit is contained in:
辉鸭蛋
2025-03-05 09:55:42 +08:00
committed by GitHub
3 changed files with 32 additions and 7 deletions

View File

@@ -13,7 +13,10 @@ public partial class PathingPartyConfig : ObservableObject
// 配置是否启用,不启用会使用路径追踪内的条件配置
[ObservableProperty]
private bool _enabled = false;
// 是否启用自动拾取
[ObservableProperty]
private bool _autoPickEnabled = true;
// 切换到队伍的名称
[ObservableProperty]
private string _partyName = string.Empty;

View File

@@ -157,15 +157,14 @@ public partial class ScriptGroupProject : ObservableObject
{
// 加载并执行
var task = PathingTask.BuildFromFilePath(Path.Combine(MapPathingViewModel.PathJsonPath, FolderName, Name));
TaskTriggerDispatcher.Instance().AddTrigger("AutoPick", null);
var pathingTask = new PathExecutor(CancellationContext.Instance.Cts.Token);
pathingTask.PartyConfig = GroupInfo?.Config.PathingConfig;
if (pathingTask.PartyConfig is null || pathingTask.PartyConfig.AutoPickEnabled)
{
TaskTriggerDispatcher.Instance().AddTrigger("AutoPick", null);
}
await pathingTask.Pathing(task);
}
else
{
//throw new Exception("不支持的脚本类型");
}
}
partial void OnTypeChanged(string value)

View File

@@ -49,7 +49,30 @@
</Grid>
</ui:CardExpander.Header>
<StackPanel>
<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:ToggleSwitch Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="1"
IsChecked="{Binding PathingConfig.AutoPickEnabled}"/>
</Grid>
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />