skip voice tracks when skipping dialogue
This commit is contained in:
@@ -15,6 +15,7 @@ import flixel.util.FlxColor;
|
||||
import flixel.text.FlxText;
|
||||
import flixel.system.FlxSound;
|
||||
import flixel.util.FlxTimer;
|
||||
import haxe.Constraints;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class FlxDirector implements Director<String, FlxStagePosition, FlxStageFacing, FlxScreenPosition, ActorFlxSprite, FlxSound, String, FlxSprite, FlxSound> {}
|
||||
|
@@ -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)
|
||||
|
@@ -17,6 +17,7 @@ interface Director<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound
|
||||
function playSound(sound:Sound, volumeMod:Float, waitForEnd:Bool, cc:Continuation):Void;
|
||||
function playSong(song:Song, volumeMod:Float, loop:Bool, waitForEnd:Bool, cc:Continuation):Void;
|
||||
function playVoiceTrack(track:VoiceTrack, volumeMod:Float, start:Float, end:Float, cc:Continuation):Void;
|
||||
function stopVoiceTrack(track:VoiceTrack):Void;
|
||||
function stopSong():Void;
|
||||
function startWaitForInput(cc:Continuation):Void;
|
||||
function stopWaitForInput():Void;
|
||||
|
@@ -41,15 +41,17 @@
|
||||
(whenLet [sceneForActor (dictGet intercutMap actorName)]
|
||||
(setScene sceneForActor ->{})))
|
||||
|
||||
(let [cc ->:Void {(director.hideDialog) (cc)}]
|
||||
(director.showDialog actorName dialogType wryly text cc)
|
||||
(let [cc ->:Void {(director.hideDialog) (cc)}
|
||||
&mut skipCC cc]
|
||||
// When an actorName is given, check for a voiced line to play.
|
||||
// Otherwise, assume it is un-voiced super text
|
||||
(when (and actorName (< 0 (count voiceTracks)))
|
||||
(case (try (dictGet voiceLines "$actorName $text") (catch [e] (print e) null))
|
||||
((objectWith trackKey start end)
|
||||
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc))
|
||||
(otherwise)))))
|
||||
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc)
|
||||
(set skipCC ->:Void {(director.stopVoiceTrack (dictGet voiceTracks trackKey)) (cc)}))
|
||||
(otherwise)))
|
||||
(director.showDialog actorName dialogType wryly text skipCC)))
|
||||
|
||||
(method newVoiceTrack [actorName :VoiceTrack track :String lineJson]
|
||||
(let [actorNumVoiceTracks (or (dictGet voiceTracksPerActor actorName) 0)
|
||||
|
Reference in New Issue
Block a user