12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- const { ArtistTrainItemSkillStyle } = require('../utils/GameEnum');
- const DWTool = require("../utils/DWTool");
- cc.Class({
- extends: cc.Component,
- properties: {
-
- skillSprite: cc.Sprite,
- title: cc.Label,
- },
-
- 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 () {
- },
-
- });
|