GameStates.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. //#region
  18. // this.InformationChanges("set", "name", "小明");
  19. //let name = this.InformationChanges("get", "name");
  20. // console.log(a);
  21. // this.InformationChanges("set", 0, "小明");
  22. // this.InformationChanges("set", 1, 50);
  23. // this.InformationChanges("set", 2, 50);
  24. //#endregion
  25. for (let i = 0; i < this.Player_infoArr.length; i++) {
  26. let info = this.InformationChanges("get", i);
  27. if (i == 1 || i == 2) {
  28. if (info / 1000 > 1) {
  29. this.Player_infoArr[i].string = parseInt(info / 1000) + "K";
  30. } else {
  31. this.Player_infoArr[i].string = info;
  32. }
  33. } else {
  34. this.Player_infoArr[i].string = info;
  35. }
  36. }
  37. },
  38. start() {
  39. //console.log("金币", this.player_gold);
  40. },
  41. update(dt) {
  42. },
  43. init() {
  44. //角色脚本
  45. },
  46. });