Files
game1/assets/_script/failEventNode_1.js
tothvillar e896e2ead4 init
2026-07-09 15:04:14 +08:00

47 lines
1.2 KiB
JavaScript

cc.Class({
extends: cc.Component,
properties: {
startDelayTime: {
default: 700,
displayName: "起始延迟的时间"
},
hideNode: {
type: cc.Node,
default: [],
displayName: "失败后需要隐藏的节点"
},
hideTime: {
default: 0,
displayName: "隐藏延迟的时间"
}
},
onLoad: function () {
this.isGameFail = false;
this.node.switchEvent = this.switchEvent.bind(this);
},
start: function () {},
switchEvent: function () {
var e = this;
if (1 != this.isGameFail) {
console.log("走到这里");
this.isGameFail = true;
this.node.stopAllActions();
setTimeout(function () {
if (e.hideNode) {
for (var o = 0; o < e.hideNode.length; o++) {
e.hideNode[o].active = false;
}
}
}, this.hideTime);
setTimeout(function () {
cc.global.LoadPreFtabData("prefab/ui/ui_lostGame", function () {}.bind(e));
}, this.startDelayTime);
}
},
setShootState: function () {
this.guang.active = true;
this.guang.runAction(cc.sequence(cc.fadeTo(.1, 255), cc.fadeTo(.2, 0), cc.callFunc(function () {
this.guang.active = false;
}.bind(this))));
}
});