yityu-patch-1 #1

Merged
yityu merged 2 commits from yityu-patch-1 into master 2024-12-10 17:29:57 +08:00
1 changed files with 17 additions and 5 deletions

View File

@ -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"))
@ -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) }