@@ -8,16 +8,17 @@ import { generateTimelineObj } from '@/Core/controller/stage/pixi/animations/tim
88import cloneDeep from 'lodash/cloneDeep' ;
99import { baseTransform } from '@/store/stageInterface' ;
1010import { IUserAnimation } from '../Modules/animations' ;
11- import { getAnimateDuration , getAnimationObject } from '@/Core/Modules/animationFunctions' ;
11+ import { getAnimateDurationFromObj , getAnimationObject } from '@/Core/Modules/animationFunctions' ;
1212import { WebGAL } from '@/Core/WebGAL' ;
13+ import { v4 as uuid } from 'uuid' ;
1314
1415/**
1516 * 设置临时动画
1617 * @param sentence
1718 */
1819export const setTempAnimation = ( sentence : ISentence ) : IPerform => {
1920 const startDialogKey = webgalStore . getState ( ) . stage . currentDialogKey ;
20- const animationName = ( Math . random ( ) * 10 ) . toString ( 16 ) ;
21+ const animationName = uuid ( ) ;
2122 const animationString = sentence . content ;
2223 let animationObj ;
2324 try {
@@ -27,15 +28,16 @@ export const setTempAnimation = (sentence: ISentence): IPerform => {
2728 }
2829 const newAnimation : IUserAnimation = { name : animationName , effects : animationObj } ;
2930 WebGAL . animationManager . addAnimation ( newAnimation ) ;
30- const animationDuration = getAnimateDuration ( animationName ) ;
31+ const animationDuration = getAnimateDurationFromObj ( newAnimation ) ;
3132 const target = getStringArgByKey ( sentence , 'target' ) ?? '0' ;
3233 const writeDefault = getBooleanArgByKey ( sentence , 'writeDefault' ) ?? false ;
3334 const keep = getBooleanArgByKey ( sentence , 'keep' ) ?? false ;
35+ const parallel = getBooleanArgByKey ( sentence , 'parallel' ) ?? false ;
3436
3537 const key = `${ target } -${ animationName } -${ animationDuration } ` ;
3638 const performInitName = `animation-${ target } ` ;
3739
38- WebGAL . gameplay . performController . unmountPerform ( performInitName , true ) ;
40+ if ( ! parallel ) WebGAL . gameplay . performController . unmountPerform ( performInitName , true ) ;
3941
4042 let stopFunction = ( ) => { } ;
4143 setTimeout ( ( ) => {
@@ -67,5 +69,6 @@ export const setTempAnimation = (sentence: ISentence): IPerform => {
6769 blockingNext : ( ) => false ,
6870 blockingAuto : ( ) => ! keep ,
6971 stopTimeout : undefined , // 暂时不用,后面会交给自动清除
72+ isParallel : parallel ,
7073 } ;
7174} ;
0 commit comments