51 lines
1.2 KiB
JavaScript
51 lines
1.2 KiB
JavaScript
cc.Class({
|
|
extends: cc.Component,
|
|
properties: {
|
|
_parentScript: null,
|
|
levelLabel: {
|
|
default: null,
|
|
type: cc.Label,
|
|
displayName: "关卡序号"
|
|
},
|
|
notUnlockKuang: {
|
|
default: null,
|
|
type: cc.Node,
|
|
displayName: "未解锁框"
|
|
},
|
|
nowLevelNode: {
|
|
default: null,
|
|
type: cc.Node,
|
|
displayName: "当前关卡节点"
|
|
},
|
|
unlockLevelBj: {
|
|
default: null,
|
|
type: cc.Node,
|
|
displayName: "解锁"
|
|
}
|
|
},
|
|
start: function () {},
|
|
onRegister: function (e) {
|
|
this._parentScript = e;
|
|
},
|
|
init: function (e, o, t) {
|
|
this.index = o;
|
|
this.levelLabel.string = o + 1;
|
|
this.isLock = true;
|
|
this.notUnlockKuang.active = false;
|
|
this.nowLevelNode.active = false;
|
|
this.unlockLevelBj.active = false;
|
|
o < t && (this.isLock = false);
|
|
if (o + 1 == t) {
|
|
this.nowLevelNode.active = true;
|
|
this.unlockLevelBj.active = true;
|
|
} else if (o + 1 < t) {
|
|
this.unlockLevelBj.active = true;
|
|
} else {
|
|
this.notUnlockKuang.active = true;
|
|
this.isLock = true;
|
|
}
|
|
},
|
|
onButtonEvevt: function () {
|
|
this._parentScript.onCheckeLevel(this.index);
|
|
}
|
|
}); |