add actor name to FlxHollywoo dialog box
This commit is contained in:
@@ -61,9 +61,10 @@
|
||||
(var DIALOG_SIZE 24)
|
||||
|
||||
(var &mut :FlxSprite dialogBox)
|
||||
(var &mut :FlxText dialog)
|
||||
(var &mut :FlxText dialogText)
|
||||
(var &mut :FlxText speakerNameText)
|
||||
|
||||
(method showDialog [:SpeechType<FlxStagePosition,FlxStageFacing,ActorFlxSprite> type :String wryly :String text :Continuation cc]
|
||||
(method showDialog [:String speakerName :SpeechType<FlxStagePosition,FlxStageFacing,ActorFlxSprite> type :String wryly :String text :Continuation cc]
|
||||
// TODO handle text messages, wrylies, off-screen, from-phone, etc. via (case type)
|
||||
// TODO attribute on-screen dialogue to the character's stageposition
|
||||
// Make a dialog box
|
||||
@@ -73,17 +74,30 @@
|
||||
(FlxG.state.add dialogBox))
|
||||
(dialogBox.revive)
|
||||
// show the dialog
|
||||
(unless dialog
|
||||
(set dialog (new FlxText DIALOG_X DIALOG_Y DIALOG_WIDTH "" DIALOG_SIZE))
|
||||
(FlxG.state.add dialog))
|
||||
(set dialog.text text)
|
||||
(dialog.revive)
|
||||
(unless dialogText
|
||||
// TODO use FlxTypeText to reveal dialog gradually
|
||||
(set dialogText (new FlxText DIALOG_X DIALOG_Y DIALOG_WIDTH "" DIALOG_SIZE))
|
||||
(FlxG.state.add dialogText))
|
||||
(set dialogText.text text)
|
||||
// show the speaker name
|
||||
(unless speakerNameText
|
||||
(set speakerNameText (new FlxText DIALOG_X DIALOG_Y DIALOG_WIDTH "" DIALOG_SIZE))
|
||||
(FlxG.state.add speakerNameText))
|
||||
(if speakerName
|
||||
{
|
||||
(set speakerNameText.text "${speakerName}:")
|
||||
(speakerNameText.revive)
|
||||
(set dialogText.y (+ DIALOG_Y speakerNameText.height))
|
||||
}
|
||||
(set dialogText.y DIALOG_Y))
|
||||
(dialogText.revive)
|
||||
|
||||
// wait for input
|
||||
// TODO customize the delay to the dialog length or voice-over length
|
||||
(waitForInputOrDelay 5
|
||||
->{
|
||||
(dialog.kill)
|
||||
(dialogText.kill)
|
||||
(speakerNameText.kill)
|
||||
(dialogBox.kill)
|
||||
(cc)
|
||||
}))
|
||||
|
Reference in New Issue
Block a user