const ArtistManager = require('../utils/ArtistManager');
const DWTool = require('../utils/DWTool');
cc.Class({
extends: cc.Component,
properties: {
levelBgBefor: cc.Sprite,
levelBgAfter: cc.Sprite,
levelBefor: cc.RichText,
levelAfter: cc.RichText,
nameBefor: cc.RichText,
nameAfter: cc.RichText,
role: sp.Skeleton,
salaryLabel: cc.Label,
progressbar: cc.ProgressBar,
blessings: cc.RichText,
levelSpriteFrame: [cc.SpriteFrame],
},
bind(userInfo, upgradeInfo, wish) {
this.levelBgBefor.spriteFrame = this.levelSpriteFrame[userInfo.jobLevel - 1];
this.levelBgAfter.spriteFrame = this.levelSpriteFrame[userInfo.jobLevel];
// this.levelBefor.string = this.numberString(userInfo.jobLevel);
this.nameBefor.string = this.nameString(userInfo.jobLevelName);
// this.levelAfter.string = this.numberString(upgradeInfo.level);
this.nameAfter.string = this.nameString(upgradeInfo.name);
this.salaryLabel.string = DWTool.coinParse(userInfo.salary);
this.blessings.string = this.nameString('祝福值:' + wish);
this.progressbar.progress = wish * this.progressbar.totalLength / 100;
//现在只有舞者有骨骼动画,默认jodId为2
ArtistManager.loadArtist(true, userInfo.gender, userInfo.jobId)
.then((skeletonData) => {
this.role.skeletonData = skeletonData;
this.role.animation = "stand";
}).catch((err) => {
console.log(err);
});
},
numberString(level) {
return '' + level + ''
},
nameString(name) {
return '' + name + ''
},
});