refactor: 重构新手引导系统,替换旧引导方案

1.  删除旧的GuideComp组件和guide1引导预制体
2.  移除UIConfig中旧的Guide1配置项
3.  改用基于smc.data.tip_done的精细化单步引导
4.  为主页开始按钮新增首次启动引导逻辑
5.  优化引导状态管理,仅单次提示未完成步骤
This commit is contained in:
panFD
2026-08-07 00:17:31 +08:00
parent 31f5340866
commit f841779e94
9 changed files with 1059 additions and 2098 deletions

View File

@@ -226,20 +226,18 @@ export class MissionCardComp extends CCComp {
// ======================== 新手按钮指引 ========================
/** 新手按钮指引 ID写入 finish_guides已占用 0~4此处用 5 */
private static readonly BUTTON_GUIDE_ID: number = 5;
/** 新手按钮指引抖动最大角度(度) */
private static readonly BUTTON_GUIDE_SHAKE_ANGLE: number = 10;
/** 新手按钮指引每步时长(秒) */
private static readonly BUTTON_GUIDE_STEP_DURATION: number = 4.2;
/** 新手按钮指引气泡停留时长(秒) */
private static readonly BUTTON_GUIDE_TIP_STAY: number = 3.4;
/** 指引步骤配置:按钮节点取值器 + 气泡文案 */
private readonly guideSteps: Array<{ getBtn: () => Node | null, text: string }> = [
{ getBtn: () => this.showHeros, text: "这里召唤英雄" },
{ getBtn: () => this.showEquips, text: "这里购买装备" },
{ getBtn: () => this.showSkills, text: "这里购买技能卷轴" },
{ getBtn: () => this.showShop, text: "这里购买药品" },
/** 指引步骤配置:完成标记键smc.data.tip_done+ 按钮节点取值器 + 气泡文案 */
private readonly guideSteps: Array<{ key: "hero" | "equip" | "skill" | "shop", getBtn: () => Node | null, text: string }> = [
{ key: "hero", getBtn: () => this.showHeros, text: "这里召唤英雄" },
{ key: "equip", getBtn: () => this.showEquips, text: "这里购买装备" },
{ key: "skill", getBtn: () => this.showSkills, text: "这里购买技能卷轴" },
{ key: "shop", getBtn: () => this.showShop, text: "这里购买药品" },
];
/** 当前指引下标(-1 = 未在指引中) */
private guideStepIndex: number = -1;
@@ -489,8 +487,9 @@ export class MissionCardComp extends CCComp {
this.enterBattlePhase();
// 首次进入战斗阶段:启动按钮逐个指引(仅提醒 1 次)
if (!smc.finish_guides.includes(MissionCardComp.BUTTON_GUIDE_ID)) {
// 首次进入战斗阶段:启动按钮逐个指引(仅提醒 1 次,全部完成则自动跳过
const tips = smc.data.tip_done;
if (!tips.hero || !tips.equip || !tips.skill || !tips.shop) {
this.playButtonGuide();
}
}
@@ -931,12 +930,27 @@ export class MissionCardComp extends CCComp {
/**
* 启动新手按钮指引:依次指引 英雄→装备→技能→药品 四个面板按钮。
* 每步播放 bg/icon 循环抖动 + smalltip 气泡文案,
* 全部播放完成后写入 smc.finish_guides,仅提醒 1 次。
* 已完成的步骤smc.data.tip_done 对应键为 true自动跳过,仅提醒 1 次。
*/
private playButtonGuide() {
// 确保无旧指引残留,再从头开始
this.stopButtonGuide();
this.guideStepIndex = 0;
this.guideStepIndex = -1;
this.nextButtonGuideStep();
}
/** 推进到下一个未完成指引的步骤;全部完成则结束 */
private nextButtonGuideStep() {
this.guideStepIndex++;
// 跳过已完成的步骤
while (this.guideStepIndex < this.guideSteps.length
&& smc.data.tip_done[this.guideSteps[this.guideStepIndex].key]) {
this.guideStepIndex++;
}
if (this.guideStepIndex >= this.guideSteps.length) {
this.finishButtonGuide();
return;
}
this.playButtonGuideStep();
}
@@ -951,22 +965,16 @@ export class MissionCardComp extends CCComp {
}
this.scheduleOnce(() => {
this.stopGuideShake(btn);
this.guideStepIndex++;
if (this.guideStepIndex < this.guideSteps.length) {
this.playButtonGuideStep();
} else {
this.finishButtonGuide();
}
// 本步提醒完成:记录完成标记(即使中止也只标记已播完的步骤)
smc.data.tip_done[step.key] = true;
this.nextButtonGuideStep();
}, MissionCardComp.BUTTON_GUIDE_STEP_DURATION);
}
/** 指引全部完成:还原气泡文案并记录引导完成标记 */
/** 指引全部完成:还原气泡文案 */
private finishButtonGuide() {
this.restoreGuideTipTexts();
this.guideStepIndex = -1;
if (!smc.finish_guides.includes(MissionCardComp.BUTTON_GUIDE_ID)) {
smc.finish_guides.push(MissionCardComp.BUTTON_GUIDE_ID);
}
mLogger.log(this.debugMode, "MissionCardComp", "button guide finished");
}