feat(关卡系统): 实现章节-关-节三级关卡推进机制
本次提交重构了关卡系统,实现了完整的小节级关卡推进流程: 1. 新增关卡配置表StageSet,定义章节-关-节三级结构与怪物数值公式 2. 重构刷怪逻辑,按小节配置生成对应怪物波次 3. 实现关卡进度存档与恢复,支持断点续玩 4. 新增结算弹窗分支逻辑,区分小节胜利/关卡通关/失败状态 5. 优化胜利按钮文案与显示逻辑,将"再来一局"改为"下一关" 6. 新增一套完整的关卡事件系统,驱动各模块协同工作
This commit is contained in:
@@ -120,6 +120,16 @@ export class VictoryComp extends CCComp {
|
||||
@property({ type: Prefab, tooltip: "钻石奖励条目预制体(reward_item_diamond.prefab,挂 RewardItemComp)" })
|
||||
reward_diamond_prefab: Prefab = null!;
|
||||
|
||||
// ======================== 关卡推进绑定 ========================
|
||||
|
||||
/** 下一节按钮(小节胜利时显示,末关通关/失败时隐藏) */
|
||||
@property({ type: Node, tooltip: "下一节按钮(小节胜利时显示)" })
|
||||
next_section_btn: Node = null!;
|
||||
|
||||
/** 通关标题(末关通关时显示"本关通关/本章通关") */
|
||||
@property({ type: Label, tooltip: "通关标题 Label(末关通关时显示,默认隐藏)" })
|
||||
settle_title: Label = null!;
|
||||
|
||||
/** 调试日志开关 */
|
||||
debugMode: boolean = false;
|
||||
/** 奖励等级(预留) */
|
||||
@@ -158,6 +168,13 @@ export class VictoryComp extends CCComp {
|
||||
/** 是否可以复活(由 MissionComp 传入,取决于剩余复活次数) */
|
||||
private canRevive: boolean = false;
|
||||
|
||||
/**
|
||||
* 结算类型(由 MissionComp 传入,驱动主按钮行为):
|
||||
* section - 小节胜利(主按钮"下一节",派发 NextSection)
|
||||
* 其余 - 末关通关 / 失败(主按钮确认退出,走原结算退出流程)
|
||||
*/
|
||||
private settleType: string = "defeat";
|
||||
|
||||
/** 加载时隐藏 loading 遮罩 */
|
||||
protected onLoad(): void {
|
||||
this.node.getChildByName("loading").active = false
|
||||
@@ -170,6 +187,8 @@ export class VictoryComp extends CCComp {
|
||||
* @param args.rewards 掉落奖励列表
|
||||
* @param args.game_data 累计数据 { exp, gold, diamond }
|
||||
* @param args.can_revive 是否可复活
|
||||
* @param args.settle_type 结算类型:section=小节胜利(下一节按钮),其余=确认退出
|
||||
* @param args.settle_title 末关通关标题(如"本关通关"),非空时在结算页顶部展示
|
||||
*/
|
||||
onAdded(args: any) {
|
||||
this.node.getChildByName("loading").active = false
|
||||
@@ -178,9 +197,17 @@ export class VictoryComp extends CCComp {
|
||||
this.game_data = args.game_data
|
||||
}
|
||||
|
||||
// 结算类型:缺省按失败处理
|
||||
this.settleType = args.settle_type ?? "defeat";
|
||||
|
||||
// 根据是否可复活决定按钮显示
|
||||
this.node.getChildByName("btns").getChildByName("next").active = !args.can_revive
|
||||
|
||||
// 下一节按钮:仅小节胜利时显示
|
||||
this.updateNextButtonState();
|
||||
// 通关标题:仅末关通关时显示
|
||||
this.updateSettleTitle(args.settle_title ? String(args.settle_title) : "");
|
||||
|
||||
// 计算总分并写入历史纪录
|
||||
this.calculateTotalScore(!!args.victory, !!args.all_alive);
|
||||
|
||||
@@ -715,7 +742,41 @@ export class VictoryComp extends CCComp {
|
||||
|
||||
// ======================== 操作入口 ========================
|
||||
|
||||
/** 退出战斗:清理数据 → 触发任务结束 → 关闭弹窗 */
|
||||
/**
|
||||
* 下一节按钮显隐:仅小节胜利(settleType === "section")时显示。
|
||||
* 该按钮为 @property 绑定节点,编辑器中已设计好样式与位置。
|
||||
*/
|
||||
private updateNextButtonState() {
|
||||
if (this.next_section_btn && this.next_section_btn.isValid) {
|
||||
this.next_section_btn.active = this.settleType === "section";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通关标题显隐与文案:仅末关通关时显示("本关通关"/"本章通关")。
|
||||
* 该 Label 为 @property 绑定节点,编辑器中默认隐藏。
|
||||
* @param title 文案,空串时隐藏
|
||||
*/
|
||||
private updateSettleTitle(title: string) {
|
||||
if (this.settle_title && this.settle_title.isValid) {
|
||||
this.settle_title.string = title;
|
||||
this.settle_title.node.active = !!title;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下一节按钮点击(编辑器 Click Events 绑定):
|
||||
* 派发 NextSection,由 MissionComp 关窗并推进下一小节。
|
||||
*/
|
||||
on_next_section() {
|
||||
oops.message.dispatchEvent(GameEvent.NextSection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主按钮点击(编辑器 Click Events 绑定,btns/next):
|
||||
* 确认结算退出(原有退出流程)。
|
||||
* 注:下一节按钮为独立节点,不经过本方法。
|
||||
*/
|
||||
victory_end() {
|
||||
this.clear_data()
|
||||
oops.message.dispatchEvent(GameEvent.MissionEnd)
|
||||
|
||||
Reference in New Issue
Block a user