Files
MaaAssistantArknights/tools/TestCaller/main.cpp
2022-03-12 22:31:10 +08:00

47 lines
1010 B
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "AsstCaller.h"
#include <filesystem>
#include <iostream>
#include <stdio.h>
#include <string>
std::string get_cur_dir()
{
return std::filesystem::current_path().u8string();
}
int main(int argc, char** argv)
{
// 若使用 VS请先设置 TestCaller 属性-调试-工作目录为 $(TargetDir)
AsstLoadResource(get_cur_dir().c_str());
auto ptr = AsstCreate();
if (ptr == nullptr) {
std::cerr << "create failed" << std::endl;
return -1;
}
bool connected = AsstConnect(ptr, "adb", "127.0.0.1:5555", "");
if (!connected) {
std::cerr << "connect failed" << std::endl;
AsstDestroy(ptr);
ptr = nullptr;
return -1;
}
AsstAppendTask(ptr, "StartUp", R"({})");
AsstAppendTask(ptr, "Fight", R"({"stage": "CE-5"})");
AsstAppendTask(ptr, "Recruit", R"({"select":[4],"confirm":[3,4],"times":4)");
AsstStart(ptr);
getchar();
AsstStop(ptr);
AsstDestroy(ptr);
ptr = nullptr;
return 0;
}