// Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html const { ccclass, property } = cc._decorator; @ccclass export default class SelectSceneItem extends cc.Component { @property(cc.Sprite) spr_selectScene: cc.Sprite = null; public sceneIndex: number = null; // LIFE-CYCLE CALLBACKS: // onLoad () {} start() { } // update (dt) {} init(sceneIndex: number = null) { this.sceneIndex = sceneIndex; if (sceneIndex != null) { mk.loader.load(`selectScene/${this.sceneIndex}`, cc.SpriteFrame).then((spriteFrame) => { this.spr_selectScene = spriteFrame; }) } else { mk.loader.load(`selectScene/${this.sceneIndex}`, cc.SpriteFrame).then((spriteFrame) => { this.spr_selectScene = spriteFrame; }) } } }