GameStates.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. this._restTime = this.restTime;
  12. this._currentTime = this.currentTime;
  13. this._player_name = this.player_name;
  14. this._player_gold = this.player_gold;
  15. this._player_energy = this.player_energy;
  16. this._player_sex = this.player_sex;
  17. this._currPass = this.currPass; //当前关卡
  18. //#region
  19. // this.InformationChanges("set", "name", "小明");
  20. //let name = this.InformationChanges("get", "name");
  21. // console.log(a);
  22. // this.InformationChanges("set", 0, "小明");
  23. // this.InformationChanges("set", 1, 50);
  24. // this.InformationChanges("set", 2, 50);
  25. //#endregion
  26. for (let i = 0; i < this.Player_infoArr.length; i++) {
  27. let info = this.InformationChanges("get", i);
  28. if (i == 1 || i == 2) {
  29. if (info / 1000 > 1) {
  30. this.Player_infoArr[i].string = parseInt(info / 1000) + "K";
  31. } else {
  32. this.Player_infoArr[i].string = info;
  33. }
  34. } else {
  35. this.Player_infoArr[i].string = info;
  36. }
  37. }
  38. },
  39. start() {
  40. //console.log("金币", this.player_gold);
  41. },
  42. update(dt) {
  43. },
  44. init() {
  45. //角色脚本
  46. },
  47. });