// ====== 环境修复代码(确保全局对象安全) ======
(function() {
if (cc && cc.sys && cc.sys.isNative) {
try {
console.log('[EnvFix] Applying environment patches for', cc.sys.os);
// 可靠获取全局对象的多平台兼容方案
const getGlobalObject = () => {
// 优先级1: Cocos Creator 的全局对象
if (typeof cc !== 'undefined' && cc.game && cc.game.globalObject) {
return cc.game.globalObject;
}
// 优先级2: Node.js 环境
if (typeof global !== 'undefined') return global;
// 优先级3: 浏览器环境
if (typeof window !== 'undefined') return window;
// 优先级4: Web Worker 环境
if (typeof self !== 'undefined') return self;
// 终极回退方案
return Function('return this')() || {};
};
const globalObj = getGlobalObject();
// 修复关键全局变量缺失问题
if (typeof global === 'undefined') global = globalObj;
if (typeof self === 'undefined') self = globalObj;
if (typeof globalThis === 'undefined') globalThis = globalObj;
// 确保全局对象上有 self 属性
if (globalObj && typeof globalObj.self === 'undefined') {
Object.defineProperty(globalObj, 'self', {
value: globalObj,
writable: false,
configurable: false,
enumerable: false
});
console.log('[EnvFix] Added self to global object');
}
// 验证修复结果
console.log('[EnvFix] Verification:', {
global: typeof global,
self: typeof self,
globalThis: typeof globalThis,
equality: self === global && global === globalThis
});
} catch (e) {
console.error('[EnvFix] Failed:', e);
}
} else {
console.log('[EnvFix] Skipping for non-native platform');
}
})();
// ====== 改进的引擎初始化保护系统 ======
const EngineReady = (function() {
let _promise = null;
let _resolve = null;
let _isReady = false;
let _checkInterval = null;
return {
get isReady() { return _isReady; },
get promise() { return _promise; },
init() {
if (!_promise) {
_promise = new Promise(resolve => {
_resolve = () => {
_isReady = true;
resolve();
if (_checkInterval) {
clearInterval(_checkInterval);
_checkInterval = null;
}
};
// 安全检查:确保cc.game存在
const safeCheckEngine = () => {
// 如果引擎已经初始化
if (cc && cc.game && cc.game._isEngineInited) {
_resolve();
return true;
}
// 尝试监听引擎初始化事件
if (cc && cc.game && cc.game.once) {
// 使用更安全的方式访问事件常量
const eventName =
(cc.game && cc.game.EVENT_ENGINE_INITED) ||
(cc.Game && cc.Game.EVENT_ENGINE_INITED) ||
'engine-inited';
cc.game.once(eventName, _resolve);
return true;
}
return false;
};
// 首次尝试检查
if (safeCheckEngine()) {
return;
}
// 如果首次检查失败,设置轮询检查
_checkInterval = setInterval(() => {
if (safeCheckEngine()) {
clearInterval(_checkInterval);
_checkInterval = null;
}
}, 100);
});
}
return _promise;
},
// 安全访问引擎API的包装器
safeAccess(callback) {
if (_isReady) {
try {
return callback();
} catch (e) {
console.error('[EngineSafe] Callback error:', e);
}
}
return _promise.then(callback).catch(e => {
console.error('[EngineSafe] Async callback error:', e);
});
}
};
})();
// 初始化但不立即等待
EngineReady.init();
// ====== 游戏主入口 ======
async function gameMainEntry() {
try {
console.log('[Main] Waiting for engine initialization...');
// 安全等待引擎初始化
await EngineReady.promise;
console.log('[Main] Engine fully initialized');
// 安全初始化游戏设置
EngineReady.safeAccess(() => {
if (cc.view) {
cc.view.enableRetina(true);
cc.view.resizeWithBrowserSize(true);
cc.view.setDesignResolutionSize(960, 640, cc.ResolutionPolicy.SHOW_ALL);
}
});
// 加载重力引擎SDK
await loadGravityEngineSDK();
// 加载启动场景
await loadStartScene();
} catch (error) {
console.error('[Main] Game initialization failed:', error);
// 尝试恢复基本功能
try {
// 直接尝试加载场景
if (cc.director && cc.director.loadScene) {
cc.director.loadScene('start');
}
} catch (fallbackError) {
console.error('[Main] Fallback scene load failed:', fallbackError);
// 最终后备方案
displayErrorFallback('Initialization Failed\nPlease Restart');
}
}
}
// 错误显示后备方案
function displayErrorFallback(message) {
try {
// 尝试使用DOM创建错误显示
const errorDiv = document.createElement('div');
errorDiv.style.position = 'fixed';
errorDiv.style.top = '0';
errorDiv.style.left = '0';
errorDiv.style.width = '100%';
errorDiv.style.height = '100%';
errorDiv.style.backgroundColor = 'black';
errorDiv.style.color = 'white';
errorDiv.style.display = 'flex';
errorDiv.style.justifyContent = 'center';
errorDiv.style.alignItems = 'center';
errorDiv.style.zIndex = '9999';
errorDiv.style.fontFamily = 'Arial, sans-serif';
errorDiv.style.fontSize = '24px';
errorDiv.style.textAlign = 'center';
errorDiv.style.whiteSpace = 'pre-line';
errorDiv.textContent = message;
document.body.appendChild(errorDiv);
} catch (domError) {
console.error('[Fallback] Failed to create error display:', domError);
}
}
// ====== SDK 加载器 ======
async function loadGravityEngineSDK() {
const sdkPaths = [
'src/assets/_plugs/lib/gravityengine.mg.cocoscreator.min.js',
'assets/_plugs/lib/gravityengine.mg.cocoscreator.min.js',
'lib/gravityengine.mg.cocoscreator.min.js' // 额外后备路径
];
let sdkLoaded = false;
for (const path of sdkPaths) {
try {
console.log(`[SDK] Attempting to load from: ${path}`);
await new Promise((resolve, reject) => {
if (cc && cc.assetManager && cc.assetManager.loadScript) {
cc.assetManager.loadScript(path, (err) => {
if (err) {
console.warn(`[SDK] Load failed: ${err.message}`);
reject(err);
} else {
resolve();
}
});
} else {
console.warn('[SDK] cc.assetManager not available');
reject('Asset manager not available');
}
});
console.log('[SDK] GravityEngine loaded successfully');
sdkLoaded = true;
initGravityEngine();
break;
} catch (err) {
// 继续尝试下一个路径
}
}
if (!sdkLoaded) {
console.error('[SDK] All load attempts failed');
handleSDKLoadFailure();
}
}
function initGravityEngine() {
if (typeof GravityEngine === 'undefined') {
console.error('[SDK] GravityEngine not defined after loading');
return;
}
try {
GravityEngine.init({
appId: 'YOUR_APP_ID', // 替换为实际AppID
enableLog: true
});
console.log('[SDK] GravityEngine initialized');
} catch (e) {
console.error('[SDK] Initialization failed:', e);
}
}
function handleSDKLoadFailure() {
console.warn('[SDK] Disabling analytics features');
// 创建空函数降级
window.trackEvent = window.trackEvent || function() {};
window.GravityEngine = window.GravityEngine || {
init: () => console.warn('SDK not available'),
trackEvent: () => {}
};
}
// ====== 场景加载器 ======
async function loadStartScene() {
try {
// 尝试加载主资源包
await new Promise((resolve, reject) => {
if (cc && cc.assetManager && cc.assetManager.loadBundle) {
cc.assetManager.loadBundle('main', (err) => {
if (err) {
console.error('[Scene] Bundle load failed:', err);
reject(err);
} else {
console.log('[Scene] Main bundle loaded');
resolve();
}
});
} else {
console.warn('[Scene] Asset manager not available, skipping bundle load');
resolve(); // 继续执行
}
});
// 加载启动场景
if (cc.director && cc.director.loadScene) {
cc.director.loadScene('start');
} else {
throw new Error('Director not available');
}
} catch (error) {
console.error('[Scene] Failed to load main bundle:', error);
// 后备方案:直接加载场景
try {
console.log('[Scene] Trying direct scene load');
if (cc.director && cc.director.loadScene) {
cc.director.loadScene('start');
} else {
throw new Error('Director not available');
}
} catch (directError) {
console.error('[Scene] Direct scene load failed:', directError);
throw directError; // 传递给上层处理
}
}
}
// ====== UI_Entry 组件 ======
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;
// 导入依赖模块
const r_Const_Common = require("Const_Common");
const r_GravityPlatform = require("GravityPlatform");
const r_YpNetMag = require("YpNetMag");
const r_EvenType = require("EvenType");
const r_PlayerDataManager = require("PlayerDataManager");
const r_ExcelLoader = require("ExcelLoader");
const r_GameDataManager = require("GameDataManager");
const r_GameGlobalVariable = require("GameGlobalVariable");
const r_UIConfig_Game = require("UIConfig_Game");
const r_UIConfig_Home = require("UIConfig_Home");
const r_BundleConfig = require("BundleConfig");
const r_GameConfig = require("GameConfig");
const r_AudioManager = require("AudioManager");
const r_EventManager = require("EventManager");
const r_HttpManager = require("HttpManager");
const r_LogManager = require("LogManager");
const r_ResLoader = require("ResLoader");
const r_UIManager = require("UIManager");
const r_UIView = require("UIView");
var def_UI_Entry = (function (_super) {
__extends(def_UI_Entry, _super);
function def_UI_Entry() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.progress_loading = null;
_this.loginTimeoutHandler = null;
return _this;
}
// 组件生命周期:加载
def_UI_Entry.prototype.onLoad = function () {
var _this = this;
EngineReady.safeAccess(function () {
try {
if (cc.director && cc.director.getCollisionManager) {
cc.director.getCollisionManager().enabled = true;
}
console.log('[UI] Collision manager enabled');
_this._show();
} catch (e) {
console.error('[UI] onLoad error:', e);
_this.startLoadGame(); // 直接开始加载游戏
}
}).catch(function (err) {
console.error('[UI] Engine access error:', err);
_this.startLoadGame();
});
};
// 组件生命周期:销毁
def_UI_Entry.prototype.onDestroy = function () {
if (this.loginTimeoutHandler) {
cc.Tween.stop(this.loginTimeoutHandler);
this.loginTimeoutHandler = null;
console.log('[UI] Login timeout handler cleared');
}
};
// 显示UI并初始化平台SDK
def_UI_Entry.prototype._show = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
this.progress_loading.progress = 0;
console.log('[UI] Showing UI_Entry');
// 平台特定的SDK初始化
if (cc.sys && cc.sys.isBrowser) {
this.initYPSDK().catch(function (err) {
console.error('[UI] YPSDK init failed:', err);
_this.startLoadGame();
});
} else {
this.startLoadGame();
}
// 设置登录超时保护(10秒)
if (cc && cc.tween) {
this.loginTimeoutHandler = cc.tween(this)
.delay(10)
.call(function () {
console.warn('[UI] Login timeout after 10s, proceeding without SDK');
_this.startLoadGame();
})
.start();
} else {
console.warn('[UI] cc.tween not available, using setTimeout');
setTimeout(() => {
console.warn('[UI] Login timeout after 10s, proceeding without SDK');
this.startLoadGame();
}, 10000);
}
return [2];
});
});
};
// 初始化游品SDK
def_UI_Entry.prototype.initYPSDK = function () {
return __awaiter(this, void 0, void 0, function () {
var config;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (typeof YPSDK === 'undefined') {
console.warn('[YPSDK] YPSDK not available');
return [2];
}
config = {
gameChannelList: {
h5: { platformType: "h5", describe: "默认 H5 渠道", version: "1.0.0" },
tt: { platformType: "tt", appId: "tt09297f94961f881b02", describe: "默认 TT 渠道", version: "1.0.0" },
wx: { platformType: "wx", appId: "wx6baaaa27ab5186ff", describe: "默认 WX 渠道", version: "1.0.0" }
}
};
return [4, YPSDK.init(39, "https://platform-shop-dev.hanyougame.com", config)];
case 1:
_a.sent();
return [4, YPSDK.login()];
case 2:
_a.sent();
// 设置登录回调
if (YPSDK.setLoginCallBack) {
YPSDK.setLoginCallBack(function (success) {
if (success) {
// 取消超时处理
if (_this.loginTimeoutHandler) {
if (cc && cc.Tween && cc.Tween.stop) {
cc.Tween.stop(_this.loginTimeoutHandler);
}
_this.loginTimeoutHandler = null;
}
// 初始化重力引擎
if (r_GravityPlatform.default && typeof r_GravityPlatform.default.GA_Init === 'function') {
r_GravityPlatform.default.GA_Init(YPSDK.Platform.loginData.bindingId);
}
_this.startLoadGame();
}
});
} else {
console.warn('[YPSDK] setLoginCallBack not available');
}
return [2];
}
});
});
};
// 开始加载游戏资源
def_UI_Entry.prototype.startLoadGame = function () {
var tasks = [
this._loadGameConfig.bind(this),
this._loadRemoteConfig.bind(this),
this._loadExcelData.bind(this),
this._loadUserData.bind(this),
this._loadCommonBundle.bind(this),
this._loadMainBundle.bind(this)
];
this.executeTasksWithProgress(tasks, this._loadGame.bind(this));
// 微信平台特殊处理
if (cc.sys && cc.sys.platform === cc.sys.WECHAT_GAME && typeof mg !== 'undefined') {
try {
mg.showShareMenu({ menus: ["shareAppMessage", "shareTimeline"] });
} catch (e) {
console.warn('[WeChat] Share menu setup failed:', e);
}
}
};
// 带进度监控的任务执行器
def_UI_Entry.prototype.executeTasksWithProgress = function (tasks, finalCallback) {
var _this = this;
var completed = 0;
var failed = 0;
var executeNext = function (index) {
if (index >= tasks.length) {
if (failed === 0) {
finalCallback();
} else {
console.warn("[Tasks] Completed with " + failed + " failures");
finalCallback(); // 即使有失败也继续
}
return;
}
tasks[index]()
.then(function () {
completed++;
_this._setProgress(completed / tasks.length);
executeNext(index + 1);
})
.catch(function (err) {
console.error("[Task] #" + index + " failed:", err);
failed++;
_this._setProgress((completed + 0.5) / tasks.length); // 部分进度
executeNext(index + 1);
});
};
executeNext(0);
};
// 加载Excel数据
def_UI_Entry.prototype._loadExcelData = function () {
return new Promise(function (resolve, reject) {
if (r_ExcelLoader && r_ExcelLoader.ExcelLoader && r_ExcelLoader.ExcelLoader.loadAll) {
r_ExcelLoader.ExcelLoader.loadAll()
.then(function () {
console.log('[Data] Excel data loaded');
resolve();
})
.catch(function (err) {
console.error('[Data] Excel load failed:', err);
reject(err);
});
} else {
console.warn('[Data] ExcelLoader not available');
resolve(); // 非关键任务继续
}
});
};
// 加载游戏配置
def_UI_Entry.prototype._loadGameConfig = function () {
return __awaiter(this, void 0, void 0, function () {
var jsonAsset;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!r_ResLoader || !r_ResLoader.default || !r_ResLoader.default.loadRes) {
console.warn('[Config] ResLoader not available');
return [2, Promise.resolve()];
}
return [4, r_ResLoader.default.loadRes("resources", "config/GameConfig", cc.JsonAsset)];
case 1:
jsonAsset = _a.sent();
if (jsonAsset && r_GameConfig && r_GameConfig.default) {
r_GameConfig.default.appConfig = jsonAsset.json;
console.log('[Config] Game config loaded');
if (jsonAsset.decRef) {
jsonAsset.decRef(); // 释放引用
}
return [2, Promise.resolve()];
} else {
console.error('[Config] Game config not found');
return [2, Promise.resolve()]; // 非关键错误继续
}
}
});
});
};
// 加载远程配置
def_UI_Entry.prototype._loadRemoteConfig = function () {
return __awaiter(this, void 0, void 0, function () {
var remoteUrl, remotePath, remoteConfig;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!r_GameConfig || !r_GameConfig.default || !r_GameConfig.default.appConfig ||
!r_GameConfig.default.appConfig.RemoteUrl) {
console.warn('[Config] RemoteUrl not configured');
return [2, Promise.resolve()];
}
remoteUrl = r_GameConfig.default.appConfig.RemoteUrl;
remotePath = cc.path.join(remoteUrl, "ADConfig.json");
return [4, r_ResLoader.default.loadRemote(remotePath, { ext: ".json" })];
case 1:
remoteConfig = _a.sent();
if (remoteConfig && remoteConfig.json && r_GravityPlatform && r_GravityPlatform.default) {
r_GravityPlatform.default.videoId = remoteConfig.json.ADUnitId[0];
if (r_GameConfig && r_GameConfig.default) {
r_GameConfig.default.adConfig = remoteConfig.json;
}
console.log('[Config] Remote config loaded');
return [2, Promise.resolve()];
} else {
console.error('[Config] Remote config load failed');
return [2, Promise.resolve()]; // 非关键错误,继续执行
}
}
});
});
};
// 加载公共资源包
def_UI_Entry.prototype._loadCommonBundle = function () {
return new Promise(function (resolve, reject) {
if (!r_ResLoader || !r_ResLoader.default || !r_ResLoader.default.loadBundle) {
console.warn('[Bundle] ResLoader not available');
resolve();
return;
}
r_ResLoader.default.loadBundle(r_BundleConfig.BundleNames.Common)
.then(function (bundle) {
if (bundle) {
console.log('[Bundle] Common bundle loaded');
resolve();
} else {
console.warn('[Bundle] Common bundle not loaded');
resolve(); // 非关键错误继续
}
})
.catch(err => {
console.error('[Bundle] Common bundle load failed:', err);
resolve(); // 非关键错误继续
});
});
};
// 加载主游戏包
def_UI_Entry.prototype._loadMainBundle = function () {
return new Promise(function (resolve, reject) {
if (!r_ResLoader || !r_ResLoader.default || !r_ResLoader.default.loadBundle) {
console.warn('[Bundle] ResLoader not available');
resolve();
return;
}
r_ResLoader.default.loadBundle(r_BundleConfig.MainGameBundle)
.then(function (bundle) {
if (bundle) {
console.log('[Bundle] Main game bundle loaded');
resolve();
} else {
console.warn('[Bundle] Main game bundle not loaded');
resolve(); // 非关键错误继续
}
})
.catch(err => {
console.error('[Bundle] Main game bundle load failed:', err);
resolve(); // 非关键错误继续
});
});
};
// 加载用户数据
def_UI_Entry.prototype._loadUserData = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
try {
if (r_AudioManager && r_AudioManager.AudioMgr && r_AudioManager.AudioMgr.init) {
r_AudioManager.AudioMgr.init();
}
if (r_GameGlobalVariable && r_GameGlobalVariable.GameGlobalVariable &&
r_GameGlobalVariable.GameGlobalVariable.initPeiZhi) {
r_GameGlobalVariable.GameGlobalVariable.initPeiZhi();
}
if (YPSDK && YPSDK.Common && YPSDK.Common.curChannelData &&
r_YpNetMag && r_YpNetMag.YpNetMag && r_YpNetMag.YpNetMag.failSever) {
var platformType = YPSDK.Common.curChannelData.platformType;
if (platformType === YPSDK.GamePlatformType.WX || platformType === YPSDK.GamePlatformType.TT) {
r_YpNetMag.YpNetMag.failSever(function () {
if (r_YpNetMag.YpNetMag) {
r_YpNetMag.YpNetMag.isFail = true;
}
console.warn('[Network] Server connection failed');
});
}
}
if (YPSDK && YPSDK.Platform && YPSDK.Platform.loginData &&
r_YpNetMag && r_YpNetMag.YpNetMag && r_YpNetMag.YpNetMag.initServer) {
return [2, r_YpNetMag.YpNetMag.initServer(YPSDK.Platform.loginData)];
} else {
console.warn('[User] No login data, skipping user init');
return [2, Promise.resolve()];
}
} catch (err) {
console.error('[User] Load user data failed:', err);
return [2, Promise.resolve()]; // 非关键错误
}
return [2];
});
});
};
// 初始化游戏主逻辑
def_UI_Entry.prototype._loadGame = function () {
try {
// 安全访问玩家数据管理器
if (!r_PlayerDataManager || !r_PlayerDataManager.PlayerDataMgr) {
throw new Error('PlayerDataManager not available');
}
// 获取引导状态
var guideIndex = r_PlayerDataManager.PlayerDataMgr.GetGuideIndexByTaskName(r_Const_Common.GuideName.战斗背包);
if (guideIndex !== r_Const_Common.GameBagGuideIndex.引导完结) {
// 新玩家流程
if (r_PlayerDataManager.PlayerDataMgr.GMSetGuideIndex) {
r_PlayerDataManager.PlayerDataMgr.GMSetGuideIndex(
r_Const_Common.GuideName.战斗背包,
r_Const_Common.GameBagGuideIndex.引导初始1
);
}
if (r_GameDataManager && r_GameDataManager.GameDataMgr &&
r_GameDataManager.GameDataMgr.ClearGameBagData) {
r_GameDataManager.GameDataMgr.ClearGameBagData();
}
if (r_GameGlobalVariable && r_GameGlobalVariable.GameGlobalVariable) {
r_GameGlobalVariable.GameGlobalVariable.nowlevel = 1;
}
// 打开游戏场景
if (r_UIManager && r_UIManager.default && r_UIManager.default.open) {
r_UIManager.default.open(
r_BundleConfig.BundleNames.Game,
r_UIConfig_Game.UIView_Game.UI_GameView
);
} else {
console.warn('[Game] UIManager not available, loading start scene');
cc.director.loadScene('start');
}
} else {
// 老玩家流程
if (r_EventManager && r_EventManager.EventMgr &&
r_EventManager.EventMgr.dispatchEvent) {
r_EventManager.EventMgr.dispatchEvent(r_EvenType.EVENT_TYPE.Game_Load_View, true);
}
if (r_UIManager && r_UIManager.default && r_UIManager.default.open) {
r_UIManager.default.open(
r_BundleConfig.BundleNames.Home,
r_UIConfig_Home.UIView_Home.UI_Hall
);
} else {
console.warn('[Game] UIManager not available, loading start scene');
cc.director.loadScene('start');
}
}
// 初始化白名单
this.onInitWhiteName();
} catch (error) {
console.error('[Game] Load game failed:', error);
// 尝试直接进入游戏场景
try {
if (cc.director && cc.director.loadScene) {
cc.director.loadScene('start');
}
} catch (sceneError) {
console.error('[Game] Fallback scene load failed:', sceneError);
}
}
};
// 初始化白名单
def_UI_Entry.prototype.onInitWhiteName = function () {
return __awaiter(this, void 0, void 0, function () {
var url;
return __generator(this, function (_a) {
try {
if (!YPSDK || !YPSDK.Platform || !YPSDK.Platform.loginData || !YPSDK.platformUrl) {
console.warn('[WhiteList] YPSDK not initialized, skipping');
return [2];
}
url = YPSDK.platformUrl + "/User/GetCfgData?userId=" +
YPSDK.Platform.loginData.userUid + "&keyId=NoVideo";
console.log('[WhiteList] Checking:', url);
if (r_HttpManager && r_HttpManager.HttpMgr && r_HttpManager.HttpMgr.requestData) {
r_HttpManager.HttpMgr.requestData(function (response) {
if (response && response.data && response.data.keyData === "true" &&
r_PlayerDataManager && r_PlayerDataManager.PlayerDataMgr) {
r_PlayerDataManager.PlayerDataMgr.WHITE_NAME_NO_VIDEO = true;
console.log('[WhiteList] User is in white list');
}
}, url);
} else {
console.warn('[WhiteList] HttpManager not available');
}
} catch (err) {
console.error('[WhiteList] Init failed:', err);
}
return [2];
});
});
};
// 设置进度条
def_UI_Entry.prototype._setProgress = function (progress) {
if (!this.progress_loading || !this.progress_loading.progress) {
return;
}
progress = Math.max(0, Math.min(1, progress));
this.progress_loading.progress = progress;
};
// 属性装饰器
__decorate([
_property(cc.ProgressBar)
], def_UI_Entry.prototype, "progress_loading", void 0);
// 类装饰器
def_UI_Entry = __decorate([
_ccclass
], def_UI_Entry);
return def_UI_Entry;
}(r_UIView.default));
exports.default = def_UI_Entry;
// ====== 启动游戏 ======
if (cc && cc.game && cc.game.run) {
cc.game.run(gameMainEntry);
} else {
console.error('[Main] cc.game.run not available, using fallback start');
setTimeout(gameMainEntry, 1000);
}
UI_Entry.js是我的项目入口吗