GameStates.js 1001 B

123456789101112131415161718192021222324252627282930313233343536
  1. cc.Class({
  2. extends: require("BaseGameStates"),
  3. properties: {
  4. Player_infoArr: {
  5. default: [],
  6. type: cc.Label,
  7. }
  8. },
  9. onLoad() {
  10. // this.InformationChanges("set", "name", "小明");
  11. //let name = this.InformationChanges("get", "name");
  12. // console.log(a);
  13. this.InformationChanges("set", 0, "小明");
  14. this.InformationChanges("set", 1, 50);
  15. this.InformationChanges("set", 2, 50);
  16. },
  17. start() {
  18. for (let i = 0; i < this.Player_infoArr.length; i++) {
  19. let info = this.InformationChanges("get", i);
  20. if (i == 1 || i == 2) {
  21. if (info / 1000 > 1) {
  22. this.Player_infoArr[i].string = info / 1000 + "K";
  23. } else {
  24. this.Player_infoArr[i].string = info;
  25. }
  26. } else {
  27. this.Player_infoArr[i].string = info;
  28. }
  29. }
  30. },
  31. // update (dt) {},
  32. });