const DWTool = require("../utils/DWTool"); cc.Class({ extends: cc.Component, properties: { giftSprite: cc.Sprite, giftNameLabel: cc.Label, descLabel: cc.Label }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start () { }, // update (dt) {}, configData(giftInfo) { this.giftInfo = giftInfo; this.giftNameLabel.string = giftInfo.name; let path = `./textures/store/8004${giftInfo.shopId - 16}2`; DWTool.loadResSpriteFrame(path).then((spriteFrame) => { this.giftSprite.spriteFrame = spriteFrame; }).catch((msg) => { console.log(msg); }); let percent = parseInt(giftInfo.zk * 100); this.descLabel.string = `明星的签约价格优惠${percent}%`; }, });