refactor(map): 重构地图动画播放逻辑,修复速度残留问题

1. 给playAnimations方法新增speed参数,支持自定义播放倍率
2. 移除硬编码的4倍速,改用可配置的常量
3. 调用处传入明确speed值,避免上一次加速状态残留
4. 补充方法注释说明参数含义和设计原因
This commit is contained in:
panFD
2026-09-13 11:53:11 +08:00
parent be6af4d157
commit a2f80e45b5
2 changed files with 15 additions and 7 deletions

View File

@@ -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);