mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
perf: 迁移肉鸽主题、肉鸽主题检查
This commit is contained in:
@@ -421,7 +421,4 @@ namespace asst
|
||||
};
|
||||
|
||||
inline static const std::string UploadDataSource = "MeoAssistant";
|
||||
inline static constexpr std::string_view RoguelikePhantomThemeName = "Phantom";
|
||||
inline static constexpr std::string_view RoguelikeMizukiThemeName = "Mizuki";
|
||||
inline static constexpr std::string_view RoguelikeSamiThemeName = "Sami";
|
||||
} // namespace asst
|
||||
|
||||
@@ -74,13 +74,8 @@ bool asst::RoguelikeTask::set_params(const json::value& params)
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
std::string theme = params.get("theme", std::string(RoguelikePhantomThemeName));
|
||||
static constexpr std::array all_themes = {
|
||||
RoguelikePhantomThemeName,
|
||||
RoguelikeMizukiThemeName,
|
||||
RoguelikeSamiThemeName,
|
||||
};
|
||||
if (ranges::find(all_themes, theme) == all_themes.end()) {
|
||||
std::string theme = params.get("theme", std::string(RoguelikeTheme::Phantom));
|
||||
if (RoguelikeConfig::is_valid_theme(theme)) {
|
||||
m_roguelike_task_ptr->set_tasks({ "Stop" });
|
||||
Log.error("Unknown roguelike theme", theme);
|
||||
return false;
|
||||
|
||||
@@ -16,8 +16,21 @@ namespace asst
|
||||
Collectible = 4,
|
||||
};
|
||||
|
||||
class RoguelikeTheme
|
||||
{
|
||||
public:
|
||||
static constexpr std::string_view Phantom = "Phantom";
|
||||
static constexpr std::string_view Mizuki = "Mizuki";
|
||||
static constexpr std::string_view Sami = "Sami";
|
||||
};
|
||||
|
||||
class RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_valid_theme(std::string_view theme)
|
||||
{
|
||||
return theme == RoguelikeTheme::Phantom || theme == RoguelikeTheme::Mizuki || theme == RoguelikeTheme::Sami;
|
||||
}
|
||||
public:
|
||||
// 清理缓存的肉鸽数据
|
||||
void clear();
|
||||
|
||||
Reference in New Issue
Block a user