mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 18:01:26 +08:00
123 lines
2.6 KiB
C++
123 lines
2.6 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
#include <ostream>
|
|
|
|
namespace asst {
|
|
|
|
const static std::string Version = "release.beta.01.2";
|
|
|
|
enum class HandleType
|
|
{
|
|
Window = 1,
|
|
View = 2,
|
|
Control = 4
|
|
};
|
|
|
|
static std::ostream& operator<<(std::ostream& os, const HandleType& type)
|
|
{
|
|
static std::unordered_map<HandleType, std::string> _type_name = {
|
|
{HandleType::Window, "Window"},
|
|
{HandleType::View, "View"},
|
|
{HandleType::Control, "Control"}
|
|
};
|
|
return os << _type_name.at(type);
|
|
}
|
|
|
|
enum class TaskType {
|
|
Invalid,
|
|
ClickSelf,
|
|
ClickRect,
|
|
ClickRand,
|
|
DoNothing,
|
|
Stop
|
|
};
|
|
|
|
static std::ostream& operator<<(std::ostream& os, const TaskType& task)
|
|
{
|
|
static std::unordered_map<TaskType, std::string> _type_name = {
|
|
{TaskType::Invalid, "Invalid"},
|
|
{TaskType::ClickSelf, "ClickSelf"},
|
|
{TaskType::ClickRect, "ClickRect"},
|
|
{TaskType::ClickRand, "ClickRand"},
|
|
{TaskType::DoNothing, "DoNothing"},
|
|
{TaskType::Stop, "Stop"}
|
|
};
|
|
return os << _type_name.at(task);
|
|
}
|
|
|
|
struct Point
|
|
{
|
|
Point() = default;
|
|
Point(int x, int y) : x(x), y(y) {}
|
|
int x = 0;
|
|
int y = 0;
|
|
};
|
|
|
|
struct Rect
|
|
{
|
|
Rect() = default;
|
|
Rect(int x, int y, int width, int height)
|
|
: x(x), y(y), width(width), height(height) {}
|
|
Rect operator*(double rhs) const
|
|
{
|
|
return { x, y, static_cast<int>(width * rhs), static_cast<int>(height * rhs) };
|
|
}
|
|
Rect center_zoom(double scale) const
|
|
{
|
|
int half_width_scale = static_cast<int>(width * (1 - scale) / 2);
|
|
int half_hight_scale = static_cast<int>(height * (1 - scale) / 2);
|
|
return { x + half_width_scale, y + half_hight_scale, width - half_width_scale, height - half_hight_scale };
|
|
}
|
|
int x = 0;
|
|
int y = 0;
|
|
int width = 0;
|
|
int height = 0;
|
|
};
|
|
|
|
struct HandleInfo {
|
|
std::string className;
|
|
std::string windowName;
|
|
};
|
|
|
|
struct AdbCmd {
|
|
std::string path;
|
|
std::string connect;
|
|
std::string click;
|
|
};
|
|
|
|
struct SimulatorInfo {
|
|
std::vector<HandleInfo> window;
|
|
std::vector<HandleInfo> view;
|
|
std::vector<HandleInfo> control;
|
|
bool is_adb = false;
|
|
AdbCmd adb;
|
|
int width = 0;
|
|
int height = 0;
|
|
int x_offset = 0;
|
|
int y_offset = 0;
|
|
};
|
|
|
|
struct TaskInfo {
|
|
std::string filename;
|
|
double threshold = 0;
|
|
double cache_threshold = 0;
|
|
TaskType type = TaskType::Invalid;
|
|
std::vector<std::string> next;
|
|
int exec_times = 0;
|
|
int max_times = INT_MAX;
|
|
std::vector<std::string> exceeded_next;
|
|
std::vector<std::string> reduce_other_times;
|
|
asst::Rect specific_area;
|
|
int pre_delay = 0;
|
|
int rear_delay = 0;
|
|
};
|
|
|
|
struct Options {
|
|
std::string delayType;
|
|
int delayFixedTime = 0;
|
|
bool cache = false;
|
|
};
|
|
} |