import SoundMgr from "../base/SoundMgr"; import UIMgr from "../base/UIMgr"; cc.Class({ extends: cc.Component, properties: { room1Node: cc.Node, room2Node: cc.Node, }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start () { }, showRoom(hallSceneJs, index){ this.hallSceneJs = hallSceneJs; this.node.active = true; this.room1Node.active = index == 1; this.room2Node.active = index == 2; if(index == 1){ this.setRoom1(); }else{ this.setRoom2(); } }, setRoom1(){ let labZhan1 = cc.find('item1/zhan/labZhan', this.room1Node).getComponent(cc.Label); let labCoin1 = cc.find('item1/coin/labCoin', this.room1Node).getComponent(cc.Label); let labZhan2 = cc.find('item2/zhan/labZhan', this.room1Node).getComponent(cc.Label); let labCoin2 = cc.find('item2/coin/labCoin', this.room1Node).getComponent(cc.Label); let labAward2Num = cc.find('item2/awardPool/labNum', this.room1Node).getComponent(cc.Label); labZhan1.string = `战力要求: ${1}-${2}`; labCoin1.string = '金币携带: ' + 100; labZhan2.string = `战力要求: ${3}-${4}`; labCoin2.string = '金币携带: ' + 200; labAward2Num.string = 1111111; }, setRoom2(){ let labZhan1 = cc.find('item1/zhan/labZhan', this.room2Node).getComponent(cc.Label); let labCoin1 = cc.find('item1/coin/labCoin', this.room2Node).getComponent(cc.Label); let labAward1Num = cc.find('item1/awardPool/labNum', this.room2Node).getComponent(cc.Label); let labZhan2 = cc.find('item2/zhan/labZhan', this.room2Node).getComponent(cc.Label); let labCoin2 = cc.find('item2/coin/labCoin', this.room2Node).getComponent(cc.Label); let labAward2Coin = cc.find('item2/awardPool/labCoin', this.room2Node).getComponent(cc.Label); let labAward2Bli = cc.find('item2/awardPool/labBli', this.room2Node).getComponent(cc.Label); labZhan1.string = `战力要求: ${5}-${6}`; labCoin1.string = '金币携带: ' + 300; labAward1Num.string = 2222222; labZhan2.string = `战力要求: ${7}-${8}`; labCoin2.string = '金币携带: ' + 400; labAward2Coin.string = 3333333; labAward2Bli.string = 4444444; }, onClickRoom1_1(){ SoundMgr.playClick(); cc.director.loadScene('gameScene'); }, onClickRoom1_2(){ SoundMgr.playClick(); cc.director.loadScene('gameScene'); }, onClickRoom2_1(){ SoundMgr.playClick(); cc.director.loadScene('gameScene'); }, onClickRoom2_2(){ SoundMgr.playClick(); UIMgr.openUI('prefabs/PowerUpLayer'); }, onClose(){ SoundMgr.playClick() this.node.active = false; this.hallSceneJs.showHides(true); }, });