import Common5 from "../../Platform/th/Common5"; import { BagGoodsConfig } from "../Manager/BagManager"; import BaiCaoJiManager from "../Manager/BaiCaoJiManager"; const {ccclass, property} = cc._decorator; @ccclass export default class BaiCaoJiShuoMing extends cc.Component { @property(cc.Node) scrollViewContent: cc.Node = null; @property(cc.Node) childItem: cc.Node = null; // LIFE-CYCLE CALLBACKS: // onLoad () {} start () { this.initView() } initView(){ let config = BaiCaoJiManager.getManagerConfigs() for(let i=0;i<config.length;i++){ let item = cc.instantiate(this.childItem) Common5.addUrlSprite_custom('BaiCaoJi/佰草集花/'+config[i].goodName, item.getChildByName('iconSpr').getComponent(cc.Sprite)) item.getChildByName('nameStr').getComponent(cc.Label).string = config[i].goodName item.active = true this.scrollViewContent.addChild(item) } //暂不需要 // for(let i=0;i<BagGoodsConfig.length;i++){ // if(BagGoodsConfig[i].GMGameType == 'BaiCaoJi'){ // let item = cc.instantiate(this.childItem) // //Common5.getSpriteFrameFromBundle("GameRes", 'BaiCaoJi/texture/佰草集花/'+BagGoodsConfig[i].goodName , item.getChildByName('iconSpr').getComponent(cc.Sprite)); // Common5.addUrlSprite_custom('BaiCaoJi/佰草集花/'+BagGoodsConfig[i].goodName, item.getChildByName('iconSpr').getComponent(cc.Sprite)) // item.getChildByName('nameStr').getComponent(cc.Label).string = BagGoodsConfig[i].goodName // item.active = true // this.scrollViewContent.addChild(item) // } // } } onBtnClose(){ this.node.removeFromParent() this.node.destroy() } // update (dt) {} }