1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| require('./swan-game-adapter.js'); require('./manifest.js'); require('./egret.baidugame.js');
const runOptions = { entryClassName: "Main", orientation: "portrait", frameRate: 30, scaleMode: "fixedWidth", contentWidth: 900, contentHeight: 1600, showFPS: false, fpsStyles: "x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9", showLog: false, maxTouches: 2, audioType: 0, renderMode:"webgl", 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 (swan.loadSubpackage) { console.warn("========分包") require("./EgretSubPackageLoading.js"); runOptions.entryClassName = "EgretSubPackageLoading"; runEgret();
let task = swan.loadSubpackage({ name: "subPack1", success: function () { EgretSubPackageLoading.instance.onSuccess(); console.warn("========分包完成")
} });
task.onProgressUpdate(res => { EgretSubPackageLoading.instance.setProgress(res); console.warn("========分包进度", res) }) } else { require("./subPack1/game.js"); runEgret();
console.warn("========没分包") }
|