const { ArtistTrainItemSkillStyle } = require('../utils/GameEnum'); const DWTool = require("../utils/DWTool"); cc.Class({ extends: cc.Component, properties: { skillSprite: cc.Sprite, title: cc.Label, scoreLabel: cc.Label, upSprite: cc.Sprite }, // LIFE-CYCLE CALLBACKS: init(data, style) { this.style = style; switch (data, style) { case ArtistTrainItemSkillStyle.Ability: // 能力加成 this.title.string = "能力提升:"; this.scoreLabel.string = `+${data.addAbility}`; DWTool.loadResSpriteFrame('./artistTrain/big_ability') .then((spriteFrame) => { this.skillSprite.spriteFrame = spriteFrame; }); // this.node.width = 94; break; case ArtistTrainItemSkillStyle.Charm: // 魅力加成 this.title.string = "魅力提升:"; this.scoreLabel.string = `+${data.addCharm}`; DWTool.loadResSpriteFrame('./artistTrain/big_charm') .then((spriteFrame) => { this.skillSprite.spriteFrame = spriteFrame; }); // this.node.width = 100; break; case ArtistTrainItemSkillStyle.Effect: // 影响力 this.title.string = "影响力提升:"; this.scoreLabel.string = `+${data.addEffect}`; DWTool.loadResSpriteFrame('./artistTrain/big_effect') .then((spriteFrame) => { this.skillSprite.spriteFrame = spriteFrame; }); // this.node.width = 114; break; default: break; } }, onLoad () { }, start () { }, // update (dt) {}, });