// Learn TypeScript: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html import EventName from "./EventName/EventName"; import LocalData from "./LocalData"; import MyComponent from "./Template/MyComponent"; const { ccclass, property } = cc._decorator; @ccclass export default class Over extends MyComponent { @property(cc.SpriteFrame) Sp: cc.SpriteFrame[] = []; @property(cc.Label) Hight: cc.Label = null; @property(cc.Label) label: cc.Label = null; onLoad() { this.regEvent(EventName.Over, this.Over, this) } Over() { this.node.opacity = 255 this.label.string = this.Hight.string if (LocalData.getInstance().getOverCount() == 0) {//首次通关 this.getComponent(cc.Sprite).spriteFrame = this.Sp[0] } else { this.getComponent(cc.Sprite).spriteFrame = this.Sp[1] } } // update (dt) {} }