12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import ResMgr from "../base/ResMgr";
- import SoundMgr from "../base/SoundMgr";
- import Tool from "../base/Tool";
- var baseLayer = require('BaseLayer');
- cc.Class({
- extends: baseLayer,
- properties: {
- labTitle: cc.Label,
- labRen: cc.Label,
- labTime: cc.Label,
- labCon: cc.Label,
- itemPre: cc.Node,
- conNode: cc.Node,
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- start () {
- this.initData();
- },
- initData(){
- this.labTitle.string = 'xxxx';
- this.labRen.string = `发送人:${'西门吹雪'}`;
- this.labTime.string = `发送时间: ${Tool.timestampToDate(1713511270000) + Tool.timesBySec(1713511270)}`;
- this.labCon.string = '天下武功唯快不破';
- this.conNode.removeAllChildren();
- for(let i=0; i < 3; i++){
- let temp = cc.instantiate(this.itemPre);
- temp.setPosition(cc.v2(0, 0));
- temp.setParent(this.conNode);
- temp.name = `${i}`;
- temp.active = true;
- temp.getChildByName('labNum').getComponent(cc.Label).string = `x${12}`;
- ResMgr.loadTexture('texture/resIcon/9005', (spFrame)=>{
- temp.getChildByName('sp').getComponent(cc.Sprite).spriteFrame = spFrame;
- });
- }
- },
- closeCb(cb){
- this.cb = cb;
- },
- onClickGet(){
- SoundMgr.playClick();
- console.log('领取');
- this.onClose();
- if(this.cb)
- this.cb();
- },
- });
|