BuildingModel.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. export default class BuildingModel {
  2. /**@type {number} */
  3. goldUnit = 0;
  4. /**@type {number} */
  5. hasNext = 0;
  6. /**@type {number} */
  7. roomId = 0;
  8. /**@type {number} */
  9. level = 0;
  10. /**@type {string} */
  11. name = "";
  12. /**@type {number} */
  13. // nextRate = 0;
  14. /**@type {string} */
  15. nextUpGold = "0";
  16. /**@type {number} */
  17. // nextGold = 0;
  18. /**@type {number} */
  19. rate = 0;
  20. /**@type {number} */
  21. jobId = 0;
  22. /**@type {string} */
  23. unlockScore = "0";
  24. /**@type {number} */
  25. isUnlocked = 0;
  26. /**@type {number} */
  27. coinCount = 0;
  28. /**@type {number} */
  29. gold = 0;
  30. /**@type {string} */
  31. gold1 = "0";
  32. /**@type {string} */
  33. gold2 = "0";
  34. /**@type {string} */
  35. gold3 = "0";
  36. /**@type {string} */
  37. gold4 = "0";
  38. /**@type {number} */
  39. buildingLevel = 0;
  40. /**@type {number} */
  41. maxLevel = 0;
  42. constructor(data) {
  43. // this.coinCount = data.coinCount || 0;
  44. this.goldUnit = data.goldUnit;
  45. this.gold = data.gold;
  46. this.hasNext = data.hasNext;
  47. this.roomId = (data.roomId === undefined) ? data.id : data.roomId;
  48. this.level = data.level;
  49. this.name = data.name;
  50. // this.nextRate = data.nextRate;
  51. this.nextUpGold = data.nextUpGold;
  52. // this.nextGold = data.nextGold;
  53. // this.rate = data.rate;
  54. // this.jobId = data.jobId;
  55. this.buildingLevel = data.buildingLevel;
  56. this.gold1 = data.gold1;
  57. this.gold2 = data.gold2;
  58. this.gold3 = data.gold3;
  59. this.gold4 = data.gold4;
  60. this.maxLevel = data.maxLevel;
  61. this.unlockScore = data.unlockScore;
  62. // if (data.unlockScore && data.unlockScore !== 0) {
  63. // this.unlockScore = data.unlockScore;
  64. // this.isUnlocked = 0;
  65. // } else {
  66. // this.isUnlocked = 1;
  67. // }
  68. }
  69. isFull() {
  70. if (this.roomLevel && this.roomLevel == Global.BuildingManager.getLevelCount(this.roomId)) {
  71. return true;
  72. } else {
  73. return false;
  74. }
  75. }
  76. }