skip voice tracks when skipping dialogue

This commit is contained in:
2021-12-30 12:03:54 -07:00
parent c568200ca8
commit c9f99e78ce
4 changed files with 16 additions and 5 deletions

View File

@@ -126,13 +126,20 @@
(sound.play)
(unless waitForEnd (cc)))
(var DELAY_BETWEEN_VOICE_TRACKS 0.1)
(prop :Map<FlxSound,Function> restoreOriginalVolumes (new Map))
(method :Void playVoiceTrack [:FlxSound track :Float volumeMod :Float start :Float end :Continuation cc]
(let [originalVolume track.volume
restoreOriginalVolume ->(set track.volume originalVolume)]
(dictSet restoreOriginalVolumes track restoreOriginalVolume)
(*= track.volume volumeMod)
(set track.onComplete ->{(restoreOriginalVolume) (movie.delay 0.1 cc)}))
(set track.onComplete ->{(restoreOriginalVolume) (movie.delay DELAY_BETWEEN_VOICE_TRACKS cc)}))
(track.play true (* 1000 start) (* 1000 end)))
(method :Void stopVoiceTrack [:FlxSound track]
(track.stop)
((dictGet restoreOriginalVolumes track)))
(prop &mut :FlxSound music)
(prop MUSIC_FADE_SEC 1)
(prop MUSIC_FADE_STEPS 10)