StoreGiftAlert.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const DWTool = require("../utils/DWTool");
  2. const WeChat = require('../net/WeChat');
  3. const GameModule = require("../utils/GameModule");
  4. cc.Class({
  5. extends: cc.Component,
  6. properties: {
  7. titleSprite: cc.Sprite,
  8. starIconSprite: cc.Sprite,
  9. descLabel: cc.Label,
  10. },
  11. // LIFE-CYCLE CALLBACKS:
  12. // onLoad () {},
  13. start () {
  14. },
  15. init(giftIndex, giftData) {
  16. let imageId = 50000 + giftData.starId;
  17. DWTool.loadResSpriteFrame(`./textures/star_stand/stand_${imageId}`)
  18. .then((spriteFrame) => {
  19. this.starIconSprite.spriteFrame = spriteFrame;
  20. }).catch((err) => {
  21. console.log(err);
  22. });
  23. let path = './textures/store/800' + 4;
  24. DWTool.loadResSpriteFrame(path + giftIndex + 3).then((spriteFrame) => {
  25. this.titleSprite.spriteFrame = spriteFrame;
  26. }).catch((msg) => {
  27. console.log(msg);
  28. });
  29. this.descLabel.string = giftData.desc;
  30. },
  31. buyAction() {
  32. GameModule.audioMng.playClickButton();
  33. WeChat.jumpCustomerServices();
  34. },
  35. closeAction() {
  36. GameModule.audioMng.playClickButton();
  37. this.node.destroy();
  38. },
  39. // update (dt) {},
  40. });