airobot/lib/action.go
2022-12-09 18:41:12 +08:00

40 lines
679 B
Go

package lib
type IAction interface {
}
type Action struct {
scene *scene
}
func NewAction() *Action {
a := &Action{}
return a
}
//存数据
func (a *Action) Store(key string, data []byte) {
defer a.scene.lock.Unlock()
a.scene.lock.Lock()
a.scene.data[key] = data
}
//取数据
func (a *Action) Get(key string) []byte {
defer a.scene.lock.Unlock()
a.scene.lock.Lock()
return a.scene.data[key]
}
// func (a *BaseAction) Load(action ...IAction) {
// for _, v := range action {
// v.RegisterAction()
// }
// }
// func (a *BaseAction) Reg(idStr string, caller interface{}) {
// // a.actionMap[idStr] = action
// a.ai.callers = append(a.ai.callers, caller)
// }