import { _decorator,Label, ProgressBar } from 'cc';
import { UIBase } from '../GameFrameWork/UIBase';
const { ccclass, property } = _decorator;

@ccclass('LoadingUI')
export class LoadingUI extends UIBase {
    progressBar: ProgressBar = null;
    progressLabel: Label = null;
    whichRes: Label = null;
    protected onStart(): void {
        this.progressBar = this.getComponentInChildren(ProgressBar);
        this.progressLabel = this.getComponentInChildren(Label);
        this.whichRes = this.getLabel("_which");
    }
    public updateProgress(progress: number){
        if(this.progressBar){
            this.progressBar.progress = progress;
        }
        if(this.progressLabel){
            this.progressLabel.string = `${Math.floor(progress * 100)}%`;
        }
    }
    public updateWhichRes(which: number){
        if(this.whichRes){
            this.whichRes.string = `${which}/2`;
        }
    }
}


