fix: 修复自动战斗-战斗列表的导航失效问题 (#6413)

- #6407
This commit is contained in:
MistEO
2023-09-18 10:39:08 +08:00
committed by GitHub
11 changed files with 49 additions and 40 deletions

View File

@@ -13131,44 +13131,54 @@
163
]
},
"Copilot@ClickCornerUntilFailedOrStartButton": {
"Copilot@ClickCornerUntilFailedOrThreeStars": {
"algorithm": "JustReturn",
"action": "DoNothing",
"next": [
"Copilot@MissionFailed",
"Copilot@EndOfAction",
"Copilot@ClickCornerBeforeThreeStars"
]
},
"Copilot@EndOfAction": {
"template": "EndOfAction.png",
"action": "DoNothing",
"reduceOtherTimes": [],
"next": [
"Copilot@StageDrops-Stars-3"
]
},
"Copilot@StageDrops-Stars-3": {
"Doc": "如果没有三星就终止",
"template": "StageDrops-Stars-3.png",
"action": "DoNothing",
"next": [
"Copilot@ClickCornerUntilStartButton"
]
},
"Copilot@ClickCornerBeforeThreeStars": {
"Doc": "三星之前",
"baseTask": "Copilot@ClickCornerUntilStartButton",
"next": [
"Copilot@ClickCornerUntilFailedOrThreeStars"
]
},
"Copilot@ClickCornerUntilStartButton": {
"Doc": "三星之后",
"next": [
"Copilot@BattleStartPreFlag",
"Copilot@ClickCornerUntilStartButton"
]
},
"Copilot@ClickCornerUntilStartButton": {
"next": [
"Copilot@ClickCornerUntilFailedOrStartButton"
]
},
"Copilot@MissionFailed": {
"Doc": "如果没有三星就终止",
"template": "MissionFailed.png",
"Copilot@BattleStartPreFlag": {
"baseTask": "BattleStartPreFlag",
"action": "DoNothing",
"roi": [
210,
290,
70,
70
],
"next_Doc": "主动抛错",
"next": [
"Copilot@BattleStartPreFlag"
]
},
"Copilot@BattleStartPreFlag": {
"baseTask": "BattleStartPre",
"action": "DoNothing",
"roi":[
0,
0,
1280,
720
]
],
"next": []
},
"ClickCornerUntilStartButton": {
"algorithm": "JustReturn",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -148,7 +148,7 @@ bool asst::CopilotTask::set_params(const json::value& params)
else if (need_navigate) {
// 如果没三星就中止
Task.get<OcrTaskInfo>("Copilot@BattleStartPreFlag")->text.emplace_back(m_navigate_name);
m_stop_task_ptr->set_tasks({ "Copilot@ClickCornerUntilFailedOrStartButton" });
m_stop_task_ptr->set_tasks({ "Copilot@ClickCornerUntilFailedOrThreeStars" });
m_stop_task_ptr->set_enable(true);
}

View File

@@ -35,6 +35,7 @@ bool asst::TaskFileReloadTask::_run()
json::value info = basic_info_with_what("CopilotListLoadTaskFileSuccess");
info["details"]["stage_name"] = Copilot.get_stage_name();
info["details"]["file_name"] = std::move(m_file);
callback(AsstMsg::SubTaskExtraInfo, info);
return true;
}

View File

@@ -1063,7 +1063,7 @@ namespace MaaWpfGui.Main
break;
case "CopilotListLoadTaskFileSuccess":
Instances.CopilotViewModel.AddLog("Parse " + subTaskDetails["stage_name"].ToString() + " Success");
Instances.CopilotViewModel.AddLog($"Parse {subTaskDetails["file_name"]}[{subTaskDetails["stage_name"]}] Success");
break;
case "CopilotListEnterSuccess":
Instances.CopilotViewModel.EnterCopilotTask();

View File

@@ -448,7 +448,7 @@ The video aspect ratio needs to be 16:9 without interference factors such as bla
<system:String x:Key="AutoSquadTip">「Favourite」 marked operators cannot be recognized at this time</system:String>
<system:String x:Key="AddTrust">Add low-trust operators</system:String>
<system:String x:Key="AddUserAdditional">Add custom operators</system:String>
<system:String x:Key="AddUserAdditionalTip">Use ";" as the separator, "," to separate the operator name and skills, for example: W, 3; Ash, 2</system:String>
<system:String x:Key="AddUserAdditionalTip">Use「;」as the separator,「,」to separate the operator name and skills, for example: W, 3; Ash, 2</system:String>
<system:String x:Key="UseCopilotList">Battle list</system:String>
<system:String x:Key="UseCopilotListTip">Please switch to the level selection page before starting</system:String>
<system:String x:Key="CopilotAddTask">Right click to add raid difficulty</system:String>

View File

@@ -447,7 +447,7 @@ Bilibili: 로그인 인터페이스에 표시되는 계정 이름(예: Zhang San
<system:String x:Key="AutoSquadTip">자동 편성은 '선호' 오퍼레이터를 인식할 수 없습니다</system:String>
<system:String x:Key="AddTrust">신뢰도가 낮은 운영자 추가</system:String>
<system:String x:Key="AddUserAdditional">맞춤 연산자 추가</system:String>
<system:String x:Key="AddUserAdditionalTip">사용 ";" 운영자 이름과 기술을 구분하기 위해 구분 기호 ","를 사용합니다. 예: W, 3; Ash, 2</system:String>
<system:String x:Key="AddUserAdditionalTip">사용「;」운영자 이름과 기술을 구분하기 위해 구분 기호「,」를 사용합니다. 예: W, 3; Ash, 2</system:String>
<system:String x:Key="UseCopilotList">전투 목록</system:String>
<system:String x:Key="UseCopilotListTip">시작하기 전에 레벨 선택 페이지로 전환하세요</system:String>
<system:String x:Key="CopilotAddTask">공격대 난이도를 추가하려면 마우스 오른쪽 버튼을 클릭하세요.</system:String>

View File

@@ -469,7 +469,7 @@
<system:String x:Key="AutoSquadTip">自动编队暂时无法识别「特别关注」的干员</system:String>
<system:String x:Key="AddTrust">补充低信赖干员</system:String>
<system:String x:Key="AddUserAdditional">追加自定干员</system:String>
<system:String x:Key="AddUserAdditionalTip">以英文";"为分隔符,英文","分隔干员名与技能,例: 史尔特尔,3;艾雅法拉,1</system:String>
<system:String x:Key="AddUserAdditionalTip">以英文「;」为分隔符,英文「,」分隔干员名与技能,例: 史尔特尔,3;艾雅法拉,1</system:String>
<system:String x:Key="LoopTimes">循环次数</system:String>
<system:String x:Key="UseCopilotList">战斗列表</system:String>
<system:String x:Key="UseCopilotListTip">开始前请切换至关卡选择页面</system:String>

View File

@@ -450,7 +450,7 @@
<system:String x:Key="AutoSquadTip">自動編隊暫時無法辨識「特別關注」的幹員</system:String>
<system:String x:Key="AddTrust">補充低信賴幹員</system:String>
<system:String x:Key="AddUserAdditional">追加自定幹員</system:String>
<system:String x:Key="AddUserAdditionalTip">使用";"作為分隔符,用","分隔操作員姓名和技能,例:史尔特尔,3;艾雅法拉,1</system:String>
<system:String x:Key="AddUserAdditionalTip">使用「;」作為分隔符,用「,」分隔操作員姓名和技能,例:史尔特尔,3;艾雅法拉,1</system:String>
<system:String x:Key="UseCopilotList">戰鬥列表</system:String>
<system:String x:Key="UseCopilotListTip">開始前請切換至關卡選擇頁面</system:String>
<system:String x:Key="CopilotAddTask">右鍵添加突襲難度</system:String>

View File

@@ -1,7 +1,5 @@
using System.Security.RightsManagement;
using MaaWpfGui.Helper;
using Stylet;
using Vanara.PInvoke;
namespace MaaWpfGui.ViewModels
{

View File

@@ -52,7 +52,7 @@ namespace MaaWpfGui.ViewModels.UI
/// <summary>
/// Gets or private sets the view models of Copilot items.
/// </summary>
public ObservableCollection<CopilotItemViewModel> CopilotItemViewModels { get; private set; } = new ObservableCollection<CopilotItemViewModel>();
public ObservableCollection<CopilotItemViewModel> CopilotItemViewModels { get; } = new ObservableCollection<CopilotItemViewModel>();
/// <summary>
/// Initializes a new instance of the <see cref="CopilotViewModel"/> class.
@@ -567,7 +567,7 @@ namespace MaaWpfGui.ViewModels.UI
}
}
private static string copilotJsonDir = "cache/copilot";
private const string CopilotJsonDir = "cache/copilot";
public void AddCopilotTask()
{
@@ -594,13 +594,13 @@ namespace MaaWpfGui.ViewModels.UI
public void AddCopilotTaskToList(string stage_name)
{
var jsonPath = $"{copilotJsonDir}/{stage_name}.json";
var jsonPath = $"{CopilotJsonDir}/{stage_name}.json";
try
{
Directory.CreateDirectory(copilotJsonDir);
Directory.CreateDirectory(CopilotJsonDir);
}
catch
catch (Exception)
{
}
@@ -628,7 +628,7 @@ namespace MaaWpfGui.ViewModels.UI
["name"] = item.Name,
["file_path"] = item.FilePath,
["is_checked"] = item.IsChecked,
}).ToArray());
}).ToList());
ConfigurationHelper.SetValue(ConfigurationKeys.CopilotTaskList, JsonConvert.SerializeObject(jArray));
}
@@ -744,7 +744,7 @@ namespace MaaWpfGui.ViewModels.UI
JArray mUserAdditional = new JArray();
Regex regex = new Regex(@"(?<=;)(?<name>[^,;]+)(?:, *(?<skill>\d))? *", RegexOptions.Compiled);
MatchCollection matches = regex.Matches(";" + UserAdditional);
MatchCollection matches = regex.Matches(";" + UserAdditional.Replace("", ",").Replace("", ";"));
foreach (Match match in matches)
{
mUserAdditional.Add(new JObject