mirror of https://github.com/axmolengine/axmol.git
Merge pull request #13585 from WenhaiLin/v3.8-scheduleOnce-hotfix
[Node::scheduleOnce]Fixed the callback will be executed multiple times if the value of delay parameter equal zero.
This commit is contained in:
commit
30d6c82da6
|
@ -130,19 +130,15 @@ void Timer::update(float dt)
|
|||
trigger(interval);
|
||||
_elapsed -= interval;
|
||||
_timesExecuted += 1;
|
||||
if (_elapsed <= 0.f)
|
||||
|
||||
if (!_runForever && _timesExecuted > _repeat)
|
||||
{
|
||||
cancel();
|
||||
break;
|
||||
}
|
||||
|
||||
if (_runForever)
|
||||
if (_elapsed <= 0.f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_timesExecuted > _repeat)
|
||||
{ //unschedule timer
|
||||
cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue