1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import { _decorator,Component,director,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`;
- // }
- // }
- // }
- export class LoadingUI extends Component {
- progressBar: ProgressBar = null;
- progressLabel: Label = null;
- whichRes: Label = null;
- protected start(): void {
- this.progressBar = this.getComponentInChildren(ProgressBar);
- this.progressLabel = this.getComponentInChildren(Label);
- this.whichRes = this.node.getChildByName("_which").getComponent(Label);
- }
- 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`;
- }
- }
- }
|