49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
cc.Class({
|
|
extends: cc.Component,
|
|
properties: {
|
|
clcicknode: {
|
|
default: null,
|
|
type: cc.Node,
|
|
displayName: "点击的节点"
|
|
},
|
|
startTime: {
|
|
default: 0,
|
|
displayName: "起始延迟时间"
|
|
},
|
|
returnDelayTime: {
|
|
default: -1,
|
|
displayName: "返回延迟的时间,负数为不返回"
|
|
},
|
|
eventNode_over: {
|
|
default: null,
|
|
type: cc.Node,
|
|
displayName: "结束事件节点"
|
|
},
|
|
hideNode: {
|
|
type: cc.Node,
|
|
default: [],
|
|
displayName: "需要隐藏的节点"
|
|
}
|
|
},
|
|
start: function () {
|
|
this.clcicknode.on(cc.Node.EventType.TOUCH_END, this.switchEvent, this);
|
|
this.canClike = true;
|
|
},
|
|
switchEvent: function () {
|
|
var e = this;
|
|
if (this.canClike) {
|
|
this.node.parent.parent.getChildByName("hand_zhiyin") && 1 == this.node.parent.parent.getChildByName("hand_zhiyin").active && (this.node.parent.parent.getChildByName("hand_zhiyin").active = false);
|
|
if (this.hideNode) {
|
|
for (var o = 0; o < this.hideNode.length; o++) {
|
|
this.hideNode[o].active = false;
|
|
}
|
|
}
|
|
cc.tween(this.clcicknode).delay(this.startTime).call(function () {
|
|
e.canClike = false;
|
|
e.eventNode_over && e.eventNode_over.switchEvent();
|
|
}).start();
|
|
}
|
|
},
|
|
returnStartPos: function () {},
|
|
restoreEvent: function () {}
|
|
}); |