12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- const { ArtistTrainItemSkillStyle } = require('../utils/GameEnum');
- const DWTool = require("../utils/DWTool");
- cc.Class({
- extends: cc.Component,
- properties: {
-
- skillSprite: cc.Sprite,
- title: cc.Label,
- },
- // LIFE-CYCLE CALLBACKS:
- init(style, addition) {
- this.style = style;
-
- this.title.string = `+${addition}`;
- switch (style) {
- case ArtistTrainItemSkillStyle.Ability: // 能力加成
- DWTool.loadResSpriteFrame('./artistTrain/artist_train_ability')
- .then((spriteFrame) => {
- this.skillSprite.spriteFrame = spriteFrame;
- });
-
- break;
- case ArtistTrainItemSkillStyle.Charm: // 魅力加成
- DWTool.loadResSpriteFrame('./artistTrain/artist_train_charm')
- .then((spriteFrame) => {
- this.skillSprite.spriteFrame = spriteFrame;
- });
-
- break;
- case ArtistTrainItemSkillStyle.Effect: // 影响力
- DWTool.loadResSpriteFrame('./artistTrain/artist_train_effect')
- .then((spriteFrame) => {
- this.skillSprite.spriteFrame = spriteFrame;
- });
-
- break;
-
- default:
- break;
- }
- this.skillSprite.node.getComponent(cc.Widget).updateAlignment();
- this.title.node.getComponent(cc.Widget).updateAlignment();
- },
- onLoad () {
- },
- start () {
- },
- // update (dt) {},
- });
|