progress.js 854 B

12345678910111213141516171819202122232425262728293031323334353637
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. usualNode: cc.Node,
  5. currentLabel: cc.Label,
  6. maxLabel: cc.Label,
  7. progress: cc.ProgressBar,
  8. nameLabel: cc.Label,
  9. levelLabel: cc.Label,
  10. limitNode: cc.Node,
  11. limitScore: cc.Label
  12. },
  13. // LIFE-CYCLE CALLBACKS:
  14. // onLoad () {},
  15. init(current, data, level) {
  16. if (level < 15) {
  17. this.limitNode.active = false
  18. this.usualNode.active = true
  19. this.maxLabel.string = data.score
  20. this.currentLabel.string = current
  21. // this.nameLabel.string = data.name
  22. this.progress.progress = current / data.score
  23. this.levelLabel.string = "lv" + (level + '')
  24. } else {
  25. this.limitNode.active = true
  26. this.usualNode.active = false
  27. this.limitScore.string = current
  28. this.progress.progress = 1
  29. }
  30. }
  31. // update (dt) {},
  32. });