

cc.Class({
    extends: cc.Component,

    properties: {

        grantnfoPrefabs: {
            default: null,
            type: cc.Prefab,
            serializable: true,
        },

        saleInfoPrefabs: {
            default: null,
            type: cc.Prefab,
            serializable: true,
        },

        //当前操作的果实信息
        fruitInfo: {
            default: null,
            serializable: true,
            visible: false
        }
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start() {

    },

    onGrantInfo() {
        let leasePanel = cc.instantiate(this.grantnfoPrefabs);
        let parent = cc.find('Canvas/UICamera');
        leasePanel.parent = parent;
        leasePanel.setPosition(0, 0);
        // leasePanel.zIndex = 999;
        let LeaseGrantInfoScript = leasePanel.getComponent("LeaseGrantInfo");
        LeaseGrantInfoScript.fruitInfo = this.fruitInfo;
        LeaseGrantInfoScript.upTarget = this.node;
     

        let _contentButton = this.getComponent("Content_Button");
        LeaseGrantInfoScript.setInfo(_contentButton.NameLabel.string, _contentButton.NumLabel.string);
    },

    onSaleInfo() {
        let leasePanel = cc.instantiate(this.saleInfoPrefabs);
        let parent = cc.find('Canvas/UICamera');
        leasePanel.parent = parent;
        leasePanel.setPosition(0, 0);
        // leasePanel.zIndex = 999;
        let leaseSaleInfoScript = leasePanel.getComponent("LeaseSaleInfo");
        leaseSaleInfoScript.fruitInfo = this.fruitInfo;
        leaseSaleInfoScript.upTarget = this.node;
     

        let _contentButton = this.getComponent("Content_Button");
        leaseSaleInfoScript.setInfo(_contentButton.NameLabel.string, _contentButton.NumLabel.string);
    }
});
