Skip to content

Commit a8d583c

Browse files
committedDec 2, 2024
chore: 完善提示
1 parent 52a567c commit a8d583c

10 files changed

+58
-770
lines changed
 

‎README.md

+43-8
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22
* @Author: Night-stars-1 nujj1042633805@gmail.com
33
* @Date: 2024-09-06 17:06:15
44
* @LastEditors: Night-stars-1 nujj1042633805@gmail.com
5-
* @LastEditTime: 2024-09-10 12:23:18
5+
* @LastEditTime: 2024-12-02 15:25:12
66
-->
77
# maa-gui
88

9-
An Electron application with Vue
9+
基于MAA流水线协议的GUI
1010

11-
## Recommended IDE Setup
11+
## 截图
12+
![截图](./resources/image.png)
1213

13-
- [VSCode](https://code.visualstudio.com/) + [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) + [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
14+
## 项目安装
1415

15-
## Project Setup
16-
17-
### Install
16+
### 安装
1817

1918
```bash
2019
git clone --recursive https://github.com/Night-stars-1/maa-gui.git
2120
$ pnpm install
2221
```
2322

24-
### Development
23+
### 开发
2524

2625
- 根据`.env`的提示更改`.env`
26+
- 根据`dev-app-update.yml``electron-builder.yml`的提示更改文件
2727
```bash
2828
$ pnpm dev
2929
```
@@ -41,5 +41,40 @@ $ pnpm build:mac
4141
$ pnpm build:linux
4242
```
4343

44+
## MAA行为扩展
45+
> `src\main\customMaa`中注册自定义行为,以达到更灵活的控制
46+
**最简示例:**
47+
```json
48+
{
49+
"识别并点击确认图标": {
50+
"next": [
51+
"我的自定义任务"
52+
]
53+
},
54+
"我的自定义任务": {
55+
"recognition": "Custom",
56+
"custom_recognition": "MyReco",
57+
"action": "Custom",
58+
"custom_action": "MyAct"
59+
}
60+
}
61+
```
62+
```ts
63+
import * as maa from '@nekosu/maa-node'
64+
const MyReco: maa.CustomRecognizerCallback = async (self) => {
65+
const data = await self.context.run_recognition('OCR', self.image, {
66+
OCR: { recognition: 'OCR', expected: '', roi: [593, 113, 516, 46] }
67+
})
68+
if (!data) {
69+
console.log('未识别到内容')
70+
return null
71+
}
72+
return null
73+
}
74+
75+
function registerCustom(res: maa.Resource) {
76+
res.register_custom_recognizer('MyReco', MyReco)
77+
}
78+
```
4479
### Thanks
4580
- [2048-AI](https://github.com/aj-r/2048-AI)

‎dev-app-update.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
provider: generic
2-
url: https://goda.srap.link/auto-updates
2+
# 这里的更新url需要更改成你自己的
3+
url: https://example.com/auto-updates
34
updaterCacheDirName: mma-gui-updater
45
# provider: github
56
# owner: Night-stars-1

‎electron-builder.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ appImage:
4949
npmRebuild: false
5050
publish:
5151
provider: generic
52-
url: https://goda.srap.link/auto-updates
52+
# 这里的更新url需要更改成你自己的
53+
url: https://example.com/auto-updates
5354
updaterCacheDirName: m5a-gui-updater

‎resources/image.png

493 KB
Loading

‎src/main/customMaa/2048/gameController.ts

-127
This file was deleted.

‎src/main/customMaa/2048/goal.ts

-216
This file was deleted.

‎src/main/customMaa/2048/grid.ts

-106
This file was deleted.

‎src/main/customMaa/challenge2048.ts

-222
This file was deleted.

‎src/main/customMaa/eventSelect.ts

-84
This file was deleted.

‎src/main/customMaa/index.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,27 @@
22
* @Author: Night-stars-1 nujj1042633805@gmail.com
33
* @Date: 2024-09-08 15:07:30
44
* @LastEditors: Night-stars-1 nujj1042633805@gmail.com
5-
* @LastEditTime: 2024-09-18 18:58:39
5+
* @LastEditTime: 2024-12-02 15:37:33
66
*/
77
import * as maa from '@nekosu/maa-node'
8-
import eventSelect from './eventSelect'
9-
import challenge2048 from './challenge2048'
108

119
/**
1210
* 自定义的Param参数
1311
* 用于将任务重定向到自定义代码上
12+
* 一般情况下不建议这么做,除非你不想同时更改流水线文件
1413
*/
1514
const customParam = {}
1615

1716
function registerCustom(res: maa.Resource) {
18-
Object.assign(customParam, eventSelect(res))
19-
Object.assign(customParam, challenge2048(res))
17+
// Object.assign(customParam, (res) => {
18+
// return {
19+
// 识别并点击确认图标: {
20+
// next: ['我的自定义任务']
21+
// }
22+
// }
23+
// })
24+
console.log('注册自定义行为')
25+
// res.register_custom_recognizer('MyReco', MyReco)
2026
}
2127

2228
export { registerCustom, customParam }

0 commit comments

Comments
 (0)
Please sign in to comment.