收藏
回答

loadSubpackage加载失败

框架类型 问题类型 提审时间 AppID
Bug 2018-08-02 wxdb232d823bdbc4c1

过审的时候总是卡在加载分包这里,本地用iphone8和其它各种android机型测了都没有任何问题
require('./weapp-adapter.js');
require('./platform.js');
require('./manifest.js');
require('./egret.wxgame.js');
 
// 启动微信小游戏本地缓存,如果开发者不需要此功能,只需注释即可
require('./library/image.js');
require('./library/text.js');
 
 
window.JSZip = require('./js/jszip.js');
 
let runOptions = {
    //以下为自动修改,请勿修改
    //The following is automatically modified, please do not modify
    //----auto option start----
        entryClassName: "Main",
        orientation: "auto",
        frameRate: 30,
        scaleMode: "fixedWidth",
        contentWidth: 720,
        contentHeight: 1280,
        showFPS: false,
        fpsStyles: "x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9",
        showLog: false,
        maxTouches: 2,
        //----auto option end----
    renderMode: 'webgl',
    audioType: 0,
    calculateCanvasScaleFactor: function (context) {
        var backingStore = context.backingStorePixelRatio ||
            context.webkitBackingStorePixelRatio ||
            context.mozBackingStorePixelRatio ||
            context.msBackingStorePixelRatio ||
            context.oBackingStorePixelRatio ||
            context.backingStorePixelRatio || 1;
        return (window.devicePixelRatio || 1) / backingStore;
    }
};
const runEgret = function () {
  egret.runEgret(runOptions);
}
if (wx.loadSubpackage) {
  require("./EgretSubPackageLoading.js");
  runOptions.entryClassName = "EgretSubPackageLoading";
  runEgret();
 
   
  var first=true;
  var retry = function () {
    if(first){
      EgretSubPackageLoading.instance.setTxt("加载分包中...");
    }else{
      EgretSubPackageLoading.instance.setTxt("再次加载分包中...");
    }
    first=false;
     
    let task = wx.loadSubpackage({
      // 开发者根据自身需求更改
      name: "ceshistage1",
      success: function (res) {
 
        console.log('加载成功');
        EgretSubPackageLoading.instance.onSuccess();
      },
      fail: function (res) {
        // 分包加载失败通过 fail 回调
        console.log('加载失败');
        retry();
      },
      complete: function (res) {
        // 分包加载失败通过 fail 回调
        console.log('加载完成');
      }
 
    });
   
   
    task.onProgressUpdate(res => {
      console.log('加ing')
      EgretSubPackageLoading.instance.setProgress(res);
    })
     
  }
  retry();
   
 
  
   
}
else {
   
  console.log('直接游戏')
  require("./stage1/game.js");
  runEgret();
}
// require("egret.min.js")


{
    "deviceOrientation": "portrait",
    "networkTimeout": {
        "request": 5000,
        "connectSocket": 5000,
        "uploadFile": 5000,
        "downloadFile": 5000
    },
    "subpackages": [
        {
            "name":"ceshistage1",
            "root": "stage1/"
       
        }
     
   
    ]
}







最后一次编辑于  2018-08-02
回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容