/**
 * 代码描述
 */

import { UIManager } from "../../common/src/UIManager";



const { ccclass, property } = cc._decorator;

@ccclass
export class FLoadingMaskPanel extends cc.Component {

    @property({ type: cc.ProgressBar, tooltip: '进度条' })
    progressBar: cc.ProgressBar = null;

    onEnable() {
        //预加载所有面板
        UIManager.preloadPanel('game:BobbleGamePanel');
        UIManager.preloadPanel('attendance:AttendancePanel');
        UIManager.preloadPanel('coinStore:CoinStorePanel');
        UIManager.preloadPanel('fail:FailPanel');
        UIManager.preloadPanel('pause:PausePanel');
        UIManager.preloadPanel('rewarded:RewardedPanel');
        UIManager.preloadPanel('tip:TipPanel');

        cc.tween(this.progressBar)
            .to(2, { progress: 1 })
            .call(() => {
                this.scheduleOnce(() => {
                    UIManager.open('game:BobbleGamePanel');
                    UIManager.close('loading:FLoadingMaskPanel', true);
                }, 1);
            })
            .start();
    }
}
