Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cocos2d/CCScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ cc.ArrayContainsObject = function (arr, findObj) {
/**
* find object from array by target
* @param {Array} arr source array
* @param {cc.ListEntry|cc.HashUpdateEntry|cc.HashSelectorEntry} findInt find target
* @return {cc.ListEntry|cc.HashUpdateEntry|cc.HashSelectorEntry}
* @param {cc.ListEntry|cc.HashUpdateEntry} findInt find target
* @return {cc.ListEntry|cc.HashUpdateEntry}
*/
cc.HASH_FIND_INT = function (arr, findInt) {
if (arr == null) {
Expand Down Expand Up @@ -331,12 +331,13 @@ cc.Timer = cc.Class.extend(/** @lends cc.Timer# */{
this._elapsed = 0;
this._timesExecuted = 0;
} else {
var locTarget = this._target, locSelector = this._selector;
if (this._runForever && !this._useDelay) {
//standard timer usage
this._elapsed += dt;

if (this._elapsed >= this._interval) {
if (this._target && this._selector)
if (locTarget && locSelector)
this._callSelector();
this._elapsed = 0;
}
Expand All @@ -345,7 +346,7 @@ cc.Timer = cc.Class.extend(/** @lends cc.Timer# */{
this._elapsed += dt;
if (this._useDelay) {
if (this._elapsed >= this._delay) {
if (this._target && this._selector)
if (locTarget && locSelector)
this._callSelector();

this._elapsed = this._elapsed - this._delay;
Expand All @@ -354,7 +355,7 @@ cc.Timer = cc.Class.extend(/** @lends cc.Timer# */{
}
} else {
if (this._elapsed >= this._interval) {
if (this._target && this._selector)
if (locTarget && locSelector)
this._callSelector();

this._elapsed = 0;
Expand All @@ -363,7 +364,7 @@ cc.Timer = cc.Class.extend(/** @lends cc.Timer# */{
}

if (this._timesExecuted > this._repeat)
cc.Director.getInstance().getScheduler().unscheduleCallbackForTarget(this._target, this._selector);
cc.Director.getInstance().getScheduler().unscheduleCallbackForTarget(locTarget, locSelector);
}
}
}
Expand Down Expand Up @@ -999,4 +1000,3 @@ cc.Scheduler = cc.Class.extend(/** @lends cc.Scheduler# */{
}
});


Loading