Merge branch 'master' of https://gogs.soyootech.com/guofei/soyoo-cocos
commit
0f7abac403
|
@ -42,8 +42,10 @@ SoyooFacade.InstallGame()
|
||||||
1. 删掉index.html里的js代码部分
|
1. 删掉index.html里的js代码部分
|
||||||
2. 在body最后加上
|
2. 在body最后加上
|
||||||
`
|
`
|
||||||
|
|
||||||
<script src="loader-and-starter.js" charset="utf-8"></script>
|
<script src="loader-and-starter.js" charset="utf-8"></script>
|
||||||
<script src="asset-map.js" charset="utf-8"></script>
|
<script src="asset-map.js" charset="utf-8"></script>
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
## 渠道处理
|
## 渠道处理
|
||||||
|
@ -51,7 +53,7 @@ SoyooFacade.InstallGame()
|
||||||
1. 把networks/applovin.js 复制到web-mobile下
|
1. 把networks/applovin.js 复制到web-mobile下
|
||||||
2. 编辑复制的applovin.js, 在前几行填入对应的iosUrl和androidUrl
|
2. 编辑复制的applovin.js, 在前几行填入对应的iosUrl和androidUrl
|
||||||
3. 编辑index.html,在body最后加上
|
3. 编辑index.html,在body最后加上
|
||||||
`
|
`js
|
||||||
<script src="applovin.js" charset="utf-8"></script>
|
<script src="applovin.js" charset="utf-8"></script>
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -65,7 +67,7 @@ SoyooFacade.InstallGame()
|
||||||
### moloco
|
### moloco
|
||||||
1. 把`networks/moloco.js`复制到web-mobile目录下。
|
1. 把`networks/moloco.js`复制到web-mobile目录下。
|
||||||
2. 编辑index.html,在body最后加上
|
2. 编辑index.html,在body最后加上
|
||||||
```
|
```js
|
||||||
<script src="moloco.js" charset="utf-8"></script>
|
<script src="moloco.js" charset="utf-8"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
window.startGame = function() {
|
window.startGame = function() {
|
||||||
window.boot()
|
var startInterval = setInterval(() => {
|
||||||
|
if (window.registerLoad) {
|
||||||
|
window.boot();
|
||||||
|
clearInterval(startInterval);
|
||||||
|
}
|
||||||
|
}, 16)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.pauseGame = function() {
|
window.pauseGame = function() {
|
||||||
|
@ -18,6 +23,8 @@ window.unmuteAudio = function() {
|
||||||
cc.audioEngine.resumeAll()
|
cc.audioEngine.resumeAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.registerLoad = false;
|
||||||
|
|
||||||
console.log("entry file loaded")
|
console.log("entry file loaded")
|
||||||
|
|
||||||
function b64ToUint6(nChr) {
|
function b64ToUint6(nChr) {
|
||||||
|
@ -69,7 +76,11 @@ function loadJson(item, _, callback) {
|
||||||
|
|
||||||
var assetMap = window.assetMap;
|
var assetMap = window.assetMap;
|
||||||
|
|
||||||
setTimeout(() => {
|
var registerInterval = setInterval(() => {
|
||||||
|
if (window.cc == undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clearInterval(registerInterval);
|
||||||
cc.assetManager.downloader.register({
|
cc.assetManager.downloader.register({
|
||||||
"bundle": function (item, _, callback) {
|
"bundle": function (item, _, callback) {
|
||||||
var bundleJsKey = Object.keys(assetMap).find(key => key.includes(item + "/index") && key.endsWith(".js"))
|
var bundleJsKey = Object.keys(assetMap).find(key => key.includes(item + "/index") && key.endsWith(".js"))
|
||||||
|
@ -79,12 +90,12 @@ setTimeout(() => {
|
||||||
loadJs(bundleJsKey, _, (a1, data) => {
|
loadJs(bundleJsKey, _, (a1, data) => {
|
||||||
console.log("bundle js loaded:", bundleJsKey)
|
console.log("bundle js loaded:", bundleJsKey)
|
||||||
})
|
})
|
||||||
|
|
||||||
var bundleJsonKey = Object.keys(assetMap).find(key => key.includes(item + "/config") && key.endsWith(".json"))
|
var bundleJsonKey = Object.keys(assetMap).find(key => key.includes(item + "/config") && key.endsWith(".json"))
|
||||||
if (!bundleJsonKey) {
|
if (!bundleJsonKey) {
|
||||||
console.error(`bundle ${item} not found`)
|
console.error(`bundle ${item} not found`)
|
||||||
}
|
}
|
||||||
loadJson(bundleJsonKey, _, (a1, data) =>
|
loadJson(bundleJsonKey, _, (a1, data) =>
|
||||||
{
|
{
|
||||||
var completeData = data;
|
var completeData = data;
|
||||||
completeData.base = "assets/" + item + "/"
|
completeData.base = "assets/" + item + "/"
|
||||||
|
@ -126,7 +137,8 @@ setTimeout(() => {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}, 10);
|
window.registerLoad = true;
|
||||||
|
}, 16);
|
||||||
|
|
||||||
|
|
||||||
window.base122ToArrayBuffer = (e) => { const n = [0, 10, 13, 34, 38, 92], r = new Uint8Array(1.75 * e.length | 0); let t = 0, o = 0, f = 0; function s(e) { o |= (e <<= 1) >>> f, f += 7, f >= 8 && (r[t++] = o, f -= 8, o = e << 7 - f & 255) } for (let r = 0; r < e.length; r++) { const t = e.charCodeAt(r); if (t > 127) { const e = t >>> 8 & 7; 7 !== e && s(n[e]), s(127 & t) } else s(t) } return new Uint8Array(r.buffer, 0, t) }
|
window.base122ToArrayBuffer = (e) => { const n = [0, 10, 13, 34, 38, 92], r = new Uint8Array(1.75 * e.length | 0); let t = 0, o = 0, f = 0; function s(e) { o |= (e <<= 1) >>> f, f += 7, f >= 8 && (r[t++] = o, f -= 8, o = e << 7 - f & 255) } for (let r = 0; r < e.length; r++) { const t = e.charCodeAt(r); if (t > 127) { const e = t >>> 8 & 7; 7 !== e && s(n[e]), s(127 & t) } else s(t) } return new Uint8Array(r.buffer, 0, t) }
|
||||||
|
|
Loading…
Reference in New Issue