diff --git a/assets/script/game/map/MissionComp.ts b/assets/script/game/map/MissionComp.ts index 56f9a0d1..43535ea1 100644 --- a/assets/script/game/map/MissionComp.ts +++ b/assets/script/game/map/MissionComp.ts @@ -49,6 +49,9 @@ import { } from "../common/config/StageSet"; const { ccclass, property } = _decorator; +/** 节间过场背景滚动速度倍率(强化推进感);大厅/常态滚动为 1x */ +const MapLayerScrollSpeed = 4; + /** 任务(关卡)生命周期阶段 */ export enum MissionPhase { None = 0, // 未初始化 @@ -226,8 +229,8 @@ export class MissionComp extends CCComp { onDestroy() { // 解除节间过场移动动画锁,避免泄漏到下一关 MoveSystem.transitionMoveLock = false; - // 退出关卡时恢复地图背景动画 - smc.map.MapView.scene.mapLayer.playAnimations() + // 退出关卡时恢复地图背景动画(显式 1x,清除节间过场 4x 残留) + smc.map.MapView.scene.mapLayer.playAnimations(undefined, 1) super.onDestroy(); if (this.start_btn && this.start_btn.isValid) { this.start_btn.off(NodeEventType.TOUCH_END, this.onStartFightBtnClick, this); @@ -1083,8 +1086,8 @@ export class MissionComp extends CCComp { private beginSectionTransition() { smc.mission.in_fight = false; smc.vmdata.mission_data.in_fight = false; - // 恢复地图背景滚动(与英雄归位同步启动,2 倍速表现推进) - smc.map?.MapView?.scene?.mapLayer?.playAnimations(); + // 恢复地图背景滚动(与英雄归位同步启动,4 倍速表现推进) + smc.map?.MapView?.scene?.mapLayer?.playAnimations(undefined, MapLayerScrollSpeed); // 过场期间英雄保持移动动画:即使已归位也持续行军,地图停才回待机 MoveSystem.transitionMoveLock = true; this.changePhase(MissionPhase.BattleEnd); diff --git a/assets/script/game/map/view/map/layer/MapLayer.ts b/assets/script/game/map/view/map/layer/MapLayer.ts index 37d481d0..0d2b7f3f 100644 --- a/assets/script/game/map/view/map/layer/MapLayer.ts +++ b/assets/script/game/map/view/map/layer/MapLayer.ts @@ -89,14 +89,19 @@ export default class MapLayer extends Component { /** 背景滚动播放速度倍率(节间过场加快推进感) */ private static readonly SCROLL_SPEED = 4; - public playAnimations(name?: string): void { + /** + * 播放背景滚动动画。 + * @param name 动画名(缺省播 defaultClip) + * @param speed 播放速度倍率:大厅/常态=1,节间过场=SCROLL_SPEED。 + * 每次 play 都显式覆盖 state.speed,避免上一次 4x 加速残留泄漏到大厅。 + */ + public playAnimations(name?: string, speed: number = 1): void { this.animations.forEach(a => { a.play(name); - // 加快背景滚动速度,强化节间"向前推进"的观感(AnimationState.speed 属性) const clip = a.defaultClip; if (clip) { const state = a.getState(clip.name); - if (state) state.speed = MapLayer.SCROLL_SPEED; + if (state) state.speed = speed; } }); }