fix.修复模拟器路径不保存问题;临时修复雷电连接方式;添加一些日志

This commit is contained in:
MistEO
2021-10-22 00:50:26 +08:00
parent d4241deab2
commit 5b6aa2abb6
4 changed files with 59 additions and 17 deletions

View File

@@ -76,11 +76,26 @@
"adb": {
"path": "[EmulatorPath]adb.exe",
"connect": "[Adb] connect 127.0.0.1:5555",
"click": "[Adb] -e shell input tap [x] [y]",
"swipe": "[Adb] -e shell input swipe [x1] [y1] [x2] [y2] [duration]",
"display": "[Adb] -e shell dumpsys window displays | grep init= | awk ' { print $3 } '",
"click": "[Adb] -s emulator-5554 shell input tap [x] [y]",
"swipe": "[Adb] -s emulator-5554 shell input swipe [x1] [y1] [x2] [y2] [duration]",
"display": "[Adb] -s emulator-5554 shell dumpsys window displays | grep init= | awk ' { print $3 } '",
"displayRegex": "cur=%dx%d",
"screencap": "[Adb] -e shell screencap -p"
"screencap": "[Adb] -s emulator-5554 shell screencap -p"
}
},
"LDPlayer64": {
"handle": {
"class": "LDPlayerMainFrame",
"window": "雷电模拟器(64)"
},
"adb": {
"path": "[EmulatorPath]adb.exe",
"connect": "[Adb] connect 127.0.0.1:5555",
"click": "[Adb] -s emulator-5554 shell input tap [x] [y]",
"swipe": "[Adb] -s emulator-5554 shell input swipe [x1] [y1] [x2] [y2] [duration]",
"display": "[Adb] -s emulator-5554 shell dumpsys window displays | grep init= | awk ' { print $3 } '",
"displayRegex": "cur=%dx%d",
"screencap": "[Adb] -s emulator-5554 shell screencap -p"
}
},
"Nox": {

View File

@@ -178,6 +178,7 @@ bool Controller::try_capture(const EmulatorInfo& info, bool without_handle)
return false;
}
resource.cfg().set_emulator_path(info.name, emulator_path);
resource.user().set_emulator_path(info.name, emulator_path);
}
else {
emulator_path = info.path;

View File

@@ -90,12 +90,7 @@ bool asst::InfrastShiftTask::optimal_calc()
[&](const InfrastOperSkillInfo& lhs, const InfrastOperSkillInfo& rhs) -> bool {
return lhs.skills_comb.efficient.at(m_product) > rhs.skills_comb.efficient.at(m_product);
});
for (int i = 0; i != max_num_of_opers; ++i) {
optimal_opers.emplace_back(m_all_available_opers.at(i));
max_efficient += m_all_available_opers.at(i).skills_comb.efficient.at(m_product);
}
#ifdef LOG_TRACE
for (const auto& oper : m_all_available_opers) {
std::string skill_str;
for (const auto& skill : oper.skills_comb.skills) {
@@ -103,7 +98,21 @@ bool asst::InfrastShiftTask::optimal_calc()
}
log.trace(skill_str, oper.skills_comb.efficient.at(m_product));
}
#endif // LOG_TRACE
for (int i = 0; i != max_num_of_opers; ++i) {
optimal_opers.emplace_back(m_all_available_opers.at(i));
max_efficient += m_all_available_opers.at(i).skills_comb.efficient.at(m_product);
}
{
std::string log_str = "[ ";
for (const auto& oper : optimal_opers) {
log_str += oper.skills_comb.intro.empty() ? oper.skills_comb.skills.begin()->names.front() : oper.skills_comb.intro;
log_str += "; ";
}
log_str += "]";
log.trace("Single comb efficient", max_efficient, " , skills:", log_str);
}
// 遍历所有组合,找到效率最高的
auto& all_group = resource.infrast().get_skills_group(m_facility);
@@ -173,19 +182,30 @@ bool asst::InfrastShiftTask::optimal_calc()
continue;
}
}
{
std::string log_str = "[ ";
for (const auto& oper : cur_opers) {
log_str += oper.skills_comb.intro.empty() ? oper.skills_comb.skills.begin()->names.front() : oper.skills_comb.intro;
log_str += "; ";
}
log_str += "]";
log.trace(group.intro, "efficient", cur_efficient, " , skills:", log_str);
}
if (cur_efficient > max_efficient) {
optimal_opers = std::move(cur_opers);
max_efficient = cur_efficient;
}
}
std::string log_str = "[ ";
for (const auto& oper : optimal_opers) {
log_str += oper.skills_comb.intro.empty() ? oper.skills_comb.skills.begin()->names.front() : oper.skills_comb.intro;
log_str += "; ";
{
std::string log_str = "[ ";
for (const auto& oper : optimal_opers) {
log_str += oper.skills_comb.intro.empty() ? oper.skills_comb.skills.begin()->names.front() : oper.skills_comb.intro;
log_str += "; ";
}
log_str += "]";
log.trace("optimal efficient", max_efficient, " , skills:", log_str);
}
log_str += "]";
log.trace("optimal efficient", max_efficient, " , skills:", log_str);
m_optimal_opers = std::move(optimal_opers);

View File

@@ -48,6 +48,9 @@ namespace asst {
InfrastConfiger& infrast() noexcept {
return m_infrast_cfg_unique_ins;
}
UserConfiger& user() noexcept {
return m_user_cfg_unique_ins;
}
OcrPack& ocr() noexcept {
return m_ocr_pack_unique_ins;
}
@@ -73,6 +76,9 @@ namespace asst {
const InfrastConfiger& infrast() const noexcept {
return m_infrast_cfg_unique_ins;
}
const UserConfiger& user() const noexcept {
return m_user_cfg_unique_ins;
}
const OcrPack& ocr() const noexcept {
return m_ocr_pack_unique_ins;
}