mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-25 10:05:49 +08:00
移除任务描述属性,新增路径属性以支持任务路径管理
This commit is contained in:
@@ -36,11 +36,11 @@ public class GearTaskData
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("task_type")]
|
||||
public string TaskType { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("path")]
|
||||
public string Path { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("is_enabled")]
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
@@ -59,10 +59,7 @@ public class GearTaskData
|
||||
|
||||
[JsonProperty("priority")]
|
||||
public int Priority { get; set; } = 0;
|
||||
|
||||
[JsonProperty("tags")]
|
||||
public string Tags { get; set; } = string.Empty;
|
||||
|
||||
|
||||
[JsonProperty("children")]
|
||||
public List<GearTaskData> Children { get; set; } = new();
|
||||
}
|
||||
@@ -252,7 +252,6 @@ public partial class GearTaskExecutor : ObservableObject
|
||||
var taskData = new GearTaskData
|
||||
{
|
||||
Name = viewModel.Name,
|
||||
Description = viewModel.Description,
|
||||
TaskType = viewModel.TaskType,
|
||||
IsEnabled = viewModel.IsEnabled,
|
||||
IsDirectory = viewModel.IsDirectory,
|
||||
@@ -260,7 +259,6 @@ public partial class GearTaskExecutor : ObservableObject
|
||||
CreatedTime = viewModel.CreatedTime,
|
||||
ModifiedTime = viewModel.ModifiedTime,
|
||||
Priority = viewModel.Priority,
|
||||
Tags = viewModel.Tags ?? string.Empty
|
||||
};
|
||||
|
||||
// 递归转换子任务
|
||||
|
||||
@@ -201,7 +201,6 @@ public class GearTaskStorageService
|
||||
return new GearTaskData
|
||||
{
|
||||
Name = viewModel.Name,
|
||||
Description = viewModel.Description,
|
||||
TaskType = viewModel.TaskType,
|
||||
IsEnabled = viewModel.IsEnabled,
|
||||
// 当 Children 存在值的情况下,IsDirectory 必定为 true
|
||||
@@ -210,7 +209,6 @@ public class GearTaskStorageService
|
||||
CreatedTime = viewModel.CreatedTime,
|
||||
ModifiedTime = viewModel.ModifiedTime,
|
||||
Priority = viewModel.Priority,
|
||||
Tags = viewModel.Tags,
|
||||
Children = children
|
||||
};
|
||||
}
|
||||
@@ -245,7 +243,7 @@ public class GearTaskStorageService
|
||||
var viewModel = new GearTaskViewModel
|
||||
{
|
||||
Name = data.Name,
|
||||
Description = data.Description,
|
||||
Path = data.Path,
|
||||
TaskType = data.TaskType,
|
||||
IsEnabled = data.IsEnabled,
|
||||
IsDirectory = data.IsDirectory,
|
||||
@@ -253,7 +251,6 @@ public class GearTaskStorageService
|
||||
CreatedTime = data.CreatedTime,
|
||||
ModifiedTime = data.ModifiedTime,
|
||||
Priority = data.Priority,
|
||||
Tags = data.Tags
|
||||
};
|
||||
|
||||
// 递归转换子任务
|
||||
|
||||
@@ -12,6 +12,9 @@ public partial class GearTaskViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string _name = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _path = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _description = string.Empty;
|
||||
@@ -149,6 +152,7 @@ public partial class GearTaskViewModel : ObservableObject
|
||||
var clone = new GearTaskViewModel
|
||||
{
|
||||
Name = Name,
|
||||
Path = Path,
|
||||
Description = Description,
|
||||
TaskType = TaskType,
|
||||
IsEnabled = IsEnabled,
|
||||
|
||||
@@ -151,12 +151,12 @@ public partial class GearTaskListPageViewModel : ViewModel
|
||||
var sampleTask = new GearTaskDefinitionViewModel("示例任务组", "这是一个示例任务组");
|
||||
if (sampleTask.RootTask != null)
|
||||
{
|
||||
sampleTask.RootTask.AddChild(new GearTaskViewModel("采集任务1") { TaskType = "采集任务", Description = "采集莲花" });
|
||||
sampleTask.RootTask.AddChild(new GearTaskViewModel("战斗任务1") { TaskType = "战斗任务", Description = "击败史莱姆" });
|
||||
sampleTask.RootTask.AddChild(new GearTaskViewModel("采集任务1") { TaskType = "采集任务" });
|
||||
sampleTask.RootTask.AddChild(new GearTaskViewModel("战斗任务1") { TaskType = "战斗任务" });
|
||||
|
||||
var subGroup = new GearTaskViewModel("子任务组", true);
|
||||
subGroup.AddChild(new GearTaskViewModel("传送任务1") { TaskType = "传送任务", Description = "传送到蒙德" });
|
||||
subGroup.AddChild(new GearTaskViewModel("交互任务1") { TaskType = "交互任务", Description = "与NPC对话" });
|
||||
subGroup.AddChild(new GearTaskViewModel("传送任务1") { TaskType = "传送任务" });
|
||||
subGroup.AddChild(new GearTaskViewModel("交互任务1") { TaskType = "交互任务" });
|
||||
sampleTask.RootTask.AddChild(subGroup);
|
||||
}
|
||||
|
||||
@@ -350,10 +350,10 @@ public partial class GearTaskListPageViewModel : ViewModel
|
||||
if (jsSelectionWindow.DialogResult && jsSelectionWindow.ViewModel.SelectedScript != null)
|
||||
{
|
||||
var selectedScript = jsSelectionWindow.ViewModel.SelectedScript;
|
||||
newTask = new GearTaskViewModel(selectedScript.DisplayName)
|
||||
newTask = new GearTaskViewModel(selectedScript.Manifest.Name)
|
||||
{
|
||||
TaskType = "Javascript",
|
||||
Description = selectedScript.Description ?? "JS脚本任务"
|
||||
Path = @$"{{jsUserFolder}}\{selectedScript.FolderName}\"
|
||||
};
|
||||
}
|
||||
else
|
||||
@@ -373,7 +373,6 @@ public partial class GearTaskListPageViewModel : ViewModel
|
||||
newTask = new GearTaskViewModel(dialogResult.TaskName)
|
||||
{
|
||||
TaskType = dialogResult.TaskType,
|
||||
Description = dialogResult.TaskDescription
|
||||
};
|
||||
}
|
||||
|
||||
@@ -419,10 +418,7 @@ public partial class GearTaskListPageViewModel : ViewModel
|
||||
return; // 用户取消了操作
|
||||
}
|
||||
|
||||
var newGroup = new GearTaskViewModel(groupName, true)
|
||||
{
|
||||
Description = "新创建的任务组"
|
||||
};
|
||||
var newGroup = new GearTaskViewModel(groupName, true);
|
||||
|
||||
// 如果有选中的节点,则在选中节点下新增
|
||||
// 如果未选择节点,则在根节点下直接新增
|
||||
|
||||
Reference in New Issue
Block a user