64 lines
2.3 KiB
C#
64 lines
2.3 KiB
C#
namespace anjianjingling.Lua
|
|
{
|
|
/// <summary>
|
|
/// Lua 脚本能力宿主:由主窗体实现,向 Lua 引擎提供系统级操作能力。
|
|
/// 所有方法均在后台执行线程上被调用。
|
|
/// </summary>
|
|
public interface ILuaHost
|
|
{
|
|
void Log(string msg);
|
|
|
|
/// <summary>是否启用拟人化(落点随机偏移 + 随机微延时)。</summary>
|
|
bool JitterEnabled { get; }
|
|
|
|
// ---- 鼠标 ----
|
|
void MouseMove(int x, int y);
|
|
void MouseMoveR(int dx, int dy);
|
|
void MouseClick(string button, int? x, int? y);
|
|
void MouseDoubleClick(int? x, int? y);
|
|
void MouseDown(string button);
|
|
void MouseUp(string button);
|
|
void MouseWheel(int delta);
|
|
void MouseDrag(int x1, int y1, int x2, int y2, int durationMs);
|
|
(int X, int Y) MousePosition();
|
|
|
|
// ---- 键盘 ----
|
|
void KeyPress(string key);
|
|
void KeyDown(string key);
|
|
void KeyUp(string key);
|
|
void HotKey(string expression);
|
|
void TypeText(string text);
|
|
|
|
// ---- 屏幕与视觉 ----
|
|
(int W, int H) ScreenSize();
|
|
string ColorAt(int x, int y);
|
|
(int X, int Y) FindColor(int x1, int y1, int x2, int y2, string hex, int tolerance);
|
|
(int X, int Y, double Score) FindImage(int x1, int y1, int x2, int y2, string templatePath, double similarity);
|
|
void ScreenShot(string path);
|
|
|
|
/// <summary>弹出框选截图,返回保存路径(用户取消返回 null)。</summary>
|
|
string? PickRegion(string? savePath);
|
|
|
|
// ---- 窗口 / 系统 ----
|
|
void Launch(string path, string? arguments);
|
|
bool ActivateWindow(string titleKeyword);
|
|
string[] ListWindows();
|
|
|
|
// ---- 剪贴板 ----
|
|
string ClipGet();
|
|
void ClipSet(string text);
|
|
|
|
// ---- 内嵌浏览器 ----
|
|
void BrowserOpen(string url);
|
|
bool BrowserClick(string selector);
|
|
bool BrowserType(string selector, string text);
|
|
bool BrowserWaitFor(string selector, int timeoutMs);
|
|
string BrowserGetText(string selector);
|
|
string BrowserExecJs(string js);
|
|
void BrowserShot(string path);
|
|
void BrowserBack();
|
|
void BrowserForward();
|
|
void BrowserReload();
|
|
}
|
|
}
|