From dbd0f4ffc19b493901f89597db39f83676af792a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=AE=B6=E6=AC=A3?= <869540029@qq.com> Date: Tue, 18 Apr 2023 15:32:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B2=E5=91=98=E8=AF=86=E5=88=AB,fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/role_index.json | 283 ------------------ resource/tasks.json | 55 ++-- .../{RoleEnter.png => OperatorEnter.png} | Bin ...eOperNameFlag.png => OperatorNameFlag.png} | Bin ...perNameFlag1.png => OperatorNameFlag1.png} | Bin resource/template/OperatorNameFlagLV.png | Bin 0 -> 343 bytes ...{RoleRareTab.png => OperatorRarityTab.png} | Bin ...oleRareTabD.png => OperatorRarityTabD.png} | Bin ...oleRareTabU.png => OperatorRarityTabU.png} | Bin src/MaaCore/Assistant.cpp | 4 +- .../Config/Miscellaneous/BattleDataConfig.cpp | 8 +- .../Config/Miscellaneous/BattleDataConfig.h | 5 +- .../Config/Miscellaneous/RoleConfig.cpp | 26 -- src/MaaCore/Config/Miscellaneous/RoleConfig.h | 35 --- src/MaaCore/Config/ResourceLoader.cpp | 2 - src/MaaCore/MaaCore.vcxproj | 10 +- src/MaaCore/MaaCore.vcxproj.filters | 14 +- .../Interface/{RoleTask.cpp => OperTask.cpp} | 10 +- src/MaaCore/Task/Interface/OperTask.h | 14 + src/MaaCore/Task/Interface/RoleTask.h | 15 - .../Miscellaneous/OperRecognitionTask.cpp | 109 +++++++ .../Task/Miscellaneous/OperRecognitionTask.h | 26 ++ .../Miscellaneous/RoleRecognitionTask.cpp | 127 -------- .../Task/Miscellaneous/RoleRecognitionTask.h | 25 -- .../Vision/OcrWithFlagTemplImageAnalyzer.cpp | 2 +- .../Vision/OcrWithPreprocessImageAnalyzer.cpp | 1 - src/MaaWpfGui/Main/AsstProxy.cs | 18 +- src/MaaWpfGui/Main/Bootstrapper.cs | 2 +- src/MaaWpfGui/Res/Localizations/en-us.xaml | 6 +- src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 6 +- src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 6 +- src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 6 +- src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 6 +- src/MaaWpfGui/ViewModels/UI/OperViewModel.cs | 159 ++++++++++ src/MaaWpfGui/ViewModels/UI/RoleViewModel.cs | 125 -------- src/MaaWpfGui/ViewModels/UI/RootViewModel.cs | 6 +- .../Views/UI/{RoleView.xaml => OperView.xaml} | 10 +- 37 files changed, 406 insertions(+), 715 deletions(-) delete mode 100644 resource/role_index.json rename resource/template/{RoleEnter.png => OperatorEnter.png} (100%) rename resource/template/{RoleOperNameFlag.png => OperatorNameFlag.png} (100%) rename resource/template/{RoleOperNameFlag1.png => OperatorNameFlag1.png} (100%) create mode 100644 resource/template/OperatorNameFlagLV.png rename resource/template/{RoleRareTab.png => OperatorRarityTab.png} (100%) rename resource/template/{RoleRareTabD.png => OperatorRarityTabD.png} (100%) rename resource/template/{RoleRareTabU.png => OperatorRarityTabU.png} (100%) delete mode 100644 src/MaaCore/Config/Miscellaneous/RoleConfig.cpp delete mode 100644 src/MaaCore/Config/Miscellaneous/RoleConfig.h rename src/MaaCore/Task/Interface/{RoleTask.cpp => OperTask.cpp} (54%) create mode 100644 src/MaaCore/Task/Interface/OperTask.h delete mode 100644 src/MaaCore/Task/Interface/RoleTask.h create mode 100644 src/MaaCore/Task/Miscellaneous/OperRecognitionTask.cpp create mode 100644 src/MaaCore/Task/Miscellaneous/OperRecognitionTask.h delete mode 100644 src/MaaCore/Task/Miscellaneous/RoleRecognitionTask.cpp delete mode 100644 src/MaaCore/Task/Miscellaneous/RoleRecognitionTask.h create mode 100644 src/MaaWpfGui/ViewModels/UI/OperViewModel.cs delete mode 100644 src/MaaWpfGui/ViewModels/UI/RoleViewModel.cs rename src/MaaWpfGui/Views/UI/{RoleView.xaml => OperView.xaml} (88%) diff --git a/resource/role_index.json b/resource/role_index.json deleted file mode 100644 index 18cb9088e0..0000000000 --- a/resource/role_index.json +++ /dev/null @@ -1,283 +0,0 @@ -{ - "roles": [ - "阿米娅", - "凯尔希", - "12F", - "陈", - "煌", - "炎狱炎熔", - "浊心斯卡蒂", - "假日威龙陈", - "耀骑士临光", - "空", - "焰影苇草", - "寒芒克洛丝", - "归溟幽灵鲨", - "濯尘芙蓉", - "百炼嘉维尔", - "承曦格雷伊", - "缄默德克萨斯", - "麒麟X夜刀", - "德克萨斯", - "火龙S黑角", - "能天使", - "芙兰卡", - "雷蛇", - "赫默", - "远山", - "深海色", - "推进之王", - "W", - "凛冬", - "末药", - "白雪", - "芙蓉", - "炎熔", - "米格鲁", - "芬", - "克洛丝", - "流星", - "艾丝黛尔", - "白面鸮", - "蓝毒", - "杜宾", - "炎客", - "梅", - "伊芙利特", - "星源", - "星熊", - "猎蜂", - "拉普兰德", - "夜烟", - "幽灵鲨", - "红", - "普罗旺斯", - "闪灵", - "临光", - "清道夫", - "蛇屠箱", - "桃金娘", - "摩根", - "因陀罗", - "达格达", - "守林人", - "断罪者", - "火神", - "夜魔", - "天火", - "华法琳", - "银灰", - "崖心", - "初雪", - "夜莺", - "艾雅法拉", - "调香师", - "地灵", - "慕斯", - "嘉维尔", - "赫拉格", - "红云", - "翎羽", - "霜叶", - "真理", - "古米", - "早露", - "讯使", - "角峰", - "刻俄柏", - "年", - "夕", - "可颂", - "令", - "重岳", - "塞雷娅", - "白金", - "灵知", - "玫兰莎", - "卡缇", - "史都华德", - "安德切尔", - "安赛尔", - "莫斯提马", - "卡夫卡", - "狮蝎", - "安哲拉", - "陨星", - "格拉尼", - "风笛", - "阿", - "吽", - "暴行", - "杰西卡", - "暗索", - "砾", - "香草", - "食铁兽", - "梅尔", - "槐琥", - "麦哲伦", - "傀影", - "柏喙", - "格雷伊", - "巫恋", - "波登可", - "坚雷", - "苇草", - "斯卡蒂", - "山", - "鞭刃", - "芳汀", - "孑", - "星极", - "微风", - "阿消", - "梓兰", - "送葬人", - "泡普卡", - "空爆", - "月见夜", - "斑点", - "Lancet-2", - "Castle-3", - "缠丸", - "红豆", - "安洁莉娜", - "棘刺", - "断崖", - "和弦", - "苏苏洛", - "菲亚梅塔", - "刻刀", - "安比尔", - "暴雨", - "惊蛰", - "诗怀雅", - "泥岩", - "老鲤", - "拜松", - "格劳克斯", - "卡达", - "空弦", - "铸铁", - "稀音", - "宴", - "爱丽丝", - "黑", - "月禾", - "蜜蜡", - "亚叶", - "奥斯塔", - "杰克", - "锡兰", - "贾维", - "史尔特尔", - "伊桑", - "布洛卡", - "铃兰", - "嵯峨", - "熔泉", - "四月", - "酸糖", - "灰喉", - "贝娜", - "莱恩哈特", - "THRM-EX", - "澄闪", - "石棉", - "慑砂", - "泡泡", - "雪雉", - "清流", - "薄绿", - "迷迭香", - "正义骑士号", - "布丁", - "艾丽妮", - "温蒂", - "耶拉", - "子月", - "风丸", - "谜图", - "九色鹿", - "极境", - "暮落", - "图耶", - "但书", - "见行者", - "号角", - "洛洛", - "褐果", - "流明", - "埃拉托", - "海蒂", - "黑键", - "车尔尼", - "多萝西", - "至简", - "鸿雪", - "苦艾", - "铅踝", - "石英", - "玛恩纳", - "斥罪", - "海沫", - "罗小黑", - "明椒", - "白铁", - "泰拉大陆调查团", - "截云", - "林", - "仇白", - "铎铃", - "伊内丝", - "U-Official", - "特米米", - "燧石", - "森蚺", - "焰尾", - "羽毛笔", - "极光", - "瑕光", - "卡涅利安", - "伺夜", - "远牙", - "灰毫", - "掠风", - "絮雨", - "水月", - "松果", - "蜜莓", - "罗宾", - "豆苗", - "乌有", - "灰烬", - "闪击", - "霜华", - "战车", - "洋灰", - "雪绒", - "深靛", - "异客", - "桑葚", - "歌蕾蒂娅", - "赤冬", - "夜半", - "绮良", - "琴柳", - "罗比菈塔", - "帕拉斯", - "龙舌兰", - "蚀清", - "休谟斯", - "夏栎", - "火哨", - "野鬃", - "晓歌", - "黑角", - "杜林", - "夜刀", - "巡林者", - "暮落" - ], - "flag": "THRM-EX" -} diff --git a/resource/tasks.json b/resource/tasks.json index 358f4ffe5b..671e114789 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -9592,18 +9592,18 @@ 20 ] }, - "RoleBegin": { + "OperatorBegin": { "algorithm": "JustReturn", "action": "DoNothing", "next": [ - "RoleEnter", - "RoleRareTab", - "RoleRareTabU", - "RoleRareTabD", - "RoleEnter@ReturnTo" + "OperatorEnter", + "OperatorRarityTab", + "OperatorRarityTabU", + "OperatorRarityTabD", + "OperatorEnter@ReturnTo" ] }, - "RoleEnter": { + "OperatorEnter": { "action": "ClickSelf", "roi": [ 935, @@ -9612,10 +9612,10 @@ 110 ], "next": [ - "RoleRareTab" + "OperatorRarityTab" ] }, - "RoleRareTab": { + "OperatorRarityTab": { "action": "ClickSelf", "roi": [ 922, @@ -9624,10 +9624,10 @@ 50 ], "next": [ - "RoleRareTabD" + "OperatorRarityTabD" ] }, - "RoleRareTabU": { + "OperatorRarityTabU": { "action": "ClickSelf", "roi": [ 922, @@ -9636,10 +9636,10 @@ 50 ], "next": [ - "RoleRareTabD" + "OperatorRarityTabD" ] }, - "RoleRareTabD": { + "OperatorRarityTabD": { "action": "DoNothing", "roi": [ 922, @@ -9648,7 +9648,7 @@ 50 ] }, - "RoleSlowlySwipeToTheRight": { + "OperatorSlowlySwipeToTheRight": { "doc": "6个横向干员防止识别不全990px", "baseTask": "SlowlySwipeToTheRight", "specificRect": [ @@ -9664,7 +9664,7 @@ 20 ] }, - "RoleOperNameFlag": { + "OperatorNameFlag": { "templThreshold": 0.8, "roi": [ 5, @@ -9673,7 +9673,7 @@ 21 ] }, - "RoleOperNameFlag1": { + "OperatorNameFlag1": { "templThreshold": 0.8, "roi": [ 5, @@ -9682,7 +9682,16 @@ 21 ] }, - "RoleOCR": { + "OperatorNameFlagLV": { + "templThreshold": 0.7, + "roi": [ + 40, + 310, + 1128, + 327 + ] + }, + "OperatorOCR": { "algorithm": "OcrDetect", "fullMatch": true, "text": [], @@ -9694,6 +9703,18 @@ ], "postDelay": 100 }, + "OperatorOCRLV": { + "algorithm": "OcrDetect", + "fullMatch": true, + "text": [], + "roi": [ + -10, + 42, + 120, + 20 + ], + "postDelay": 100 + }, "RoguelikeRecruitSwipeMaxTime": { "algorithm": "JustReturn", "maxTimes_Doc": "这个参数是肉鸽招募时,向右划动的最大次数", diff --git a/resource/template/RoleEnter.png b/resource/template/OperatorEnter.png similarity index 100% rename from resource/template/RoleEnter.png rename to resource/template/OperatorEnter.png diff --git a/resource/template/RoleOperNameFlag.png b/resource/template/OperatorNameFlag.png similarity index 100% rename from resource/template/RoleOperNameFlag.png rename to resource/template/OperatorNameFlag.png diff --git a/resource/template/RoleOperNameFlag1.png b/resource/template/OperatorNameFlag1.png similarity index 100% rename from resource/template/RoleOperNameFlag1.png rename to resource/template/OperatorNameFlag1.png diff --git a/resource/template/OperatorNameFlagLV.png b/resource/template/OperatorNameFlagLV.png new file mode 100644 index 0000000000000000000000000000000000000000..3baa29f9d2cec25db9b15bbbffd8ef80f8412829 GIT binary patch literal 343 zcmV-d0jU0oP)$=qIbv)0*7=ws#zu$3Pm$EEz9EV!1#_RP$7ezs*(_uE7Q4|HoE6J1pm&1RD@46)Xd=Q+FGj=^AnwU%D5N4wqTa5x|$Xr&at z-;c-R!RPbA^E|fOEtkuM@pw!WMI=eWe!s_Y9JI9-tu?;yBO>^|Pg$01HX9a;1^s@X z^?FTJRpfd8U&^wKAP874m#kJRMxzmN9P@s^IiJs*PA5c!G)+-}HOA2Gc4@U*D5bbw puVh(9qtW2|{gS3BBEoPu - +#include #include "Utils/Logger.hpp" bool asst::BattleDataConfig::parse(const json::value& json) { + m_opers.clear(); + //使用正则筛选干员 + std::regex regexStr("^char.*"); + std::smatch match; for (const auto& [id, char_data_json] : json.at("chars").as_object()) { battle::OperProps data; data.id = id; @@ -19,6 +23,8 @@ bool asst::BattleDataConfig::parse(const json::value& json) { "TANK", battle::Role::Tank }, { "WARRIOR", battle::Role::Warrior }, }; + if (std::regex_match(id, match, regexStr)) m_opers.insert(name); + if (auto iter = RoleMap.find(char_data_json.at("profession").as_string()); iter == RoleMap.cend()) { data.role = battle::Role::Drone; } diff --git a/src/MaaCore/Config/Miscellaneous/BattleDataConfig.h b/src/MaaCore/Config/Miscellaneous/BattleDataConfig.h index 418f77a312..25ece7ff2a 100644 --- a/src/MaaCore/Config/Miscellaneous/BattleDataConfig.h +++ b/src/MaaCore/Config/Miscellaneous/BattleDataConfig.h @@ -2,7 +2,7 @@ #include "Config/AbstractConfig.h" #include - +#include #include "Common/AsstBattleDef.h" #include "Common/AsstTypes.h" @@ -90,12 +90,15 @@ namespace asst return name.empty() || m_chars.find(name) == m_chars.cend(); } + const std::unordered_set& get_all_oper_names() const noexcept { return m_opers; } + protected: virtual bool parse(const json::value& json) override; private: std::unordered_map m_chars; std::unordered_map m_ranges; + std::unordered_set m_opers; }; inline static auto& BattleData = BattleDataConfig::get_instance(); } // namespace asst diff --git a/src/MaaCore/Config/Miscellaneous/RoleConfig.cpp b/src/MaaCore/Config/Miscellaneous/RoleConfig.cpp deleted file mode 100644 index 55a227b72a..0000000000 --- a/src/MaaCore/Config/Miscellaneous/RoleConfig.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "RoleConfig.h" - -#include "Utils/Ranges.hpp" -#include - -#include "Utils/Logger.hpp" - -bool asst::RoleConfig::parse(const json::value& json) -{ - LogTraceFunction; - - clear(); - const auto& roleFile = json.as_object(); - tagname = roleFile.at("flag").as_string(); - for (const auto& name : roleFile.at("roles").as_array()) { - std::string rolename = name.as_string(); - role_all_name.insert(rolename); - } - return true; -} - -void asst::RoleConfig::clear() -{ - role_all_name.clear(); - tagname = ""; -} diff --git a/src/MaaCore/Config/Miscellaneous/RoleConfig.h b/src/MaaCore/Config/Miscellaneous/RoleConfig.h deleted file mode 100644 index 8a1882a93c..0000000000 --- a/src/MaaCore/Config/Miscellaneous/RoleConfig.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once -#pragma once -#pragma once - -#include "Config/AbstractConfigWithTempl.h" - -#include -#include -#include - -namespace asst -{ - class RoleConfig final : public SingletonHolder, public AbstractConfigWithTempl - { - public: - virtual ~RoleConfig() override = default; - - const auto& get_all_role_name() const noexcept { return role_all_name; } - virtual const std::unordered_set& get_templ_required() const noexcept override - { - return get_all_role_name(); - } - const auto& get_role_tag() const noexcept { return tagname; } - - protected: - virtual bool parse(const json::value& json) override; - void clear(); - - // 干员名(zh,utf8) - std::unordered_set role_all_name; - std::string tagname; - }; - - inline static auto& RoleData = RoleConfig::get_instance(); -} diff --git a/src/MaaCore/Config/ResourceLoader.cpp b/src/MaaCore/Config/ResourceLoader.cpp index 8eedddfbea..2f10babe19 100644 --- a/src/MaaCore/Config/ResourceLoader.cpp +++ b/src/MaaCore/Config/ResourceLoader.cpp @@ -9,7 +9,6 @@ #include "Miscellaneous/CopilotConfig.h" #include "Miscellaneous/InfrastConfig.h" #include "Miscellaneous/ItemConfig.h" -#include "Miscellaneous/RoleConfig.h" #include "Miscellaneous/OcrConfig.h" #include "Miscellaneous/OcrPack.h" #include "Miscellaneous/RecruitConfig.h" @@ -84,7 +83,6 @@ bool asst::ResourceLoader::load(const std::filesystem::path& path) LoadResourceWithTemplAndCheckRet(TaskData, "tasks.json"_p, "template"_p); LoadResourceWithTemplAndCheckRet(InfrastConfig, "infrast.json"_p, "template"_p / "infrast"_p); LoadResourceWithTemplAndCheckRet(ItemConfig, "item_index.json"_p, "template"_p / "items"_p); - LoadResourceWithTemplAndCheckRet(RoleConfig, "role_index.json"_p, "template"_p); /* load cache */ LoadCacheWithoutRet(AvatarCacheManager, "avatars"_p); diff --git a/src/MaaCore/MaaCore.vcxproj b/src/MaaCore/MaaCore.vcxproj index 19b6ba7da4..71d96b308f 100644 --- a/src/MaaCore/MaaCore.vcxproj +++ b/src/MaaCore/MaaCore.vcxproj @@ -39,7 +39,6 @@ - @@ -61,8 +60,8 @@ - - + + @@ -200,7 +199,6 @@ - @@ -216,8 +214,8 @@ - - + + diff --git a/src/MaaCore/MaaCore.vcxproj.filters b/src/MaaCore/MaaCore.vcxproj.filters index ca739494fe..ff01c82e83 100644 --- a/src/MaaCore/MaaCore.vcxproj.filters +++ b/src/MaaCore/MaaCore.vcxproj.filters @@ -603,13 +603,10 @@ 源文件\Controller - - 源文件\Resource\Miscellaneous - - + 源文件\Task\Interface - + 源文件\Task\Miscellaneous @@ -1001,13 +998,10 @@ 源文件\Controller - - 源文件\Resource\Miscellaneous - - + 源文件\Task\Interface - + 源文件\Task\Miscellaneous diff --git a/src/MaaCore/Task/Interface/RoleTask.cpp b/src/MaaCore/Task/Interface/OperTask.cpp similarity index 54% rename from src/MaaCore/Task/Interface/RoleTask.cpp rename to src/MaaCore/Task/Interface/OperTask.cpp index 119e14600b..7e09994603 100644 --- a/src/MaaCore/Task/Interface/RoleTask.cpp +++ b/src/MaaCore/Task/Interface/OperTask.cpp @@ -1,15 +1,15 @@ -#include "RoleTask.h" +#include "OperTask.h" -#include "Task/Miscellaneous/RoleRecognitionTask.h" +#include "Task/Miscellaneous/OperRecognitionTask.h" #include "Task/ProcessTask.h" -asst::RoleTask::RoleTask(const AsstCallback& callback, Assistant* inst) : InterfaceTask(callback, inst, TaskType) +asst::OperTask::OperTask(const AsstCallback& callback, Assistant* inst) : InterfaceTask(callback, inst, TaskType) { auto enter_task = std::make_shared(m_callback, m_inst, TaskType); - enter_task->set_tasks({ "RoleBegin" }).set_ignore_error(true); + enter_task->set_tasks({ "OperatorBegin" }).set_ignore_error(true); m_subtasks.emplace_back(enter_task); - auto recognition_task = std::make_shared(m_callback, m_inst, TaskType); + auto recognition_task = std::make_shared(m_callback, m_inst, TaskType); recognition_task->set_retry_times(0); m_subtasks.emplace_back(recognition_task); } diff --git a/src/MaaCore/Task/Interface/OperTask.h b/src/MaaCore/Task/Interface/OperTask.h new file mode 100644 index 0000000000..6f422e1703 --- /dev/null +++ b/src/MaaCore/Task/Interface/OperTask.h @@ -0,0 +1,14 @@ +#pragma once +#include "Task/InterfaceTask.h" + +namespace asst +{ + class OperTask final : public InterfaceTask + { + public: + inline static constexpr std::string_view TaskType = "Oper"; + + OperTask(const AsstCallback& callback, Assistant* inst); + virtual ~OperTask() override = default; + }; +} diff --git a/src/MaaCore/Task/Interface/RoleTask.h b/src/MaaCore/Task/Interface/RoleTask.h deleted file mode 100644 index d9bdea707b..0000000000 --- a/src/MaaCore/Task/Interface/RoleTask.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once -#pragma once -#include "Task/InterfaceTask.h" - -namespace asst -{ - class RoleTask final : public InterfaceTask - { - public: - inline static constexpr std::string_view TaskType = "Role"; - - RoleTask(const AsstCallback& callback, Assistant* inst); - virtual ~RoleTask() override = default; - }; -} diff --git a/src/MaaCore/Task/Miscellaneous/OperRecognitionTask.cpp b/src/MaaCore/Task/Miscellaneous/OperRecognitionTask.cpp new file mode 100644 index 0000000000..db7e3b7a47 --- /dev/null +++ b/src/MaaCore/Task/Miscellaneous/OperRecognitionTask.cpp @@ -0,0 +1,109 @@ +#include "OperRecognitionTask.h" + +#include "Utils/Ranges.hpp" + +#include "Config/Miscellaneous/BattleDataConfig.h" +#include "Config/TaskData.h" +#include "Controller/Controller.h" +#include "Task/ProcessTask.h" +#include "Utils/Logger.hpp" +#include "Vision/OcrWithFlagTemplImageAnalyzer.h" + +bool asst::OperRecognitionTask::_run() +{ + LogTraceFunction; + std::string current_page_last_oper_name = ""; + own_opers.clear(); + + while (!need_exit()) { + auto resOpers = analyzer_opers(); + if (resOpers.back().name == current_page_last_oper_name) { + break; + } + else { + current_page_last_oper_name = resOpers.back().name; + own_opers.insert(own_opers.end(),resOpers.begin(),resOpers.end()); + } + swipe_page(); + // callback_analyze_result(true); + } + callback_analyze_result(true); + return true; +} + +std::vector asst::OperRecognitionTask::analyzer_opers() +{ + std::vector current_page_opers; + current_page_opers.clear(); + auto image = ctrler()->get_image(); + const auto& ocr_replace = Task.get("CharsNameOcrReplace"); + + OcrWithFlagTemplImageAnalyzer oper_name_analyzer(image); + // 识别第一行 + //name_analyzer.set_task_info("OperatorNameFlag", "OperatorOCR"); + oper_name_analyzer.set_task_info("OperatorNameFlagLV", "OperatorOCRLV"); + oper_name_analyzer.set_replace(ocr_replace->replace_map, ocr_replace->replace_full); + oper_name_analyzer.analyze(); + + auto oper_names_result = oper_name_analyzer.get_result(); + + //if (opers_result.empty() || opers_res.empty()) { + if (oper_names_result.empty()) { + return {}; + } + + for (auto& opername : oper_names_result) { + OperBoxInfo oper_info; + oper_info.name = std::move(opername.text); + current_page_opers.push_back(oper_info); + } + + return current_page_opers; +} + +void asst::OperRecognitionTask::swipe_page() +{ + ProcessTask(*this, { "OperatorSlowlySwipeToTheRight" }).run(); +} + +void asst::OperRecognitionTask::callback_analyze_result(bool done) +{ + LogTraceFunction; + // 获取所有干员名 + const auto& all_oper_names = BattleData.get_all_oper_names(); + //size_t total = all_oper_names.size(); + + // 获取识别干员名 + const auto own_oper_names = get_own_oper_names(); + // 识别干员个数 + //size_t own_count = own_oper_names.size(); + // 未拥有干员名 + std::unordered_set n_own_oper_names; + n_own_oper_names.clear(); + for (const auto& oper : all_oper_names) { + if (own_oper_names.find(oper) == own_oper_names.end()) n_own_oper_names.insert(oper); + } + + json::value info = basic_info_with_what("OperInfo"); + auto& details = info["details"]; + details["done"] = done; + //details["total"] = total; + //details["owncount"] = own_count; + details["have"] = json::array(own_oper_names); + details["nhave"] = json::array(n_own_oper_names); + details["all"] = json::array(all_oper_names); + // details["hroles"] = json::array(roles); + + callback(AsstMsg::SubTaskExtraInfo, info); +} + +std::unordered_set asst::OperRecognitionTask::get_own_oper_names() +{ + LogTraceFunction; + std::unordered_set own_oper_names; + + for (auto& oper_info : own_opers) { + own_oper_names.insert(std::move(oper_info.name)); + } + return own_oper_names; +} diff --git a/src/MaaCore/Task/Miscellaneous/OperRecognitionTask.h b/src/MaaCore/Task/Miscellaneous/OperRecognitionTask.h new file mode 100644 index 0000000000..179e089a34 --- /dev/null +++ b/src/MaaCore/Task/Miscellaneous/OperRecognitionTask.h @@ -0,0 +1,26 @@ +#pragma once +#include "Common/AsstBattleDef.h" +#include "Task/AbstractTask.h" +#include + +namespace asst +{ + class OperRecognitionTask : public AbstractTask + { + public: + using AbstractTask::AbstractTask; + virtual ~OperRecognitionTask() override = default; + + protected: + struct OperBoxInfo + { + std::string name; + }; + virtual bool _run() override; + void swipe_page(); + std::vector analyzer_opers(); + std::vector own_opers; + void callback_analyze_result(bool done); + std::unordered_set get_own_oper_names(); + }; +} diff --git a/src/MaaCore/Task/Miscellaneous/RoleRecognitionTask.cpp b/src/MaaCore/Task/Miscellaneous/RoleRecognitionTask.cpp deleted file mode 100644 index dd775b421f..0000000000 --- a/src/MaaCore/Task/Miscellaneous/RoleRecognitionTask.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include "RoleRecognitionTask.h" - -#include "Utils/Ranges.hpp" - -#include "Config/Miscellaneous/RoleConfig.h" -#include "Config/TaskData.h" -#include "Controller/Controller.h" -#include "Task/ProcessTask.h" -#include "Utils/Logger.hpp" -#include "Vision/OcrWithFlagTemplImageAnalyzer.h" - -bool asst::RoleRecognitionTask::_run() -{ - LogTraceFunction; - lastRole = ""; - roles.clear(); - // lastRole = RoleData.get_role_tag(); - while (!need_exit()) { - auto resRole = analyzer_opers(); - if (resRole.back().text == lastRole) { - break; - } - else { - lastRole = resRole.back().text; - for (const auto& res : resRole) { - const std::string& name = res.text; - roles.insert(name); - } - } - swipe_page(); - // callback_analyze_result(true); - } - callback_analyze_result(true); - return true; -} - -std::vector asst::RoleRecognitionTask::analyzer_opers() -{ - std::vector cRole; - cRole.clear(); - auto image = ctrler()->get_image(); - const auto& ocr_replace = Task.get("CharsNameOcrReplace"); - - OcrWithFlagTemplImageAnalyzer name_analyzer(image); - // 识别第一行 - name_analyzer.set_task_info("RoleOperNameFlag", "RoleOCR"); - name_analyzer.set_replace(ocr_replace->replace_map, ocr_replace->replace_full); - name_analyzer.analyze(); - - ////识别第二行 - OcrWithFlagTemplImageAnalyzer name_analyzer2(image); - name_analyzer2.set_task_info("RoleOperNameFlag1", "RoleOCR"); - name_analyzer2.set_replace(ocr_replace->replace_map, ocr_replace->replace_full); - name_analyzer2.analyze(); - - auto opers_result = name_analyzer.get_result(); - auto opers_res = name_analyzer2.get_result(); - - if (opers_result.empty() || opers_res.empty()) { - return {}; - } - opers_result.insert(opers_result.end(), opers_res.begin(), opers_res.end()); - // 按位置排个序 - // ranges::sort(opers_result, [](const TextRect& lhs, const TextRect& rhs) -> bool { - // if (std::abs(lhs.rect.x - rhs.rect.x) < 5) { // x差距较小则理解为是同一列的,按y排序 - // return lhs.rect.y < rhs.rect.y; - // } - // else { - // return lhs.rect.x < rhs.rect.x; // 否则按x排序 - // } - //}); - // save_img(utils::path("debug") / utils::path("role")); - - /*for (const auto& res : opers_result) { - const std::string& name = res.text; - json::value info = basic_info_with_what("RoleInfo"); - auto& details = info["details"]; - details["name"] = name; - callback(AsstMsg::SubTaskExtraInfo, info); - }*/ - return opers_result; -} - -void asst::RoleRecognitionTask::swipe_page() -{ - ProcessTask(*this, { "RoleSlowlySwipeToTheRight" }).run(); -} -bool asst::RoleRecognitionTask::isLastRole(std::string name) -{ - return name == lastRole; -} -void asst::RoleRecognitionTask::callback_analyze_result(bool done) -{ - LogTraceFunction; - // 获取所有role - const auto& all_roles = RoleData.get_all_role_name(); - size_t total = all_roles.size(); - // 如果有U-Official,识别出来为U-official,需要替换 - if (roles.find("U-official") != roles.end()) { - roles.erase("U-official"); - roles.insert("U-Official"); - } - // 去掉不存在的干员名 - for (const auto& r : roles) { - if (all_roles.find(r) == all_roles.end()) roles.erase(r); - } - - // 识别干员个数 - size_t roleHave = roles.size(); - // 未拥有干员名 - std::list noRoles; - noRoles.clear(); - for (const auto& r : all_roles) { - if (roles.find(r) == roles.end()) noRoles.push_back(r); - } - - json::value info = basic_info_with_what("RoleInfo"); - auto& details = info["details"]; - details["done"] = done; - details["total"] = total; - details["have"] = roleHave; - details["nroles"] = json::array(noRoles); - // details["allroles"] = json::array(all_roles); - // details["hroles"] = json::array(roles); - - callback(AsstMsg::SubTaskExtraInfo, info); -} diff --git a/src/MaaCore/Task/Miscellaneous/RoleRecognitionTask.h b/src/MaaCore/Task/Miscellaneous/RoleRecognitionTask.h deleted file mode 100644 index 6973b5d29e..0000000000 --- a/src/MaaCore/Task/Miscellaneous/RoleRecognitionTask.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#pragma once -#include "Common/AsstBattleDef.h" -#include "Task/AbstractTask.h" -#include - -namespace asst -{ - class RoleRecognitionTask : public AbstractTask - { - public: - using AbstractTask::AbstractTask; - virtual ~RoleRecognitionTask() override = default; - - protected: - virtual bool _run() override; - void swipe_page(); - std::vector analyzer_opers(); - std::string lastRole; - std::string m_support_unit_name; - std::unordered_set roles; - bool isLastRole(std::string name); - void callback_analyze_result(bool done); - }; -} diff --git a/src/MaaCore/Vision/OcrWithFlagTemplImageAnalyzer.cpp b/src/MaaCore/Vision/OcrWithFlagTemplImageAnalyzer.cpp index 4b528b10d2..1ae6197ec6 100644 --- a/src/MaaCore/Vision/OcrWithFlagTemplImageAnalyzer.cpp +++ b/src/MaaCore/Vision/OcrWithFlagTemplImageAnalyzer.cpp @@ -37,7 +37,7 @@ bool asst::OcrWithFlagTemplImageAnalyzer::analyze() std::make_move_iterator(m_ocr_result.end())); } } - + save_img(utils::path("debug") / utils::path("oper")); return !m_all_result.empty(); } diff --git a/src/MaaCore/Vision/OcrWithPreprocessImageAnalyzer.cpp b/src/MaaCore/Vision/OcrWithPreprocessImageAnalyzer.cpp index d9b781225f..333ca9d8d0 100644 --- a/src/MaaCore/Vision/OcrWithPreprocessImageAnalyzer.cpp +++ b/src/MaaCore/Vision/OcrWithPreprocessImageAnalyzer.cpp @@ -32,7 +32,6 @@ bool asst::OcrWithPreprocessImageAnalyzer::analyze() #ifdef ASST_DEBUG cv::rectangle(m_image_draw, make_rect(new_roi), cv::Scalar(0, 0, 255), 1); #endif // ASST_DEBUG - return OcrImageAnalyzer::analyze(); } diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs index 85c38348d7..fe49a64830 100644 --- a/src/MaaWpfGui/Main/AsstProxy.cs +++ b/src/MaaWpfGui/Main/AsstProxy.cs @@ -165,7 +165,7 @@ namespace MaaWpfGui.Main private readonly RecruitViewModel _recruitViewModel; private readonly CopilotViewModel _copilotViewModel; private readonly DepotViewModel _depotViewModel; - private readonly RoleViewModel _roleViewModel; + private readonly OperViewModel _operViewModel; /// /// Initializes a new instance of the class. @@ -179,7 +179,7 @@ namespace MaaWpfGui.Main _recruitViewModel = container.Get(); _copilotViewModel = container.Get(); _depotViewModel = container.Get(); - _roleViewModel = container.Get(); + _operViewModel = container.Get(); _windowManager = windowManager; _callback = CallbackFunction; @@ -571,7 +571,7 @@ namespace MaaWpfGui.Main || unique_finished_task == (_latestTaskId.TryGetValue(TaskType.RecruitCalc, out var recruitCalcTaskId) ? recruitCalcTaskId : 0) || unique_finished_task == (_latestTaskId.TryGetValue(TaskType.CloseDown, out var closeDownTaskId) ? closeDownTaskId : 0) || unique_finished_task == (_latestTaskId.TryGetValue(TaskType.Depot, out var depotTaskId) ? depotTaskId : 0) - || unique_finished_task == (_latestTaskId.TryGetValue(TaskType.Role, out var roleTaskId) ? roleTaskId : 0)) + || unique_finished_task == (_latestTaskId.TryGetValue(TaskType.Oper, out var operTaskId) ? operTaskId : 0)) { isMainTaskQueueAllCompleted = false; } @@ -826,9 +826,9 @@ namespace MaaWpfGui.Main _depotViewModel.Parse((JObject)subTaskDetails); } - if (taskChain == "Role") + if (taskChain == "Oper") { - _roleViewModel.Parse((JObject)subTaskDetails); + _operViewModel.Parse((JObject)subTaskDetails); } string what = details["what"].ToString(); @@ -1251,7 +1251,7 @@ namespace MaaWpfGui.Main Copilot, VideoRec, Depot, - Role, + Oper, } private readonly Dictionary _latestTaskId = new Dictionary(); @@ -1653,11 +1653,11 @@ namespace MaaWpfGui.Main /// 干员识别。 /// /// 是否成功。 - public bool AsstStartRole() + public bool AsstStartOper() { var task_params = new JObject(); - AsstTaskId id = AsstAppendTaskWithEncoding("Role", task_params); - _latestTaskId[TaskType.Role] = id; + AsstTaskId id = AsstAppendTaskWithEncoding("Oper", task_params); + _latestTaskId[TaskType.Oper] = id; return id != 0 && AsstStart(); } diff --git a/src/MaaWpfGui/Main/Bootstrapper.cs b/src/MaaWpfGui/Main/Bootstrapper.cs index 8fb0238356..9155af3e7c 100644 --- a/src/MaaWpfGui/Main/Bootstrapper.cs +++ b/src/MaaWpfGui/Main/Bootstrapper.cs @@ -147,7 +147,7 @@ namespace MaaWpfGui.Main builder.Bind().ToSelf().InSingletonScope(); builder.Bind().ToSelf().InSingletonScope(); builder.Bind().ToSelf().InSingletonScope(); - builder.Bind().ToSelf().InSingletonScope(); + builder.Bind().ToSelf().InSingletonScope(); builder.Bind().ToSelf().InSingletonScope(); builder.Bind().ToSelf().InSingletonScope(); diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml index c8778b572d..adca5d4b11 100644 --- a/src/MaaWpfGui/Res/Localizations/en-us.xaml +++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml @@ -377,9 +377,9 @@ - 干员识别 beta - 该功能尚处于测试阶段,请清空特别关注干员再使用,若统计有误,欢迎打包 asst.log 文件后向我们提交issue ~ - 开始识别 + 干员识别 beta + 该功能尚处于测试阶段,请清空特别关注干员再使用,若统计有误,欢迎打包 asst.log 文件后向我们提交issue ~ + 开始识别 diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml index 715ad731dc..c6d90a821e 100644 --- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml +++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml @@ -378,9 +378,9 @@ - 干员识别 beta - 该功能尚处于测试阶段,请清空特别关注干员再使用,若统计有误,欢迎打包 asst.log 文件后向我们提交issue ~ - 开始识别 + 干员识别 beta + 该功能尚处于测试阶段,请清空特别关注干员再使用,若统计有误,欢迎打包 asst.log 文件后向我们提交issue ~ + 开始识别 diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml index 8da1305c1a..f2fa3d8d51 100644 --- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml +++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml @@ -358,9 +358,9 @@ - 干员识别 beta - 该功能尚处于测试阶段,请清空特别关注干员再使用,若统计有误,欢迎打包 asst.log 文件后向我们提交issue ~ - 开始识别 + 干员识别 beta + 该功能尚处于测试阶段,请清空特别关注干员再使用,若统计有误,欢迎打包 asst.log 文件后向我们提交issue ~ + 开始识别 diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml index 281cdbecaf..8f41d172a8 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml @@ -380,9 +380,9 @@ - 干员识别 beta - 该功能尚处于测试阶段,请清空特别关注干员再使用,若统计有误,欢迎打包 asst.log 文件后向我们提交issue ~ - 开始识别 + 干员识别 beta + 该功能尚处于测试阶段,请清空特别关注干员再使用,若统计有误,欢迎打包 asst.log 文件后向我们提交issue ~ + 开始识别 diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml index 088e76e38a..c1a6257132 100644 --- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml +++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml @@ -312,9 +312,9 @@ - 干员识别 beta - 该功能尚处于测试阶段,请清空特别关注干员再使用,若统计有误,欢迎打包 asst.log 文件后向我们提交issue ~ - 开始识别 + 干员识别 beta + 该功能尚处于测试阶段,请清空特别关注干员再使用,若统计有误,欢迎打包 asst.log 文件后向我们提交issue ~ + 开始识别 diff --git a/src/MaaWpfGui/ViewModels/UI/OperViewModel.cs b/src/MaaWpfGui/ViewModels/UI/OperViewModel.cs new file mode 100644 index 0000000000..b7644e1269 --- /dev/null +++ b/src/MaaWpfGui/ViewModels/UI/OperViewModel.cs @@ -0,0 +1,159 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; +using MaaWpfGui.Helper; +using MaaWpfGui.Main; +using Newtonsoft.Json.Linq; +using Stylet; +using StyletIoC; + +namespace MaaWpfGui.ViewModels.UI +{ + public class OperViewModel : Screen + { + private readonly IWindowManager _windowManager; + private readonly IContainer _container; + + private AsstProxy _asstProxy; + + /// + /// 未实装干员,但在battle_data中, + /// + private static readonly string[] VirtuallyOpers = + { + "预备干员-近战", + "预备干员-术师", + "预备干员-后勤", + "预备干员-狙击", + "预备干员-重装", + "郁金香", + "Stormeye", + "Touch", + "Pith", + "Sharp", + "阿米娅-WARRIOR", + }; + + public OperViewModel(IContainer container, IWindowManager windowManager) + { + _windowManager = windowManager; + _container = container; + DisplayName = LocalizationHelper.GetString("OperRecognition"); + } + + protected override void OnInitialActivate() + { + base.OnInitialActivate(); + _asstProxy = _container.Get(); + } + + private string _operInfo = LocalizationHelper.GetString("OperRecognitionTip"); + + public string OperInfo + { + get => _operInfo; + set => SetAndNotify(ref _operInfo, value); + } + + private string _operResult; + + public string OperResult + { + get => _operResult; + set => SetAndNotify(ref _operResult, value); + } + + public bool Parse(JObject details) + { + string result = string.Empty; + /*已拥有干员*/ + JArray operOwn = (JArray)details["have"]; + /*未拥有干员,包含预备干员等*/ + JArray operNotOwn = (JArray)details["nhave"]; + /*JArray operAll = (JArray)details["all"];*/ + /*groups.Where(i => i.Type == JTokenType.String && (string)i == groupName).ToList().ForEach(i => i.Remove());*/ + /*移除未实装干员*/ + foreach (var name in VirtuallyOpers) + { + operNotOwn.Where(i => i.Type == JTokenType.String && (string)i == name).ToList().ForEach(i => i.Remove()); + } + + result = "已拥有:" + operOwn.Count.ToString() + "名,未拥有:" + operNotOwn.Count.ToString() + "名;" + "\n\n"; + result += "以下干员未拥有:\n\t"; + int count = 0; + foreach (var name in operNotOwn) + { + if (count++ < 3) + { + result += name + ", "; + } + else + { + result += name + "\n\t"; + count = 0; + } + } + + result += "\n\n以下干员已拥有:\n\n\t"; + count = 0; + foreach (var name in operOwn) + { + if (count++ < 3) + { + result += name + ", "; + } + else + { + result += name + "\n\t"; + count = 0; + } + } + + OperResult = result; + bool done = (bool)details["done"]; + if (done) + { + OperInfo = LocalizationHelper.GetString("IdentificationCompleted") + "\n" + LocalizationHelper.GetString("OperRecognitionTip"); + Done = true; + } + + return true; + } + + private bool _done = false; + + /// + /// Gets or sets a value indicating whether depot info is parsed. + /// + public bool Done + { + get => _done; + set => SetAndNotify(ref _done, value); + } + + private void Clear() + { + OperResult = string.Empty; + Done = false; + } + + public async void Start() + { + string errMsg = string.Empty; + OperInfo = LocalizationHelper.GetString("ConnectingToEmulator"); + bool caught = await Task.Run(() => _asstProxy.AsstConnect(ref errMsg)); + if (!caught) + { + OperInfo = errMsg; + return; + } + + OperInfo = LocalizationHelper.GetString("Identifying"); + Clear(); + + _asstProxy.AsstStartOper(); + } + } +} + diff --git a/src/MaaWpfGui/ViewModels/UI/RoleViewModel.cs b/src/MaaWpfGui/ViewModels/UI/RoleViewModel.cs deleted file mode 100644 index 39c5f0a4bf..0000000000 --- a/src/MaaWpfGui/ViewModels/UI/RoleViewModel.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; -using MaaWpfGui.Helper; -using MaaWpfGui.Main; -using Newtonsoft.Json.Linq; -using Stylet; -using StyletIoC; - -namespace MaaWpfGui.ViewModels.UI -{ - public class RoleViewModel : Screen - { - private readonly IWindowManager _windowManager; - private readonly IContainer _container; - - private AsstProxy _asstProxy; - - public RoleViewModel(IContainer container, IWindowManager windowManager) - { - _windowManager = windowManager; - _container = container; - DisplayName = LocalizationHelper.GetString("RoleRecognition"); - } - - protected override void OnInitialActivate() - { - base.OnInitialActivate(); - _asstProxy = _container.Get(); - } - - private string _roleInfo = LocalizationHelper.GetString("RoleRecognitionTip"); - - public string RoleInfo - { - get => _roleInfo; - set => SetAndNotify(ref _roleInfo, value); - } - - private string _roleResult; - - public string RoleResult - { - get => _roleResult; - set => SetAndNotify(ref _roleResult, value); - } - - public bool Parse(JObject details) - { - string result = string.Empty; - /*foreach (var item in details.Cast()) - { - result += (string)item["name"] + "\n"; - }*/ - - /*result += details.Cast();*/ - JArray allRoles = (JArray)details["allroles"]; - JArray nRoles = (JArray)details["nroles"]; - JArray hRoles = (JArray)details["hroles"]; - - /*string[] allroles = details["allroles"].Value>().ToArray(); - string[] noroles = details["nroles"].Value>().ToArray();*/ - result = "干员总计:" + (int)details["total"] + "名,已拥有:" + (int)details["have"] + "名,未拥有:" + nRoles.Count.ToString() + "名;" + "\n\n\t"; - int count = 0; - foreach (var name in nRoles) - { - if (count++ < 3) - { - result += name + ", "; - } - else - { - result += name + "\n\t"; - count = 0; - } - } - - RoleResult = result; - bool done = (bool)details["done"]; - if (done) - { - RoleInfo = LocalizationHelper.GetString("IdentificationCompleted") + "\n" + LocalizationHelper.GetString("RoleRecognitionTip"); - Done = true; - } - - return true; - } - - private bool _done = false; - - /// - /// Gets or sets a value indicating whether depot info is parsed. - /// - public bool Done - { - get => _done; - set => SetAndNotify(ref _done, value); - } - - private void Clear() - { - RoleResult = string.Empty; - Done = false; - } - - public async void Start() - { - string errMsg = string.Empty; - RoleInfo = LocalizationHelper.GetString("ConnectingToEmulator"); - bool caught = await Task.Run(() => _asstProxy.AsstConnect(ref errMsg)); - if (!caught) - { - RoleInfo = errMsg; - return; - } - - RoleInfo = LocalizationHelper.GetString("Identifying"); - Clear(); - - _asstProxy.AsstStartRole(); - } - } -} - diff --git a/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs b/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs index eb73ef9def..b37efa9b5d 100644 --- a/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/RootViewModel.cs @@ -32,7 +32,7 @@ namespace MaaWpfGui.ViewModels.UI private readonly SettingsViewModel _settingsViewModel; private readonly CopilotViewModel _copilotViewModel; private readonly DepotViewModel _depotViewModel; - private readonly RoleViewModel _roleViewModel; + private readonly OperViewModel _operViewModel; private readonly VersionUpdateViewModel _versionUpdateViewModel; /// @@ -49,7 +49,7 @@ namespace MaaWpfGui.ViewModels.UI _settingsViewModel = container.Get(); _copilotViewModel = container.Get(); _depotViewModel = container.Get(); - _roleViewModel = container.Get(); + _operViewModel = container.Get(); _versionUpdateViewModel = container.Get(); } @@ -73,7 +73,7 @@ namespace MaaWpfGui.ViewModels.UI Items.Add(_copilotViewModel); Items.Add(_recruitViewModel); Items.Add(_depotViewModel); - Items.Add(_roleViewModel); + Items.Add(_operViewModel); Items.Add(_settingsViewModel); _settingsViewModel.UpdateWindowTitle(); // 在标题栏上显示模拟器和IP端口 必须在 Items.Add(settings)之后执行。 diff --git a/src/MaaWpfGui/Views/UI/RoleView.xaml b/src/MaaWpfGui/Views/UI/OperView.xaml similarity index 88% rename from src/MaaWpfGui/Views/UI/RoleView.xaml rename to src/MaaWpfGui/Views/UI/OperView.xaml index 7cc9828a58..a2418f5a1f 100644 --- a/src/MaaWpfGui/Views/UI/RoleView.xaml +++ b/src/MaaWpfGui/Views/UI/OperView.xaml @@ -1,4 +1,4 @@ - @@ -30,13 +30,13 @@ VerticalAlignment="Top" FontSize="14" Style="{StaticResource TextBlockDefaultBold}" - Text="{Binding RoleInfo}" + Text="{Binding OperInfo}" TextWrapping="Wrap"/> @@ -54,7 +54,7 @@ HorizontalAlignment="Center" VerticalAlignment="Center" Command="{s:Action Start}" - Content="{DynamicResource BeganToRoleRecognition}" + Content="{DynamicResource BeganToOperRecognition}" />