progress.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. // console.log('zh:等级展示')
  17. if (level < 15) {
  18. this.limitNode.active = false
  19. this.usualNode.active = true
  20. this.maxLabel.string = data.score
  21. this.currentLabel.string = current
  22. // this.nameLabel.string = data.name
  23. this.progress.progress = current / data.score
  24. this.levelLabel.string = "lv" + (level + '')
  25. } else {
  26. this.limitNode.active = true
  27. this.usualNode.active = false
  28. this.limitScore.string = current
  29. this.progress.progress = 1
  30. //zh: 隐藏等级,这是我加的
  31. //console.log('zh:等级开始隐藏')
  32. this.levelLabel.string = ''
  33. // this.levelLabel.active = false; 这句TMD无效
  34. }
  35. }
  36. // update (dt) {},
  37. });