@@ -78,6 +78,7 @@ import (
78
78
" github.com/MaaXYZ/maa-framework-go"
79
79
" github.com/MaaXYZ/maa-framework-go/toolkit"
80
80
" github.com/MaaXYZ/maa-framework-go/buffer"
81
+ " image"
81
82
)
82
83
83
84
func main () {
@@ -112,13 +113,12 @@ func main() {
112
113
113
114
inst.BindResource (res)
114
115
inst.BindController (ctrl)
115
-
116
+
116
117
myRec := NewMyRec ()
118
+ defer myRec.Destroy ()
117
119
myAct := NewMyAct ()
118
- defer func () {
119
- myRec.Destroy ()
120
- myAct.Destroy ()
121
- }()
120
+ defer myAct.Destroy ()
121
+
122
122
inst.RegisterCustomRecognizer (" MyRec" , myRec)
123
123
inst.RegisterCustomAction (" MyAct" , myAct)
124
124
@@ -134,15 +134,15 @@ type MyRec struct {
134
134
maa.CustomRecognizerHandler
135
135
}
136
136
137
- func NewMyRec () MyRec {
138
- return MyRec{
137
+ func NewMyRec () maa . CustomRecognizer {
138
+ return & MyRec{
139
139
CustomRecognizerHandler: maa.NewCustomRecognizerHandler (),
140
140
}
141
141
}
142
142
143
- func (MyRec ) Analyze (
143
+ func (* MyRec ) Analyze (
144
144
ctx maa.SyncContext,
145
- image buffer.ImageBuffer ,
145
+ image image.Image ,
146
146
taskName string,
147
147
customRecognitionParam string,
148
148
) (maa.AnalyzeResult, bool) {
@@ -157,13 +157,13 @@ type MyAct struct {
157
157
maa.CustomActionHandler
158
158
}
159
159
160
- func NewMyAct () MyAct {
161
- return MyAct{
160
+ func NewMyAct () maa . CustomAction {
161
+ return & MyAct{
162
162
CustomActionHandler: maa.NewCustomActionHandler (),
163
163
}
164
164
}
165
165
166
- func (MyAct ) Run (
166
+ func (* MyAct ) Run (
167
167
ctx maa.SyncContext,
168
168
taskName string,
169
169
customActionParam string,
@@ -173,7 +173,7 @@ func (MyAct) Run(
173
173
return true
174
174
}
175
175
176
- func (MyAct ) Stop () {
176
+ func (* MyAct ) Stop () {
177
177
}
178
178
```
179
179
0 commit comments