Skip to content

Commit 4387543

Browse files
committed
docs: update README.md
1 parent 7d9995b commit 4387543

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ import (
7878
"github.com/MaaXYZ/maa-framework-go"
7979
"github.com/MaaXYZ/maa-framework-go/toolkit"
8080
"github.com/MaaXYZ/maa-framework-go/buffer"
81+
"image"
8182
)
8283

8384
func main() {
@@ -112,13 +113,12 @@ func main() {
112113

113114
inst.BindResource(res)
114115
inst.BindController(ctrl)
115-
116+
116117
myRec := NewMyRec()
118+
defer myRec.Destroy()
117119
myAct := NewMyAct()
118-
defer func() {
119-
myRec.Destroy()
120-
myAct.Destroy()
121-
}()
120+
defer myAct.Destroy()
121+
122122
inst.RegisterCustomRecognizer("MyRec", myRec)
123123
inst.RegisterCustomAction("MyAct", myAct)
124124

@@ -134,15 +134,15 @@ type MyRec struct {
134134
maa.CustomRecognizerHandler
135135
}
136136

137-
func NewMyRec() MyRec {
138-
return MyRec{
137+
func NewMyRec() maa.CustomRecognizer {
138+
return &MyRec{
139139
CustomRecognizerHandler: maa.NewCustomRecognizerHandler(),
140140
}
141141
}
142142

143-
func (MyRec) Analyze(
143+
func (*MyRec) Analyze(
144144
ctx maa.SyncContext,
145-
image buffer.ImageBuffer,
145+
image image.Image,
146146
taskName string,
147147
customRecognitionParam string,
148148
) (maa.AnalyzeResult, bool) {
@@ -157,13 +157,13 @@ type MyAct struct {
157157
maa.CustomActionHandler
158158
}
159159

160-
func NewMyAct() MyAct {
161-
return MyAct{
160+
func NewMyAct() maa.CustomAction {
161+
return &MyAct{
162162
CustomActionHandler: maa.NewCustomActionHandler(),
163163
}
164164
}
165165

166-
func (MyAct) Run(
166+
func (*MyAct) Run(
167167
ctx maa.SyncContext,
168168
taskName string,
169169
customActionParam string,
@@ -173,7 +173,7 @@ func (MyAct) Run(
173173
return true
174174
}
175175

176-
func (MyAct) Stop() {
176+
func (*MyAct) Stop() {
177177
}
178178
```
179179

0 commit comments

Comments
 (0)