fix(victory): align buttons with final type

The stage-complete settle type was renamed to final; update
the victory panel to match the value sent by MissionComp.

- show the secondary button on every settle result, labeled
  back for final and exit otherwise
- hide the next button only for the final settle type
- sync the bound confirm button visibility
This commit is contained in:
panFD
2026-09-11 08:15:18 +08:00
parent 4b0c0f00f9
commit f6a1a99dc9

View File

@@ -766,9 +766,9 @@ export class VictoryComp extends CCComp {
/** /**
* 统一更新按钮显隐与文案: * 统一更新按钮显隐与文案:
* section(小节胜利)→ next="下一节",btn 隐藏 * section(小节胜利)→ btn="退出",next="下一节"
* victory(末关通关)→ btn="确认",next 隐藏 * final(末关通关) → btn="返回",next 隐藏
* defeat(失败) → btn="确认",next="再来一次" * defeat(失败) → btn="退出",next="再来一次"
*/ */
private updateButtonStates() { private updateButtonStates() {
const btns = this.node.getChildByName("btns"); const btns = this.node.getChildByName("btns");
@@ -777,16 +777,18 @@ export class VictoryComp extends CCComp {
const btnNode = btns.getChildByName("btn"); const btnNode = btns.getChildByName("btn");
const nextNode = btns.getChildByName("next"); const nextNode = btns.getChildByName("next");
// btn 确认按钮:仅小节胜利时隐藏 // btn 确认/退出按钮:所有结算类型都显示
if (btnNode) { if (btnNode) {
btnNode.active = this.settleType !== "section"; btnNode.active = true;
const label = btnNode.getChildByName("Label")?.getComponent(Label); const label = btnNode.getChildByName("Label")?.getComponent(Label);
if (label) label.string = "确认"; if (label) {
label.string = this.settleType === "final" ? "返回" : "退出";
}
} }
// next 按钮:小节胜利→"下一节",失败→"再来一次",末关通关隐藏 // next 按钮:小节胜利→"下一节",失败→"再来一次",末关通关隐藏
if (nextNode) { if (nextNode) {
nextNode.active = this.settleType !== "victory"; nextNode.active = this.settleType !== "final";
const label = nextNode.getChildByName("Label")?.getComponent(Label); const label = nextNode.getChildByName("Label")?.getComponent(Label);
if (label) { if (label) {
label.string = this.settleType === "section" ? "下一节" : "再来一次"; label.string = this.settleType === "section" ? "下一节" : "再来一次";
@@ -795,7 +797,7 @@ export class VictoryComp extends CCComp {
// 属性绑定的确认按钮同步显隐 // 属性绑定的确认按钮同步显隐
if (this.confirm_btn && this.confirm_btn.isValid) { if (this.confirm_btn && this.confirm_btn.isValid) {
this.confirm_btn.active = this.settleType !== "section"; this.confirm_btn.active = true;
} }
} }