更换cocos
This commit is contained in:
14
nginx.conf
14
nginx.conf
@@ -57,13 +57,13 @@ server {
|
|||||||
|
|
||||||
# 纯 CDN:/cdn-unity/ → OSS 游戏包(config.js unityCdnUseSiteProxy: true)
|
# 纯 CDN:/cdn-unity/ → OSS 游戏包(config.js unityCdnUseSiteProxy: true)
|
||||||
# 路径需与 unityCdnRemote 保持一致,更新 OSS 目录时同步修改
|
# 路径需与 unityCdnRemote 保持一致,更新 OSS 目录时同步修改
|
||||||
location /cdn-unity/ {
|
# location /cdn-unity/ {
|
||||||
proxy_pass https://oss.eanic.cn/001_code_cocos_res_20260616/;
|
# proxy_pass https://oss.eanic.cn/001_code_cocos_res_20260616/;
|
||||||
proxy_ssl_server_name on;
|
# proxy_ssl_server_name on;
|
||||||
proxy_set_header Host oss.eanic.cn;
|
# proxy_set_header Host oss.eanic.cn;
|
||||||
proxy_hide_header Access-Control-Allow-Origin;
|
# proxy_hide_header Access-Control-Allow-Origin;
|
||||||
expires 7d;
|
# expires 7d;
|
||||||
}
|
# }
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
|
|||||||
9
scratch-gui/package-lock.json
generated
9
scratch-gui/package-lock.json
generated
@@ -7688,9 +7688,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/caniuse-lite": {
|
"node_modules/caniuse-lite": {
|
||||||
"version": "1.0.30001649",
|
"version": "1.0.30001810",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001649.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz",
|
||||||
"integrity": "sha512-fJegqZZ0ZX8HOWr6rcafGr72+xcgJKI9oWfDW5DrD7ExUtgZC7a7R7ZYmZqplh7XDocFdGeIFn7roAxhOeYrPQ==",
|
"integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
@@ -7704,7 +7704,8 @@
|
|||||||
"type": "github",
|
"type": "github",
|
||||||
"url": "https://github.com/sponsors/ai"
|
"url": "https://github.com/sponsors/ai"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"license": "CC-BY-4.0"
|
||||||
},
|
},
|
||||||
"node_modules/canvas-toBlob": {
|
"node_modules/canvas-toBlob": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"build:cdn-pure": "npm run clean && cross-env NODE_ENV=production UNITY_CDN_PURE=1 webpack --colors --bail",
|
"build:cdn-pure": "npm run clean && cross-env NODE_ENV=production UNITY_CDN_PURE=1 webpack --colors --bail",
|
||||||
"build:test": "npm run clean && cross-env NODE_ENV=production node scripts\\patch-config.js && webpack --colors --bail",
|
"build:test": "npm run clean && cross-env NODE_ENV=production node scripts\\patch-config.js && webpack --colors --bail",
|
||||||
"build:prod": "npm run clean && cross-env NODE_ENV=production node scripts\\patch-config.js && webpack --colors --bail",
|
"build:prod": "npm run clean && cross-env NODE_ENV=production node scripts\\patch-config.js && webpack --colors --bail",
|
||||||
"clean": "rimraf ./build && mkdirp build && rimraf ./dist && mkdirp dist",
|
"clean": "rimraf ./build && mkdirp build && rimraf ./dist && mkdirp dist && rimraf ./node_modules/.cache",
|
||||||
"deploy": "touch build/.nojekyll && gh-pages -t -d build -m \"[skip ci] Build for $(git log --pretty=format:%H -n1)\"",
|
"deploy": "touch build/.nojekyll && gh-pages -t -d build -m \"[skip ci] Build for $(git log --pretty=format:%H -n1)\"",
|
||||||
"prepublish": "node scripts/prepublish.mjs",
|
"prepublish": "node scripts/prepublish.mjs",
|
||||||
"prune": "./prune-gh-pages.sh",
|
"prune": "./prune-gh-pages.sh",
|
||||||
|
|||||||
@@ -164,18 +164,18 @@ const CONFIG = {
|
|||||||
// DataServerBaseUrl: "https://test.server.001code.com",
|
// DataServerBaseUrl: "https://test.server.001code.com",
|
||||||
// DataServerBaseUrl: "https://test.server.001code.com",
|
// DataServerBaseUrl: "https://test.server.001code.com",
|
||||||
|
|
||||||
version: "20260717",
|
version: "2026071701",
|
||||||
|
|
||||||
/** OSS 真实地址(生产环境浏览器直连) */
|
/** OSS 真实地址(生产环境浏览器直连) */
|
||||||
unityCdnRemote: 'https://oss.eanic.cn/001_code_cocos_res_20260617',
|
unityCdnRemote: 'https://oss.eanic.cn/001_code_cocos_res_2026071701',
|
||||||
/** 方案 B:nginx / webpack 同源代理前缀(方案 A 直连 OSS 请保持 false) */
|
/** 方案 B:nginx / webpack 同源代理前缀(方案 A 直连 OSS 请保持 false) */
|
||||||
unityCdnDevProxy: '/cdn-unity',
|
unityCdnDevProxy: '/cdn-unity',
|
||||||
/** 本地 npm start 也走代理(仅 unityCdnUseSiteProxy 或此项为 true 时生效) */
|
/** 本地 npm start 也走代理(仅 unityCdnUseSiteProxy 或此项为 true 时生效) */
|
||||||
unityCdnUseDevProxy: false,
|
unityCdnUseDevProxy: false,
|
||||||
/** 生产 nginx 反向代理 OSS 同路径时设为 true(方案 B) */
|
/** 生产 nginx 反向代理 OSS 同路径时设为 true(方案 B) */
|
||||||
unityCdnUseSiteProxy: false,
|
unityCdnUseSiteProxy: false,
|
||||||
unitycdndir: 'https://oss.eanic.cn/001_code_cocos_res_20260717',
|
unitycdndir: 'https://oss.eanic.cn/001_code_cocos_res_2026071701',
|
||||||
unitycdnbuilddir: 'https://oss.eanic.cn/001_code_cocos_res_20260717/Build',
|
unitycdnbuilddir: 'https://oss.eanic.cn/001_code_cocos_res_2026071701/Build',
|
||||||
python_pyodide_cdn_dir: 'https://oss.eanic.cn/001_code_python_res_20241213/pyodide/',
|
python_pyodide_cdn_dir: 'https://oss.eanic.cn/001_code_python_res_20241213/pyodide/',
|
||||||
|
|
||||||
// 可以根据需要添加其他配置
|
// 可以根据需要添加其他配置
|
||||||
@@ -183,7 +183,7 @@ const CONFIG = {
|
|||||||
|
|
||||||
|
|
||||||
disabledev: false,
|
disabledev: false,
|
||||||
usecdn: true,
|
usecdn: false,
|
||||||
lvlock: false,
|
lvlock: false,
|
||||||
lvlock_normal_learn: !(typeof localStorage !== 'undefined' &&
|
lvlock_normal_learn: !(typeof localStorage !== 'undefined' &&
|
||||||
(localStorage.getItem('player_id') === '37' || localStorage.getItem('player_id') === '45' || localStorage.getItem('player_id') === '55')),
|
(localStorage.getItem('player_id') === '37' || localStorage.getItem('player_id') === '45' || localStorage.getItem('player_id') === '55')),
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="footer-inner">
|
<div class="footer-inner">
|
||||||
<div class="footer-text" ">
|
<div class="footer-text">
|
||||||
ICP备案号:<a style=" color: #387cbd;" href=" " target="_blank">蜀ICP备2022002563号-5</a>
|
ICP备案号:<a style=" color: #387cbd;" href=" " target="_blank">蜀ICP备2022002563号-5</a>
|
||||||
<span> 公安备案号:<a style=" color: #387cbd;" href="https://beian.mps.gov.cn/"
|
<span> 公安备案号:<a style=" color: #387cbd;" href="https://beian.mps.gov.cn/"
|
||||||
target="_blank">川公网安备51011202000980号</a></span>
|
target="_blank">川公网安备51011202000980号</a></span>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const CACHE_NAME = 'pyodide-cache-v1';
|
const CACHE_NAME = 'pyodide-cache-v1';
|
||||||
const usecdn = true;
|
const usecdn = false;
|
||||||
const PYODIDE_CDN = usecdn
|
const PYODIDE_CDN = usecdn
|
||||||
? 'https://oss.eanic.cn/001_code_python_res_20241213/pyodide/'
|
? 'https://oss.eanic.cn/001_code_python_res_20241213/pyodide/'
|
||||||
: 'pyodide/';
|
: 'pyodide/';
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 19 MiB |
@@ -1,7 +1,7 @@
|
|||||||
// pyodideWorker.js
|
// pyodideWorker.js
|
||||||
|
|
||||||
importScripts("../pyodide/pyodide.js");
|
importScripts("../pyodide/pyodide.js");
|
||||||
usecdn = true
|
usecdn = false
|
||||||
// 确定 indexURL 的值
|
// 确定 indexURL 的值
|
||||||
let indexURL;
|
let indexURL;
|
||||||
if (usecdn) {
|
if (usecdn) {
|
||||||
|
|||||||
@@ -613,10 +613,13 @@
|
|||||||
1,
|
1,
|
||||||
).then(function (buf) {
|
).then(function (buf) {
|
||||||
mergeZipIntoFiles(unzip(buf));
|
mergeZipIntoFiles(unzip(buf));
|
||||||
var ok = (entry.files || []).every(function (rel) { return files.has(rel); });
|
var filesList = entry.files;
|
||||||
|
if (filesList && filesList.length) {
|
||||||
|
var ok = filesList.every(function (rel) { return files.has(rel); });
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
throw new Error('关卡包解压不完整: Level' + levelId);
|
throw new Error('关卡包解压不完整: Level' + levelId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
loadedLevelIds.add(levelId);
|
loadedLevelIds.add(levelId);
|
||||||
return invalidateLevelPrefabsBundle();
|
return invalidateLevelPrefabsBundle();
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
@@ -994,14 +997,19 @@
|
|||||||
var scene = cc.director.getScene();
|
var scene = cc.director.getScene();
|
||||||
if (!scene) return;
|
if (!scene) return;
|
||||||
var find = cc.find;
|
var find = cc.find;
|
||||||
['UICamera', 'BgCamera', 'Main Camera'].forEach(function (name) {
|
['UICamera', 'BgCamera'].forEach(function (name) {
|
||||||
var node = find(name, scene);
|
var node = find(name, scene);
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
var cam = node.getComponent(cc.Camera);
|
var cam = node.getComponent(cc.Camera);
|
||||||
if (cam) cam.orthoHeight = halfH;
|
if (cam) cam.orthoHeight = halfH;
|
||||||
});
|
});
|
||||||
|
var preserve = !!global.__tfrhPreserveMapView;
|
||||||
var mainNode = find('Main Camera', scene);
|
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) {
|
function installEmbeddedStageLayout(canvas) {
|
||||||
@@ -1382,12 +1390,8 @@
|
|||||||
|
|
||||||
function loadLevelsManifest(base) {
|
function loadLevelsManifest(base) {
|
||||||
var manifestUrl = joinUrl(base, 'aa/levels-manifest.json');
|
var manifestUrl = joinUrl(base, 'aa/levels-manifest.json');
|
||||||
return origFetch(manifestUrl, { cache: 'no-cache' }).then(function (res) {
|
return fetchLevelsDatabaseJson(manifestUrl).then(function (json) {
|
||||||
if (!res.ok) {
|
return json;
|
||||||
console.warn('[mstest5] 缺少 levels-manifest.json,将无法按关下载');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return res.json();
|
|
||||||
}).catch(function (e) {
|
}).catch(function (e) {
|
||||||
console.warn('[mstest5] levels-manifest.json 读取失败', e);
|
console.warn('[mstest5] levels-manifest.json 读取失败', e);
|
||||||
return null;
|
return null;
|
||||||
@@ -1449,10 +1453,7 @@
|
|||||||
function loadBundleManifest(config) {
|
function loadBundleManifest(config) {
|
||||||
var base = resolveStreamingBase(config);
|
var base = resolveStreamingBase(config);
|
||||||
var catalogUrl = joinUrl(base, 'aa/catalog.json');
|
var catalogUrl = joinUrl(base, 'aa/catalog.json');
|
||||||
return origFetch(catalogUrl).then(function (res) {
|
return fetchLevelsDatabaseJson(catalogUrl).then(function (catalog) {
|
||||||
if (!res.ok) throw new Error('HTTP ' + res.status + ' for ' + catalogUrl);
|
|
||||||
return res.json();
|
|
||||||
}).then(function (catalog) {
|
|
||||||
var bundles = parseCatalogBundles(catalog);
|
var bundles = parseCatalogBundles(catalog);
|
||||||
var manifest = {
|
var manifest = {
|
||||||
scenesUrl: joinUrl(base, 'aa/WebGL/' + bundles.scenes),
|
scenesUrl: joinUrl(base, 'aa/WebGL/' + bundles.scenes),
|
||||||
@@ -1523,15 +1524,10 @@
|
|||||||
|
|
||||||
function resolveLevelsDbBase(config) {
|
function resolveLevelsDbBase(config) {
|
||||||
var sa = config && config.streamingAssetsUrl;
|
var sa = config && config.streamingAssetsUrl;
|
||||||
var base;
|
|
||||||
if (sa && /^https?:\/\//i.test(sa)) {
|
if (sa && /^https?:\/\//i.test(sa)) {
|
||||||
base = String(sa).replace(/\/StreamingAssets\/?$/i, '');
|
return String(sa).replace(/\/StreamingAssets\/?$/i, '');
|
||||||
} else {
|
|
||||||
base = packageRoot || getPackageRoot();
|
|
||||||
}
|
}
|
||||||
// new URL(rel, base) 要求 base 以 / 结尾,否则最后一段会被当成文件名
|
return packageRoot || getPackageRoot();
|
||||||
if (base && !/\/$/.test(base)) base += '/';
|
|
||||||
return base;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveLevelsDatabaseUrl(config) {
|
function resolveLevelsDatabaseUrl(config) {
|
||||||
@@ -1541,8 +1537,7 @@
|
|||||||
|
|
||||||
function resolveLevelsDbIndexUrl(config) {
|
function resolveLevelsDbIndexUrl(config) {
|
||||||
if (global.__tfrhLevelsDbIndexUrl) return global.__tfrhLevelsDbIndexUrl;
|
if (global.__tfrhLevelsDbIndexUrl) return global.__tfrhLevelsDbIndexUrl;
|
||||||
// 与分片同树:StreamingAssets/aa/levels-db-index.json(CDN streamingBase 恒带尾 /)
|
return joinUrl(resolveLevelsDbBase(config), 'levels-db-index.json');
|
||||||
return joinUrl(resolveStreamingBase(config), 'aa/levels-db-index.json');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchLevelsDatabaseJson(url) {
|
function fetchLevelsDatabaseJson(url) {
|
||||||
@@ -1564,32 +1559,18 @@
|
|||||||
|
|
||||||
function prefetchLevelDbIndex(config) {
|
function prefetchLevelDbIndex(config) {
|
||||||
var indexUrl = resolveLevelsDbIndexUrl(config);
|
var indexUrl = resolveLevelsDbIndexUrl(config);
|
||||||
var rootIndexUrl = joinUrl(resolveLevelsDbBase(config), 'levels-db-index.json');
|
|
||||||
var legacyUrl = resolveLevelsDatabaseUrl(config);
|
var legacyUrl = resolveLevelsDatabaseUrl(config);
|
||||||
global.__tfrhLevelsDbIndexUrl = indexUrl;
|
global.__tfrhLevelsDbIndexUrl = indexUrl;
|
||||||
global.__tfrhLevelsDatabaseUrl = legacyUrl;
|
global.__tfrhLevelsDatabaseUrl = legacyUrl;
|
||||||
if (global.__tfrhLevelsDbIndex) return Promise.resolve();
|
if (global.__tfrhLevelsDbIndex) return Promise.resolve();
|
||||||
function acceptIndex(json, usedUrl) {
|
return fetchLevelsDatabaseJson(indexUrl).then(function (json) {
|
||||||
if (json && json.mode === 'sharded') {
|
if (json && json.mode === 'sharded') {
|
||||||
global.__tfrhLevelsDbIndex = json;
|
global.__tfrhLevelsDbIndex = json;
|
||||||
global.__tfrhLevelsDbIndexUrl = usedUrl;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new Error('非分片索引');
|
throw new Error('非分片索引');
|
||||||
}
|
}).catch(function (e) {
|
||||||
return fetchLevelsDatabaseJson(indexUrl).then(function (json) {
|
console.warn('[mstest5] 关卡库索引预取失败,启动时将由 LevelDatabase 回退', indexUrl, e);
|
||||||
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);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
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