StarGiftBagItem.js 807 B

1234567891011121314151617181920212223242526272829303132333435
  1. const DWTool = require("../utils/DWTool");
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. giftSprite: cc.Sprite,
  6. giftNameLabel: cc.Label,
  7. descLabel: cc.Label
  8. },
  9. // LIFE-CYCLE CALLBACKS:
  10. // onLoad () {},
  11. start () {
  12. },
  13. // update (dt) {},
  14. configData(giftInfo) {
  15. this.giftInfo = giftInfo;
  16. this.giftNameLabel.string = giftInfo.name;
  17. let path = `./textures/store/8004${giftInfo.shopId - 16}2`;
  18. DWTool.loadResSpriteFrame(path).then((spriteFrame) => {
  19. this.giftSprite.spriteFrame = spriteFrame;
  20. }).catch((msg) => {
  21. console.log(msg);
  22. });
  23. let percent = parseInt(giftInfo.zk * 100);
  24. this.descLabel.string = `明星的签约价格优惠${percent}%`;
  25. },
  26. });