add actor name to FlxHollywoo dialog box
This commit is contained in:
@@ -61,9 +61,10 @@
|
|||||||
(var DIALOG_SIZE 24)
|
(var DIALOG_SIZE 24)
|
||||||
|
|
||||||
(var &mut :FlxSprite dialogBox)
|
(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 handle text messages, wrylies, off-screen, from-phone, etc. via (case type)
|
||||||
// TODO attribute on-screen dialogue to the character's stageposition
|
// TODO attribute on-screen dialogue to the character's stageposition
|
||||||
// Make a dialog box
|
// Make a dialog box
|
||||||
@@ -73,17 +74,30 @@
|
|||||||
(FlxG.state.add dialogBox))
|
(FlxG.state.add dialogBox))
|
||||||
(dialogBox.revive)
|
(dialogBox.revive)
|
||||||
// show the dialog
|
// show the dialog
|
||||||
(unless dialog
|
(unless dialogText
|
||||||
(set dialog (new FlxText DIALOG_X DIALOG_Y DIALOG_WIDTH "" DIALOG_SIZE))
|
// TODO use FlxTypeText to reveal dialog gradually
|
||||||
(FlxG.state.add dialog))
|
(set dialogText (new FlxText DIALOG_X DIALOG_Y DIALOG_WIDTH "" DIALOG_SIZE))
|
||||||
(set dialog.text text)
|
(FlxG.state.add dialogText))
|
||||||
(dialog.revive)
|
(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
|
// wait for input
|
||||||
// TODO customize the delay to the dialog length or voice-over length
|
// TODO customize the delay to the dialog length or voice-over length
|
||||||
(waitForInputOrDelay 5
|
(waitForInputOrDelay 5
|
||||||
->{
|
->{
|
||||||
(dialog.kill)
|
(dialogText.kill)
|
||||||
|
(speakerNameText.kill)
|
||||||
(dialogBox.kill)
|
(dialogBox.kill)
|
||||||
(cc)
|
(cc)
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ interface Director<Set, StagePosition, StageFacing, ScreenPosition, Actor> {
|
|||||||
function showScene(scene:Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor>, appearance:Appearance, cc:Continuation):Void;
|
function showScene(scene:Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor>, appearance:Appearance, cc:Continuation):Void;
|
||||||
function showCharacter(character:Character<StagePosition, StageFacing, Actor>, appearance:Appearance, cc:Continuation):Void;
|
function showCharacter(character:Character<StagePosition, StageFacing, Actor>, appearance:Appearance, cc:Continuation):Void;
|
||||||
function waitForInputOrDelay(delaySeconds:Float, cc:Continuation):Void;
|
function waitForInputOrDelay(delaySeconds:Float, cc:Continuation):Void;
|
||||||
function showDialog(type:SpeechType<StagePosition, StageFacing, Actor>, wryly:String, dialog:String, cc:Continuation):Void;
|
function showDialog(speakerName:String, type:SpeechType<StagePosition, StageFacing, Actor>, wryly:String, dialog:String, cc:Continuation):Void;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,9 +76,9 @@
|
|||||||
// TODO moveCharacterAndFollow remove them, add them to another scene, set that the scene
|
// TODO moveCharacterAndFollow remove them, add them to another scene, set that the scene
|
||||||
|
|
||||||
(method normalSpeech [actorName wryly text cc]
|
(method normalSpeech [actorName wryly text cc]
|
||||||
(director.showDialog (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc))
|
(director.showDialog actorName (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc))
|
||||||
|
|
||||||
(method onPhoneSpeech [actorName wryly text cc]
|
(method onPhoneSpeech [actorName wryly text cc]
|
||||||
(director.showDialog (ifLet [charOnScreen (dictGet .characters (_currentScene) actorName)]
|
(director.showDialog actorName (ifLet [charOnScreen (dictGet .characters (_currentScene) actorName)]
|
||||||
(OnScreen charOnScreen)
|
(OnScreen charOnScreen)
|
||||||
(FromPhone (dictGet actors actorName))) wryly text cc))
|
(FromPhone (dictGet actors actorName))) wryly text cc))
|
||||||
Reference in New Issue
Block a user