feat: 自动战斗引入干员头像缓存机制

This commit is contained in:
MistEO
2022-12-23 23:44:34 +08:00
parent 35b93b765e
commit 5e08e1e138
13 changed files with 287 additions and 39 deletions

View File

@@ -7,6 +7,7 @@
#include "Utils/NoWarningCV.h"
#include "Config/Miscellaneous/BattleDataConfig.h"
#include "Config/Miscellaneous/CopilotConfig.h"
#include "Config/Miscellaneous/TilePack.h"
#include "Config/TaskData.h"
@@ -35,6 +36,7 @@ bool asst::BattleProcessTask::_run()
return false;
}
load_cache();
update_deployment(true);
to_group();
@@ -63,6 +65,23 @@ bool asst::BattleProcessTask::set_stage_name(const std::string& stage_name)
return true;
}
void asst::BattleProcessTask::load_cache()
{
LogTraceFunction;
for (const auto& oper_list : m_combat_data.groups | views::values) {
for (const auto& oper : oper_list) {
load_avatar_cache(oper.name);
if (auto tokens = BattleData.get_tokens(oper.name); !tokens.empty()) {
for (const std::string& token_name : tokens) {
load_avatar_cache(token_name);
}
}
}
}
// TODO: 识别编队,额外加载编队中有的干员的缓存
}
bool asst::BattleProcessTask::to_group()
{
std::unordered_map<std::string, std::vector<std::string>> groups;