mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 10:32:19 +08:00
rft: Wpf一键长草任务配置重构 (#15385)
* rft: 已重构部分 * rft: 差stageList * rft: 补上界园常乐 * rft: 备选关卡 * i18n: 添加关卡 & 备选 * fix: 任务添加出错时中断 * fix: 当前上次关卡转换错误 * fix: 当前上次关卡转换错误 * rft: 刷理智任务序列化 * perf: 糊点 * fix: 漏了一个 * rft: 迁移标记 * fix: 加上剿灭 * fix: index漏了 * fix: 重构后的基建计划 * chore: customTask弃用多任务 * perf: 周几选择框动画 * fix: 移除备选CheckBox * perf: 刷理智-剿灭不上传企鹅 * rft: rename * feat: 刷理智 周几 设置 * chore: sync * revert: debug * revert: 使用备选关卡 * feat: 下拉框 # Conflicts: # src/MaaWpfGui/Views/UserControl/TaskQueue/FightSettingsUserControl.xaml * rft: rename * fix: config * feat: stageList刷新, 差移除过期关卡 * perf: StageListSource 当日未开放 * fix: bingding * perf: UI 上下布局 * Revert "perf: UI 上下布局" This reverts commitdf39cb2f09. * feat: 增加默认隐藏的删除和拖动区域 * chore: 优化触发事件绑定 * perf: 优化全反选按钮布局 * feat: 添加任务列表的删除和重命名 * perf: idle 或 inited 为 false 时禁用删除和重命名 * chore: 确保 StagePlan 有一个元素 * fix: ComboBox无法滚动 * Revert "perf: idle 或 inited 为 false 时禁用删除和重命名" This reverts commite0b71b53b6. * perf: 非 idle 期间禁止重命名或删除任务 * feat: 添加启用周计划勾选框 * perf: 不启用周计划时不重置 * perf: 优化滚动 * fix: 一键长草任务添加或跳过时提示修复 * i18n: TaskQueue 添加任务失败 / 跳过 * feat: config 保存 * perf: 删除任务Dialog增加任务类型文本 * rft: 任务可见rename * rft: 删除任务 & 任务切换 * perf: 合并备选 & 非备选的关卡选择 * fix: index * rft: 任务设置界面刷新 * fix: 任务设置界面 * fix: 移除最后一个任务后不会自动选中上一个 * fix: stageList刷新 * perf: 当StageList仅存在一个关卡时隐藏删除按钮 * fix: 刷理智-手动输入关卡代码自动补全 * i18n: 添加关卡 * fix: CreditFightOnceADay set * fix: ExpectedCollapsalParadigms set * perf: 移除无用注释 & 变量 * feat: 迁移前加个备份 * fix: 刷理智迁移时重复添加关卡 * fix: 移除信用任务中设置基建任务的UI * fix: TaskId * fix: 任务后状态重置 * fix: 基建任务检查 * Revert "fix: 移除信用任务中设置基建任务的UI" This reverts commit1f51b5fe00. * fix: 收取信用任务的基建设置说明 * fix: TaskQueue & 基建房间 拖动容器限制 * fix: CanShowAutoReload * fix: CustomTask适配 * fix: 任务设置改名删除Context绑定 * perf: 移除 StagePlanItem 的 Index * rft: TaskId 迁移 * feat: TaskStatus 显示任务颜色 * perf: UI状态颜色 for Light * perf: config迁移 * fix: base * perf: 调整界面布局 * perf: 调整运行时任务的颜色,调整圆角 * fix: 拖动标签后无法修改配置 * fix: 部分元素在运行中时未被正确禁用 * fix: 是 move 不是 swap * docs: 移除文档中关于 `剩余理智` & `备选关卡`中剿灭任务相关的特殊逻辑 * i18n: update introduction\combat for zh-tw * i18n: KR * i18n: update zh-tw.xaml --------- Co-authored-by: uye <99072975+ABA2396@users.noreply.github.com> Co-authored-by: momomochi987 <as99us301@gmail.com> Co-authored-by: HX3N <scarlet7518@gmail.com>
This commit is contained in:
@@ -12,9 +12,11 @@
|
||||
// </copyright>
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using MaaWpfGui.Configuration.Single.MaaTask;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Constants.Enums;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Main;
|
||||
using MaaWpfGui.Models.AsstTasks;
|
||||
@@ -25,7 +27,7 @@ using static MaaWpfGui.Main.AsstProxy;
|
||||
|
||||
namespace MaaWpfGui.ViewModels.UserControl.TaskQueue;
|
||||
|
||||
public class StartUpSettingsUserControlModel : TaskViewModel
|
||||
public class StartUpSettingsUserControlModel : TaskSettingsViewModel
|
||||
{
|
||||
static StartUpSettingsUserControlModel()
|
||||
{
|
||||
@@ -34,15 +36,12 @@ public class StartUpSettingsUserControlModel : TaskViewModel
|
||||
|
||||
public static StartUpSettingsUserControlModel Instance { get; }
|
||||
|
||||
private string _accountName = ConfigurationHelper.GetValue(ConfigurationKeys.AccountName, string.Empty).Trim();
|
||||
|
||||
public string AccountName
|
||||
{
|
||||
get => _accountName;
|
||||
get => GetTaskConfig<StartUpTask>().AccountName;
|
||||
set {
|
||||
value = value.Trim();
|
||||
SetAndNotify(ref _accountName, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.AccountName, value);
|
||||
SetTaskConfig<StartUpTask>(t => t.AccountName == value, t => t.AccountName = value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,12 +60,21 @@ public class StartUpSettingsUserControlModel : TaskViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public override void RefreshUI(BaseTask baseTask)
|
||||
{
|
||||
if (baseTask is StartUpTask)
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("使用SerializeTask作为代替")]
|
||||
public override (AsstTaskType Type, JObject Params) Serialize()
|
||||
{
|
||||
var clientType = SettingsViewModel.GameSettings.ClientType;
|
||||
var startGame = SettingsViewModel.GameSettings.StartGame;
|
||||
var accountName = clientType switch {
|
||||
"Official" or "Bilibili" => AccountName,
|
||||
ClientType.Official or ClientType.Bilibili => AccountName,
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
@@ -79,7 +87,7 @@ public class StartUpSettingsUserControlModel : TaskViewModel
|
||||
return task.Serialize();
|
||||
}
|
||||
|
||||
public override bool? SerializeTask(BaseTask baseTask, int? taskId = null)
|
||||
public override bool? SerializeTask(BaseTask? baseTask, int? taskId = null)
|
||||
{
|
||||
if (baseTask is not StartUpTask startUp)
|
||||
{
|
||||
@@ -88,7 +96,7 @@ public class StartUpSettingsUserControlModel : TaskViewModel
|
||||
|
||||
var clientType = SettingsViewModel.GameSettings.ClientType;
|
||||
var accountName = clientType switch {
|
||||
"Official" or "Bilibili" => startUp.AccountName,
|
||||
ClientType.Official or ClientType.Bilibili => startUp.AccountName,
|
||||
_ => string.Empty,
|
||||
};
|
||||
|
||||
@@ -98,13 +106,10 @@ public class StartUpSettingsUserControlModel : TaskViewModel
|
||||
AccountName = accountName,
|
||||
};
|
||||
|
||||
if (taskId is int id)
|
||||
{
|
||||
return Instances.AsstProxy.AsstSetTaskParamsEncoded(id, task);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Instances.AsstProxy.AsstAppendTaskWithEncoding(TaskType.StartUp, task);
|
||||
}
|
||||
return taskId switch {
|
||||
int id when id > 0 => Instances.AsstProxy.AsstSetTaskParamsEncoded(id, task),
|
||||
null => Instances.AsstProxy.AsstAppendTaskWithEncoding(TaskType.StartUp, task),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user