LevelUp.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Learn cc.Class:
  2. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
  10. cc.Class({
  11. extends: cc.Component,
  12. properties: {
  13. levelBefor: cc.RichText,
  14. levelAfter: cc.RichText,
  15. nameBefor: cc.RichText,
  16. nameAfter: cc.RichText,
  17. role: sp.Skeleton,
  18. salaryLabel: cc.Label,
  19. progressbar: cc.ProgressBar,
  20. blessings: cc.RichText,
  21. },
  22. bind(userInfo, upgradeInfo, wish) {
  23. this.levelBefor.string = this.numberString(userInfo.jobLevel);
  24. this.nameBefor.string = this.nameString(userInfo.jobLevelName);
  25. this.levelAfter.string = this.numberString(upgradeInfo.level);
  26. this.nameAfter.string = this.nameString(upgradeInfo.name);
  27. this.salaryLabel.string = upgradeInfo.salary;
  28. this.blessings.string = this.nameString('祝福值:' + wish);
  29. this.progressbar.progress = wish * this.progressbar.totalLength / 100;
  30. },
  31. numberString(level) {
  32. return '<outline color=#584A47 width=2><b>' + level + '</b></outline>'
  33. },
  34. nameString(name) {
  35. return '<outline color=#ffffff width=2><b>' + name + '</b></outline>'
  36. },
  37. });