12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- import LayerManager from "../gui/layers/LayerManager";
- export default class LoadingView{
- /**
- * 进度条
- */
- private progressBar:fgui.GProgressBar;
- /**
- * label
- */
- private label:fgui.GLabel;
- /**
- * 根节点
- */
- private root:fgui.GComponent;
-
- /**
- * 初始化
- * @param root
- * @param progressBar
- * @param label
- */
- Init(root:fgui.GComponent,progressBar:fgui.GProgressBar,label?:fgui.GLabel):void{
- this.root=root;
- this.root.setSize(fgui.GRoot.inst.width,fgui.GRoot.inst.height);
- this.progressBar=progressBar;
- this.label=label;
- if(this.progressBar!=null){
- this.progressBar.min=0;
- this.progressBar.max=1;
- }
- }
- /**
- * 更新进度
- * @param progress
- */
- UpdateProgress(progress:number):void{
- if(this.progressBar!=null){
- this.progressBar.value=progress;
- }
- }
- /**
- * 更新文本
- * @param label
- */
- UpdateLabel(label:string):void{
- if(this.label!=null){
- this.label.text=label;
- }
- }
- Show():void{
- LayerManager.single.AddToLayer(9,this.root);
- }
- Hide():void{
- LayerManager.single.RemoveFormeLayer(9,this.root);
- }
-
- private static instance:LoadingView;
- public static get single(){
- if(this.instance==null){
- this.instance=new LoadingView();
- }
- return this.instance;
- }
- }
|