# Conflicts:
#	scratch-gui/src/playground/config.js
#	scratch-gui/static/unity/Build/mstest5.loader.js
#	scratch-gui/static/unity/StreamingAssets/aa/WebGL/defaultlocalgroup_scenes_all_44c83ead579edde0422cd5707e20fce8.bundle.br
#	scratch-gui/static/unity/StreamingAssets/aa/catalog.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/91601-91700.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/91601-91700.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/91701-91800.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/91701-91800.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/91801-91900.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/91801-91900.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/91901-92000.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/91901-92000.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92001-92100.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92001-92100.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92101-92200.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92101-92200.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92201-92300.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92201-92300.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92301-92400.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92301-92400.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92401-92500.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92401-92500.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92501-92600.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92501-92600.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92601-92700.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92601-92700.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92701-92800.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92701-92800.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92801-92900.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92801-92900.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92901-93000.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/92901-93000.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93001-93100.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93001-93100.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93101-93200.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93101-93200.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93201-93300.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93201-93300.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93301-93400.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93301-93400.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93401-93500.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93401-93500.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93501-93600.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93501-93600.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93601-93700.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93601-93700.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93701-93800.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93701-93800.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93801-93900.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93801-93900.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93901-94000.json
#	scratch-gui/static/unity/StreamingAssets/aa/levels-db/93901-94000.json.br
#	scratch-gui/static/unity/StreamingAssets/aa/levels-manifest.json
#	scratch-gui/static/unity/StreamingAssets/aa/settings.json
#	scratch-gui/static/unity/levels-database.json
#	scratch-gui/static/unity/levels-database.json.br
#	scratch-gui/static/unity/levels-db-index.json
#	scratch-gui/static/unity/levels-db-index.json.br
This commit is contained in:
Evan
2026-07-17 17:29:53 +08:00
4917 changed files with 1260 additions and 18 deletions

View File

@@ -20,36 +20,59 @@ export function getUnityCdnBuildRoot() {
return `${getUnityCdnRoot()}/Build`; return `${getUnityCdnRoot()}/Build`;
} }
/** 预取关卡库并注入,避免 LevelDatabase 回退到 /unity/ 或 editor 相对路径 */ async function fetchJsonWithBrotli(jsonUrl) {
export async function prefetchLevelsDatabase(cdnRoot) {
const root = String(cdnRoot || getUnityCdnRoot()).replace(/\/$/, '');
const jsonUrl = `${root}/levels-database.json`;
window.__tfrhLevelsDatabaseUrl = jsonUrl;
if (window.__tfrhLevelsDatabaseJson) {
return;
}
const brUrl = jsonUrl.replace(/\.json(\?.*)?$/i, '.json.br$1'); const brUrl = jsonUrl.replace(/\.json(\?.*)?$/i, '.json.br$1');
if (typeof DecompressionStream !== 'undefined') { if (typeof DecompressionStream !== 'undefined') {
try { try {
const brRes = await fetch(brUrl); const brRes = await fetch(brUrl);
if (brRes.ok) { if (brRes.ok) {
const text = await new Response(await brRes.arrayBuffer()) const ab = await brRes.arrayBuffer();
.pipeThrough(new DecompressionStream('brotli')) let text = new TextDecoder().decode(ab);
.text(); if (text.charCodeAt(0) !== 0x7b && text.charCodeAt(0) !== 0x5b) {
window.__tfrhLevelsDatabaseJson = JSON.parse(text); text = await new Response(ab)
return; .pipeThrough(new DecompressionStream('brotli'))
.text();
}
return JSON.parse(text);
} }
} catch (e) { } catch (e) {
console.warn('[unity-cdn] levels-database.json.br 预取失败,尝试 .json', e); console.warn('[unity-cdn] Brotli 预取失败,尝试 .json', jsonUrl, e);
} }
} }
const res = await fetch(jsonUrl); const res = await fetch(jsonUrl);
if (!res.ok) { if (!res.ok) {
throw new Error(`levels-database HTTP ${res.status}: ${jsonUrl}`); throw new Error(`HTTP ${res.status}: ${jsonUrl}`);
} }
window.__tfrhLevelsDatabaseJson = await res.json(); return res.json();
}
/** 首屏只预取关卡库索引分片模式legacy 全量库作回退 URL */
export async function prefetchLevelsDatabase(cdnRoot) {
const root = String(cdnRoot || getUnityCdnRoot()).replace(/\/$/, '');
const indexUrl = `${root}/levels-db-index.json`;
const jsonUrl = `${root}/levels-database.json`;
window.__tfrhLevelsDbIndexUrl = indexUrl;
window.__tfrhLevelsDatabaseUrl = jsonUrl;
if (window.__tfrhLevelsDbIndex) {
return;
}
try {
const index = await fetchJsonWithBrotli(indexUrl);
if (index?.mode === 'sharded' && index.shards?.length) {
window.__tfrhLevelsDbIndex = index;
return;
}
} catch (e) {
console.warn('[unity-cdn] levels-db-index 预取失败,启动时将回退全量库', e);
}
if (window.__tfrhLevelsDatabaseJson) {
return;
}
window.__tfrhLevelsDatabaseJson = await fetchJsonWithBrotli(jsonUrl);
} }

View File

