feat: 还原首页 UI
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,12 @@ export class PageLevel extends BaseView {
|
||||
/** 静态常量:零位置 */
|
||||
private static readonly ZERO_POS = new Vec3(0, 0, 0);
|
||||
|
||||
/** 解锁线索按钮默认文案 */
|
||||
private static readonly UNLOCK_BUTTON_CLUE_TEXT = '查看线索';
|
||||
|
||||
/** 线索全部查看后的按钮文案 */
|
||||
private static readonly UNLOCK_BUTTON_ANSWER_TEXT = '查看答案';
|
||||
|
||||
/** 默认体力上限,服务端未返回 max 时使用 */
|
||||
private static readonly DEFAULT_STAMINA_MAX = 50;
|
||||
|
||||
@@ -704,17 +710,18 @@ export class PageLevel extends BaseView {
|
||||
private showUnlockButton(_index?: number): void {
|
||||
if (this.unLockTipsBtn) {
|
||||
this.unLockTipsBtn.active = true;
|
||||
this.setUnlockButtonText(PageLevel.UNLOCK_BUTTON_CLUE_TEXT);
|
||||
console.log('[PageLevel] 显示解锁按钮');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏解锁按钮
|
||||
* 更新底部线索/答案按钮文案
|
||||
*/
|
||||
private hideUnlockButton(_index?: number): void {
|
||||
if (this.unLockTipsBtn) {
|
||||
this.unLockTipsBtn.active = false;
|
||||
console.log('[PageLevel] 隐藏解锁按钮');
|
||||
private setUnlockButtonText(text: string): void {
|
||||
const label = this.unLockTipsBtn?.getChildByName('Label')?.getComponent(Label);
|
||||
if (label) {
|
||||
label.string = text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,12 +754,13 @@ export class PageLevel extends BaseView {
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击解锁线索(顺序解锁:先线索2,再线索3;全部解锁后提示已解锁完毕)
|
||||
* 点击解锁线索(顺序解锁:先线索2,再线索3;全部解锁后切换为查看答案入口)
|
||||
*/
|
||||
private onUnlockClue(): void {
|
||||
// 全部已解锁,提示用户
|
||||
// 全部已解锁后,按钮保留为"查看答案",后续弹窗逻辑在这里接入
|
||||
if (this._nextClueIndex > 3) {
|
||||
ToastManager.show('已解锁完毕');
|
||||
this.playClickSound();
|
||||
console.log('[PageLevel] 点击查看答案,后续弹窗逻辑待接入');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -771,9 +779,9 @@ export class PageLevel extends BaseView {
|
||||
// 推进到下一条待解锁线索
|
||||
this._nextClueIndex++;
|
||||
|
||||
// 全部解锁完毕则隐藏按钮
|
||||
// 全部解锁完毕后不隐藏按钮,改为查看答案入口
|
||||
if (this._nextClueIndex > 3) {
|
||||
this.hideUnlockButton();
|
||||
this.setUnlockButtonText(PageLevel.UNLOCK_BUTTON_ANSWER_TEXT);
|
||||
}
|
||||
|
||||
console.log(`[PageLevel] 解锁线索${index}`);
|
||||
@@ -838,7 +846,18 @@ export class PageLevel extends BaseView {
|
||||
private updateTitleLevelLabel(): void {
|
||||
if (!this.titleLevelLabel) return;
|
||||
|
||||
this.titleLevelLabel.string = `第 ${this._currentLevelNumber} 关`;
|
||||
this.titleLevelLabel.string = `第 ${this.getDisplayLevelNumber()} 关`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务端 level 使用 sortOrder,首关可能为 0;页面展示统一转成从 1 开始的关卡序号
|
||||
*/
|
||||
private getDisplayLevelNumber(): number {
|
||||
if (this._isShareMode) {
|
||||
return this._shareLevelIndex + 1;
|
||||
}
|
||||
|
||||
return Math.max(1, this._currentLevelNumber + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1251,7 +1270,7 @@ export class PageLevel extends BaseView {
|
||||
const passModal = modalNode.getComponent(PassModal);
|
||||
if (passModal) {
|
||||
passModal.setParams({
|
||||
levelIndex: this._currentLevelNumber,
|
||||
levelIndex: this.getDisplayLevelNumber(),
|
||||
titleInfo: AchievementTitleManager.getTitleInfo(this._getPassModalCompletedLevelCount())
|
||||
});
|
||||
passModal.setCallbacks({
|
||||
@@ -1368,7 +1387,7 @@ export class PageLevel extends BaseView {
|
||||
const timeoutModal = modalNode.getComponent(TimeoutModal);
|
||||
if (timeoutModal) {
|
||||
timeoutModal.setParams({
|
||||
levelIndex: this._currentLevelNumber
|
||||
levelIndex: this.getDisplayLevelNumber()
|
||||
});
|
||||
timeoutModal.setCallbacks({
|
||||
onShare: () => {
|
||||
|
||||
Reference in New Issue
Block a user