cocos creator 自定义类使用schedule

2025-03-13  本文已影响0人  凡凡的小web
image.png
private _scheduler: Scheduler = null

    init(){
        Scheduler.enableForTarget(this)
        this._scheduler = director.getScheduler()
    }

    update(){

    }

      startCheck(){
       director.on(Director.EVENT_BEFORE_DRAW, this.checkProfile, this);
        this._scheduler.schedule(this.checked, this, 10)    
      }

      checked(){
     this._scheduler.unschedule(this.checked, this)
      director.off(Director.EVENT_BEFORE_DRAW, this.checkProfile, this);
        }

checkProfile(){
}
上一篇 下一篇

猜你喜欢

热点阅读