@@ -0,0 +1,288 @@
// config.js
// 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",
// // DataServerBaseUrl: "https://test.server.001code.com",
// // DataServerBaseUrl: "https://test.server.001code.com",
// version : "2025010301",
// unitycdndir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826',
// unitycdnbuilddir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826/Build',
// python_pyodide_cdn_dir : 'https://oss-rpwqy.jjwlcdn.com/001_code_python_res_20241213/pyodide/',
// // 可以根据需要添加其他配置
// disabledev: false,
// usecdn :true, //资源走CDN
// lvlock :false, //关卡5关解锁,下一关加锁
// lvlock_normal_learn :true, //常规关起锁
// lockupdate :false, //上传按钮
// mactchlv : false, //比赛关卡
// learnvideo : true,
// gameNumber:150,
// SSN_COMPETITION_ID: [13],
// // 计算关卡实际id
// getRealLvId(gamelv,gameid, ismatch, gameNumber){
// if(localStorage.getItem('platformMode') === 'competition'){
// return parseInt(window.unity_game_number, 10)
// }else{
// if (!ismatch){
// return ((gamelv-1)*20*gameNumber)+((gameid-1)*gameNumber)
// }else{
// //TODO 这里维护一张匹配关卡映射表
// if (gamelv === 240896 && gameid === 0) {
// return 10000;
// }
// }
// }
// },
// lastGameStyle: '',
// lastGameDefaultSkin: 0,
// checkGameStyle(realLvId){
// let gameStyle = '';
// let gameDefaultSkin = 0;
// if ((realLvId >= 1 && realLvId <= 400) || (realLvId >= 20001 && realLvId <= 30000)) {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// } else if ((realLvId >= 401 && realLvId <= 800) || (realLvId >= 10001 && realLvId <= 20000)) {
// gameStyle = 'chinese';
// gameDefaultSkin = 1;
// } else if ((realLvId >= 801 && realLvId <= 1200) || (realLvId >= 40001 && realLvId <= 50000)) {
// gameStyle = 'redArmy';
// gameDefaultSkin = 2;
// } else if ((realLvId >= 1201 && realLvId <= 1600) || (realLvId >= 30001 && realLvId <= 40000)) {
// gameStyle = 'numMan';
// gameDefaultSkin = 3;
// }else {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// }
// if (gameStyle !== this.lastGameStyle) {
// window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
// this.lastGameStyle = gameStyle;
// }
// if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// setTimeout(() => {
// window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
// console.log("CallChangeSkin >>> ", gameDefaultSkin);
// }, 3000);
// this.lastGameDefaultSkin = gameDefaultSkin;
// }
// }
// };
// 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",
// // DataServerBaseUrl: "https://test.server.001code.com",
// // DataServerBaseUrl: "https://test.server.001code.com",
// version : "2025011001",
// unitycdndir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826',
// unitycdnbuilddir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826/Build',
// python_pyodide_cdn_dir : 'https://oss-rpwqy.jjwlcdn.com/001_code_python_res_20241213/pyodide/',
// // 可以根据需要添加其他配置
// // disabledev: false,
// disabledev: false,
// usecdn :true, //资源走CDN
// lvlock :false, //关卡5关解锁,下一关加锁
// lvlock_normal_learn : !(typeof localStorage !== 'undefined' &&
// (localStorage.getItem('player_id') === '32' || localStorage.getItem('player_id') === '1506'|| localStorage.getItem('player_id') === '24'|| localStorage.getItem('player_id') === '1550')), //常规关起锁
// lockupdate :false, //上传按钮
// mactchlv : false, //比赛关卡
// learnvideo : true,
// gameNumber:120,
// // 计算关卡实际id
// SSN_COMPETITION_ID: [21,22,23],
// getRealLvId(gamelv,gameid, ismatch, gameNumber){
// if(localStorage.getItem('platformMode') === 'competition'){
// return parseInt(window.unity_game_number, 10)
// }else{
// if (!ismatch){
// return ((gamelv-1)*20*gameNumber)+((gameid-1)*gameNumber)
// }else{
// //TODO 这里维护一张匹配关卡映射表
// if (gamelv === 240896 && gameid === 0) {
// return 10000;
// }
// }
// }
// },
// lastGameStyle: '',
// lastGameDefaultSkin: 0,
// checkGameStyle(realLvId){
// let gameStyle = '';
// let gameDefaultSkin = 0;
// if ((realLvId >= 1 && realLvId <= 400) || (realLvId >= 20001 && realLvId <= 30000)) {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// } else if ((realLvId >= 401 && realLvId <= 800) || (realLvId >= 10001 && realLvId <= 20000)) {
// gameStyle = 'chinese';
// gameDefaultSkin = 1;
// } else if ((realLvId >= 801 && realLvId <= 1200) || (realLvId >= 40001 && realLvId <= 50000)) {
// gameStyle = 'redArmy';
// gameDefaultSkin = 2;
// } else if ((realLvId >= 1201 && realLvId <= 1600) || (realLvId >= 30001 && realLvId <= 40000)) {
// gameStyle = 'numMan';
// gameDefaultSkin = 3;
// }else {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// }
// if (gameStyle !== this.lastGameStyle) {
// window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
// this.lastGameStyle = gameStyle;
// }
// if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// setTimeout(() => {
// window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
// console.log("CallChangeSkin >>> ", gameDefaultSkin);
// }, 3000);
// this.lastGameDefaultSkin = gameDefaultSkin;
// }
// }
// };
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",
// DataServerBaseUrl: "https://test.server.001code.com",
// DataServerBaseUrl: "https://test.server.001code.com",
version: "20260717",
/** OSS 真实地址(生产环境浏览器直连) */
unityCdnRemote: 'https://oss.eanic.cn/001_code_cocos_res_20260617',
/** 方案 Bnginx / webpack 同源代理前缀(方案 A 直连 OSS 请保持 false */
unityCdnDevProxy: '/cdn-unity',
/** 本地 npm start 也走代理(仅 unityCdnUseSiteProxy 或此项为 true 时生效) */
unityCdnUseDevProxy: false,
/** 生产 nginx 反向代理 OSS 同路径时设为 true方案 B */
unityCdnUseSiteProxy: false,
<<<<<<< HEAD
unitycdndir: 'https://oss.eanic.cn/001_code_cocos_res_20260717',
unitycdnbuilddir: 'https://oss.eanic.cn/001_code_cocos_res_20260717/Build',
=======
unitycdndir: 'https://oss.eanic.cn/001_code_cocos_res_20260617',
unitycdnbuilddir: 'https://oss.eanic.cn/001_code_cocos_res_20260617/Build',
>>>>>>> b08562d603e88576042ff972dedf771c32224b4b
python_pyodide_cdn_dir: 'https://oss.eanic.cn/001_code_python_res_20241213/pyodide/',
// 可以根据需要添加其他配置
disabledev: false,
usecdn: true,
lvlock: false,
lvlock_normal_learn: !(typeof localStorage !== 'undefined' &&
(localStorage.getItem('player_id') === '37' || localStorage.getItem('player_id') === '45' || localStorage.getItem('player_id') === '55')),
lockupdate: false,
mactchlv: false,
learnvideo: true,
gameNumber: 120,
//计算关卡实际id
SSN_COMPETITION_ID: [13],
NOT_ALLOWED_COMPETITION_ID: [72, 62, 64, 65, 69, 61, 63, 67, 70, 74, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84],
BEGINNING_REAL_LVID: 91600,
END_REAL_LVID: 93100,
SIMULATE_COMPETITION_ID: [149], // 用于测试的模拟比赛ID
HIDE_COMPETITION_TIME_ID: [154, 155, 156], // 需要隐藏比赛时间的比赛ID列表
// 计算关卡实际id
getRealLvId(gamelv, gameid, ismatch, gameNumber) {
if (localStorage.getItem('platformMode') === 'competition') {
return parseInt(window.unity_game_number, 10)
} else {
if (!ismatch) {
return ((gamelv - 1) * 30 * gameNumber) + ((gameid - 1) * gameNumber) + this.BEGINNING_REAL_LVID
} else {
//TODO 这里维护一张匹配关卡映射表
if (gamelv === 240896 && gameid === 0) {
return 10000;
}
}
}
},
lastGameStyle: '',
lastGameDefaultSkin: 0,
checkGameStyle(realLvId) {
let gameStyle = 'SILU';
let gameDefaultSkin = 0;
if (realLvId >= this.BEGINNING_REAL_LVID && realLvId <= this.END_REAL_LVID) {
realLvId = realLvId - this.BEGINNING_REAL_LVID;
if (realLvId >= 1 && realLvId <= 300) {
gameStyle = 'SILU';
gameDefaultSkin = 0;
} else if (realLvId >= 301 && realLvId <= 600) {
gameStyle = 'redArmy';
gameDefaultSkin = 2;
} else if (realLvId >= 601 && realLvId <= 900) {
gameStyle = 'numMan';
gameDefaultSkin = 3;
} else if (realLvId >= 901 && realLvId <= 1200) {
gameStyle = 'chinese';
gameDefaultSkin = 1;
} else if (realLvId >= 1201 && realLvId <= 1500) {
gameStyle = 'snow';
gameDefaultSkin = 4;
} else if (realLvId >= 1501 && realLvId <= 1800) {
gameStyle = 'SILU';
gameDefaultSkin = 0;
} else {
gameStyle = 'SILU';
gameDefaultSkin = 0;
}
}
if (gameStyle !== this.lastGameStyle) {
window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
this.lastGameStyle = gameStyle;
}
// 尝试多次发送消息,以确保 Unity 场景和 Player 对象已加载
if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// 尝试多次发送消息,以确保 Unity 场景和 Player 对象已加载
const sendSkinMsg = (delay) => {
setTimeout(() => {
if (window.unityInstance) {
try {
window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
console.log("CallChangeSkin sent >>> ", gameDefaultSkin);
} catch (e) {
console.log("Player not ready yet");
}
}
}, delay);
};
sendSkinMsg(2000);
sendSkinMsg(4000);
sendSkinMsg(6000);
this.lastGameDefaultSkin = gameDefaultSkin;
}
}
};
export default CONFIG;

