ms-types 0.9.24 → 0.9.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types/dotocr.d.ts +1 -1
- package/types/image.d.ts +30 -24
- package/types/lua/README.md +13 -0
- package/types/lua/action.lua +232 -0
- package/types/lua/alias/cv.lua +2 -0
- package/types/lua/alias/dotOcr.lua +2 -0
- package/types/lua/alias/yoloCls.lua +2 -0
- package/types/lua/appleocr.lua +115 -0
- package/types/lua/cloud.lua +32 -0
- package/types/lua/config.lua +34 -0
- package/types/lua/cryptoUtils.lua +47 -0
- package/types/lua/device.lua +105 -0
- package/types/lua/dotocr.lua +46 -0
- package/types/lua/file.lua +96 -0
- package/types/lua/global.lua +122 -0
- package/types/lua/hid.lua +274 -0
- package/types/lua/hotupdate.lua +23 -0
- package/types/lua/http.lua +144 -0
- package/types/lua/image.lua +205 -0
- package/types/lua/ime.lua +48 -0
- package/types/lua/logger.lua +48 -0
- package/types/lua/media.lua +46 -0
- package/types/lua/mysql.lua +64 -0
- package/types/lua/netcard.lua +45 -0
- package/types/lua/node.lua +74 -0
- package/types/lua/opencv.lua +729 -0
- package/types/lua/paddleocr.lua +99 -0
- package/types/lua/pip.lua +56 -0
- package/types/lua/system.lua +139 -0
- package/types/lua/tomatoocr.lua +83 -0
- package/types/lua/tts.lua +42 -0
- package/types/lua/ui.lua +46 -0
- package/types/lua/utils.lua +49 -0
- package/types/lua/yolo.lua +63 -0
- package/types/lua/yolocls.lua +41 -0
- package/types/zh//345/233/276/347/211/207/346/250/241/345/235/227.d.ts +30 -24
- package/types/zh//347/202/271/351/230/265OCR/346/250/241/345/235/227.d.ts +1 -1
package/package.json
CHANGED
package/types/dotocr.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ declare namespace dotOcr {
|
|
|
31
31
|
* 识别文字并返回原图或全屏绝对坐标。
|
|
32
32
|
* 颜色按字库逐字自带的前景色/偏色匹配,无需额外传色。
|
|
33
33
|
* 结果按行从上到下、同行从左到右排列。
|
|
34
|
-
* @param confidenceThreshold 相似度下限;`<=0` 时按 `0.
|
|
34
|
+
* @param confidenceThreshold 相似度下限;`<=0` 时按 `0.95`;`>0.95` 时要求像素完全一致
|
|
35
35
|
*/
|
|
36
36
|
function recognizeAbs(
|
|
37
37
|
fontId: string,
|
package/types/image.d.ts
CHANGED
|
@@ -21,15 +21,15 @@ declare namespace image {
|
|
|
21
21
|
ex?: number,
|
|
22
22
|
ey?: number,
|
|
23
23
|
): string | null;
|
|
24
|
-
/**
|
|
25
|
-
* 截图
|
|
26
|
-
* @returns 截图的imageId ,如果截图失败则返回null
|
|
27
|
-
* @deprecated 请改用 captureScreen()。
|
|
28
|
-
* @example
|
|
29
|
-
* const imageId = image.captureScreen()
|
|
30
|
-
* if (imageId) {
|
|
31
|
-
* image.saveTo(imageId, "screen.jpg")
|
|
32
|
-
* }
|
|
24
|
+
/**
|
|
25
|
+
* 截图
|
|
26
|
+
* @returns 截图的imageId ,如果截图失败则返回null
|
|
27
|
+
* @deprecated 请改用 captureScreen()。
|
|
28
|
+
* @example
|
|
29
|
+
* const imageId = image.captureScreen()
|
|
30
|
+
* if (imageId) {
|
|
31
|
+
* image.saveTo(imageId, "screen.jpg")
|
|
32
|
+
* }
|
|
33
33
|
*/
|
|
34
34
|
function captureFullScreen(): string | null;
|
|
35
35
|
/**
|
|
@@ -37,14 +37,14 @@ declare namespace image {
|
|
|
37
37
|
* @param x 截图区域左上角x坐标
|
|
38
38
|
* @param y 截图区域左上角y坐标
|
|
39
39
|
* @param ex 截图区域右下角x坐标
|
|
40
|
-
* @param ey 截图区域右下角y坐标
|
|
41
|
-
* @returns 截图的imageId ,如果截图失败则返回null
|
|
42
|
-
* @deprecated 请改用 captureScreen(x, y, ex, ey)。
|
|
43
|
-
* @example
|
|
44
|
-
* const imageId = image.captureScreen(0, 0, 100, 100)
|
|
45
|
-
* if (imageId) {
|
|
46
|
-
* image.saveTo(imageId, "screen.jpg")
|
|
47
|
-
* }
|
|
40
|
+
* @param ey 截图区域右下角y坐标
|
|
41
|
+
* @returns 截图的imageId ,如果截图失败则返回null
|
|
42
|
+
* @deprecated 请改用 captureScreen(x, y, ex, ey)。
|
|
43
|
+
* @example
|
|
44
|
+
* const imageId = image.captureScreen(0, 0, 100, 100)
|
|
45
|
+
* if (imageId) {
|
|
46
|
+
* image.saveTo(imageId, "screen.jpg")
|
|
47
|
+
* }
|
|
48
48
|
*/
|
|
49
49
|
function captureRect(
|
|
50
50
|
x: number,
|
|
@@ -63,11 +63,11 @@ declare namespace image {
|
|
|
63
63
|
/**
|
|
64
64
|
* 图片是否已释放
|
|
65
65
|
* @param imageId 图片id
|
|
66
|
-
* @returns true 已释放 false 未释放
|
|
67
|
-
* @example
|
|
68
|
-
* const imageId = image.captureScreen()
|
|
69
|
-
* if (imageId) {
|
|
70
|
-
* image.saveTo(imageId, "screen.jpg")
|
|
66
|
+
* @returns true 已释放 false 未释放
|
|
67
|
+
* @example
|
|
68
|
+
* const imageId = image.captureScreen()
|
|
69
|
+
* if (imageId) {
|
|
70
|
+
* image.saveTo(imageId, "screen.jpg")
|
|
71
71
|
* image.isRelease(imageId) // false
|
|
72
72
|
* image.release(imageId)
|
|
73
73
|
* image.isRelease(imageId) // true
|
|
@@ -249,8 +249,10 @@ declare namespace image {
|
|
|
249
249
|
* @param method 方法
|
|
250
250
|
* @param rgb 是否使用RGB找图,默认false
|
|
251
251
|
* @param options 选项
|
|
252
|
-
* @param options.scaleFactors
|
|
253
|
-
*
|
|
252
|
+
* @param options.scaleFactors 仅 method=99 生效。模板缩放比例列表(不是屏幕 scale)。
|
|
253
|
+
* 应围绕 baseScale=当前设备宽/截模板设备宽 生成,例如 baseScale 附近 ±0.05~0.1 共 3~7 档;
|
|
254
|
+
* 默认 [1.0, 0.9, 1.1, 0.8, 1.2] 只适合尺寸接近时的盲扫,跨大分辨率请按设备动态计算。
|
|
255
|
+
* @returns 图片数组;method=99 时结果额外含 scaleX/scaleY
|
|
254
256
|
* @example
|
|
255
257
|
* const points = image.findImage("screen", "template.jpg", 0, 0, 100, 100, 0.9, 1, 5, false)
|
|
256
258
|
* if (points.length > 0) {
|
|
@@ -282,6 +284,10 @@ declare namespace image {
|
|
|
282
284
|
centerY: number;
|
|
283
285
|
ex: number;
|
|
284
286
|
ey: number;
|
|
287
|
+
/** 仅 method=99 返回:命中时模板的横向缩放比例 */
|
|
288
|
+
scaleX?: number;
|
|
289
|
+
/** 仅 method=99 返回:命中时模板的纵向缩放比例 */
|
|
290
|
+
scaleY?: number;
|
|
285
291
|
}[];
|
|
286
292
|
/**
|
|
287
293
|
* 裁剪图片
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Lua EmmyLua 类型提示
|
|
2
|
+
|
|
3
|
+
随 `ms-types` npm 包发布。安装依赖后,在项目 `.vscode/settings.json` 写入:
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"Lua.workspace.library": ["./node_modules/ms-types/types/lua"],
|
|
8
|
+
"Lua.runtime.version": "Lua 5.4",
|
|
9
|
+
"Lua.workspace.checkThirdParty": false
|
|
10
|
+
}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
不要把本目录复制进脚本项目根目录。`Sleep`、`HidKey` 等裸全局会随 library 自动加载。
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
---@meta action
|
|
2
|
+
---@class Action
|
|
3
|
+
local _Action = {}
|
|
4
|
+
|
|
5
|
+
--- 设置动作抖动值
|
|
6
|
+
--- @param value integer 抖动值
|
|
7
|
+
function _Action.setJitterValue(value) end
|
|
8
|
+
|
|
9
|
+
--- 点击
|
|
10
|
+
--- @param x integer
|
|
11
|
+
--- @param y integer
|
|
12
|
+
--- @param duration integer|nil 按下持续时间,默认20ms
|
|
13
|
+
--- @param jitter boolean|nil 是否抖动,默认false
|
|
14
|
+
--- @return boolean 成功与否
|
|
15
|
+
function _Action.click(x, y, duration, jitter) return true end
|
|
16
|
+
|
|
17
|
+
--- 随机点击
|
|
18
|
+
--- @param x1 integer
|
|
19
|
+
--- @param y1 integer
|
|
20
|
+
--- @param x2 integer
|
|
21
|
+
--- @param y2 integer
|
|
22
|
+
--- @param duration integer|nil 按下持续时间
|
|
23
|
+
--- @return boolean 成功与否
|
|
24
|
+
function _Action.clickRandom(x1, y1, x2, y2, duration) return true end
|
|
25
|
+
|
|
26
|
+
--- 双击
|
|
27
|
+
--- @param x integer
|
|
28
|
+
--- @param y integer
|
|
29
|
+
--- @param duration integer|nil 按下持续时间,默认20ms
|
|
30
|
+
--- @param interval integer|nil 双击间隔,默认20ms
|
|
31
|
+
--- @param jitter boolean|nil 是否抖动
|
|
32
|
+
--- @return boolean 成功与否
|
|
33
|
+
function _Action.doubleClick(x, y, duration, interval, jitter) return true end
|
|
34
|
+
|
|
35
|
+
--- 随机双击
|
|
36
|
+
--- @param x1 integer
|
|
37
|
+
--- @param y1 integer
|
|
38
|
+
--- @param x2 integer
|
|
39
|
+
--- @param y2 integer
|
|
40
|
+
--- @param duration integer|nil 持续时间
|
|
41
|
+
--- @param interval integer|nil 间隔时间
|
|
42
|
+
--- @return boolean 成功与否
|
|
43
|
+
function _Action.doubleClickRandom(x1, y1, x2, y2, duration, interval)
|
|
44
|
+
return true
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
--- 直线滑动
|
|
48
|
+
--- @param startX integer
|
|
49
|
+
--- @param startY integer
|
|
50
|
+
--- @param endX integer
|
|
51
|
+
--- @param endY integer
|
|
52
|
+
--- @param duration integer|nil 总持续时间
|
|
53
|
+
--- @param jitter boolean|nil 是否抖动
|
|
54
|
+
--- @param steps integer|nil 步数
|
|
55
|
+
--- @return boolean 成功与否
|
|
56
|
+
function _Action.swipe(startX, startY, endX, endY, duration, jitter, steps)
|
|
57
|
+
return true
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
--- 长按并滑动
|
|
61
|
+
--- @param startX integer
|
|
62
|
+
--- @param startY integer
|
|
63
|
+
--- @param endX integer
|
|
64
|
+
--- @param endY integer
|
|
65
|
+
--- @param touchDown integer|nil 按下时长
|
|
66
|
+
--- @param touchMove integer|nil 移动时长
|
|
67
|
+
--- @param touchUp integer|nil 抬起时长
|
|
68
|
+
--- @param jitter boolean|nil 是否抖动
|
|
69
|
+
--- @param steps integer|nil 步数
|
|
70
|
+
--- @return boolean 成功与否
|
|
71
|
+
function _Action.pressAndSwipe(startX, startY, endX, endY, touchDown, touchMove,
|
|
72
|
+
touchUp, jitter, steps) return true end
|
|
73
|
+
|
|
74
|
+
--- 曲线滑动
|
|
75
|
+
--- @param startX integer
|
|
76
|
+
--- @param startY integer
|
|
77
|
+
--- @param midX integer
|
|
78
|
+
--- @param midY integer
|
|
79
|
+
--- @param endX integer
|
|
80
|
+
--- @param endY integer
|
|
81
|
+
--- @param duration integer 总时长
|
|
82
|
+
--- @return boolean 成功与否
|
|
83
|
+
function _Action.swipeCurve(startX, startY, midX, midY, endX, endY, duration)
|
|
84
|
+
return true
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
--- 输入文本
|
|
88
|
+
--- @param text string 文本
|
|
89
|
+
--- @return boolean 成功与否
|
|
90
|
+
function _Action.input(text) return true end
|
|
91
|
+
|
|
92
|
+
--- 基础文本输入(不支持中文,走键盘按键)
|
|
93
|
+
--- @param text string ASCII 文本
|
|
94
|
+
--- @return boolean 成功与否
|
|
95
|
+
function _Action.inputSimple(text) return true end
|
|
96
|
+
|
|
97
|
+
--- 删除文本
|
|
98
|
+
--- @param count integer|nil 删除数量,默认1
|
|
99
|
+
--- @return boolean 成功与否
|
|
100
|
+
function _Action.backspace(count) return true end
|
|
101
|
+
|
|
102
|
+
--- 回车
|
|
103
|
+
--- @return boolean 成功与否
|
|
104
|
+
function _Action.enter() return true end
|
|
105
|
+
|
|
106
|
+
--- 回到主页
|
|
107
|
+
--- @return boolean 成功与否
|
|
108
|
+
function _Action.homeScreen() return true end
|
|
109
|
+
|
|
110
|
+
--- 按键
|
|
111
|
+
--- @param name string 按键名称
|
|
112
|
+
--- @return boolean 成功与否
|
|
113
|
+
function _Action.pressButton(name) return true end
|
|
114
|
+
|
|
115
|
+
--- 发送键盘组合键(标准 USB HID usage)
|
|
116
|
+
--- @param keys (string|integer)[] 按键数组
|
|
117
|
+
--- @return boolean 成功与否
|
|
118
|
+
function _Action.sendKey(keys) return true end
|
|
119
|
+
|
|
120
|
+
--- 执行 W3C Actions JSON
|
|
121
|
+
--- @param json table W3C Actions 请求体
|
|
122
|
+
--- @return boolean 成功与否
|
|
123
|
+
function _Action.w3cActions(json) return true end
|
|
124
|
+
|
|
125
|
+
---@class TapPoint
|
|
126
|
+
---@field x integer 坐标X
|
|
127
|
+
---@field y integer 坐标Y
|
|
128
|
+
|
|
129
|
+
---@class ActionBuilder
|
|
130
|
+
local _ActionBuilder = {}
|
|
131
|
+
|
|
132
|
+
--- 添加手指
|
|
133
|
+
--- @param id integer 指针编号
|
|
134
|
+
--- @return Pointer 返回指针对象
|
|
135
|
+
function _ActionBuilder:addPointer(id)
|
|
136
|
+
---@type Pointer
|
|
137
|
+
local ret
|
|
138
|
+
return ret
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
--- 单指点击
|
|
142
|
+
--- @param x integer
|
|
143
|
+
--- @param y integer
|
|
144
|
+
--- @param duration integer|nil 按下持续时间,默认20ms
|
|
145
|
+
--- @return ActionBuilder self
|
|
146
|
+
function _ActionBuilder:singleTap(x, y, duration)
|
|
147
|
+
---@type ActionBuilder
|
|
148
|
+
local ret
|
|
149
|
+
return ret
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
--- 多指同时点击
|
|
153
|
+
--- @param points TapPoint[] 坐标数组
|
|
154
|
+
--- @param duration integer|nil 按下持续时间,默认20ms
|
|
155
|
+
--- @return ActionBuilder self
|
|
156
|
+
function _ActionBuilder:multiTap(points, duration)
|
|
157
|
+
---@type ActionBuilder
|
|
158
|
+
local ret
|
|
159
|
+
return ret
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
--- 执行动作
|
|
163
|
+
--- @return boolean 成功与否
|
|
164
|
+
function _ActionBuilder:execute() return true end
|
|
165
|
+
|
|
166
|
+
---@class Pointer
|
|
167
|
+
local _Pointer = {}
|
|
168
|
+
|
|
169
|
+
--- 移动到
|
|
170
|
+
--- @param x integer
|
|
171
|
+
--- @param y integer
|
|
172
|
+
--- @param duration integer|nil 持续时间
|
|
173
|
+
--- @return Pointer self
|
|
174
|
+
function _Pointer:moveTo(x, y, duration)
|
|
175
|
+
---@type Pointer
|
|
176
|
+
local ret
|
|
177
|
+
return ret
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
--- 按下
|
|
181
|
+
--- @return Pointer self
|
|
182
|
+
function _Pointer:down()
|
|
183
|
+
---@type Pointer
|
|
184
|
+
local ret
|
|
185
|
+
return ret
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
--- 抬起
|
|
189
|
+
--- @return Pointer self
|
|
190
|
+
function _Pointer:up()
|
|
191
|
+
---@type Pointer
|
|
192
|
+
local ret
|
|
193
|
+
return ret
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
--- 停留
|
|
197
|
+
--- @param duration integer 停留时间,默认20ms
|
|
198
|
+
--- @return Pointer self
|
|
199
|
+
function _Pointer:stay(duration)
|
|
200
|
+
---@type Pointer
|
|
201
|
+
local ret
|
|
202
|
+
return ret
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
--- 点击
|
|
206
|
+
--- @param x integer
|
|
207
|
+
--- @param y integer
|
|
208
|
+
--- @param duration integer|nil 按下持续时间,默认20ms
|
|
209
|
+
--- @return Pointer self
|
|
210
|
+
function _Pointer:tap(x, y, duration)
|
|
211
|
+
---@type Pointer
|
|
212
|
+
local ret
|
|
213
|
+
return ret
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
--- 完成,返回构建器
|
|
217
|
+
--- @return ActionBuilder builder
|
|
218
|
+
function _Pointer:done()
|
|
219
|
+
---@type ActionBuilder
|
|
220
|
+
local ret
|
|
221
|
+
return ret
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
--- 创建构建器
|
|
225
|
+
--- @return ActionBuilder builder
|
|
226
|
+
function _Action.createBuilder()
|
|
227
|
+
---@type ActionBuilder
|
|
228
|
+
local ret
|
|
229
|
+
return ret
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
return _Action
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---@meta appleocr
|
|
2
|
+
---@class AppleOCR
|
|
3
|
+
local _AppleOCR = {}
|
|
4
|
+
|
|
5
|
+
---@class AppleOCRResult
|
|
6
|
+
---@field text string 识别的文本内容
|
|
7
|
+
---@field confidence number 识别置信度 (0-1)
|
|
8
|
+
---@field x integer 文本区域左上角 x 坐标
|
|
9
|
+
---@field y integer 文本区域左上角 y 坐标
|
|
10
|
+
---@field ex integer 文本区域右下角 x 坐标
|
|
11
|
+
---@field ey integer 文本区域右下角 y 坐标
|
|
12
|
+
---@field width integer 文本区域宽度
|
|
13
|
+
---@field height integer 文本区域高度
|
|
14
|
+
---@field centerX integer 文本区域中心点 x 坐标
|
|
15
|
+
---@field centerY integer 文本区域中心点 y 坐标
|
|
16
|
+
|
|
17
|
+
--- 识别文本
|
|
18
|
+
--- @param input string 图像ID或路径
|
|
19
|
+
--- @param x integer|nil 区域X,默认0
|
|
20
|
+
--- @param y integer|nil 区域Y,默认0
|
|
21
|
+
--- @param ex integer|nil 区域右下角 X,默认0
|
|
22
|
+
--- @param ey integer|nil 区域右下角 Y,默认0
|
|
23
|
+
--- @param langs string[]|nil 语言数组
|
|
24
|
+
--- @return AppleOCRResult[] 结果数组
|
|
25
|
+
function _AppleOCR.recognize(input, x, y, ex, ey, langs)
|
|
26
|
+
x = x or 0;
|
|
27
|
+
y = y or 0;
|
|
28
|
+
ex = ex or 0;
|
|
29
|
+
ey = ey or 0
|
|
30
|
+
---@type AppleOCRResult[]
|
|
31
|
+
local ret = {}
|
|
32
|
+
return ret
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
--- 识别文本,坐标映射为原图/全屏绝对坐标
|
|
36
|
+
--- @param input string 图像ID或路径
|
|
37
|
+
--- @param x integer|nil 区域X,默认0
|
|
38
|
+
--- @param y integer|nil 区域Y,默认0
|
|
39
|
+
--- @param ex integer|nil 区域右下角 X,默认0
|
|
40
|
+
--- @param ey integer|nil 区域右下角 Y,默认0
|
|
41
|
+
--- @param langs string[]|nil 语言数组
|
|
42
|
+
--- @return AppleOCRResult[] 结果数组
|
|
43
|
+
function _AppleOCR.recognizeAbs(input, x, y, ex, ey, langs)
|
|
44
|
+
---@type AppleOCRResult[]
|
|
45
|
+
local ret = {}
|
|
46
|
+
return ret
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
--- 识别数字
|
|
50
|
+
--- @param input string 图像ID或路径
|
|
51
|
+
--- @param x integer|nil 区域X,默认0
|
|
52
|
+
--- @param y integer|nil 区域Y,默认0
|
|
53
|
+
--- @param ex integer|nil 区域右下角 X,默认0
|
|
54
|
+
--- @param ey integer|nil 区域右下角 Y,默认0
|
|
55
|
+
--- @return AppleOCRResult[] 结果数组
|
|
56
|
+
function _AppleOCR.recognizeNumbers(input, x, y, ex, ey)
|
|
57
|
+
x = x or 0;
|
|
58
|
+
y = y or 0;
|
|
59
|
+
ex = ex or 0;
|
|
60
|
+
ey = ey or 0
|
|
61
|
+
---@type AppleOCRResult[]
|
|
62
|
+
local ret = {}
|
|
63
|
+
return ret
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
--- 识别数字,坐标映射为原图/全屏绝对坐标
|
|
67
|
+
--- @param input string 图像ID或路径
|
|
68
|
+
--- @param x integer|nil 区域X,默认0
|
|
69
|
+
--- @param y integer|nil 区域Y,默认0
|
|
70
|
+
--- @param ex integer|nil 区域右下角 X,默认0
|
|
71
|
+
--- @param ey integer|nil 区域右下角 Y,默认0
|
|
72
|
+
--- @return AppleOCRResult[] 结果数组
|
|
73
|
+
function _AppleOCR.recognizeNumbersAbs(input, x, y, ex, ey)
|
|
74
|
+
---@type AppleOCRResult[]
|
|
75
|
+
local ret = {}
|
|
76
|
+
return ret
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
--- 查找文本
|
|
80
|
+
--- @param input string 图像ID或路径
|
|
81
|
+
--- @param targets string[]|string 目标文本数组或逗号分隔字符串
|
|
82
|
+
--- @param x integer|nil 区域X,默认0
|
|
83
|
+
--- @param y integer|nil 区域Y,默认0
|
|
84
|
+
--- @param ex integer|nil 区域右下角 X,默认0
|
|
85
|
+
--- @param ey integer|nil 区域右下角 Y,默认0
|
|
86
|
+
--- @param langs string[]|nil 语言数组
|
|
87
|
+
--- @param exactMatch boolean|nil 是否完整匹配,默认 false
|
|
88
|
+
--- @return AppleOCRResult[] 结果数组
|
|
89
|
+
function _AppleOCR.findText(input, targets, x, y, ex, ey, langs, exactMatch)
|
|
90
|
+
x = x or 0;
|
|
91
|
+
y = y or 0;
|
|
92
|
+
ex = ex or 0;
|
|
93
|
+
ey = ey or 0
|
|
94
|
+
---@type AppleOCRResult[]
|
|
95
|
+
local ret = {}
|
|
96
|
+
return ret
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
--- 查找文本,坐标映射为原图/全屏绝对坐标
|
|
100
|
+
--- @param input string 图像ID或路径
|
|
101
|
+
--- @param targets string[]|string 目标文本数组或逗号分隔字符串
|
|
102
|
+
--- @param x integer|nil 区域X,默认0
|
|
103
|
+
--- @param y integer|nil 区域Y,默认0
|
|
104
|
+
--- @param ex integer|nil 区域右下角 X,默认0
|
|
105
|
+
--- @param ey integer|nil 区域右下角 Y,默认0
|
|
106
|
+
--- @param langs string[]|nil 语言数组
|
|
107
|
+
--- @param exactMatch boolean|nil 是否完整匹配,默认 false
|
|
108
|
+
--- @return AppleOCRResult[] 结果数组
|
|
109
|
+
function _AppleOCR.findTextAbs(input, targets, x, y, ex, ey, langs, exactMatch)
|
|
110
|
+
---@type AppleOCRResult[]
|
|
111
|
+
local ret = {}
|
|
112
|
+
return ret
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
return _AppleOCR
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---@meta cloud
|
|
2
|
+
---@class Cloud
|
|
3
|
+
local _Cloud = {}
|
|
4
|
+
|
|
5
|
+
--- 云控 WebSocket;仅主脚本注册 onEvent
|
|
6
|
+
|
|
7
|
+
--- connect
|
|
8
|
+
---@param url string
|
|
9
|
+
---@param deviceNo string|nil
|
|
10
|
+
---@return boolean
|
|
11
|
+
function _Cloud.connect(url, deviceNo) return false end
|
|
12
|
+
|
|
13
|
+
--- isConnected
|
|
14
|
+
---@return boolean
|
|
15
|
+
function _Cloud.isConnected() return false end
|
|
16
|
+
|
|
17
|
+
--- disconnect
|
|
18
|
+
|
|
19
|
+
function _Cloud.disconnect() end
|
|
20
|
+
|
|
21
|
+
--- report
|
|
22
|
+
---@param event string
|
|
23
|
+
---@param data table
|
|
24
|
+
---@return boolean
|
|
25
|
+
function _Cloud.report(event, data) return false end
|
|
26
|
+
|
|
27
|
+
--- onEvent
|
|
28
|
+
---@param callback fun(event:string, data:table)|nil
|
|
29
|
+
function _Cloud.onEvent(callback) end
|
|
30
|
+
|
|
31
|
+
package.loaded['cloud'] = _Cloud
|
|
32
|
+
return _Cloud
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---@meta config
|
|
2
|
+
---@class Config
|
|
3
|
+
local _Config = {}
|
|
4
|
+
|
|
5
|
+
--- 获取所有配置
|
|
6
|
+
---@return table<string, any>
|
|
7
|
+
function _Config.all() return {} end
|
|
8
|
+
|
|
9
|
+
--- 用完整表覆盖配置
|
|
10
|
+
---@param config table<string, any>
|
|
11
|
+
---@return boolean
|
|
12
|
+
function _Config.setAll(config) return true end
|
|
13
|
+
|
|
14
|
+
--- 设置单个配置
|
|
15
|
+
---@param key string
|
|
16
|
+
---@param value any
|
|
17
|
+
---@return boolean
|
|
18
|
+
function _Config.set(key, value) return true end
|
|
19
|
+
|
|
20
|
+
--- 读取配置
|
|
21
|
+
---@param key string
|
|
22
|
+
---@return any|nil
|
|
23
|
+
function _Config.get(key) return nil end
|
|
24
|
+
|
|
25
|
+
--- 获取 KUI_CONFIG 表;不存在时返回空表
|
|
26
|
+
---@return table<string, any>
|
|
27
|
+
function _Config.getKuiConfig() return {} end
|
|
28
|
+
|
|
29
|
+
--- 删除配置
|
|
30
|
+
---@param key string
|
|
31
|
+
---@return boolean
|
|
32
|
+
function _Config.remove(key) return true end
|
|
33
|
+
|
|
34
|
+
return _Config
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---@meta cryptoUtils
|
|
2
|
+
---@class CryptoUtils
|
|
3
|
+
local _CryptoUtils = {}
|
|
4
|
+
|
|
5
|
+
--- encryptWithAES_ECB
|
|
6
|
+
---@param data string
|
|
7
|
+
---@param aesKey string
|
|
8
|
+
---@param noPadding boolean
|
|
9
|
+
---@return string
|
|
10
|
+
function _CryptoUtils.encryptWithAES_ECB(data, aesKey, noPadding) return "" end
|
|
11
|
+
|
|
12
|
+
--- decryptWithAES_ECB
|
|
13
|
+
---@param data string
|
|
14
|
+
---@param aesKey string
|
|
15
|
+
---@param noPadding boolean
|
|
16
|
+
---@return string
|
|
17
|
+
function _CryptoUtils.decryptWithAES_ECB(data, aesKey, noPadding) return "" end
|
|
18
|
+
|
|
19
|
+
--- encryptWithRSA
|
|
20
|
+
---@param data string
|
|
21
|
+
---@param publicKeyBase64 string
|
|
22
|
+
---@return string
|
|
23
|
+
function _CryptoUtils.encryptWithRSA(data, publicKeyBase64) return "" end
|
|
24
|
+
|
|
25
|
+
--- decryptWithRSA
|
|
26
|
+
---@param encryptedData string
|
|
27
|
+
---@param privateKeyBase64 string
|
|
28
|
+
---@return string
|
|
29
|
+
function _CryptoUtils.decryptWithRSA(encryptedData, privateKeyBase64) return "" end
|
|
30
|
+
|
|
31
|
+
--- md5
|
|
32
|
+
---@param data string
|
|
33
|
+
---@return string
|
|
34
|
+
function _CryptoUtils.md5(data) return "" end
|
|
35
|
+
|
|
36
|
+
--- sha1
|
|
37
|
+
---@param data string
|
|
38
|
+
---@return string
|
|
39
|
+
function _CryptoUtils.sha1(data) return "" end
|
|
40
|
+
|
|
41
|
+
--- sha256
|
|
42
|
+
---@param data string
|
|
43
|
+
---@return string
|
|
44
|
+
function _CryptoUtils.sha256(data) return "" end
|
|
45
|
+
|
|
46
|
+
package.loaded['cryptoUtils'] = _CryptoUtils
|
|
47
|
+
return _CryptoUtils
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---@meta device
|
|
2
|
+
---@class Device
|
|
3
|
+
local _Device = {}
|
|
4
|
+
|
|
5
|
+
---@class ScreenSize
|
|
6
|
+
---@field width number 屏幕宽度
|
|
7
|
+
---@field height number 屏幕高度
|
|
8
|
+
|
|
9
|
+
---@class BatteryInfo
|
|
10
|
+
---@field level integer 电池电量百分比 (0-100)
|
|
11
|
+
---@field isCharging boolean 是否充电中
|
|
12
|
+
|
|
13
|
+
---@class StorageSpaceInfo
|
|
14
|
+
---@field total number 总容量(GB,十进制)
|
|
15
|
+
---@field free number 剩余容量(GB,十进制)
|
|
16
|
+
---@field unit string 单位,固定 "GB"
|
|
17
|
+
|
|
18
|
+
--- 获取电池信息
|
|
19
|
+
---@return BatteryInfo
|
|
20
|
+
function _Device.getBatteryInfo()
|
|
21
|
+
return { level = 0, isCharging = false }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
--- 获取存储空间(GB,十进制)
|
|
25
|
+
---@return StorageSpaceInfo
|
|
26
|
+
function _Device.getStorageSpace()
|
|
27
|
+
return { total = 0, free = 0, unit = 'GB' }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
--- 设备 ID(卸载重装会变)
|
|
31
|
+
---@return string
|
|
32
|
+
function _Device.getDeviceID() return '' end
|
|
33
|
+
|
|
34
|
+
--- 服务器设备 ID(签名不变则卸载重装仍保持)
|
|
35
|
+
---@return string
|
|
36
|
+
function _Device.getServerDeviceId() return '' end
|
|
37
|
+
|
|
38
|
+
--- ECID
|
|
39
|
+
---@return string
|
|
40
|
+
function _Device.getECID() return '' end
|
|
41
|
+
|
|
42
|
+
--- UDID
|
|
43
|
+
---@return string
|
|
44
|
+
function _Device.getUDID() return '' end
|
|
45
|
+
|
|
46
|
+
--- 设备名
|
|
47
|
+
---@return string
|
|
48
|
+
function _Device.getDeviceName() return '' end
|
|
49
|
+
|
|
50
|
+
--- 设备型号
|
|
51
|
+
---@return string
|
|
52
|
+
function _Device.getDeviceModel() return '' end
|
|
53
|
+
|
|
54
|
+
--- 屏幕逻辑尺寸
|
|
55
|
+
---@return ScreenSize
|
|
56
|
+
function _Device.getScreenSize()
|
|
57
|
+
return { width = 0, height = 0 }
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
--- 屏幕实际尺寸
|
|
61
|
+
---@return ScreenSize
|
|
62
|
+
function _Device.getScreenRealSize()
|
|
63
|
+
return { width = 0, height = 0 }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
--- 屏幕缩放比例
|
|
67
|
+
---@return number
|
|
68
|
+
function _Device.getScreenScale() return 1 end
|
|
69
|
+
|
|
70
|
+
--- 屏幕亮度 0.0-1.0
|
|
71
|
+
---@return number
|
|
72
|
+
function _Device.getScreenBrightness() return 0 end
|
|
73
|
+
|
|
74
|
+
--- 设置屏幕亮度 0.0-1.0
|
|
75
|
+
---@param brightness number
|
|
76
|
+
---@return boolean
|
|
77
|
+
function _Device.setScreenBrightness(brightness) return true end
|
|
78
|
+
|
|
79
|
+
--- 系统音量 0.0-1.0
|
|
80
|
+
---@return number
|
|
81
|
+
function _Device.getVolume() return 0 end
|
|
82
|
+
|
|
83
|
+
--- 设置系统音量 0.0-1.0
|
|
84
|
+
---@param volume number
|
|
85
|
+
---@return boolean
|
|
86
|
+
function _Device.setVolume(volume) return true end
|
|
87
|
+
|
|
88
|
+
--- 屏幕方向
|
|
89
|
+
---@return string
|
|
90
|
+
function _Device.getOrientation() return 'PORTRAIT' end
|
|
91
|
+
|
|
92
|
+
--- 系统版本
|
|
93
|
+
---@return string
|
|
94
|
+
function _Device.getOSVersion() return '' end
|
|
95
|
+
|
|
96
|
+
--- 局域网 IP
|
|
97
|
+
---@return string
|
|
98
|
+
function _Device.getLanIp() return '' end
|
|
99
|
+
|
|
100
|
+
--- 震动
|
|
101
|
+
---@param duration integer 毫秒
|
|
102
|
+
---@param intensity number 0.0-1.0
|
|
103
|
+
function _Device.vibrate(duration, intensity) end
|
|
104
|
+
|
|
105
|
+
return _Device
|