egret自定义loadingUI

class LoadingUI extends egret.Sprite{
    
    private textField:egret.TextField;
    public constructor()
    {
        super();
        RES.getResByUrl('resource/assets/loading.png',this.onComplete,this,RES.ResourceItem.TYPE_IMAGE);
    }
    private onComplete(event:any):void {
        var img: egret.Texture = event;
        var bitmap: egret.Bitmap = new egret.Bitmap(img);
        this.addChild(bitmap);
        this.textField = new egret.TextField();
        this.addChild(this.textField);
        this.textField.width = 480;
        this.textField.height = 100;
        this.textField.x = (this.width - this.textField.width)/2;
        this.textField.y = (this.height - 80);
        this.textField.textAlign = "center";
    }

    public setProgress(current, total):void {
        this.textField.text = "游戏加载中" + current + "/" + total;
    }
}

 



Bookmark the permalink.

Comments are closed.