



export default class ProgressBarS extends egret.DisplayObjectContainer {
    _value = 0;//0到1
    progressNum:eui.Label;
    private upImage:egret.Shape;

    //一般用于定制，手写时
    constructor(progressNum: eui.Label) {
        super()
        this._value = 0;
        //文本
        progressNum.text = "0%";
        this.progressNum = progressNum;
        // this.addChild(progressNum)

        this.upImage=new egret.Shape();
        this.upImage.graphics.beginFill(0xe6844e, 1);
        this.upImage.graphics.drawRoundRect(114, 759, 1, 40,40)  //宽度0到518
        this.upImage.graphics.endFill();
        this.addChild(this.upImage);
    }

    get value() {
        return this._value;
    }
    set value(v) {
        this._value = v;
        var mask=this.upImage.graphics;
        // console.log(this.value * 472)
        // this.upImage.visible = true
        mask.clear();
        mask.beginFill(0xe6844e, 1);
        mask.drawRoundRect(114, 759, this.value * 518, 40, 40)
        mask.endFill();
        this.progressNum.text = ((this.value * 100) >> 0) + "%";
    }
}