Complete Cocos Creator port with level bundles, themes, and tooling.

Adds level prefabs, theme assets, audio, extensions, and deployment scripts for the Unity WebGL migration.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-16 15:30:58 +08:00
parent cba5105908
commit d393302388
6248 changed files with 17322729 additions and 11036 deletions

View File

@@ -3,11 +3,48 @@
* 用法:构建产物 index.html 末尾引入本脚本,或在主站模板中引入
*/
(function (global) {
function processData(json) { global.__tfrhOnProcessData?.(json); console.log('[processData]', JSON.parse(json)); }
function processVehicleData(json) { global.__tfrhOnProcessVehicleData?.(json); console.log('[processVehicleData]', JSON.parse(json)); }
function externalResult(json) { global.__tfrhOnExternalResult?.(json); console.log('[externalResult]', JSON.parse(json)); }
function externalLevelInfo(json) { global.__tfrhOnExternalLevelInfo?.(json); console.log('[externalLevelInfo]', JSON.parse(json)); }
function coinsData(json) { global.__tfrhOnCoinsData?.(json); console.log('[coinsData]', JSON.parse(json)); }
function wrap(name, hookKey) {
return function (json) {
var hook = global[hookKey];
if (typeof hook === 'function') hook(json);
try {
console.log('[' + name + ']', JSON.parse(json));
} catch (e) {
console.log('[' + name + ']', json);
}
};
}
function processData(json) { wrap('processData', '__tfrhOnProcessData')(json); }
function processVehicleData(json) { wrap('processVehicleData', '__tfrhOnProcessVehicleData')(json); }
function externalResult(json) { wrap('externalResult', '__tfrhOnExternalResult')(json); }
function externalLevelInfo(json) { wrap('externalLevelInfo', '__tfrhOnExternalLevelInfo')(json); }
function coinsData(json) { wrap('coinsData', '__tfrhOnCoinsData')(json); }
/** Editor 注册真实回调;同时写入 hook 与 window.processData 等全局名 */
global.tfrhBindUnityCallbacks = function (hooks) {
if (!hooks || typeof hooks !== 'object') return;
if (typeof hooks.processData === 'function') {
global.__tfrhOnProcessData = hooks.processData;
global.processData = wrap('processData', '__tfrhOnProcessData');
}
if (typeof hooks.processVehicleData === 'function') {
global.__tfrhOnProcessVehicleData = hooks.processVehicleData;
global.processVehicleData = wrap('processVehicleData', '__tfrhOnProcessVehicleData');
}
if (typeof hooks.externalResult === 'function') {
global.__tfrhOnExternalResult = hooks.externalResult;
global.externalResult = wrap('externalResult', '__tfrhOnExternalResult');
}
if (typeof hooks.externalLevelInfo === 'function') {
global.__tfrhOnExternalLevelInfo = hooks.externalLevelInfo;
global.externalLevelInfo = wrap('externalLevelInfo', '__tfrhOnExternalLevelInfo');
}
if (typeof hooks.coinsData === 'function') {
global.__tfrhOnCoinsData = hooks.coinsData;
global.coinsData = wrap('coinsData', '__tfrhOnCoinsData');
}
};
global.processData = processData;
global.processVehicleData = processVehicleData;
@@ -16,7 +53,7 @@
global.coinsData = coinsData;
// 动态 processPlayerA1 等
['A1','A2','A3','B1','B2','B3'].forEach(function (id) {
['A1', 'A2', 'A3', 'B1', 'B2', 'B3'].forEach(function (id) {
global['processPlayer' + id] = function (json) { console.log('[processPlayer' + id + ']', JSON.parse(json)); };
global['processVehicle' + id] = function (json) { console.log('[processVehicle' + id + ']', JSON.parse(json)); };
});