View File

@@ -0,0 +1,283 @@
// config.js
// 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",
// // DataServerBaseUrl: "https://test.server.001code.com",
// // DataServerBaseUrl: "https://test.server.001code.com",
// version : "2025010301",
// unitycdndir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826',
// unitycdnbuilddir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826/Build',
// python_pyodide_cdn_dir : 'https://oss-rpwqy.jjwlcdn.com/001_code_python_res_20241213/pyodide/',
// // 可以根据需要添加其他配置
// disabledev: false,
// usecdn :true, //资源走CDN
// lvlock :false, //关卡5关解锁,下一关加锁
// lvlock_normal_learn :true, //常规关起锁
// lockupdate :false, //上传按钮
// mactchlv : false, //比赛关卡
// learnvideo : true,
// gameNumber:150,
// SSN_COMPETITION_ID: [13],
// // 计算关卡实际id
// getRealLvId(gamelv,gameid, ismatch, gameNumber){
// if(localStorage.getItem('platformMode') === 'competition'){
// return parseInt(window.unity_game_number, 10)
// }else{
// if (!ismatch){
// return ((gamelv-1)*20*gameNumber)+((gameid-1)*gameNumber)
// }else{
// //TODO 这里维护一张匹配关卡映射表
// if (gamelv === 240896 && gameid === 0) {
// return 10000;
// }
// }
// }
// },
// lastGameStyle: '',
// lastGameDefaultSkin: 0,
// checkGameStyle(realLvId){
// let gameStyle = '';
// let gameDefaultSkin = 0;
// if ((realLvId >= 1 && realLvId <= 400) || (realLvId >= 20001 && realLvId <= 30000)) {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// } else if ((realLvId >= 401 && realLvId <= 800) || (realLvId >= 10001 && realLvId <= 20000)) {
// gameStyle = 'chinese';
// gameDefaultSkin = 1;
// } else if ((realLvId >= 801 && realLvId <= 1200) || (realLvId >= 40001 && realLvId <= 50000)) {
// gameStyle = 'redArmy';
// gameDefaultSkin = 2;
// } else if ((realLvId >= 1201 && realLvId <= 1600) || (realLvId >= 30001 && realLvId <= 40000)) {
// gameStyle = 'numMan';
// gameDefaultSkin = 3;
// }else {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// }
// if (gameStyle !== this.lastGameStyle) {
// window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
// this.lastGameStyle = gameStyle;
// }
// if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// setTimeout(() => {
// window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
// console.log("CallChangeSkin >>> ", gameDefaultSkin);
// }, 3000);
// this.lastGameDefaultSkin = gameDefaultSkin;
// }
// }
// };
// 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",
// // DataServerBaseUrl: "https://test.server.001code.com",
// // DataServerBaseUrl: "https://test.server.001code.com",
// version : "2025011001",
// unitycdndir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826',
// unitycdnbuilddir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826/Build',
// python_pyodide_cdn_dir : 'https://oss-rpwqy.jjwlcdn.com/001_code_python_res_20241213/pyodide/',
// // 可以根据需要添加其他配置
// // disabledev: false,
// disabledev: false,
// usecdn :true, //资源走CDN
// lvlock :false, //关卡5关解锁,下一关加锁
// lvlock_normal_learn : !(typeof localStorage !== 'undefined' &&
// (localStorage.getItem('player_id') === '32' || localStorage.getItem('player_id') === '1506'|| localStorage.getItem('player_id') === '24'|| localStorage.getItem('player_id') === '1550')), //常规关起锁
// lockupdate :false, //上传按钮
// mactchlv : false, //比赛关卡
// learnvideo : true,
// gameNumber:120,
// // 计算关卡实际id
// SSN_COMPETITION_ID: [21,22,23],
// getRealLvId(gamelv,gameid, ismatch, gameNumber){
// if(localStorage.getItem('platformMode') === 'competition'){
// return parseInt(window.unity_game_number, 10)
// }else{
// if (!ismatch){
// return ((gamelv-1)*20*gameNumber)+((gameid-1)*gameNumber)
// }else{
// //TODO 这里维护一张匹配关卡映射表
// if (gamelv === 240896 && gameid === 0) {
// return 10000;
// }
// }
// }
// },
// lastGameStyle: '',
// lastGameDefaultSkin: 0,
// checkGameStyle(realLvId){
// let gameStyle = '';
// let gameDefaultSkin = 0;
// if ((realLvId >= 1 && realLvId <= 400) || (realLvId >= 20001 && realLvId <= 30000)) {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// } else if ((realLvId >= 401 && realLvId <= 800) || (realLvId >= 10001 && realLvId <= 20000)) {
// gameStyle = 'chinese';
// gameDefaultSkin = 1;
// } else if ((realLvId >= 801 && realLvId <= 1200) || (realLvId >= 40001 && realLvId <= 50000)) {
// gameStyle = 'redArmy';
// gameDefaultSkin = 2;
// } else if ((realLvId >= 1201 && realLvId <= 1600) || (realLvId >= 30001 && realLvId <= 40000)) {
// gameStyle = 'numMan';
// gameDefaultSkin = 3;
// }else {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// }
// if (gameStyle !== this.lastGameStyle) {
// window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
// this.lastGameStyle = gameStyle;
// }
// if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// setTimeout(() => {
// window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
// console.log("CallChangeSkin >>> ", gameDefaultSkin);
// }, 3000);
// this.lastGameDefaultSkin = gameDefaultSkin;
// }
// }
// };
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",
// DataServerBaseUrl: "https://test.server.001code.com",
// DataServerBaseUrl: "https://test.server.001code.com",
version: "20260520",
/** OSS 真实地址(生产环境浏览器直连) */
unityCdnRemote: 'https://oss.eanic.cn/001_code_cocos_res_20260616',
/** 方案 Bnginx / webpack 同源代理前缀(方案 A 直连 OSS 请保持 false */
unityCdnDevProxy: '/cdn-unity',
/** 本地 npm start 也走代理(仅 unityCdnUseSiteProxy 或此项为 true 时生效) */
unityCdnUseDevProxy: false,
/** 生产 nginx 反向代理 OSS 同路径时设为 true方案 B */
unityCdnUseSiteProxy: false,
unitycdndir: 'https://oss.eanic.cn/001_code_cocos_res_20260616',
unitycdnbuilddir: 'https://oss.eanic.cn/001_code_cocos_res_20260616/Build',
python_pyodide_cdn_dir: 'https://oss.eanic.cn/001_code_python_res_20241213/pyodide/',
// 可以根据需要添加其他配置
disabledev: false,
usecdn: true,
lvlock: false,
lvlock_normal_learn: !(typeof localStorage !== 'undefined' &&
(localStorage.getItem('player_id') === '37' || localStorage.getItem('player_id') === '45' || localStorage.getItem('player_id') === '55')),
lockupdate: false,
mactchlv: false,
learnvideo: true,
gameNumber: 120,
//计算关卡实际id
SSN_COMPETITION_ID: [13],
NOT_ALLOWED_COMPETITION_ID: [72, 62, 64, 65, 69, 61, 63, 67, 70, 74, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84],
BEGINNING_REAL_LVID: 91600,
END_REAL_LVID: 93100,
SIMULATE_COMPETITION_ID: [149], // 用于测试的模拟比赛ID
HIDE_COMPETITION_TIME_ID: [154, 155, 156], // 需要隐藏比赛时间的比赛ID列表
// 计算关卡实际id
getRealLvId(gamelv, gameid, ismatch, gameNumber) {
if (localStorage.getItem('platformMode') === 'competition') {
return parseInt(window.unity_game_number, 10)
} else {
if (!ismatch) {
return ((gamelv - 1) * 30 * gameNumber) + ((gameid - 1) * gameNumber) + this.BEGINNING_REAL_LVID
} else {
//TODO 这里维护一张匹配关卡映射表
if (gamelv === 240896 && gameid === 0) {
return 10000;
}
}
}
},
lastGameStyle: '',
lastGameDefaultSkin: 0,
checkGameStyle(realLvId) {
let gameStyle = 'SILU';
let gameDefaultSkin = 0;
if (realLvId >= this.BEGINNING_REAL_LVID && realLvId <= this.END_REAL_LVID) {
realLvId = realLvId - this.BEGINNING_REAL_LVID;
if (realLvId >= 1 && realLvId <= 300) {
gameStyle = 'SILU';
gameDefaultSkin = 0;
} else if (realLvId >= 301 && realLvId <= 600) {
gameStyle = 'redArmy';
gameDefaultSkin = 2;
} else if (realLvId >= 601 && realLvId <= 900) {
gameStyle = 'numMan';
gameDefaultSkin = 3;
} else if (realLvId >= 901 && realLvId <= 1200) {
gameStyle = 'chinese';
gameDefaultSkin = 1;
} else if (realLvId >= 1201 && realLvId <= 1500) {
gameStyle = 'snow';
gameDefaultSkin = 4;
} else if (realLvId >= 1501 && realLvId <= 1800) {
gameStyle = 'SILU';
gameDefaultSkin = 0;
} else {
gameStyle = 'SILU';
gameDefaultSkin = 0;
}
}
if (gameStyle !== this.lastGameStyle) {
window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
this.lastGameStyle = gameStyle;
}
// 尝试多次发送消息,以确保 Unity 场景和 Player 对象已加载
if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// 尝试多次发送消息,以确保 Unity 场景和 Player 对象已加载
const sendSkinMsg = (delay) => {
setTimeout(() => {
if (window.unityInstance) {
try {
window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
console.log("CallChangeSkin sent >>> ", gameDefaultSkin);
} catch (e) {
console.log("Player not ready yet");
}
}
}, delay);
};
sendSkinMsg(2000);
sendSkinMsg(4000);
sendSkinMsg(6000);
this.lastGameDefaultSkin = gameDefaultSkin;
}
}
};
export default CONFIG;

