mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
refactor: 重构 Resource 类
fix https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/1541
This commit is contained in:
@@ -29,8 +29,8 @@
|
||||
#endif
|
||||
|
||||
#include "AsstTypes.h"
|
||||
#include "GeneralConfiger.h"
|
||||
#include "Logger.hpp"
|
||||
#include "Resource.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
// for Windows socket
|
||||
@@ -479,7 +479,7 @@ asst::Point asst::Controller::rand_point_in_rect(const Rect& rect)
|
||||
|
||||
void asst::Controller::random_delay() const
|
||||
{
|
||||
auto& opt = Resrc.cfg().get_options();
|
||||
auto& opt = GeneralConfiger::get_instance().get_options();
|
||||
if (opt.control_delay_upper != 0) {
|
||||
LogTraceFunction;
|
||||
static std::default_random_engine rand_engine(std::random_device {}());
|
||||
@@ -785,7 +785,7 @@ std::optional<int> asst::Controller::start_game(const std::string& client_type,
|
||||
if (client_type.empty()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
if (auto intent_name = Resrc.cfg().get_intent_name(client_type)) {
|
||||
if (auto intent_name = GeneralConfiger::get_instance().get_intent_name(client_type)) {
|
||||
std::string cur_cmd = utils::string_replace_all(m_adb.start, "[Intent]", intent_name.value());
|
||||
int id = push_cmd(cur_cmd);
|
||||
if (block) {
|
||||
@@ -882,7 +882,7 @@ int asst::Controller::swipe_without_scale(const Point& p1, const Point& p2, int
|
||||
|
||||
int id = 0;
|
||||
// 额外的滑动:adb有bug,同样的参数,偶尔会划得非常远。额外做一个短程滑动,把之前的停下来
|
||||
const auto& opt = Resrc.cfg().get_options();
|
||||
const auto& opt = GeneralConfiger::get_instance().get_options();
|
||||
if (extra_swipe && opt.adb_extra_swipe_duration > 0) {
|
||||
std::string extra_cmd = utils::string_replace_all_batch(
|
||||
m_adb.swipe, {
|
||||
@@ -938,7 +938,7 @@ bool asst::Controller::connect(const std::string& adb_path, const std::string& a
|
||||
};
|
||||
};
|
||||
|
||||
auto adb_ret = Resrc.cfg().get_adb_cfg(config);
|
||||
auto adb_ret = GeneralConfiger::get_instance().get_adb_cfg(config);
|
||||
if (!adb_ret) {
|
||||
json::value info = get_info_json() | json::object {
|
||||
{ "what", "ConnectFailed" },
|
||||
|
||||
Reference in New Issue
Block a user