123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- import ResMgr from "../base/ResMgr";
- import SoundMgr from "../base/SoundMgr";
- import Tool from "../base/Tool";
- import UIMgr from "../base/UIMgr";
- var baseLayer = require('BaseLayer');
- cc.Class({
- extends: baseLayer,
- properties: {
- lab1: cc.Label, //贝利
- lab2: cc.Label, //金币
- labCode: cc.Label,
- labBindCode: cc.Label,
- blueNode: cc.Node,
- labCool: cc.Label,
- itemPre: cc.Node,
- conNode: cc.Node,
- helpView: cc.Node,
- bindView: cc.Node,
- editBind: cc.EditBox,
- detailView: cc.Node,
- labDBi: cc.Label,
- itemDPre: cc.Node,
- conDNode: cc.Node,
-
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- start () {
- this.initData();
- },
- initData(){
- this.lab1.string = `x${12321}`;
- this.lab2.string = `x${222}`;
- this.labCode.string = 778899;
- this.labBindCode.string = 'xxxxxx';
- this.blueNode.active = true;
- this.lerpTime = 2134;
- this.daoshiji();
- this.schedule(this.daoshiji, 1, cc.macro.REPEAT_FOREVER);
-
- this.initItems();
- this.initDItems();
- },
- daoshiji(){
- if(this.lerpTime <= 1){
- this.labCool.node.active = false;
- this.unschedule(this.daoshiji);
- return;
- }
- this.lerpTime -= 1;
- this.labCool.string = Tool.timesBySec(this.lerpTime);
- },
- initItems(){
- this.conNode.removeAllChildren();
- for(let i=0; i < 4; i++){
- let temp = cc.instantiate(this.itemPre);
- temp.setParent(this.conNode);
- temp.name = `${i}`;
- temp.active = true;
- temp.getChildByName('labDes').getComponent(cc.RichText).string = '哈哈哈哈';
- temp.getChildByName('sp1').active = true; //贝利
- temp.getChildByName('sp2').active = false; //金币
- temp.getChildByName('labNum').getComponent(cc.Label).string = `x${998}`;
- }
- },
- initDItems(){
- this.labDBi.string = '00908';
- this.conDNode.removeAllChildren();
- for(let i=0; i < 10; i++){
- let temp = cc.instantiate(this.itemDPre);
- temp.setParent(this.conDNode);
- temp.name = `${i}`;
- temp.active = true;
- temp.getChildByName('labName').getComponent(cc.Label).string = '法外狂徒';
- }
- },
- onClickHelpView(){
- SoundMgr.playClick();
- this.helpView.active = !this.helpView.active;
- },
- onClickBindView(){
- SoundMgr.playClick();
- this.bindView.active = !this.bindView.active;
- },
- onClickEditSure(){
- console.log('确定: ', this.editBind.string);
- },
- onClickDetailView(){
- SoundMgr.playClick();
- this.detailView.active = !this.detailView.active;
- },
- onClickGet(){
- SoundMgr.playClick();
- UIMgr.openUI('prefabs/TipsLayer', (pf)=>{
- pf.getComponent('TipsLayer').setCon('没有可领取的红包');
- });
- },
- onClickPYQ(){
- SoundMgr.playClick();
- },
- onClickWX(){
- SoundMgr.playClick();
- },
- onClickCopy(){
- SoundMgr.playClick();
- },
-
- });
|