更换cocos
This commit is contained in:
@@ -613,9 +613,12 @@
|
||||
1,
|
||||
).then(function (buf) {
|
||||
mergeZipIntoFiles(unzip(buf));
|
||||
var ok = (entry.files || []).every(function (rel) { return files.has(rel); });
|
||||
if (!ok) {
|
||||
throw new Error('关卡包解压不完整: Level' + levelId);
|
||||
var filesList = entry.files;
|
||||
if (filesList && filesList.length) {
|
||||
var ok = filesList.every(function (rel) { return files.has(rel); });
|
||||
if (!ok) {
|
||||
throw new Error('关卡包解压不完整: Level' + levelId);
|
||||
}
|
||||
}
|
||||
loadedLevelIds.add(levelId);
|
||||
return invalidateLevelPrefabsBundle();
|
||||
@@ -994,14 +997,19 @@
|
||||
var scene = cc.director.getScene();
|
||||
if (!scene) return;
|
||||
var find = cc.find;
|
||||
['UICamera', 'BgCamera', 'Main Camera'].forEach(function (name) {
|
||||
['UICamera', 'BgCamera'].forEach(function (name) {
|
||||
var node = find(name, scene);
|
||||
if (!node) return;
|
||||
var cam = node.getComponent(cc.Camera);
|
||||
if (cam) cam.orthoHeight = halfH;
|
||||
});
|
||||
var preserve = !!global.__tfrhPreserveMapView;
|
||||
var mainNode = find('Main Camera', scene);
|
||||
if (mainNode) mainNode.setPosition(0, 0, mainNode.position.z);
|
||||
if (mainNode && !preserve) {
|
||||
var mainCam = mainNode.getComponent(cc.Camera);
|
||||
if (mainCam) mainCam.orthoHeight = halfH;
|
||||
mainNode.setPosition(0, 0, mainNode.position.z);
|
||||
}
|
||||
}
|
||||
|
||||
function installEmbeddedStageLayout(canvas) {
|
||||
@@ -1382,12 +1390,8 @@
|
||||
|
||||
function loadLevelsManifest(base) {
|
||||
var manifestUrl = joinUrl(base, 'aa/levels-manifest.json');
|
||||
return origFetch(manifestUrl, { cache: 'no-cache' }).then(function (res) {
|
||||
if (!res.ok) {
|
||||
console.warn('[mstest5] 缺少 levels-manifest.json,将无法按关下载');
|
||||
return null;
|
||||
}
|
||||
return res.json();
|
||||
return fetchLevelsDatabaseJson(manifestUrl).then(function (json) {
|
||||
return json;
|
||||
}).catch(function (e) {
|
||||
console.warn('[mstest5] levels-manifest.json 读取失败', e);
|
||||
return null;
|
||||
@@ -1449,10 +1453,7 @@
|
||||
function loadBundleManifest(config) {
|
||||
var base = resolveStreamingBase(config);
|
||||
var catalogUrl = joinUrl(base, 'aa/catalog.json');
|
||||
return origFetch(catalogUrl).then(function (res) {
|
||||
if (!res.ok) throw new Error('HTTP ' + res.status + ' for ' + catalogUrl);
|
||||
return res.json();
|
||||
}).then(function (catalog) {
|
||||
return fetchLevelsDatabaseJson(catalogUrl).then(function (catalog) {
|
||||
var bundles = parseCatalogBundles(catalog);
|
||||
var manifest = {
|
||||
scenesUrl: joinUrl(base, 'aa/WebGL/' + bundles.scenes),
|
||||
@@ -1523,15 +1524,10 @@
|
||||
|
||||
function resolveLevelsDbBase(config) {
|
||||
var sa = config && config.streamingAssetsUrl;
|
||||
var base;
|
||||
if (sa && /^https?:\/\//i.test(sa)) {
|
||||
base = String(sa).replace(/\/StreamingAssets\/?$/i, '');
|
||||
} else {
|
||||
base = packageRoot || getPackageRoot();
|
||||
return String(sa).replace(/\/StreamingAssets\/?$/i, '');
|
||||
}
|
||||
// new URL(rel, base) 要求 base 以 / 结尾,否则最后一段会被当成文件名
|
||||
if (base && !/\/$/.test(base)) base += '/';
|
||||
return base;
|
||||
return packageRoot || getPackageRoot();
|
||||
}
|
||||
|
||||
function resolveLevelsDatabaseUrl(config) {
|
||||
@@ -1541,8 +1537,7 @@
|
||||
|
||||
function resolveLevelsDbIndexUrl(config) {
|
||||
if (global.__tfrhLevelsDbIndexUrl) return global.__tfrhLevelsDbIndexUrl;
|
||||
// 与分片同树:StreamingAssets/aa/levels-db-index.json(CDN streamingBase 恒带尾 /)
|
||||
return joinUrl(resolveStreamingBase(config), 'aa/levels-db-index.json');
|
||||
return joinUrl(resolveLevelsDbBase(config), 'levels-db-index.json');
|
||||
}
|
||||
|
||||
function fetchLevelsDatabaseJson(url) {
|
||||
@@ -1564,32 +1559,18 @@
|
||||
|
||||
function prefetchLevelDbIndex(config) {
|
||||
var indexUrl = resolveLevelsDbIndexUrl(config);
|
||||
var rootIndexUrl = joinUrl(resolveLevelsDbBase(config), 'levels-db-index.json');
|
||||
var legacyUrl = resolveLevelsDatabaseUrl(config);
|
||||
global.__tfrhLevelsDbIndexUrl = indexUrl;
|
||||
global.__tfrhLevelsDatabaseUrl = legacyUrl;
|
||||
if (global.__tfrhLevelsDbIndex) return Promise.resolve();
|
||||
function acceptIndex(json, usedUrl) {
|
||||
return fetchLevelsDatabaseJson(indexUrl).then(function (json) {
|
||||
if (json && json.mode === 'sharded') {
|
||||
global.__tfrhLevelsDbIndex = json;
|
||||
global.__tfrhLevelsDbIndexUrl = usedUrl;
|
||||
return;
|
||||
}
|
||||
throw new Error('非分片索引');
|
||||
}
|
||||
return fetchLevelsDatabaseJson(indexUrl).then(function (json) {
|
||||
acceptIndex(json, indexUrl);
|
||||
}).catch(function (e1) {
|
||||
// 旧 CDN 包仅有包根 levels-db-index.json
|
||||
if (rootIndexUrl === indexUrl) {
|
||||
console.warn('[mstest5] 关卡库索引预取失败,启动时将由 LevelDatabase 回退', indexUrl, e1);
|
||||
return;
|
||||
}
|
||||
return fetchLevelsDatabaseJson(rootIndexUrl).then(function (json) {
|
||||
acceptIndex(json, rootIndexUrl);
|
||||
}).catch(function (e2) {
|
||||
console.warn('[mstest5] 关卡库索引预取失败,启动时将由 LevelDatabase 回退', indexUrl, e1, rootIndexUrl, e2);
|
||||
});
|
||||
}).catch(function (e) {
|
||||
console.warn('[mstest5] 关卡库索引预取失败,启动时将由 LevelDatabase 回退', indexUrl, e);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user