import { Fun } from "../data/GData";

const { ccclass, property } = cc._decorator;

@ccclass
export default class FunBtns extends cc.Component {
    @property({ type: cc.Node, displayName: "互推" })
    btn1: cc.Node = null;
    @property({ type: cc.Node, displayName: "转盘" })
    btn2: cc.Node = null;
    @property({ type: cc.Node, displayName: "裂变" })
    btn3: cc.Node = null;
    @property({ type: cc.Node, displayName: "存钱罐" })
    btn4: cc.Node = null;
    @property({ type: cc.Node, displayName: "福袋" })
    btn5: cc.Node = null;
    @property({ type: cc.Node, displayName: "签到" })
    btn6: cc.Node = null;
    @property({ type: cc.Node, displayName: "常规提现" })
    btn7: cc.Node = null;
    @property({ type: cc.Node, displayName: "福利礼包" })
    btn_redeem: cc.Node = null;

    onLoad() {

    }

    start() {


    }

    init() {
        let data = gData.gameData.funOpenData;
        for (let i = 0; i < data.length; i++) {
            this['btn' + (i + 1)].active = data[i] == "1";
        }
        this.updateRedeem();
    }

    private updateRedeem() {
        this.btn_redeem.active = gData.redeem.showBtn;
    }


    update() {
        if (gData.redeem.init_btnChange) {
            this.updateRedeem();
            gData.redeem.init_btnChange = false;
        }
    }
}

