ArtistTrainCompletionSkill.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. const { ArtistTrainItemSkillStyle } = require('../utils/GameEnum');
  2. const DWTool = require("../utils/DWTool");
  3. cc.Class({
  4. extends: cc.Component,
  5. properties: {
  6. skillSprite: cc.Sprite,
  7. title: cc.Label,
  8. scoreLabel: cc.Label,
  9. upSprite: cc.Sprite
  10. },
  11. // LIFE-CYCLE CALLBACKS:
  12. init(data, style) {
  13. this.style = style;
  14. switch (data, style) {
  15. case ArtistTrainItemSkillStyle.Ability: // 能力加成
  16. this.title.string = "能力提升:";
  17. this.scoreLabel.string = `+${data.addAbility}`;
  18. DWTool.loadResSpriteFrame('./artistTrain/big_ability')
  19. .then((spriteFrame) => {
  20. this.skillSprite.spriteFrame = spriteFrame;
  21. });
  22. // this.node.width = 94;
  23. break;
  24. case ArtistTrainItemSkillStyle.Charm: // 魅力加成
  25. this.title.string = "魅力提升:";
  26. this.scoreLabel.string = `+${data.addCharm}`;
  27. DWTool.loadResSpriteFrame('./artistTrain/big_charm')
  28. .then((spriteFrame) => {
  29. this.skillSprite.spriteFrame = spriteFrame;
  30. });
  31. // this.node.width = 100;
  32. break;
  33. case ArtistTrainItemSkillStyle.Effect: // 影响力
  34. this.title.string = "影响力提升:";
  35. this.scoreLabel.string = `+${data.addEffect}`;
  36. DWTool.loadResSpriteFrame('./artistTrain/big_effect')
  37. .then((spriteFrame) => {
  38. this.skillSprite.spriteFrame = spriteFrame;
  39. });
  40. // this.node.width = 114;
  41. break;
  42. default:
  43. break;
  44. }
  45. },
  46. onLoad () {
  47. },
  48. start () {
  49. },
  50. // update (dt) {},
  51. });