298 lines
12 KiB
JavaScript
298 lines
12 KiB
JavaScript
// config.js
|
||
|
||
// const CONFIG = {
|
||
// DataServerBaseUrl: "https://server.001code.com", // 在这里定义服务器地址
|
||
// // DataServerBaseUrl: "https://server.001code.com", // 在这里定义服务器地址
|
||
// // DataServerBaseUrl: "https://server.001code.com",
|
||
// // DataServerBaseUrl: "https://server.001code.com",
|
||
// // DataServerBaseUrl: "https://server.001code.com",
|
||
// // DataServerBaseUrl: "https://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: true,
|
||
// 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://server.001code.com", // 在这里定义服务器地址
|
||
// // DataServerBaseUrl: "https://server.001code.com", // 在这里定义服务器地址
|
||
// // DataServerBaseUrl: "https://server.001code.com",
|
||
// DataServerBaseUrl: "https://server.001code.com",
|
||
// // DataServerBaseUrl: "https://server.001code.com",
|
||
// // DataServerBaseUrl: "https://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: true,
|
||
// disabledev: true,
|
||
// 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://server.001code.com", // 在这里定义服务器地址
|
||
// DataServerBaseUrl: "https://server.001code.com", // 在这里定义服务器地址
|
||
// DataServerBaseUrl: "https://server.001code.com",
|
||
DataServerBaseUrl: "https://server.001code.com",
|
||
// DataServerBaseUrl: "https://server.001code.com",
|
||
// DataServerBaseUrl: "https://server.001code.com",
|
||
|
||
version: "2026071701",
|
||
|
||
/** OSS 真实地址(生产环境浏览器直连) */
|
||
unityCdnRemote: 'https://oss.eanic.cn/001_code_cocos_res_2026071701',
|
||
/** 方案 B:nginx / 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_2026071701',
|
||
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/',
|
||
|
||
// 可以根据需要添加其他配置
|
||
|
||
|
||
|
||
disabledev: true,
|
||
usecdn: false,
|
||
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: 93400,
|
||
SIMULATE_COMPETITION_ID: [149], // 用于测试的模拟比赛ID
|
||
HIDE_COMPETITION_TIME_ID: [154, 155, 156], // 需要隐藏比赛时间的比赛ID列表
|
||
MODE_START_OFFSET: {
|
||
'1': [0, 0, 0], //Level A
|
||
'2': [0, 0, 0], //Level B
|
||
'3': [0, 0, 0], //Level C
|
||
'4': [0, 0, 0], //Level D
|
||
'5': [0, 0, 0], //Level E
|
||
'6': [0, 300, 600], //Level F
|
||
},
|
||
// 计算关卡实际id
|
||
getRealLvId(gamelv, gameid, ismatch, gameNumber, gamemode) {
|
||
if (localStorage.getItem('platformMode') === 'competition') {
|
||
return parseInt(window.unity_game_number, 10)
|
||
} else {
|
||
if (!ismatch) {
|
||
let modeOffset = 0;
|
||
if (this.MODE_START_OFFSET && this.MODE_START_OFFSET[gamelv]) {
|
||
modeOffset = this.MODE_START_OFFSET[gamelv][gamemode - 1] || 0;
|
||
}
|
||
return (modeOffset + (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; |