Files
MaaAssistantArknights/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/ReclamationSettingsUserControlModel.cs
Michael Liu 刘嘉远 31805c16ef feat: 生稀盐酸-重启锚点 添加 RA15 支持 (#16667)
* feat: 新增生息演算「重启锚点」RA-15 关卡任务链

* feat: 生息演算 RA-1/RA-15 关卡选择 UI 及 Core 适配

新增 RelaunchAnchorStage 枚举,WPF 界面添加关卡选择下拉框,
C++ Core 根据 stage 参数加载对应的任务链入口。

* feat: 添加RA-15自己有初雪的版本

* fix: Delete resource/tasks/RA/Reclamation3-RA15-HaveCX.json

* fix: 增加识别已有初雪功能

* feat: 拆分 RA-1/RA-15 教程文本,根据关卡选择切换提示

* rft: 合并生稀盐酸文件,并抽取相同任务

* fix: MaaCore 为新盐酸修改为通用性入口

* fix: 生稀盐酸 wpfgui 提示文本选取逻辑优化

* chore: 修改生稀盐酸入口任务命名

* chore: 优化生稀盐酸提示文本

* fix: 重启锚点不再 fallback 关卡

* chore: 生稀盐酸目录结构优化

* chore: 移除旧任务入口

* fix: 修正提示描述

* chore: 优化key命名及选取逻辑

* chore: 修正翻译缩进

---------

Co-Authored-By: Michael Liu 刘嘉远 <walkerljy@163.com>
Co-authored-by: 晓丶梦丶仁 <74444214+Daydreamer114@users.noreply.github.com>
Co-authored-by: SherkeyXD <57581480+SherkeyXD@users.noreply.github.com>
2026-05-17 23:18:30 +08:00

231 lines
8.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// <copyright file="ReclamationSettingsUserControlModel.cs" company="MaaAssistantArknights">
// Part of the MaaWpfGui project, maintained by the MaaAssistantArknights team (Maa Team)
// Copyright (C) 2021-2025 MaaAssistantArknights Contributors
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License v3.0 only as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY
// </copyright>
#nullable enable
using System.Collections.Generic;
using System.Linq;
using MaaWpfGui.Configuration.Single.MaaTask;
using MaaWpfGui.Helper;
using MaaWpfGui.Models.AsstTasks;
using MaaWpfGui.Utilities;
using MaaWpfGui.Utilities.ValueType;
using MaaWpfGui.ViewModels.UI;
using static MaaWpfGui.Main.AsstProxy;
using Mode = MaaWpfGui.Configuration.Single.MaaTask.ReclamationMode;
using Stage = MaaWpfGui.Configuration.Single.MaaTask.RelaunchAnchorStage;
using Theme = MaaWpfGui.Configuration.Single.MaaTask.ReclamationTheme;
namespace MaaWpfGui.ViewModels.UserControl.TaskQueue;
public class ReclamationSettingsUserControlModel : TaskSettingsViewModel, ReclamationSettingsUserControlModel.ISerialize
{
static ReclamationSettingsUserControlModel()
{
Instance = new();
}
public static ReclamationSettingsUserControlModel Instance { get; }
/// <summary>
/// Gets the list of reclamation themes.
/// </summary>
public List<GenericCombinedData<Theme>> ReclamationThemeList { get; } =
[
new() { Display = $"{LocalizationHelper.GetString("ReclamationThemeFire")} ({LocalizationHelper.GetString("ClosedStage")})", Value = Theme.Fire },
new() { Display = LocalizationHelper.GetString("ReclamationThemeTales"), Value = Theme.Tales },
new() { Display = LocalizationHelper.GetString("ReclamationThemeRelaunchAnchor"), Value = Theme.RelaunchAnchor },
];
/// <summary>
/// Gets or sets 生息演算主题["Tales"].
/// </summary>
public Theme ReclamationTheme
{
get => GetTaskConfig<ReclamationTask>().Theme;
set => SetTaskConfig<ReclamationTask>(
t => t.Theme == value,
t =>
{
t.Theme = value;
if (value == Theme.RelaunchAnchor) {
t.Mode = Mode.NoArchive;
t.ClearStore = false;
}
});
}
/// <summary>
/// Gets the list of reclamation stages for RelaunchAnchor theme.
/// </summary>
public List<GenericCombinedData<Stage>> ReclamationStageList { get; } =
[
new() { Display = "RA-1", Value = Stage.RA1 },
new() { Display = "RA-15", Value = Stage.RA15 },
];
/// <summary>
/// Gets or sets 生息演算关卡选择
/// </summary>
public Stage ReclamationStage
{
get => GetTaskConfig<ReclamationTask>().Stage;
set => SetTaskConfig<ReclamationTask>(t => t.Stage == value, t => t.Stage = value);
}
/// <summary>
/// Gets the list of reclamation modes.
/// </summary>
public List<GenericCombinedData<Mode>> ReclamationModeList { get; } =
[
new() { Display = LocalizationHelper.GetString("ReclamationModeProsperityNoSave"), Value = Mode.NoArchive },
new() { Display = LocalizationHelper.GetString("ReclamationModeProsperityInSave"), Value = Mode.Archive },
];
/// <summary>
/// Gets or sets 策略,无存档刷生息点数 / 有存档刷生息点数
/// 可用值包括:
/// <list type="bullet">
/// <item>
/// <term><c>0</c></term>
/// <description>无存档时通过进出关卡刷生息点数</description>
/// </item>
/// <item>
/// <term><c>1</c></term>
/// <description>有存档时通过合成支援道具刷生息点数</description>
/// </item>
/// </list>
/// </summary>
public Mode ReclamationMode
{
get => GetTaskConfig<ReclamationTask>().Mode;
set => SetTaskConfig<ReclamationTask>(t => t.Mode == value, t => t.Mode = value);
}
/// <summary>
/// Gets or sets 要组装的支援道具
/// </summary>
public string ReclamationToolToCraft
{
get => GetTaskConfig<ReclamationTask>().ToolToCraft;
set {
value = value.Replace('', ';').Trim();
SetTaskConfig<ReclamationTask>(t => t.ToolToCraft == value, t => t.ToolToCraft = value);
}
}
/// <summary>
/// Gets the list of reclamation increment modes.
/// </summary>
public List<GenericCombinedData<int>> ReclamationIncrementModeList { get; } =
[
new() { Display = LocalizationHelper.GetString("ReclamationIncrementModeClick"), Value = 0 },
new() { Display = LocalizationHelper.GetString("ReclamationIncrementModeHold"), Value = 1 },
];
/// <summary>
/// Gets or sets 点击类型0 连点1 长按
/// </summary>
public int ReclamationIncrementMode
{
get => GetTaskConfig<ReclamationTask>().IncrementMode;
set => SetTaskConfig<ReclamationTask>(t => t.IncrementMode == value, t => t.IncrementMode = value);
}
/// <summary>
/// Gets or sets 单次最大制造轮数
/// </summary>
public int ReclamationMaxCraftCountPerRound
{
get => GetTaskConfig<ReclamationTask>().MaxCraftCountPerRound;
set => SetTaskConfig<ReclamationTask>(t => t.MaxCraftCountPerRound == value, t => t.MaxCraftCountPerRound = value);
}
/// <summary>
/// Gets or sets a value indicating whether 刷完点数后是否清空商店
/// </summary>
public bool ReclamationClearStore
{
get => GetTaskConfig<ReclamationTask>().ClearStore;
set => SetTaskConfig<ReclamationTask>(t => t.ClearStore == value, t => t.ClearStore = value);
}
/// <summary>
/// Gets the theme-specific tip text.
/// </summary>
[PropertyDependsOn(nameof(ReclamationTheme), nameof(ReclamationStage))]
public string ReclamationTip
{
get
{
var theme = ReclamationTheme;
if (theme == Theme.RelaunchAnchor)
{
var stageTipKey = $"ReclamationTipRelaunchAnchorRA{(int)ReclamationStage}";
if (LocalizationHelper.TryGetString(stageTipKey, out var stageTip))
{
return stageTip;
}
return LocalizationHelper.GetString("ReclamationTipRelaunchAnchorRA1");
}
else if (theme == Theme.Tales || theme == Theme.Fire)
{
return LocalizationHelper.GetString("ReclamationTipTales");
}
else
{
return string.Empty;
}
}
}
public override void RefreshUI(BaseTask baseTask)
{
if (baseTask is ReclamationTask)
{
Refresh();
}
}
public override (bool? IsSuccess, IEnumerable<int> TaskId) SerializeTask(BaseTask? baseTask, int? taskId = null) => (this as ISerialize).Serialize(baseTask, taskId);
private interface ISerialize : ITaskQueueModelSerialize
{
(bool? IsSuccess, IEnumerable<int> TaskId) ITaskQueueModelSerialize.Serialize(BaseTask? baseTask, int? taskId)
{
if (baseTask is not ReclamationTask reclamation)
{
return (null, []);
}
var toolToCraft = !string.IsNullOrEmpty(reclamation.ToolToCraft) ? reclamation.ToolToCraft : LocalizationHelper.GetString("ReclamationToolToCraftPlaceholder", DataHelper.ClientLanguageMapper[SettingsViewModel.GameSettings.ClientType]);
var task = new AsstReclamationTask() {
Theme = reclamation.Theme,
Stage = reclamation.Stage,
Mode = reclamation.Mode,
IncrementMode = reclamation.IncrementMode,
MaxCraftCountPerRound = reclamation.MaxCraftCountPerRound,
ToolToCraft = [.. toolToCraft.Split(';').Select(s => s.Trim())],
ClearStore = reclamation.ClearStore,
};
return taskId switch {
int id when id > 0 => (Instances.AsstProxy.AsstSetTaskParamsEncoded(id, task), [id]),
null => FromSingle(Instances.AsstProxy.AsstAppendTaskWithEncoding(TaskType.Reclamation, task)),
_ => (null, []),
};
}
}
}