发布微信小游戏,fairygui的进度条bar设置填充在安卓平台会引起花屏

laya版本2.13.0beta  fairygui版本是最新版发布微信小游戏,fairygui的进度条bar设置填充在安卓平台会引起花屏
fairygui制作进度条,bar设置填充方式为水平,发布微信小游戏,安卓平台,当进度条的value第二次以上等于0的时候,会引起进度条周边花屏,我参考了fairgui的进度条填充的算法,模拟写了一个进度条,是没问题的,同样都是调用了mask.graphics.drawPoly  这个方法,测试demo和ui工程在附件里面,麻烦谷主看一下。。 
 

import GameConfig from "./GameConfig";
class Main
{
constructor()
{
//根据IDE设置初始化引擎
if (window["Laya3D"]) Laya3D.init(GameConfig.width, GameConfig.height);
else Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
Laya.stage.scaleMode = Laya.Stage.SCALE_FIXED_HEIGHT;
Laya.stage.alignH = Laya.Stage.ALIGN_CENTER;
Laya.stage.alignV = Laya.Stage.ALIGN_TOP;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
Laya.stage.frameRate = Laya.Stage.FRAME_FAST;
Laya.alertGlobalError(true);
Laya.stage.on("resize", this, this.onResize);
}
private onResize(): void
{
Laya.stage.off("resize", this, this.onResize);
this._ceshi();
}
private _contiener: Laya.Sprite;
private _bg: Laya.Sprite;
private _bar: Laya.Sprite;
private _mask?: Laya.Sprite;
private _ceshi(): void
{
let urlArr: any = ;
urlArr.push({ url: "res/img_loadbg.png", type: Laya.Loader.IMAGE });
urlArr.push({ url: "res/img_loadbar.png", type: Laya.Loader.IMAGE });
urlArr.push({ url: "res/loading_atlas0.png", type: Laya.Loader.IMAGE });
urlArr.push({ url: "res/loading.bin", type: Laya.Loader.BUFFER });
Laya.loader.load(urlArr, Laya.Handler.create(this, this._loadEnd));
}
private _loadpanel: fgui.GComponent;
private _fguiPro: fgui.GProgressBar;
private _loadEnd(): void
{
Laya.stage.addChild(fgui.GRoot.inst.displayObject);
fgui.UIConfig.packageFileExtension = "bin";
fgui.UIPackage.addPackage("res/loading");
this._loadpanel = fgui.UIPackage.createObject("loading", "loadingView").asCom;
this._fguiPro = this._loadpanel.getChild("pro_0").asProgress;
fgui.GRoot.inst.addChild(this._loadpanel);
this._loadpanel.setSize(Laya.stage.width, Laya.stage.height);
this._contiener = new Laya.Sprite;
Laya.stage.addChild(this._contiener);
this._contiener.x = (Laya.stage.width - 642) / 2;
this._contiener.y = (Laya.stage.height - 12) / 2;
this._bar = new Laya.Sprite;
this._bg = new Laya.Sprite;
this._contiener.addChild(this._bg);
this._bg.loadImage("res/img_loadbg.png");
this._contiener.addChild(this._bar);
this._bar.loadImage("res/img_loadbar.png");
this._bar.x = 48;
this._bar.y = 7;
this._mask = new Laya.Sprite();
this._mask.mouseEnabled = false;
this._bar.mask = this._mask;
Laya.timer.loop(1, this, this._updateMask);
}
private _index: number = 0;
private _updateMask(): void
{
var w: number = 642;
var h: number = 12;
var g: Laya.Graphics = this._mask.graphics;
g.clear();
if (w == 0 || h == 0)
return;

var points: any = ;
points.push(0, h);
points.push(0, 0);
points.push(this._index, 0);
points.push(this._index, h);
// points.push(0, h);
g.drawPoly(0, 0, points, "#FFFFFF");
this._fguiPro.value = Math.floor(this._index / w * 100);
this._index += 8;
if (this._index >= 642)
{
this._index = 0;
}
}
private _again(): void
{
Laya.stage.addChild(this._contiener);
this._index = 0;
Laya.timer.loop(1, this, this._updateMask);
}
}
//激活启动类
new Main();
已邀请:

zkang5

赞同来自:

附件好像一直上传不成功

要回复问题请先登录注册