LevelUp.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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) {
  23. this.levelBefor.string = this.numberString(userInfo.jobLevel);
  24. this.nameBefor.string = this.nameString(userInfo.jobLevelName);
  25. this.levelAfter.string = this.numberString(userInfo.jobLevel + 1);
  26. this.nameAfter.string = this.nameString(upgradeInfo.jobLevelName);
  27. this.salaryLabel.string = upgradeInfo.salary;
  28. this.blessings.string = this.nameString('祝福值:' + upgradeInfo.wish);
  29. this.progressbar.progress = upgradeInfo.wish;
  30. this.progressbar.totalLength = 100;
  31. },
  32. numberString(level) {
  33. return '<outline color=#584A47 width=2><b>' + level + '</b></outline>'
  34. },
  35. nameString(name) {
  36. return '<outline color=#ffffff width=2><b>' + name + '</b></outline>'
  37. },
  38. });