const ButtonSelect1 = require('ButtonSelect1') const ViewBase = require('ViewBase'); const SequenCreateView = require('SequenCreateView'); const BoxItem = require('BoxItem') cc.Class({ extends: ViewBase, properties: { button1: { default: null, type: ButtonSelect1, serializable: true, }, button2: { default: null, type: ButtonSelect1, serializable: true, }, button3: { default: null, type: ButtonSelect1, serializable: true, }, buttonPrice1: { default: null, type: ButtonSelect1, serializable: true, }, buttonPrice2: { default: null, type: ButtonSelect1, serializable: true, }, buttonPrice3: { default: null, type: ButtonSelect1, serializable: true, }, buttonPrice4: { default: null, type: ButtonSelect1, serializable: true, }, scrollViewBox: { default: null, type: cc.ScrollView, serializable: true, }, viewContent: { default: null, type: cc.Node, serializable: true, } }, onLoad () { this.buttons = [ this.button1, this.button2, this.button3, ]; this.buttonPrices = [ this.buttonPrice1, this.buttonPrice2, this.buttonPrice3, this.buttonPrice4, ]; this.sequenCreateBoxs = new SequenCreateView().initRoot(this); this.initBoxs(); this.onClickPrice(null, "0"); }, initBoxs() { // getConfigAll // this.sequenCreateBoxs.addDatas(G.CfgMgr.battleBoxConfig.getConfigAll()); this.sequenCreateBoxs.addDatas(G.CfgMgr.battleBoxConfig.getConfigAll()); this.sequenCreateBoxs.startCreate(JMC.UIEnum.BoxItem, this.scrollViewBox.content, function(node, data) { let boxItem = node.getComponent(BoxItem); boxItem.setScale(0.73); boxItem.setNameScale(1/0.73); boxItem.setName(data.name); boxItem.setPrice(G.PlayUtils.getPrice(data.price)); }); }, updatePriceSelect(index) { for (let i = 0; i < this.buttonPrices.length; i++) { const b = this.buttonPrices[i]; b.setSelect(index == i) } }, onClickTitle(event, customEventData) { let index = parseInt(customEventData) }, onClickPrice(event, customEventData) { let index = parseInt(customEventData) this.updatePriceSelect(index) }, // update (dt) {}, });