123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- 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) {},
- });
|