123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- var baseLayer = require('BaseLayer');
- import SoundMgr from "../base/SoundMgr";
- cc.Class({
- extends: baseLayer,
- properties: {
- spArr: [cc.SpriteFrame],
- itemPrefab: cc.Node,
- layoutNode: cc.Node,
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- this._super(true);
- },
- start () {
- },
- initData(){
- this.scheduleOnce(this.onClose, 3);
- this.layoutNode.removeAllChildren();
- for(let i=0; i < 3; i++){
- let temp = cc.instantiate(this.itemPrefab);
- temp.setParent(this.layoutNode);
- temp.active = true;
- temp.getChildByName('labName').getComponent(cc.Label).string = 'xx';
- temp.getChildByName('sp').getComponent(cc.Sprite).spriteFrame = this.spArr[0];
- temp.getChildByName('labNum').getComponent(cc.Label).string = `x${200}`;
- }
- },
- onClose(){
- SoundMgr.playClick();
- this.unscheduleAllCallbacks();
- this._super();
- },
- // update (dt) {},
- });
|