View File

@@ -0,0 +1,283 @@
// config.js
// 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",
// // DataServerBaseUrl: "https://test.server.001code.com",
// // DataServerBaseUrl: "https://test.server.001code.com",
// version : "2025010301",
// unitycdndir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826',
// unitycdnbuilddir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826/Build',
// python_pyodide_cdn_dir : 'https://oss-rpwqy.jjwlcdn.com/001_code_python_res_20241213/pyodide/',
// // 可以根据需要添加其他配置
// disabledev: false,
// usecdn :true, //资源走CDN
// lvlock :false, //关卡5关解锁,下一关加锁
// lvlock_normal_learn :true, //常规关起锁
// lockupdate :false, //上传按钮
// mactchlv : false, //比赛关卡
// learnvideo : true,
// gameNumber:150,
// SSN_COMPETITION_ID: [13],
// // 计算关卡实际id
// getRealLvId(gamelv,gameid, ismatch, gameNumber){
// if(localStorage.getItem('platformMode') === 'competition'){
// return parseInt(window.unity_game_number, 10)
// }else{
// if (!ismatch){
// return ((gamelv-1)*20*gameNumber)+((gameid-1)*gameNumber)
// }else{
// //TODO 这里维护一张匹配关卡映射表
// if (gamelv === 240896 && gameid === 0) {
// return 10000;
// }
// }
// }
// },
// lastGameStyle: '',
// lastGameDefaultSkin: 0,
// checkGameStyle(realLvId){
// let gameStyle = '';
// let gameDefaultSkin = 0;
// if ((realLvId >= 1 && realLvId <= 400) || (realLvId >= 20001 && realLvId <= 30000)) {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// } else if ((realLvId >= 401 && realLvId <= 800) || (realLvId >= 10001 && realLvId <= 20000)) {
// gameStyle = 'chinese';
// gameDefaultSkin = 1;
// } else if ((realLvId >= 801 && realLvId <= 1200) || (realLvId >= 40001 && realLvId <= 50000)) {
// gameStyle = 'redArmy';
// gameDefaultSkin = 2;
// } else if ((realLvId >= 1201 && realLvId <= 1600) || (realLvId >= 30001 && realLvId <= 40000)) {
// gameStyle = 'numMan';
// gameDefaultSkin = 3;
// }else {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// }
// if (gameStyle !== this.lastGameStyle) {
// window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
// this.lastGameStyle = gameStyle;
// }
// if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// setTimeout(() => {
// window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
// console.log("CallChangeSkin >>> ", gameDefaultSkin);
// }, 3000);
// this.lastGameDefaultSkin = gameDefaultSkin;
// }
// }
// };
// 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",
// // DataServerBaseUrl: "https://test.server.001code.com",
// // DataServerBaseUrl: "https://test.server.001code.com",
// version : "2025011001",
// unitycdndir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826',
// unitycdnbuilddir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826/Build',
// python_pyodide_cdn_dir : 'https://oss-rpwqy.jjwlcdn.com/001_code_python_res_20241213/pyodide/',
// // 可以根据需要添加其他配置
// // disabledev: false,
// disabledev: false,
// usecdn :true, //资源走CDN
// lvlock :false, //关卡5关解锁,下一关加锁
// lvlock_normal_learn : !(typeof localStorage !== 'undefined' &&
// (localStorage.getItem('player_id') === '32' || localStorage.getItem('player_id') === '1506'|| localStorage.getItem('player_id') === '24'|| localStorage.getItem('player_id') === '1550')), //常规关起锁
// lockupdate :false, //上传按钮
// mactchlv : false, //比赛关卡
// learnvideo : true,
// gameNumber:120,
// // 计算关卡实际id
// SSN_COMPETITION_ID: [21,22,23],
// getRealLvId(gamelv,gameid, ismatch, gameNumber){
// if(localStorage.getItem('platformMode') === 'competition'){
// return parseInt(window.unity_game_number, 10)
// }else{
// if (!ismatch){
// return ((gamelv-1)*20*gameNumber)+((gameid-1)*gameNumber)
// }else{
// //TODO 这里维护一张匹配关卡映射表
// if (gamelv === 240896 && gameid === 0) {
// return 10000;
// }
// }
// }
// },
// lastGameStyle: '',
// lastGameDefaultSkin: 0,
// checkGameStyle(realLvId){
// let gameStyle = '';
// let gameDefaultSkin = 0;
// if ((realLvId >= 1 && realLvId <= 400) || (realLvId >= 20001 && realLvId <= 30000)) {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// } else if ((realLvId >= 401 && realLvId <= 800) || (realLvId >= 10001 && realLvId <= 20000)) {
// gameStyle = 'chinese';
// gameDefaultSkin = 1;
// } else if ((realLvId >= 801 && realLvId <= 1200) || (realLvId >= 40001 && realLvId <= 50000)) {
// gameStyle = 'redArmy';
// gameDefaultSkin = 2;
// } else if ((realLvId >= 1201 && realLvId <= 1600) || (realLvId >= 30001 && realLvId <= 40000)) {
// gameStyle = 'numMan';
// gameDefaultSkin = 3;
// }else {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// }
// if (gameStyle !== this.lastGameStyle) {
// window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
// this.lastGameStyle = gameStyle;
// }
// if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// setTimeout(() => {
// window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
// console.log("CallChangeSkin >>> ", gameDefaultSkin);
// }, 3000);
// this.lastGameDefaultSkin = gameDefaultSkin;
// }
// }
// };
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",
// DataServerBaseUrl: "https://test.server.001code.com",
// DataServerBaseUrl: "https://test.server.001code.com",
version: "20260717",
/** OSS 真实地址(生产环境浏览器直连) */
unityCdnRemote: 'https://oss.eanic.cn/001_code_cocos_res_20260617',
/** 方案 Bnginx / webpack 同源代理前缀(方案 A 直连 OSS 请保持 false */
unityCdnDevProxy: '/cdn-unity',
/** 本地 npm start 也走代理(仅 unityCdnUseSiteProxy 或此项为 true 时生效) */
unityCdnUseDevProxy: false,
/** 生产 nginx 反向代理 OSS 同路径时设为 true方案 B */
unityCdnUseSiteProxy: false,
unitycdndir: 'https://oss.eanic.cn/001_code_cocos_res_20260717',
unitycdnbuilddir: 'https://oss.eanic.cn/001_code_cocos_res_20260717/Build',
python_pyodide_cdn_dir: 'https://oss.eanic.cn/001_code_python_res_20241213/pyodide/',
// 可以根据需要添加其他配置
disabledev: false,
usecdn: true,
lvlock: false,
lvlock_normal_learn: !(typeof localStorage !== 'undefined' &&
(localStorage.getItem('player_id') === '37' || localStorage.getItem('player_id') === '45' || localStorage.getItem('player_id') === '55')),
lockupdate: false,
mactchlv: false,
learnvideo: true,
gameNumber: 120,
//计算关卡实际id
SSN_COMPETITION_ID: [13],
NOT_ALLOWED_COMPETITION_ID: [72, 62, 64, 65, 69, 61, 63, 67, 70, 74, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84],
BEGINNING_REAL_LVID: 91600,
END_REAL_LVID: 93100,
SIMULATE_COMPETITION_ID: [149], // 用于测试的模拟比赛ID
HIDE_COMPETITION_TIME_ID: [154, 155, 156], // 需要隐藏比赛时间的比赛ID列表
// 计算关卡实际id
getRealLvId(gamelv, gameid, ismatch, gameNumber) {
if (localStorage.getItem('platformMode') === 'competition') {
return parseInt(window.unity_game_number, 10)
} else {
if (!ismatch) {
return ((gamelv - 1) * 30 * gameNumber) + ((gameid - 1) * gameNumber) + this.BEGINNING_REAL_LVID
} else {
//TODO 这里维护一张匹配关卡映射表
if (gamelv === 240896 && gameid === 0) {
return 10000;
}
}
}
},
lastGameStyle: '',
lastGameDefaultSkin: 0,
checkGameStyle(realLvId) {
let gameStyle = 'SILU';
let gameDefaultSkin = 0;
if (realLvId >= this.BEGINNING_REAL_LVID && realLvId <= this.END_REAL_LVID) {
realLvId = realLvId - this.BEGINNING_REAL_LVID;
if (realLvId >= 1 && realLvId <= 300) {
gameStyle = 'SILU';
gameDefaultSkin = 0;
} else if (realLvId >= 301 && realLvId <= 600) {
gameStyle = 'redArmy';
gameDefaultSkin = 2;
} else if (realLvId >= 601 && realLvId <= 900) {
gameStyle = 'numMan';
gameDefaultSkin = 3;
} else if (realLvId >= 901 && realLvId <= 1200) {
gameStyle = 'chinese';
gameDefaultSkin = 1;
} else if (realLvId >= 1201 && realLvId <= 1500) {
gameStyle = 'snow';
gameDefaultSkin = 4;
} else if (realLvId >= 1501 && realLvId <= 1800) {
gameStyle = 'SILU';
gameDefaultSkin = 0;
} else {
gameStyle = 'SILU';
gameDefaultSkin = 0;
}
}
if (gameStyle !== this.lastGameStyle) {
window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
this.lastGameStyle = gameStyle;
}
// 尝试多次发送消息,以确保 Unity 场景和 Player 对象已加载
if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// 尝试多次发送消息,以确保 Unity 场景和 Player 对象已加载
const sendSkinMsg = (delay) => {
setTimeout(() => {
if (window.unityInstance) {
try {
window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
console.log("CallChangeSkin sent >>> ", gameDefaultSkin);
} catch (e) {
console.log("Player not ready yet");
}
}
}, delay);
};
sendSkinMsg(2000);
sendSkinMsg(4000);
sendSkinMsg(6000);
this.lastGameDefaultSkin = gameDefaultSkin;
}
}
};
export default CONFIG;

