36 lines
876 B
JavaScript
36 lines
876 B
JavaScript
cc.Class({
|
|
extends: cc.Component,
|
|
properties: {
|
|
img: {
|
|
default: null,
|
|
type: cc.SpriteFrame,
|
|
displayName: "更换的图片"
|
|
},
|
|
startTime: {
|
|
default: 0,
|
|
displayName: "起始延迟时间"
|
|
},
|
|
returnDelayTime: {
|
|
default: -1,
|
|
displayName: "返回延迟的时间,负数为不返回"
|
|
},
|
|
eventNode_over: {
|
|
default: null,
|
|
type: cc.Node,
|
|
displayName: "结束事件节点"
|
|
}
|
|
},
|
|
start: function () {
|
|
this.node.switchEvent = this.switchEvent.bind(this);
|
|
},
|
|
switchEvent: function () {
|
|
var e = this;
|
|
var o = this.node.getComponent(cc.Sprite);
|
|
cc.tween(o).delay(this.startTime).call(function () {
|
|
o.spriteFrame = e.img;
|
|
e.eventNode_over && e.eventNode_over.switchEvent();
|
|
}).start();
|
|
},
|
|
returnStartPos: function () {},
|
|
restoreEvent: function () {}
|
|
}); |