这样的话 loading场景如果有动画的话 加载主场景的时候会非常卡
亲。如果加图片。会怎么样???
动态加载好像不可行啊
gameThirdScriptError
n.textureLoaded is not a function;at setTimeout callback function
TypeError: n.textureLoaded is not a function
at e._applySpriteFrame (http://127.0.0.1:40220/game/cocos2d-js-min.d26a9.js:1:367093)
at e.set [as spriteFrame] (http://127.0.0.1:40220/game/cocos2d-js-min.d26a9.js:1:364080)
at e. (
这样还是绕不开2.xM的cocos引擎代码部分 和 1.xM左右的子域引擎部分吧?, 加载慢主要还是因为这两个文件.
mark
这个时候cc.AssetLibrary.init 还没有执行 调用cc.loader.loadRes加载图片会报does not exist
子域的相关部分可不可以延后加载呢
由于微信官方的限制,子域不能延后加载
`var scene = new cc.Scene();
var root = new cc.Node();
var canvas = root.addComponent(cc.Canvas);
canvas.designResolution = new cc.size(1334, 750);
canvas.fitHeight = true;
canvas.fitWidth = true;
root.parent = scene;
//背景图片
var node = new cc.Node();
var sprite = node.addComponent(cc.Sprite);
node.parent = root;
var widget = node.addComponent(cc.Widget);
widget.left = 0;
widget.right = 0;
widget.top = 0;
widget.bottom = 0;
var remoteUrl = “https://x x x x/bg_loading.jpg”;
cc.loader.load(remoteUrl, function (err, texture) {
if (err == null) {
var sf = new cc.SpriteFrame(texture);
sprite.spriteFrame = sf;
}
});
var node = new cc.Node();
var label = node.addComponent(cc.Label);
label.string = “请稍候…”;
label.fontSize = 26;
node.parent = root;
module.exports = scene;`
此处cc.loader.load 这段导致报错,而且真机必现
gameThirdScriptError
Cannot read property ‘setInsetTop’ of null;at setTimeout callback function
TypeError: Cannot read property ‘setInsetTop’ of null
at e._applySpriteFrameInsets (https://servicewechat.qq.com/game.js:3:341686)
at e._applySpriteFrame (https://servicewechat.qq.com/game.js:3:342385)
at e.set [as spriteFrame] (https://servicewechat.qq.com/game.js:3:339400)
at r. (https://servicewechat.qq.com/game.js:120:432)
at https://servicewechat.qq.com/game.js:3:479895
at Function. (https://servicewechat.qq.com/game.js:3:592619)
at Function. (27175)
支持。。。。
大佬,我想问下这里是在处理什么,可以加载资源吗,如果可以的话,是不是代表就不用再额外做个loading界面了,不可以的话,能说下这里是在处理什么吗,了解下。。
学习下
试了一下,优化启动速度倒是没有,就是加个进度条吧,不过这个场景隐藏以后,还有很长一段时间的黑屏,求助
我也想知道唉
mark
我猜是从微信后台下载首包,并解压。
mark
mark