1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- export default class BuildingModel {
- /**@type {number} */
- rateUnit = 0;
-
- /**@type {number} */
- hasNext = 0;
- /**@type {number} */
- buildingId = 0;
- /**@type {number} */
- level = 0;
- /**@type {string} */
- name = "";
- /**@type {number} */
- nextRate = 0;
- /**@type {number} */
- nextUpScore = 0;
- /**@type {number} */
- rate = 0;
- /**@type {number} */
- jobId = 0;
- /**@type {number} */
- unlockScore = 0;
- /**@type {number} */
- isUnlocked = 0;
- /**@type {number} */
- coinCount = 0;
- constructor(data) {
- this.coinCount = data.coinCount || 0;
- this.rateUnit = data.rateUnit;
- this.hasNext = data.hasNext;
- this.buildingId = (data.buildingId === undefined) ? data.id : data.buildingId;
- this.level = data.level;
- this.name = data.name;
- this.nextRate = data.nextRate;
- this.nextUpScore = data.nextUpScore;
- this.rate = data.rate;
- this.jobId = data.jobId;
-
- if (data.unlockScore && data.unlockScore !== 0) {
- this.unlockScore = data.unlockScore;
- this.isUnlocked = 0;
- } else {
- this.isUnlocked = 1;
- }
- }
- isFull() {
- if (this.level && this.level == Global.BuildingManager.getLevelCount(this.buildingId)) {
- return true;
- } else {
- return false;
- }
- }
- }
|