mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
rft: Wpf重构生息演算任务参数序列化
perf: 移除不必要的分隔符
This commit is contained in:
@@ -13,10 +13,13 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Services;
|
||||
using MaaWpfGui.Utilities.ValueType;
|
||||
using MaaWpfGui.ViewModels.UI;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace MaaWpfGui.ViewModels.UserControl.TaskQueue;
|
||||
|
||||
@@ -77,7 +80,7 @@ public class ReclamationSettingsUserControlModel : TaskViewModel
|
||||
}
|
||||
}
|
||||
|
||||
private string _reclamationToolToCraft = ConfigurationHelper.GetValue(ConfigurationKeys.ReclamationToolToCraft, string.Empty);
|
||||
private string _reclamationToolToCraft = ConfigurationHelper.GetValue(ConfigurationKeys.ReclamationToolToCraft, string.Empty).Replace(';', ';');
|
||||
|
||||
public string ReclamationToolToCraft
|
||||
{
|
||||
@@ -93,6 +96,7 @@ public class ReclamationSettingsUserControlModel : TaskViewModel
|
||||
|
||||
set
|
||||
{
|
||||
value = value.Replace(';', ';');
|
||||
SetAndNotify(ref _reclamationToolToCraft, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.ReclamationToolToCraft, value);
|
||||
}
|
||||
@@ -130,4 +134,38 @@ public class ReclamationSettingsUserControlModel : TaskViewModel
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.ReclamationMaxCraftCountPerRound, value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自动生息演算。
|
||||
/// </summary>
|
||||
/// <param name="toolToCraft">要组装的支援道具。</param>
|
||||
/// <param name="theme">生息演算主题["Tales"]</param>
|
||||
/// <param name="mode">
|
||||
/// 策略。可用值包括:
|
||||
/// <list type="bullet">
|
||||
/// <item>
|
||||
/// <term><c>0</c></term>
|
||||
/// <description>无存档时通过进出关卡刷生息点数</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term><c>1</c></term>
|
||||
/// <description>有存档时通过合成支援道具刷生息点数</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </param>
|
||||
/// <param name="incrementMode">点击类型:0 连点;1 长按</param>
|
||||
/// <param name="numCraftBatches">单次最大制造轮数</param>
|
||||
/// <returns>返回(Asst任务类型, 参数)</returns>
|
||||
public (AsstTaskType Type, JObject Params) Serialize()
|
||||
{
|
||||
var data = new JObject
|
||||
{
|
||||
["theme"] = ReclamationTheme,
|
||||
["mode"] = ReclamationMode,
|
||||
["increment_mode"] = ReclamationIncrementMode,
|
||||
["num_craft_batches"] = ReclamationMaxCraftCountPerRound,
|
||||
["tools_to_craft"] = new JArray(ReclamationToolToCraft.Split(';').Select(s => s.Trim())),
|
||||
};
|
||||
return (AsstTaskType.Reclamation, data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user