mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 10:00:44 +08:00
refactor.删除实例化的TaskData
This commit is contained in:
@@ -7,10 +7,6 @@
|
||||
|
||||
#include "AsstUtils.hpp"
|
||||
|
||||
asst::CreditShopImageAnalyzer::CreditShopImageAnalyzer(const cv::Mat image, std::shared_ptr<TaskData> task_data)
|
||||
: AbstractImageAnalyzer(image, task_data)
|
||||
{}
|
||||
|
||||
void asst::CreditShopImageAnalyzer::set_black_list(std::vector<std::string> black_list)
|
||||
{
|
||||
m_shopping_list = std::move(black_list);
|
||||
@@ -35,10 +31,9 @@ bool asst::CreditShopImageAnalyzer::analyze()
|
||||
bool asst::CreditShopImageAnalyzer::commoditys_analyze()
|
||||
{
|
||||
// 识别信用点的图标
|
||||
const auto commodity_task_ptr = m_task_data->get("CreditShop-Commoditys");
|
||||
const auto commodity_task_ptr = Task.get("CreditShop-Commoditys");
|
||||
MultiMatchImageAnalyzer mm_annlyzer(m_image);
|
||||
mm_annlyzer.set_task_info(commodity_task_ptr);
|
||||
mm_annlyzer.set_task_data(m_task_data);
|
||||
|
||||
if (!mm_annlyzer.analyze()) {
|
||||
return false;
|
||||
@@ -65,7 +60,7 @@ bool asst::CreditShopImageAnalyzer::commoditys_analyze()
|
||||
bool asst::CreditShopImageAnalyzer::whether_to_buy_analyze()
|
||||
{
|
||||
const auto not_to_buy_task_ptr = std::dynamic_pointer_cast<OcrTaskInfo>(
|
||||
m_task_data->get("CreditShop-NotToBuy"));
|
||||
Task.get("CreditShop-NotToBuy"));
|
||||
|
||||
for (const Rect& commodity : m_commoditys) {
|
||||
// 商品名的区域
|
||||
@@ -74,7 +69,6 @@ bool asst::CreditShopImageAnalyzer::whether_to_buy_analyze()
|
||||
name_roi.y += commodity.y;
|
||||
|
||||
OcrImageAnalyzer ocr_analyzer(m_image, name_roi);
|
||||
ocr_analyzer.set_task_data(m_task_data);
|
||||
ocr_analyzer.set_required(m_shopping_list);
|
||||
if (ocr_analyzer.analyze()) {
|
||||
// 黑名单模式,有识别结果说明这个商品不买,直接跳过
|
||||
@@ -99,8 +93,7 @@ bool asst::CreditShopImageAnalyzer::sold_out_analyze()
|
||||
{
|
||||
// 识别是否售罄
|
||||
MatchImageAnalyzer sold_out_analyzer(m_image);
|
||||
sold_out_analyzer.set_task_info(m_task_data->get("CreditShop-SoldOut"));
|
||||
sold_out_analyzer.set_task_data(m_task_data);
|
||||
sold_out_analyzer.set_task_info(Task.get("CreditShop-SoldOut"));
|
||||
|
||||
for (const Rect& commodity : m_need_to_buy) {
|
||||
sold_out_analyzer.set_roi(commodity);
|
||||
|
||||
Reference in New Issue
Block a user