View File

@@ -0,0 +1,283 @@
// config.js
// 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",
// // DataServerBaseUrl: "https://test.server.001code.com",
// // DataServerBaseUrl: "https://test.server.001code.com",
// version : "2025010301",
// unitycdndir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826',
// unitycdnbuilddir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826/Build',
// python_pyodide_cdn_dir : 'https://oss-rpwqy.jjwlcdn.com/001_code_python_res_20241213/pyodide/',
// // 可以根据需要添加其他配置
// disabledev: false,
// usecdn :true, //资源走CDN
// lvlock :false, //关卡5关解锁,下一关加锁
// lvlock_normal_learn :true, //常规关起锁
// lockupdate :false, //上传按钮
// mactchlv : false, //比赛关卡
// learnvideo : true,
// gameNumber:150,
// SSN_COMPETITION_ID: [13],
// // 计算关卡实际id
// getRealLvId(gamelv,gameid, ismatch, gameNumber){
// if(localStorage.getItem('platformMode') === 'competition'){
// return parseInt(window.unity_game_number, 10)
// }else{
// if (!ismatch){
// return ((gamelv-1)*20*gameNumber)+((gameid-1)*gameNumber)
// }else{
// //TODO 这里维护一张匹配关卡映射表
// if (gamelv === 240896 && gameid === 0) {
// return 10000;
// }
// }
// }
// },
// lastGameStyle: '',
// lastGameDefaultSkin: 0,
// checkGameStyle(realLvId){
// let gameStyle = '';
// let gameDefaultSkin = 0;
// if ((realLvId >= 1 && realLvId <= 400) || (realLvId >= 20001 && realLvId <= 30000)) {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// } else if ((realLvId >= 401 && realLvId <= 800) || (realLvId >= 10001 && realLvId <= 20000)) {
// gameStyle = 'chinese';
// gameDefaultSkin = 1;
// } else if ((realLvId >= 801 && realLvId <= 1200) || (realLvId >= 40001 && realLvId <= 50000)) {
// gameStyle = 'redArmy';
// gameDefaultSkin = 2;
// } else if ((realLvId >= 1201 && realLvId <= 1600) || (realLvId >= 30001 && realLvId <= 40000)) {
// gameStyle = 'numMan';
// gameDefaultSkin = 3;
// }else {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// }
// if (gameStyle !== this.lastGameStyle) {
// window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
// this.lastGameStyle = gameStyle;
// }
// if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// setTimeout(() => {
// window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
// console.log("CallChangeSkin >>> ", gameDefaultSkin);
// }, 3000);
// this.lastGameDefaultSkin = gameDefaultSkin;
// }
// }
// };
// 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",
// // DataServerBaseUrl: "https://test.server.001code.com",
// // DataServerBaseUrl: "https://test.server.001code.com",
// version : "2025011001",
// unitycdndir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826',
// unitycdnbuilddir : 'https://oss-rpwqy.jjwlcdn.com/001_code_unity_res_20250826/Build',
// python_pyodide_cdn_dir : 'https://oss-rpwqy.jjwlcdn.com/001_code_python_res_20241213/pyodide/',
// // 可以根据需要添加其他配置
// // disabledev: false,
// disabledev: false,
// usecdn :true, //资源走CDN
// lvlock :false, //关卡5关解锁,下一关加锁
// lvlock_normal_learn : !(typeof localStorage !== 'undefined' &&
// (localStorage.getItem('player_id') === '32' || localStorage.getItem('player_id') === '1506'|| localStorage.getItem('player_id') === '24'|| localStorage.getItem('player_id') === '1550')), //常规关起锁
// lockupdate :false, //上传按钮
// mactchlv : false, //比赛关卡
// learnvideo : true,
// gameNumber:120,
// // 计算关卡实际id
// SSN_COMPETITION_ID: [21,22,23],
// getRealLvId(gamelv,gameid, ismatch, gameNumber){
// if(localStorage.getItem('platformMode') === 'competition'){
// return parseInt(window.unity_game_number, 10)
// }else{
// if (!ismatch){
// return ((gamelv-1)*20*gameNumber)+((gameid-1)*gameNumber)
// }else{
// //TODO 这里维护一张匹配关卡映射表
// if (gamelv === 240896 && gameid === 0) {
// return 10000;
// }
// }
// }
// },
// lastGameStyle: '',
// lastGameDefaultSkin: 0,
// checkGameStyle(realLvId){
// let gameStyle = '';
// let gameDefaultSkin = 0;
// if ((realLvId >= 1 && realLvId <= 400) || (realLvId >= 20001 && realLvId <= 30000)) {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// } else if ((realLvId >= 401 && realLvId <= 800) || (realLvId >= 10001 && realLvId <= 20000)) {
// gameStyle = 'chinese';
// gameDefaultSkin = 1;
// } else if ((realLvId >= 801 && realLvId <= 1200) || (realLvId >= 40001 && realLvId <= 50000)) {
// gameStyle = 'redArmy';
// gameDefaultSkin = 2;
// } else if ((realLvId >= 1201 && realLvId <= 1600) || (realLvId >= 30001 && realLvId <= 40000)) {
// gameStyle = 'numMan';
// gameDefaultSkin = 3;
// }else {
// gameStyle = 'default';
// gameDefaultSkin = 0;
// }
// if (gameStyle !== this.lastGameStyle) {
// window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
// this.lastGameStyle = gameStyle;
// }
// if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// setTimeout(() => {
// window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
// console.log("CallChangeSkin >>> ", gameDefaultSkin);
// }, 3000);
// this.lastGameDefaultSkin = gameDefaultSkin;
// }
// }
// };
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",
// DataServerBaseUrl: "https://test.server.001code.com",
// DataServerBaseUrl: "https://test.server.001code.com",
version: "20260520",
/** OSS 真实地址(生产环境浏览器直连) */
unityCdnRemote: 'https://oss.eanic.cn/001_code_cocos_res_20260617',
/** 方案 Bnginx / webpack 同源代理前缀(方案 A 直连 OSS 请保持 false */
unityCdnDevProxy: '/cdn-unity',
/** 本地 npm start 也走代理(仅 unityCdnUseSiteProxy 或此项为 true 时生效) */
unityCdnUseDevProxy: false,
/** 生产 nginx 反向代理 OSS 同路径时设为 true方案 B */
unityCdnUseSiteProxy: false,
unitycdndir: 'https://oss.eanic.cn/001_code_cocos_res_20260617',
unitycdnbuilddir: 'https://oss.eanic.cn/001_code_cocos_res_20260617/Build',
python_pyodide_cdn_dir: 'https://oss.eanic.cn/001_code_python_res_20241213/pyodide/',
// 可以根据需要添加其他配置
disabledev: false,
usecdn: true,
lvlock: false,
lvlock_normal_learn: !(typeof localStorage !== 'undefined' &&
(localStorage.getItem('player_id') === '37' || localStorage.getItem('player_id') === '45' || localStorage.getItem('player_id') === '55')),
lockupdate: false,
mactchlv: false,
learnvideo: true,
gameNumber: 120,
//计算关卡实际id
SSN_COMPETITION_ID: [13],
NOT_ALLOWED_COMPETITION_ID: [72, 62, 64, 65, 69, 61, 63, 67, 70, 74, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84],
BEGINNING_REAL_LVID: 91600,
END_REAL_LVID: 93100,
SIMULATE_COMPETITION_ID: [149], // 用于测试的模拟比赛ID
HIDE_COMPETITION_TIME_ID: [154, 155, 156], // 需要隐藏比赛时间的比赛ID列表
// 计算关卡实际id
getRealLvId(gamelv, gameid, ismatch, gameNumber) {
if (localStorage.getItem('platformMode') === 'competition') {
return parseInt(window.unity_game_number, 10)
} else {
if (!ismatch) {
return ((gamelv - 1) * 30 * gameNumber) + ((gameid - 1) * gameNumber) + this.BEGINNING_REAL_LVID
} else {
//TODO 这里维护一张匹配关卡映射表
if (gamelv === 240896 && gameid === 0) {
return 10000;
}
}
}
},
lastGameStyle: '',
lastGameDefaultSkin: 0,
checkGameStyle(realLvId) {
let gameStyle = 'SILU';
let gameDefaultSkin = 0;
if (realLvId >= this.BEGINNING_REAL_LVID && realLvId <= this.END_REAL_LVID) {
realLvId = realLvId - this.BEGINNING_REAL_LVID;
if (realLvId >= 1 && realLvId <= 300) {
gameStyle = 'SILU';
gameDefaultSkin = 0;
} else if (realLvId >= 301 && realLvId <= 600) {
gameStyle = 'redArmy';
gameDefaultSkin = 2;
} else if (realLvId >= 601 && realLvId <= 900) {
gameStyle = 'numMan';
gameDefaultSkin = 3;
} else if (realLvId >= 901 && realLvId <= 1200) {
gameStyle = 'chinese';
gameDefaultSkin = 1;
} else if (realLvId >= 1201 && realLvId <= 1500) {
gameStyle = 'snow';
gameDefaultSkin = 4;
} else if (realLvId >= 1501 && realLvId <= 1800) {
gameStyle = 'SILU';
gameDefaultSkin = 0;
} else {
gameStyle = 'SILU';
gameDefaultSkin = 0;
}
}
if (gameStyle !== this.lastGameStyle) {
window.unityInstance.SendMessage("GameController", "ChangeUIStyle", gameStyle);
this.lastGameStyle = gameStyle;
}
// 尝试多次发送消息,以确保 Unity 场景和 Player 对象已加载
if (gameDefaultSkin !== this.lastGameDefaultSkin) {
// 尝试多次发送消息,以确保 Unity 场景和 Player 对象已加载
const sendSkinMsg = (delay) => {
setTimeout(() => {
if (window.unityInstance) {
try {
window.unityInstance.SendMessage("Player", "CallChangeSkin", gameDefaultSkin);
console.log("CallChangeSkin sent >>> ", gameDefaultSkin);
} catch (e) {
console.log("Player not ready yet");
}
}
}, delay);
};
sendSkinMsg(2000);
sendSkinMsg(4000);
sendSkinMsg(6000);
this.lastGameDefaultSkin = gameDefaultSkin;
}
}
};
export default CONFIG;

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