43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
cc.Class({
|
|
extends: cc.Component,
|
|
properties: {
|
|
StartNode: cc.Node,
|
|
EndNode: cc.Node
|
|
},
|
|
start: function () {
|
|
this.node.getChildByName("anim");
|
|
this.anim_com = this.node.getComponent(cc.Animation);
|
|
},
|
|
onGameStart: function () {
|
|
var e = this;
|
|
setTimeout(function () {
|
|
e.onUpdataPlay();
|
|
}, 1e3);
|
|
},
|
|
onUpdataPlay: function () {
|
|
this.id = 0;
|
|
this.time = .1;
|
|
var e = this;
|
|
for (var o = 0; o < this.node.children.length; o++) {
|
|
this.time += .05;
|
|
cc.global.onTransitionPosition(this.StartNode, this.node, this.StartNode.getPosition());
|
|
var t = cc.global.onTransitionPosition(this.EndNode.parent, this.node, this.EndNode.getPosition());
|
|
cc.tween(this.node.children[o]).to(this.time, {
|
|
position: cc.v2(t.x, t.y)
|
|
}).call(function () {
|
|
e.id++;
|
|
console.log("self.id" + e.id);
|
|
if (10 == e.id) {
|
|
console.log("金币:" + e.jinbi);
|
|
cc.playerData.coin += e.jinbi;
|
|
cc.global.savePlayerData();
|
|
e.callBack && e.callBack();
|
|
}
|
|
}).start();
|
|
}
|
|
},
|
|
show: function (e, o) {
|
|
this.jinbi = o;
|
|
this.callBack = e;
|
|
}
|
|
}); |