BaseGameStates.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. cc.Class({
  2. extends: cc.Component,
  3. properties: {
  4. },
  5. onLoad() {
  6. this.restTime = 12;
  7. this.currentTime = 0;
  8. this.player_name = "";
  9. this.player_gold = 10000;
  10. this.player_energy = 10001;
  11. this.player_sex = 0;
  12. this.game_time = 720; //战斗时间
  13. this.currPass = 0;
  14. },
  15. start() {
  16. },
  17. update(dt) {
  18. },
  19. InformationChanges(state, indel, info) {
  20. if (state == "set") {
  21. if (indel == 0) {
  22. this.player_name = info;
  23. }
  24. if (indel == 1) {
  25. this.player_gold = info;
  26. }
  27. if (indel == 2) {
  28. this.player_energy = info;
  29. }
  30. if (indel == 3) {
  31. this.player_sex = info;
  32. }
  33. } else if (state == "get") {
  34. if (indel == 0) {
  35. return this.player_name;
  36. }
  37. if (indel == 1) {
  38. return this.player_gold;
  39. }
  40. if (indel == 2) {
  41. return this.player_energy;
  42. }
  43. if (indel == 3) {
  44. return this.player_sex;
  45. }
  46. }
  47. },
  48. //时间减少
  49. countdown(currentTime) {
  50. currentTime--;
  51. if (currentTime <= 0) {
  52. currentTime = 0;
  53. }
  54. return currentTime;
  55. },
  56. });