最近做了一个微信小游戏,里边在超越好友时会显示好友的动画。因为主域和子域的通信问题,主域不知道什么时候会有超越好友的显示,子域的刷新需要不断update。显示的方式使用的是:
var openDataContext = wx.getOpenDataContext();
this.sharedCanvas = openDataContext.canvas;
this.tex.initWithElement(this.sharedCanvas);
this.tex.handleLoadedTexture();
this.spriteContent.spriteFrame = new cc.SpriteFrame(this.tex);
其中tex是已经创建的Texture2D。
问题是在update时增加这段逻辑之后帧率掉得比较多,最后定位在this.tex.handleLoadedTexture();这句代码的消耗比较大。不知道有没有什么解决办法可以解决这个问题?