GameStates.js 1.1 KB

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