@ccclass('frame_event')
export class frame_event extends Component {
@property({displayName: "视图模块", type: [Node]})
view: Node[] = [];
public event(): void {
if (arguments.length < 1) {
console.error(this.node.name + "节点动画帧事件参数错误(未指定调用函数)");
}
this.view.forEach(view =>{
view.emit(arguments[0], this.node.uuid, arguments);
});
}
}
版本:1.1.0
由于emit只能通知同节点上面监听的事件,所以我写了一个帧事件转发类,用于在监听函数存在的代码组件挂载在其他节点的问题。
在 windows上面测试没有问题,在微信小游戏上面测试发现view参数节点通过on监听的函数没有收到emit派发的事件,这是怎么回事?