export default class BuildingModel { /**@type {number} */ goldUnit = 0; /**@type {number} */ hasNext = 0; /**@type {number} */ roomId = 0; /**@type {number} */ level = 0; /**@type {string} */ name = ""; /**@type {number} */ // nextRate = 0; /**@type {string} */ nextUpGold = "0"; /**@type {number} */ // nextGold = 0; /**@type {number} */ rate = 0; /**@type {number} */ jobId = 0; /**@type {string} */ unlockScore = "0"; /**@type {number} */ isUnlocked = 0; /**@type {number} */ coinCount = 0; /**@type {number} */ gold = 0; /**@type {string} */ gold1 = "0"; /**@type {string} */ gold2 = "0"; /**@type {string} */ gold3 = "0"; /**@type {string} */ gold4 = "0"; /**@type {number} */ buildingLevel = 0; /**@type {number} */ maxLevel = 0; constructor(data) { // this.coinCount = data.coinCount || 0; this.goldUnit = data.goldUnit; this.gold = data.gold; this.hasNext = data.hasNext; this.roomId = (data.roomId === undefined) ? data.id : data.roomId; this.level = data.level; this.name = data.name; // this.nextRate = data.nextRate; this.nextUpGold = data.nextUpGold; // this.nextGold = data.nextGold; // this.rate = data.rate; // this.jobId = data.jobId; this.buildingLevel = data.buildingLevel; this.gold1 = data.gold1; this.gold2 = data.gold2; this.gold3 = data.gold3; this.gold4 = data.gold4; this.maxLevel = data.maxLevel; this.unlockScore = data.unlockScore; // if (data.unlockScore && data.unlockScore !== 0) { // this.unlockScore = data.unlockScore; // this.isUnlocked = 0; // } else { // this.isUnlocked = 1; // } } isFull() { if (this.roomLevel && this.roomLevel == Global.BuildingManager.getLevelCount(this.roomId)) { return true; } else { return false; } } }