Jelajahi Sumber

fix: 安卓端,评测时间进度问题修复

TIANYONG 9 bulan lalu
induk
melakukan
aba9c2b9f7
2 mengubah file dengan 13 tambahan dan 5 penghapusan
  1. 8 3
      src/pages/detail/runtime.ts
  2. 5 2
      src/subpages/colexiu/buttons/evaluating.tsx

+ 8 - 3
src/pages/detail/runtime.ts

@@ -412,14 +412,18 @@ const dynamicShowPlaySpeed = (index: number) => {
 export const refreshIndex = (ctime?: number) => {
   const { osmd }: any = state
   if (osmd && (ctime || state.audiosInstance.audio)) {
-    const currentTimeNum = ctime || (state.audiosInstance.audio as HTMLAudioElement).currentTime
+    let currentTimeNum = ctime || (state.audiosInstance.audio as HTMLAudioElement).currentTime
+    // 如果是评测状态,当前时间取app返回的进度
+    if (state.evaluatingStatus) {
+      currentTimeNum = ctime ? ctime : 0
+    }
     try {
       metronomeData?.metro?.sound(currentTimeNum);
     } catch (error) {}
 
     const index = getIndex(detailState.times, currentTimeNum)
     // 监听app返回的ctime
-    // console.log(777777777,index,ctime)
+    // console.log(777777777,index,ctime,state.audiosInstance.audio.currentTime)
     dynamicShowPlaySpeed(index);
     state.activeIndex = index
     removeRepateBackground(index)
@@ -516,7 +520,8 @@ export const refreshPlayer = async (ctime?: number) => {
       setSectionModeCurrentTime()
       clearAccelerateRefreshPlayer()
       setTimeout(() => {
-        if (detailState.section.length){
+        // 开启了循环播放
+        if (detailState.section.length && SettingState.sett.loop){
           setPlayState()
         }
       }, 1000)

+ 5 - 2
src/subpages/colexiu/buttons/evaluating.tsx

@@ -829,7 +829,7 @@ const sendResult = (evt?: IPostMessage) => {
             ...startNote,
             ...getLeveByScoreMeasure(data.score),
             score: data.score,
-            dontTransition,
+            dontTransition, // 是否显示得分
           },
         }
       }
@@ -851,11 +851,14 @@ const sendResult = (evt?: IPostMessage) => {
               const currentMeasureNum = time.noteElement.measureNumber;
               const note = getParentNote(item)
               if (!note) continue
+              
               if (note.measureNumberPrinted === currentMeasureNum) {
+                // console.log('得分',item.NoteToGraphicalNoteObjectId,time.NoteToGraphicalNoteObjectId)
                 setEvaluatings(
                   note,
                   data,
-                  item.NoteToGraphicalNoteObjectId !== time.noteElement.tie.StartNote?.NoteToGraphicalNoteObjectId
+                  // item.NoteToGraphicalNoteObjectId !== time.noteElement.tie.StartNote?.NoteToGraphicalNoteObjectId
+                  item.NoteToGraphicalNoteObjectId !== time.NoteToGraphicalNoteObjectId
                 )
               }
             }