| | |
| | | |
| | | // 新建方案中的实时模拟不能倍速 |
| | | if (selectedScheme.value.type === 2 && simStore.rePlayList.length == 0) { |
| | | // 类型为 2:每 5 秒跳动一次 |
| | | console.log("新建方案实时模拟五秒一跳"); |
| | | // 实时模拟:每 5 秒跳动一次 |
| | | playInterval = setInterval(() => { |
| | | const fiveSeconds = 5; |
| | | const totalDuration = duration.value; // 总时长(秒) |
| | |
| | | currentTime.value = duration.value; |
| | | stopPlayback(); |
| | | isPlaying.value = false; |
| | | finishPlay.value = true; |
| | | emit("isPlaying", false); |
| | | emit("playbackFinished", true); |
| | | return; |
| | |
| | | } |
| | | |
| | | const progress = currentTime.value / duration.value; |
| | | emit("timeUpdate", progress * 100); |
| | | // if ( |
| | | // currentReplayIndex.value == simStore.rePlayList.length - 1 && |
| | | // selectedScheme.value.type === 2 && |
| | | // simStore.rePlayList.length > 0 |
| | | // ) { |
| | | // // 历史回放直接给100 |
| | | // emit("timeUpdate", 100); |
| | | // } |
| | | if (selectedScheme.value.type !== 2) { |
| | | emit("timeUpdate", progress * 100); |
| | | } |
| | | }, 1000 / playbackRate.value); |
| | | } |
| | | }; |
| | |
| | | // 打印信息 |
| | | // console.log("========================================"); |
| | | // console.log(`【时间戳】: ${new Date(currentTimeMs).toLocaleString()}`); |
| | | console.log(`【累计降雨量 R】: ${currentTotal !== null ? currentTotal.toFixed(2) : '未知'} mm`); |
| | | console.log( |
| | | `【累计降雨量 R】: ${ |
| | | currentTotal !== null ? currentTotal.toFixed(2) : "未知" |
| | | } mm` |
| | | ); |
| | | // console.log(`【当前阶段】: 第 ${currentStage} 阶段`); |
| | | console.log(`【颜色 HEX】: ${colorState.colorStages[currentStage]?.color || '未定义'}`); |
| | | console.log( |
| | | `【颜色 HEX】: ${colorState.colorStages[currentStage]?.color || "未定义"}` |
| | | ); |
| | | // console.log(`【透明度 Alpha】: ${colorState.colorStages[currentStage]?.alpha || '未定义'}`); |
| | | // console.log("========================================"); |
| | | // 应用颜色 |
| | |
| | | }); |
| | | } |
| | | } |
| | | |
| | | // 播放完成后的回调 |
| | | function handlePlayFinished() { |
| | | if (selectedScheme.value.type !== 2) return; |
| | |
| | | currentReplayIndex.value++; |
| | | |
| | | if (currentReplayIndex.value < simStore.rePlayList.length) { |
| | | console.log(currentReplayIndex.value); |
| | | |
| | | // 自动播放下一个 |
| | | initializeSimulationData(simStore.rePlayList[currentReplayIndex.value]); |
| | | togglePlay(); |
| | |
| | | } |
| | | |
| | | async function endSimulation() { |
| | | // 结束模拟之后清除layer列表 |
| | | simStore.rePlayList = []; |
| | | console.log(simStore.rePlayList, "结束模拟清除rePlayListrePlayList列表"); |
| | | EventBus.emit("close-time"); |
| | | endSimulate(); |
| | | isWaterPrimitiveCreated.value = false; |