startDisplayTimer(){
    this.scheduleOnce(this.displayNumber,1);
}

displayNumber(){
    this.startDisplayTimer();
}

//test
this.startDisplayTimer();

由于在scheduleOnce的回调函数(displayNumber)内,又重新调用startDisplayTimer函数再次执行scheduleOnce,因为间隔时间为0所以出错。
CCScheduler#scheduleSelector. Selector already scheduled. Updating interval from: 0 to 0"。
导出无法再次开始计时。
修改startDisplayTimer函数以下:

startDisplayTimer(){
    //使用lambed表达式()=>{},每次新建一个匿名函数
    this.scheduleOnce(()=>{this.displayNumber();},1);
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-23
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-14
  • 2021-11-17
相关资源
相似解决方案