feat: 新增自定义基建sort字段,默认关闭

fix https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/1900
This commit is contained in:
MistEO
2022-09-22 11:07:58 +08:00
parent 6208287327
commit 8593ffd15e
6 changed files with 27 additions and 12 deletions

View File

@@ -6,8 +6,8 @@
```jsonc
{
"title": "小号的换班方案", // 作业名,可选
"description": "哈哈哈哈", // 作业描述,可选
"title": "小号的换班方案", // 作业名,可选
"description": "哈哈哈哈", // 作业描述,可选
"plans": [
{
"name": "早班", // 计划名,可选
@@ -56,7 +56,8 @@
"芬",
"稀音",
"克洛丝"
]
],
"sort": false, // 是否排序(按照上面 operators 的顺序),可选,默认 false
},
{
"skip": true // 是否跳过当前房间(数组序号对应),可选,默认 false

View File

@@ -31,6 +31,7 @@
"龙舌兰",
"但书"
],
"sort": true,
"product": "LMD"
}
],
@@ -64,6 +65,7 @@
"帕拉斯",
"稀音"
],
"sort": true,
"product": "Battle Record"
},
{
@@ -153,6 +155,7 @@
"龙舌兰",
"但书"
],
"sort": true,
"product": "LMD"
}
],
@@ -268,6 +271,7 @@
"龙舌兰",
"柏喙"
],
"sort": true,
"product": "LMD"
}
],
@@ -293,6 +297,7 @@
"帕拉斯",
"稀音"
],
"sort": true,
"product": "Battle Record"
},
{

View File

@@ -31,6 +31,7 @@
"龙舌兰",
"柏喙"
],
"sort": true,
"product": "LMD"
},
{
@@ -49,6 +50,7 @@
"稀音",
"帕拉斯"
],
"sort": true,
"product": "Battle Record"
},
{
@@ -154,6 +156,7 @@
"龙舌兰",
"柏喙"
],
"sort": true,
"product": "LMD"
},
{
@@ -172,6 +175,7 @@
"稀音",
"帕拉斯"
],
"sort": true,
"product": "Battle Record"
},
{
@@ -372,4 +376,4 @@
}
}
]
}
}

View File

@@ -132,6 +132,7 @@ namespace asst::infrast
Product product = Product::Unknown;
std::vector<std::string> candidates;
int selected = 0;
bool sort = false;
};
using CustomFacilityConfig = std::vector<CustomRoomConfig>;

View File

@@ -189,7 +189,7 @@ bool asst::InfrastAbstractTask::swipe_and_select_custom_opers(bool is_dorm_order
Log.error("already retring");
break;
}
swipe_to_the_left_of_operlist(2);
swipe_to_the_left_of_operlist(5);
retried = true;
}
pre_partial_result = partial_result;
@@ -205,15 +205,18 @@ bool asst::InfrastAbstractTask::swipe_and_select_custom_opers(bool is_dorm_order
else {
ProcessTask(*this, { "InfrastOperListTabWorkStatusUnClicked" }).run();
}
// 如果只选了一个人或不用自动填充,则不需要滑动回去,也不需要排序
if (m_current_room_custom_config.selected > 1 || m_current_room_custom_config.autofill) {
swipe_to_the_left_of_operlist(2);
// 如果只选了一个人没必要排序
if (m_current_room_custom_config.selected > 1) {
click_clear_button();
if (m_current_room_custom_config.sort) {
// 如果只选了一个人或不用自动填充,则不需要滑动回去,也不需要排序
if (m_current_room_custom_config.selected > 1 || m_current_room_custom_config.autofill) {
swipe_to_the_left_of_operlist(2);
order_opers_selection(opers_order);
// 如果只选了一个人没必要排序
if (m_current_room_custom_config.selected > 1) {
click_clear_button();
order_opers_selection(opers_order);
}
}
}

View File

@@ -150,6 +150,7 @@ bool asst::InfrastTask::parse_and_set_custom_config(const std::filesystem::path&
infrast::CustomRoomConfig room_config;
room_config.skip = room_info.get("skip", false);
room_config.autofill = room_info.get("autofill", false);
room_config.sort = room_info.get("sort", false);
static std::unordered_map<std::string, infrast::CustomRoomConfig::Product> ProductNames = {
{ "Battle Record", infrast::CustomRoomConfig::Product::BattleRecord },
{ "Pure Gold", infrast::CustomRoomConfig::Product::PureGold },