File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
packages/webgal/src/Core/gameScripts Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { IPerform } from '@/Core/Modules/perform/performInterface';
66import { useSelector } from 'react-redux' ;
77import { WebGAL } from '@/Core/WebGAL' ;
88import { WEBGAL_NONE } from '@/Core/constants' ;
9+ import { end } from './end' ;
910
1011/**
1112 * 播放一段效果音
@@ -91,7 +92,7 @@ export const playEffect = (sentence: ISentence): IPerform => {
9192 } ;
9293 resolve ( perform ) ;
9394 seElement ?. play ( ) ;
94- seElement . onended = ( ) => {
95+ const endFunc = ( ) => {
9596 for ( const e of WebGAL . gameplay . performController . performList ) {
9697 if ( e . performName === performInitName ) {
9798 isOver = true ;
@@ -100,10 +101,11 @@ export const playEffect = (sentence: ISentence): IPerform => {
100101 }
101102 }
102103 } ;
104+ seElement . onended = endFunc ;
103105 seElement . addEventListener ( 'error' , ( e ) => {
104106 logger . error ( `播放效果音失败: ${ url } ` ) ;
105107 // 播放失败提前结束
106- seElement . onended ?. ( e ) ;
108+ endFunc ( ) ;
107109 } ) ;
108110 } , 1 ) ;
109111 } ) ,
You can’t perform that action at this time.
0 commit comments