@bettergi/types 0.0.4 → 0.0.6
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/README.md +5 -7
- package/csharp/BetterGenshinImpact/Core/Recognition/RecognitionObject.d.ts +27 -0
- package/csharp/BetterGenshinImpact/Core/Recognition/RecognitionTypes.d.ts +1 -0
- package/csharp/BetterGenshinImpact/GameTask/Model/Area/ImageRegion.d.ts +6 -2
- package/csharp/System/Windows/Point.d.ts +3 -0
- package/csharp/Vanara/PInvoke/POINT.d.ts +14 -0
- package/csharp/Vanara/PInvoke/RECT.d.ts +19 -0
- package/csharp/Vanara/PInvoke/SIZE.d.ts +10 -0
- package/modules/globalMethod.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
本项目是一个为 [Better Genshin Impact](https://github.com/babalae/better-genshin-impact) 提供的 JavaScript 类型声明文件。
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 安装
|
|
4
4
|
|
|
5
5
|
```shell
|
|
6
6
|
npm install --save-dev @bettergi/types
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## 用法
|
|
10
|
+
|
|
11
|
+
在项目的 `tsconfig.json` 文件中添加类型引用。
|
|
10
12
|
|
|
11
13
|
```json
|
|
12
14
|
{
|
|
@@ -15,7 +17,3 @@ npm install --save-dev @bettergi/types
|
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
```
|
|
18
|
-
|
|
19
|
-
## Related Tools
|
|
20
|
-
|
|
21
|
-
[@bettergi/create-script](https://www.npmjs.com/package/@bettergi/create-script)
|
|
@@ -83,8 +83,10 @@ export interface RecognitionObject {
|
|
|
83
83
|
/** 颜色匹配方式 */
|
|
84
84
|
colorConversionCode: ColorConversionCodes;
|
|
85
85
|
|
|
86
|
+
/** 起始颜色范围 */
|
|
86
87
|
lowerColor: Scalar;
|
|
87
88
|
|
|
89
|
+
/** 终止颜色范围 */
|
|
88
90
|
upperColor: Scalar;
|
|
89
91
|
|
|
90
92
|
/**
|
|
@@ -108,19 +110,44 @@ export interface RecognitionObject {
|
|
|
108
110
|
/** 正则匹配 多个值全匹配的情况下才算成功 */
|
|
109
111
|
regexMatchText: List<string>;
|
|
110
112
|
|
|
113
|
+
/** 初始化模板 */
|
|
111
114
|
initTemplate(): RecognitionObject;
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
declare global {
|
|
115
118
|
namespace RecognitionObject {
|
|
119
|
+
/**
|
|
120
|
+
* 识别图片模板
|
|
121
|
+
* @param mat 模板图片
|
|
122
|
+
*/
|
|
116
123
|
function templateMatch(mat: Mat): RecognitionObject;
|
|
117
124
|
|
|
125
|
+
/**
|
|
126
|
+
* 在指定区域识别图片模板
|
|
127
|
+
* @param mat 模板图片
|
|
128
|
+
* @param x 水平位置(像素)
|
|
129
|
+
* @param y 垂直位置(像素)
|
|
130
|
+
* @param w 宽度
|
|
131
|
+
* @param h 高度
|
|
132
|
+
*/
|
|
118
133
|
function templateMatch(mat: Mat, x: number, y: number, w: number, h: number): RecognitionObject;
|
|
119
134
|
|
|
135
|
+
/**
|
|
136
|
+
* 识别指定区域
|
|
137
|
+
* @param x 水平位置(像素)
|
|
138
|
+
* @param y 垂直位置(像素)
|
|
139
|
+
* @param w 宽度
|
|
140
|
+
* @param h 高度
|
|
141
|
+
*/
|
|
120
142
|
function ocr(x: number, y: number, w: number, h: number): RecognitionObject;
|
|
121
143
|
|
|
144
|
+
/**
|
|
145
|
+
* 识别矩形区域
|
|
146
|
+
* @param rect 矩形
|
|
147
|
+
*/
|
|
122
148
|
function ocr(rect: Rect): RecognitionObject;
|
|
123
149
|
|
|
150
|
+
/** 识别文字 */
|
|
124
151
|
var ocrThis: RecognitionObject;
|
|
125
152
|
}
|
|
126
153
|
}
|
|
@@ -33,7 +33,11 @@ export interface ImageRegion extends Region {
|
|
|
33
33
|
* @param successAction 识别成功回调
|
|
34
34
|
* @param failAction 识别失败回调
|
|
35
35
|
*/
|
|
36
|
-
find: (
|
|
36
|
+
find: (
|
|
37
|
+
ro: RecognitionObject,
|
|
38
|
+
successAction?: (region: Region) => void,
|
|
39
|
+
failAction?: () => void
|
|
40
|
+
) => Region;
|
|
37
41
|
|
|
38
42
|
/**
|
|
39
43
|
* 在本区域内查找识别对象,返回所有找到的结果
|
|
@@ -44,7 +48,7 @@ export interface ImageRegion extends Region {
|
|
|
44
48
|
*/
|
|
45
49
|
findMulti: (
|
|
46
50
|
ro: RecognitionObject,
|
|
47
|
-
successAction?: () =>
|
|
51
|
+
successAction?: (regions: List<Region>) => void,
|
|
48
52
|
failAction?: () => void
|
|
49
53
|
) => List<Region>;
|
|
50
54
|
}
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
export interface POINT {
|
|
2
|
+
/** 目标水平位置(像素) */
|
|
2
3
|
x: number;
|
|
4
|
+
|
|
5
|
+
/** 目标垂直位置(像素) */
|
|
3
6
|
y: number;
|
|
7
|
+
|
|
8
|
+
/** 判断该点是否为空 */
|
|
4
9
|
isEmpty: boolean;
|
|
5
10
|
|
|
11
|
+
/**
|
|
12
|
+
* 通过给定的偏移量移动当前点
|
|
13
|
+
* @param dx - x 轴方向的偏移量(正数向右,负数向左)。
|
|
14
|
+
* @param dy - y 轴方向的偏移量(正数向下,负数向上)。
|
|
15
|
+
*/
|
|
6
16
|
offset(dx: number, dy: number): void;
|
|
7
17
|
|
|
18
|
+
/**
|
|
19
|
+
* 通过另一个点对象偏移当前点
|
|
20
|
+
* @param p - 包含偏移量的 `POINT` 对象,其 `x` 和 `y` 值会被加到当前点。
|
|
21
|
+
*/
|
|
8
22
|
offset(p: POINT): void;
|
|
9
23
|
}
|
|
@@ -2,17 +2,36 @@ import { POINT } from "./POINT";
|
|
|
2
2
|
import { SIZE } from "./SIZE";
|
|
3
3
|
|
|
4
4
|
export interface RECT {
|
|
5
|
+
/** 矩形左侧的 x 坐标 */
|
|
5
6
|
left: number;
|
|
7
|
+
|
|
8
|
+
/** 矩形顶部的 y 坐标 */
|
|
6
9
|
top: number;
|
|
10
|
+
|
|
11
|
+
/** 矩形右侧的 x 坐标 */
|
|
7
12
|
right: number;
|
|
13
|
+
|
|
14
|
+
/** 矩形底部的 y 坐标 */
|
|
8
15
|
bottom: number;
|
|
16
|
+
|
|
17
|
+
/** 目标水平位置(像素) */
|
|
9
18
|
x: number;
|
|
19
|
+
|
|
20
|
+
/** 目标垂直位置(像素) */
|
|
10
21
|
y: number;
|
|
22
|
+
|
|
23
|
+
/** 矩形的宽度 */
|
|
11
24
|
width: number;
|
|
25
|
+
|
|
26
|
+
/** 矩形的高度 */
|
|
12
27
|
height: number;
|
|
28
|
+
|
|
29
|
+
/** 判断矩形是否为空 */
|
|
13
30
|
isEmpty: boolean;
|
|
14
31
|
|
|
32
|
+
/** 获取矩形的位置 */
|
|
15
33
|
location(): POINT;
|
|
16
34
|
|
|
35
|
+
/** 获取矩形的尺寸 */
|
|
17
36
|
size(): SIZE;
|
|
18
37
|
}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
export interface SIZE {
|
|
2
|
+
/** 尺寸的宽度 */
|
|
2
3
|
cx: number;
|
|
4
|
+
|
|
5
|
+
/** 尺寸的高度 */
|
|
3
6
|
cy: number;
|
|
7
|
+
|
|
8
|
+
/** 尺寸的宽度 */
|
|
4
9
|
width: number;
|
|
10
|
+
|
|
11
|
+
/** 尺寸的高度 */
|
|
5
12
|
height: number;
|
|
13
|
+
|
|
14
|
+
/** 判断尺寸是否为空 */
|
|
6
15
|
isEmpty: boolean;
|
|
7
16
|
|
|
17
|
+
/** 返回当前尺寸的副本 */
|
|
8
18
|
toSize(): SIZE;
|
|
9
19
|
}
|
|
@@ -121,9 +121,10 @@ declare global {
|
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
123
|
* 鼠标滚动
|
|
124
|
+
* @param scrollAmountInClicks - 滚动的点击数 正数向上滚动,负数向下滚动
|
|
124
125
|
* @since 0.44.5
|
|
125
126
|
*/
|
|
126
|
-
function verticalScroll(): void;
|
|
127
|
+
function verticalScroll(scrollAmountInClicks: number): void;
|
|
127
128
|
|
|
128
129
|
/**
|
|
129
130
|
* 捕获当前游戏窗口内容
|