|
|
@@ -282,6 +282,9 @@ export class GameBlockSelection extends Component {
|
|
|
// 引导期禁用颜色置灰(HEX: 4D4545)
|
|
|
private readonly GUIDE_DISABLED_COLOR: Color = new Color(0x4D, 0x45, 0x45, 255);
|
|
|
|
|
|
+ // 引导阶段确认按钮交互覆盖:true 启用;false 禁用;null 不覆盖
|
|
|
+ private guideConfirmEnabledOverride: boolean | null = null;
|
|
|
+
|
|
|
onEnable() {
|
|
|
// 如果还未初始化,则进行初始化
|
|
|
if (!this.isInitialized) {
|
|
|
@@ -400,6 +403,10 @@ export class GameBlockSelection extends Component {
|
|
|
eventBus.on(GameEvents.ENEMY_START_WAVE, this.updateGuideButtonStates, this);
|
|
|
// 监听:全局强制结束所有拖拽(用于教程自动放置期间收敛拖拽状态)
|
|
|
eventBus.on(GameEvents.FORCE_END_ALL_DRAGS, this.onForceEndAllDrags, this);
|
|
|
+
|
|
|
+ // 监听:新手引导确认按钮覆盖事件
|
|
|
+ eventBus.on(GameEvents.GUIDE_SET_CONFIRM_ENABLED, this.onGuideSetConfirmEnabledEvent, this);
|
|
|
+ eventBus.on(GameEvents.GUIDE_CLEAR_CONFIRM_OVERRIDE, this.onGuideClearConfirmOverrideEvent, this);
|
|
|
}
|
|
|
|
|
|
// 处理重置方块选择事件
|
|
|
@@ -408,6 +415,7 @@ export class GameBlockSelection extends Component {
|
|
|
// 恢复按钮颜色与交互状态,并清理颜色缓存,避免跨关卡残留
|
|
|
this.applyGuideDisabledVisual(this.addCoinButton, false);
|
|
|
this.applyGuideDisabledVisual(this.refreshButton, false);
|
|
|
+ this.applyGuideDisabledVisual(this.confirmButton, false);
|
|
|
this.originalButtonColors.clear();
|
|
|
}
|
|
|
|
|
|
@@ -416,6 +424,7 @@ export class GameBlockSelection extends Component {
|
|
|
// 恢复按钮颜色与交互状态,并清理颜色缓存,避免跨关卡残留
|
|
|
this.applyGuideDisabledVisual(this.addCoinButton, false);
|
|
|
this.applyGuideDisabledVisual(this.refreshButton, false);
|
|
|
+ this.applyGuideDisabledVisual(this.confirmButton, false);
|
|
|
this.originalButtonColors.clear();
|
|
|
}
|
|
|
// 处理游戏开始事件
|
|
|
@@ -679,6 +688,12 @@ export class GameBlockSelection extends Component {
|
|
|
|
|
|
// 确认按钮点击
|
|
|
public onConfirmButtonClicked() {
|
|
|
+ // 引导阶段需要禁用时直接拦截点击
|
|
|
+ const restrictGuide = this.isGuideRestrictActive();
|
|
|
+ if (this.guideConfirmEnabledOverride === false || (restrictGuide && this.guideConfirmEnabledOverride !== true)) {
|
|
|
+ this.applyGuideDisabledVisual(this.confirmButton, true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
// 检查是否有上阵方块
|
|
|
const hasBlocks = this.hasPlacedBlocks();
|
|
|
if (!hasBlocks) {
|
|
|
@@ -846,8 +861,30 @@ export class GameBlockSelection extends Component {
|
|
|
const restrict = this.isGuideRestrictActive();
|
|
|
this.applyGuideDisabledVisual(this.addCoinButton, restrict);
|
|
|
this.applyGuideDisabledVisual(this.refreshButton, restrict);
|
|
|
+ // 同步确认按钮禁用(允许由引导覆盖)
|
|
|
+ let confirmDisabled = restrict;
|
|
|
+ if (this.guideConfirmEnabledOverride !== null) {
|
|
|
+ confirmDisabled = !this.guideConfirmEnabledOverride;
|
|
|
+ }
|
|
|
+ this.applyGuideDisabledVisual(this.confirmButton, confirmDisabled);
|
|
|
};
|
|
|
|
|
|
+ // 引导:设置确认按钮启用/禁用覆盖
|
|
|
+ private onGuideSetConfirmEnabledEvent(enabled: boolean) {
|
|
|
+ if (typeof enabled === 'boolean') {
|
|
|
+ this.guideConfirmEnabledOverride = enabled;
|
|
|
+ } else {
|
|
|
+ this.guideConfirmEnabledOverride = null;
|
|
|
+ }
|
|
|
+ this.updateGuideButtonStates();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 引导:清除确认按钮覆盖
|
|
|
+ private onGuideClearConfirmOverrideEvent() {
|
|
|
+ this.guideConfirmEnabledOverride = null;
|
|
|
+ this.updateGuideButtonStates();
|
|
|
+ }
|
|
|
+
|
|
|
// 显示金币不足UI
|
|
|
private showInsufficientCoinsUI() {
|
|
|
// 使用事件机制显示资源不足Toast
|