const GameModule = require("../utils/GameModule");

cc.Class({
    extends: cc.Component,

    properties: {
        nameLabel: cc.Label,
        conditionLabel: cc.Label,

        figure: cc.Sprite,  //明星图片
        countLabel: cc.Label,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {

    },

    configData(starInfo) {
        this.starInfo = starInfo;

        //获取到配置表的明星数据
        let star = Global.BuildingManager.getStarInfo(starInfo.starId);
        this.nameLabel.string = star.name;

        let roomName = Global.BuildingManager.getRoomName(star.roomId);

        var descString = `需要 开启${roomName}`;

        let buyStarCount = GameModule.userInfo.buyStarCount;
        let needStarCount = starInfo.itemCount;
        if (needStarCount > 0) {
            descString += `\n需要 ${star.desc}`;
        } else {

        }

        this.conditionLabel.string = descString;

        this.countLabel.string = `${starInfo.starCount}个`;
    },

    // update (dt) {},
});
