feat: 支持关卡配置分享
This commit is contained in:
@@ -3,6 +3,8 @@ import { ViewManager } from './scripts/core/ViewManager';
|
||||
import { LevelDataManager } from './scripts/utils/LevelDataManager';
|
||||
import { AuthManager } from './scripts/utils/AuthManager';
|
||||
import { StorageManager } from './scripts/utils/StorageManager';
|
||||
import { ShareManager } from './scripts/utils/ShareManager';
|
||||
import { WxSDK } from './scripts/utils/WxSDK';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/**
|
||||
@@ -55,7 +57,27 @@ export class PageLoading extends Component {
|
||||
this._syncProgressFromServer();
|
||||
}
|
||||
|
||||
// 预加载 PageHome (80-100%)
|
||||
// 检测分享码:从微信启动参数中获取
|
||||
const shareCode = WxSDK.getShareCodeFromLaunch();
|
||||
if (shareCode && loginSuccess) {
|
||||
this._updateStatusLabel('正在加载挑战关卡...');
|
||||
const joinSuccess = await ShareManager.instance.joinShare(shareCode);
|
||||
if (joinSuccess) {
|
||||
this._updateProgress(1);
|
||||
this._updateStatusLabel('加载完成');
|
||||
// 跳过首页,直接进入分享挑战关卡
|
||||
ViewManager.instance.open('PageLevel', {
|
||||
params: { shareMode: true },
|
||||
onComplete: () => {
|
||||
this.node.destroy();
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.warn('[PageLoading] 加入分享失败,进入正常模式');
|
||||
}
|
||||
|
||||
// 正常流程:预加载 PageHome (80-100%)
|
||||
ViewManager.instance.preload('PageHome',
|
||||
(progress) => {
|
||||
this._updateProgress(0.8 + progress * 0.2);
|
||||
|
||||
Reference in New Issue
Block a user