File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export interface IAnimationObject {
1717 setEndState : Function ;
1818 tickerFunc : PIXI . TickerCallback < number > ;
1919 getEndStateEffect ?: Function ;
20+ forceStopWithoutSetEndState ?: Function ;
2021}
2122
2223interface IStageAnimationObject {
@@ -267,6 +268,19 @@ export default class PixiStage {
267268 }
268269 }
269270
271+ public removeAnimationWithoutSetEndState ( key : string ) {
272+ const index = this . stageAnimations . findIndex ( ( e ) => e . key === key ) ;
273+ if ( index >= 0 ) {
274+ const thisTickerFunc = this . stageAnimations [ index ] ;
275+ this . currentApp ?. ticker . remove ( thisTickerFunc . animationObject . tickerFunc ) ;
276+ if ( thisTickerFunc . animationObject . forceStopWithoutSetEndState ) {
277+ thisTickerFunc . animationObject . forceStopWithoutSetEndState ( ) ;
278+ }
279+ this . unlockStageObject ( thisTickerFunc . targetKey ?? 'default' ) ;
280+ this . stageAnimations . splice ( index , 1 ) ;
281+ }
282+ }
283+
270284 public removeAllAnimations ( ) {
271285 while ( this . stageAnimations . length > 0 ) {
272286 this . removeAnimationByIndex ( 0 ) ;
Original file line number Diff line number Diff line change @@ -129,11 +129,17 @@ export function generateTimelineObj(
129129 return timeline [ timeline . length - 1 ] ;
130130 }
131131
132+ function forceStopWithoutSetEndState ( ) {
133+ if ( animateInstance ) animateInstance . stop ( ) ;
134+ animateInstance = null ;
135+ }
136+
132137 return {
133138 setStartState,
134139 setEndState,
135140 tickerFunc,
136141 getEndStateEffect,
142+ forceStopWithoutSetEndState,
137143 } ;
138144}
139145
Original file line number Diff line number Diff line change @@ -46,8 +46,11 @@ export const setTransform = (sentence: ISentence): IPerform => {
4646 const animationDuration = getAnimateDuration ( animationName ) ;
4747
4848 const key = `${ target } -${ animationName } -${ animationDuration } ` ;
49- let stopFunction = ( ) => { } ;
49+ let keepAnimationStopped = false ;
5050 setTimeout ( ( ) => {
51+ if ( keep && keepAnimationStopped ) {
52+ return ;
53+ }
5154 WebGAL . gameplay . pixiStage ?. stopPresetAnimationOnTarget ( target ) ;
5255 const animationObj : IAnimationObject | null = getAnimationObject (
5356 animationName ,
@@ -60,10 +63,13 @@ export const setTransform = (sentence: ISentence): IPerform => {
6063 WebGAL . gameplay . pixiStage ?. registerAnimation ( animationObj , key , target ) ;
6164 }
6265 } , 0 ) ;
63- stopFunction = ( ) => {
66+ const stopFunction = ( ) => {
67+ if ( keep ) {
68+ WebGAL . gameplay . pixiStage ?. removeAnimationWithoutSetEndState ( key ) ;
69+ keepAnimationStopped = true ;
70+ return ;
71+ }
6472 setTimeout ( ( ) => {
65- const endDialogKey = webgalStore . getState ( ) . stage . currentDialogKey ;
66- const isHasNext = startDialogKey !== endDialogKey ;
6773 WebGAL . gameplay . pixiStage ?. removeAnimationWithSetEffects ( key ) ;
6874 } , 0 ) ;
6975 } ;
You can’t perform that action at this time.
0 commit comments