
const TopEdgeDistance = 0;
const BottomEdgeDistance = 0;
const { ccclass, property } = cc._decorator;
/**
 * 窗口遮罩
 * @author 薛鸿潇
 */
@ccclass//('UIMask')
export class UIMask extends cc.Component {
    @property({ type: cc.Node, tooltip: '遮罩节点' })
    private node_mask: cc.Node = null;

    start() {
        this.node.zIndex = -10000;
        this.adaptTopAndBottomBox();
        this.node.getComponent(cc.Widget).updateAlignment();
        this.node_mask.getComponent(cc.Widget).updateAlignment();
    }
    /**
     * 全面屏适配
     */
    private adaptTopAndBottomBox() {
        let widget = this.node.getComponent(cc.Widget);
        widget.top = TopEdgeDistance;
        widget.bottom = BottomEdgeDistance;
    }

    /**
     * 设置遮罩显示 or 隐藏
     * @param bVisible {boolen} 显示或隐藏
     */
    public setMaskVisible(bVisible: boolean) {
        this.node_mask.active = bVisible;
    }

}
