// Learn TypeScript: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html import Common5 from "../../Platform/th/Common5"; import MiShuManager from "../Manager/MiShuManager"; import ShipuManager from "../Manager/ShipuManager"; import TanWeiManager from "../Manager/TanWeiManager"; import ZaoCanManager from "../Manager/ZaoCanManager"; const { ccclass, property } = cc._decorator; @ccclass export default class zaocanItem extends cc.Component { @property(cc.Label) nameLabel: cc.Label = null; @property(cc.Sprite) icon: cc.Sprite = null; @property(cc.Label) price_1: cc.Label = null; @property(cc.Label) price_2: cc.Label = null; // LIFE-CYCLE CALLBACKS: config = null // onLoad () {} start() { } setViewDate(config) { this.config = config this.refreshView() } refreshView() { let name = ZaoCanManager.getCurNameById(this.config.id) // Common5.getSpriteFrameFromBundle("PeopleLevelUp", 'texture/1/' + name, this.icon) Common5.getSpriteFrameFromBundle("PeopleLevelUp", 'texture/1/' + '炸球', this.icon) this.nameLabel.string = name this.price_1.string = `售价:${ZaoCanManager.getCurPriceById(this.config.id)}` this.price_2.string = `${ZaoCanManager.getNextPriceById(this.config.id)}` if (this.config.id % 2 == 0) { this.node.getChildByName("升级条").active = true } else { this.node.getChildByName("升级条").active = false } this.node.getChildByName("晋升条").active = false this.node.getChildByName("晋升").active = false this.price_1.node.getChildByName("晋升").active = false let isCanLevelUp = ZaoCanManager.isCanLevelUpById(this.config.id) if (isCanLevelUp) { this.node.getChildByName("晋升条").active = true this.node.getChildByName("晋升").active = true this.price_1.node.getChildByName("晋升").active = true } } // update (dt) {} }