File tree Expand file tree Collapse file tree 5 files changed +28
-4
lines changed Expand file tree Collapse file tree 5 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import cloneDeep from 'lodash/cloneDeep';
5
5
import { resetStageState , stageActions } from '@/store/stageReducer' ;
6
6
import { nextSentence } from '@/Core/controller/gamePlay/nextSentence' ;
7
7
import { IRunPerform } from '@/store/stageInterface' ;
8
+ import { WEBGAL_NONE } from '@/Core/constants' ;
8
9
9
10
/**
10
11
* 获取随机演出名称
@@ -34,7 +35,7 @@ export class PerformController {
34
35
}
35
36
36
37
// 语句不执行演出
37
- if ( perform . performName === 'none' ) {
38
+ if ( perform . performName === WEBGAL_NONE ) {
38
39
return ;
39
40
}
40
41
// 同步演出状态
Original file line number Diff line number Diff line change @@ -4,3 +4,5 @@ export const STAGE_KEYS = {
4
4
FIG_L : 'fig-left' ,
5
5
FIG_R : 'fig-right' ,
6
6
} ;
7
+
8
+ export const WEBGAL_NONE = 'none' ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { sceneFetcher } from '../scene/sceneFetcher';
3
3
import { sceneParser } from '../../parser/sceneParser' ;
4
4
import { IStageState } from '@/store/stageInterface' ;
5
5
import { webgalStore } from '@/store/store' ;
6
- import { resetStageState } from '@/store/stageReducer' ;
6
+ import { resetStageState , stageActions } from '@/store/stageReducer' ;
7
7
import { setVisibility } from '@/store/GUIReducer' ;
8
8
import { runScript } from '@/Core/controller/gamePlay/runScript' ;
9
9
import { stopAllPerform } from '@/Core/controller/gamePlay/stopAllPerform' ;
@@ -18,7 +18,10 @@ import { WebGAL } from '@/Core/WebGAL';
18
18
*/
19
19
export const restorePerform = ( ) => {
20
20
const stageState = webgalStore . getState ( ) . stage ;
21
- stageState . PerformList . forEach ( ( e ) => {
21
+ const performToRestore = cloneDeep ( stageState . PerformList ) ;
22
+ // 清除状态表中演出序列
23
+ webgalStore . dispatch ( stageActions . removeAllPerform ( ) ) ;
24
+ performToRestore . forEach ( ( e ) => {
22
25
runScript ( e . script ) ;
23
26
} ) ;
24
27
} ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { getSentenceArgByKey } from '@/Core/util/getSentenceArg';
5
5
import { IPerform } from '@/Core/Modules/perform/performInterface' ;
6
6
import { useSelector } from 'react-redux' ;
7
7
import { WebGAL } from '@/Core/WebGAL' ;
8
+ import { WEBGAL_NONE } from '@/Core/constants' ;
8
9
9
10
/**
10
11
* 播放一段效果音
@@ -27,6 +28,21 @@ export const playEffect = (sentence: ISentence): IPerform => {
27
28
isLoop = true ;
28
29
}
29
30
let isOver = false ;
31
+ if ( ! url || url === WEBGAL_NONE ) {
32
+ return {
33
+ performName : WEBGAL_NONE ,
34
+ duration : 0 ,
35
+ isHoldOn : false ,
36
+ blockingAuto ( ) : boolean {
37
+ return false ;
38
+ } ,
39
+ blockingNext ( ) : boolean {
40
+ return false ;
41
+ } ,
42
+ stopFunction ( ) : void { } ,
43
+ stopTimeout : undefined ,
44
+ } ;
45
+ }
30
46
return {
31
47
performName : 'none' ,
32
48
blockingAuto ( ) : boolean {
Original file line number Diff line number Diff line change @@ -148,6 +148,9 @@ const stageSlice = createSlice({
148
148
}
149
149
}
150
150
} ,
151
+ removeAllPerform : ( state ) => {
152
+ state . PerformList . splice ( 0 , state . PerformList . length ) ;
153
+ } ,
151
154
removeAllPixiPerforms : ( state , action : PayloadAction < undefined > ) => {
152
155
for ( let i = 0 ; i < state . PerformList . length ; i ++ ) {
153
156
const performItem : IRunPerform = state . PerformList [ i ] ;
@@ -218,7 +221,6 @@ const stageSlice = createSlice({
218
221
if ( action . payload [ 3 ] ) {
219
222
if ( state . figureMetaData [ action . payload [ 0 ] ] ) delete state . figureMetaData [ action . payload [ 0 ] ] ;
220
223
} else {
221
- console . log ( 'yeah' ) ;
222
224
// 初始化对象
223
225
if ( ! state . figureMetaData [ action . payload [ 0 ] ] ) {
224
226
state . figureMetaData [ action . payload [ 0 ] ] = { } ;
You can’t perform that action at this time.
0 commit comments