AWAITPLAYSOUNDS
This commit is contained in:
@@ -838,16 +838,16 @@
|
|||||||
.camera (dictGet scenes name)
|
.camera (dictGet scenes name)
|
||||||
cc)))))))
|
cc)))))))
|
||||||
|
|
||||||
(hollywooMethod playSound [:Bool skipping :String name :Continuation cc &opt :Float volumeMod :Bool waitForEnd]
|
(hollywooMethod playSound [:Bool skipping :String name :Continuation cc &opt :Float volumeMod :Bool waitForEnd :Bool dontWaitForInput]
|
||||||
(when skipping
|
|
||||||
(cc)
|
|
||||||
(return))
|
|
||||||
(set volumeMod (or volumeMod 1))
|
(set volumeMod (or volumeMod 1))
|
||||||
(assert (<= 0 volumeMod 1))
|
(assert (<= 0 volumeMod 1))
|
||||||
(let [name (FuzzyMapTools.bestMatch sounds name)]
|
(let [name (FuzzyMapTools.bestMatch sounds name)]
|
||||||
(localVar looping ?(dictGet loopingSoundPlays name))
|
(localVar looping ?(dictGet loopingSoundPlays name))
|
||||||
(whenLet [desc (dictGet soundDescriptions name)]
|
(whenLet [desc (dictGet soundDescriptions name)]
|
||||||
(dialogHistory.push (Sound desc)))
|
(dialogHistory.push (Sound desc)))
|
||||||
|
(when skipping
|
||||||
|
(cc)
|
||||||
|
(return))
|
||||||
(unless looping
|
(unless looping
|
||||||
(handleCaption skipping name))
|
(handleCaption skipping name))
|
||||||
(let [sound (dictGet sounds name)]
|
(let [sound (dictGet sounds name)]
|
||||||
@@ -856,11 +856,13 @@
|
|||||||
(:Void innerCC []
|
(:Void innerCC []
|
||||||
(unless looping
|
(unless looping
|
||||||
(director.stopSound sound)
|
(director.stopSound sound)
|
||||||
(director.stopWaitForInput innerCC))
|
(unless dontWaitForInput
|
||||||
|
(director.stopWaitForInput innerCC)))
|
||||||
(cc))
|
(cc))
|
||||||
]
|
]
|
||||||
(unless looping
|
(unless (or looping dontWaitForInput)
|
||||||
(when waitForEnd (director.startWaitForInput innerCC)))
|
(when waitForEnd
|
||||||
|
(director.startWaitForInput innerCC)))
|
||||||
(director.playSound sound volumeMod (when waitForEnd innerCC))))
|
(director.playSound sound volumeMod (when waitForEnd innerCC))))
|
||||||
(unless waitForEnd
|
(unless waitForEnd
|
||||||
(cc))))
|
(cc))))
|
||||||
@@ -868,6 +870,28 @@
|
|||||||
(hollywooMethod awaitPlaySound [:Bool skipping :String name :Continuation cc &opt :Float volumeMod]
|
(hollywooMethod awaitPlaySound [:Bool skipping :String name :Continuation cc &opt :Float volumeMod]
|
||||||
(playSound skipping name cc volumeMod true))
|
(playSound skipping name cc volumeMod true))
|
||||||
|
|
||||||
|
(hollywooMethod awaitPlaySounds [:Bool skipping :Array<String> names :Continuation cc &opt :Float volumeMod]
|
||||||
|
(let [names (names.copy)]
|
||||||
|
(localVar &mut currentSound "")
|
||||||
|
(localVar endCC
|
||||||
|
(makeCC
|
||||||
|
(whileLet [soundKey (names.shift)]
|
||||||
|
// This just adds the sounds to the history:
|
||||||
|
(playSound true soundKey (makeCC null) volumeMod false true))
|
||||||
|
(when currentSound
|
||||||
|
(stopSound skipping currentSound cc))
|
||||||
|
(cc)))
|
||||||
|
(when skipping
|
||||||
|
(endCC)
|
||||||
|
(return))
|
||||||
|
(director.startWaitForInput endCC)
|
||||||
|
(_ccForEach names
|
||||||
|
->[name cc]
|
||||||
|
{
|
||||||
|
(set currentSound name)
|
||||||
|
(playSound skipping name cc volumeMod true true)
|
||||||
|
}
|
||||||
|
endCC)))
|
||||||
|
|
||||||
(hollywooMethod stopSound [:Bool skipping :String name :Continuation cc]
|
(hollywooMethod stopSound [:Bool skipping :String name :Continuation cc]
|
||||||
(let [name (FuzzyMapTools.bestMatch sounds name)]
|
(let [name (FuzzyMapTools.bestMatch sounds name)]
|
||||||
|
Reference in New Issue
Block a user