Skip to content

Commit 4ed5d93

Browse files
committed
issue cocos2d#3251 add call function for cocostudio action
1 parent b724b63 commit 4ed5d93

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

extensions/CocoStudio/Action/CCActionManager.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ ccs.ActionManager = ccs.Class.extend(/** @lends ccs.ActionManager# */{
7878
* Play an Action with a name.
7979
* @param {String} jsonName
8080
* @param {String} actionName
81+
* @param {cc.CallFunc} fun
8182
*/
82-
playActionByName: function (jsonName, actionName) {
83+
playActionByName: function (jsonName, actionName, fun) {
8384
var action = this.getActionByName(jsonName, actionName);
8485
if (action) {
85-
action.play();
86+
action.play(fun);
8687
}
8788
},
8889

extensions/CocoStudio/Action/CCActionNode.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,17 @@ ccs.ActionNode = ccs.Class.extend({
279279
/**
280280
* Play the action.
281281
* @param {Boolean} loop
282+
* @param {cc.CallFunc} fun
282283
*/
283-
playAction: function () {
284+
playAction: function (fun) {
284285
if (this._object == null || this._actionSpawn == null) {
285286
return;
286287
}
287-
this._action = cc.Sequence.create(this._actionSpawn, null);
288-
this._action.retain();
288+
if(fun){
289+
this._action = cc.Sequence.create(this._actionSpawn,fun);
290+
}else{
291+
this._action = cc.Sequence.create(this._actionSpawn);
292+
}
289293
this.runAction();
290294
},
291295

extensions/CocoStudio/Action/CCActionObject.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,19 @@ ccs.ActionObject = ccs.Class.extend({
170170

171171
/**
172172
* Play the action.
173+
* @param {cc.CallFunc} fun
173174
*/
174-
play: function () {
175+
play: function (fun) {
175176
this.stop();
176177
this.updateToFrameByTime(0);
177178
var frameNum = this._actionNodeList.length;
178179
for (var i = 0; i < frameNum; i++) {
179180
var locActionNode = this._actionNodeList[i];
180-
locActionNode.playAction(this.getLoop());
181+
locActionNode.playAction(fun);
181182
}
182183
if (this._loop) {
183-
this._scheduler.scheduleCallbackForTarget(this, this.simulationActionUpdate, this, 0., cc.REPEAT_FOREVER, 0, false);
184-
}
184+
this._scheduler.scheduleCallbackForTarget(this, this.simulationActionUpdate, 0, cc.REPEAT_FOREVER, 0, false);
185+
}
185186
},
186187

187188
/**

0 commit comments

Comments
 (0)