Browse Source

Merge branch 'gyt-feature-tianyong' into online

TIANYONG 1 year ago
parent
commit
b25afc2e96

+ 3 - 0
osmd-extended/src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts

@@ -601,6 +601,9 @@ export class VexFlowConverter {
             if (stemDirection && typeof stemDirection?.direction === 'number') {
                 wantedStemDirection = stemDirection.direction
             }
+            // 自定义符杆朝向
+            const DYMusicalOrientation = (window as any).DYMusicalOrientation
+            wantedStemDirection = DYMusicalOrientation !== undefined ? DYMusicalOrientation : wantedStemDirection
             switch (wantedStemDirection) {
                 case(StemDirectionType.Up):
                     vfnote.setStemDirection(VF.Stem.UP);

+ 7 - 0
src/pages/detail/runtime.ts

@@ -532,6 +532,8 @@ export const resetPlayStatus = async (notStop?: boolean) => {
 }
 
 export const play = async () => {
+  // 评测是app播放,非h5播放
+  if (modelType.value === 'evaluation') return
   if (state.isFirstPlay) {
     resetPlayStatus()
     detailState.fixedKey = 0
@@ -880,6 +882,11 @@ export const testPlay = async () => {
   //setTick(setTickStop)
 }
 
+// 有系统节拍器的,评测需要播放系统节拍器
+export const setEvaluatTick = async () => {
+  await setTick(setTickStop)
+}
+
 export const stopTick = () => {
   if (state.tickPlayer) {
     state.tickPlayer.destroy()

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

@@ -548,7 +548,7 @@ const startPlay = () => {
   RuntimeUtils.setPlayState()
 }
 
-const setPlayer = async () => {
+export const setPlayer = async () => {
   // 连接中,禁止重复连接
   if (connentLoading.value) return
   runtime.clickTime = new Date().getTime()
@@ -577,10 +577,12 @@ const setPlayer = async () => {
     runtime.evaluatingStatus = false
     Toast.clear()
   }
-  evaluatStart()
+  if (!detailState.needTick) {
+    evaluatStart()
+  }
 }
 
-const togglePlay = () => {
+const togglePlay = async () => {
   if (detailState.isPauseRecording) {
     evaluating.value = false
     startPlay()
@@ -675,6 +677,9 @@ const endevent = (evt: Event) => {
 
 /**正式开始评测 */
 const evaluatStart = () => {
+  if (detailState.needTick) {
+    setPlayer()
+  }
   playStatus.value = 'play'
   if (detailState.isPauseRecording) {
     postMessage(
@@ -982,8 +987,13 @@ export default defineComponent({
                   'transform': detailState.isSpecialShapedScreen ? `translateX(${detailState.notchHeight / 4}px)`  : '',
                 }}
                 class={[styles.evaluatStartBtn]}
-                onClick={() => {
-                  setPlayer()
+                onClick={async () => {
+                  // 评测模式,如果有系统节拍器,需要先播放系统节拍器
+                  if (detailState.needTick) {
+                    await RuntimeUtils.setEvaluatTick()
+                  } else {
+                    setPlayer()
+                  }
                 }}
               ></div>
             )}

+ 7 - 0
src/subpages/colexiu/uses/use-app.ts

@@ -184,6 +184,13 @@ export const useDetail = (id: number | string): [Ref<ShaeetStatusType>, Ref<Musi
         setGlobalData('multitrack', res.data.background?.length)
       }
       ;(window as any).DYSubjectId = formatId(data.value.code as any)
+      /**
+       * 长笛教程2-5-2,符杆全部朝下
+       * DYMusicalOrientation,0:朝上;1:朝下
+       */
+      if (id == 904) {
+        ;(window as any).DYMusicalOrientation = 1
+      }
       status.value = 'success'
 
       // 额外配置