fix: 修复关卡排序
This commit is contained in:
@@ -125,9 +125,10 @@ export class PageLevel extends BaseView {
|
||||
this.currentLevelIndex = 0;
|
||||
console.log('[PageLevel] 进入分享挑战模式');
|
||||
} else {
|
||||
// 从本地存储恢复关卡进度
|
||||
this.currentLevelIndex = StorageManager.getCurrentLevelIndex();
|
||||
console.log(`[PageLevel] 恢复关卡进度: 第 ${this.currentLevelIndex + 1} 关`);
|
||||
// 根据关卡列表找到第一个未通关的关卡
|
||||
this.currentLevelIndex = LevelDataManager.instance.getFirstUncompletedIndex();
|
||||
StorageManager.setCurrentLevelIndex(this.currentLevelIndex);
|
||||
console.log(`[PageLevel] 进入第一个未通关关卡: 第 ${this.currentLevelIndex + 1} 关`);
|
||||
}
|
||||
this.updateStaminaLabel();
|
||||
this.initIconSetting();
|
||||
@@ -905,30 +906,34 @@ export class PageLevel extends BaseView {
|
||||
* 进入下一关
|
||||
*/
|
||||
private async nextLevel(): Promise<void> {
|
||||
// 分享模式不保存本地进度
|
||||
// 标记当前关卡已通关
|
||||
if (!this._isShareMode) {
|
||||
StorageManager.onLevelCompleted(this.currentLevelIndex);
|
||||
LevelDataManager.instance.markLevelCompleted(this.currentLevelIndex);
|
||||
}
|
||||
|
||||
this.currentLevelIndex++;
|
||||
|
||||
// 检查是否还有关卡
|
||||
const totalLevels = this._isShareMode
|
||||
? ShareManager.instance.getShareLevelCount()
|
||||
: LevelDataManager.instance.getLevelCount();
|
||||
|
||||
if (this.currentLevelIndex >= totalLevels) {
|
||||
// 所有关卡完成
|
||||
console.log('[PageLevel] 恭喜通关!');
|
||||
this.stopCountdown();
|
||||
|
||||
if (this._isShareMode) {
|
||||
// 查找下一个未通关的关卡
|
||||
if (this._isShareMode) {
|
||||
this.currentLevelIndex++;
|
||||
const totalLevels = ShareManager.instance.getShareLevelCount();
|
||||
if (this.currentLevelIndex >= totalLevels) {
|
||||
console.log('[PageLevel] 分享关卡全部完成');
|
||||
this.stopCountdown();
|
||||
ShareManager.instance.clearShareMode();
|
||||
ViewManager.instance.replace('PageHome');
|
||||
} else {
|
||||
ViewManager.instance.back();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
const nextIndex = LevelDataManager.instance.getNextUncompletedIndex(this.currentLevelIndex);
|
||||
if (nextIndex < 0) {
|
||||
// 所有关卡全部通关
|
||||
console.log('[PageLevel] 恭喜通关!所有关卡已完成');
|
||||
this.stopCountdown();
|
||||
ViewManager.instance.back();
|
||||
return;
|
||||
}
|
||||
this.currentLevelIndex = nextIndex;
|
||||
StorageManager.setCurrentLevelIndex(this.currentLevelIndex);
|
||||
}
|
||||
|
||||
// 重置并加载下一关(包含进入关卡接口调用)
|
||||
|
||||
Reference in New Issue
Block a user