1
0

ArtistTrainItemSkill.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. upSprite: cc.Sprite
  9. },
  10. // LIFE-CYCLE CALLBACKS:
  11. init(style) {
  12. this.style = style;
  13. switch (style) {
  14. case ArtistTrainItemSkillStyle.Ability: // 能力加成
  15. this.title.string = "能力";
  16. DWTool.loadResSpriteFrame('./artistTrain/artist_train_ability')
  17. .then((spriteFrame) => {
  18. this.skillSprite.spriteFrame = spriteFrame;
  19. });
  20. this.node.width = 94;
  21. break;
  22. case ArtistTrainItemSkillStyle.Charm: // 魅力加成
  23. this.title.string = "魅力";
  24. DWTool.loadResSpriteFrame('./artistTrain/artist_train_charm')
  25. .then((spriteFrame) => {
  26. this.skillSprite.spriteFrame = spriteFrame;
  27. });
  28. this.node.width = 100;
  29. break;
  30. case ArtistTrainItemSkillStyle.Effect: // 影响力
  31. this.title.string = "影响力";
  32. DWTool.loadResSpriteFrame('./artistTrain/artist_train_effect')
  33. .then((spriteFrame) => {
  34. this.skillSprite.spriteFrame = spriteFrame;
  35. });
  36. this.node.width = 114;
  37. break;
  38. default:
  39. break;
  40. }
  41. this.skillSprite.node.getComponent(cc.Widget).updateAlignment();
  42. this.title.node.getComponent(cc.Widget).updateAlignment();
  43. this.upSprite.node.getComponent(cc.Widget).updateAlignment();
  44. },
  45. onLoad () {
  46. },
  47. start () {
  48. },
  49. // update (dt) {},
  50. });