speech types

This commit is contained in:
2021-10-29 18:39:02 -04:00
parent 0c611fe5a7
commit ee1b5e99bb
4 changed files with 19 additions and 4 deletions

View File

@@ -63,7 +63,9 @@
(var &mut :FlxSprite dialogBox)
(var &mut :FlxText dialog)
(method showDialog [:Character<FlxStagePosition,FlxStageFacing,ActorFlxSprite> character :String text :Continuation cc]
(method showDialog [: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
(unless dialogBox
(set dialogBox (new FlxSprite DIALOG_X DIALOG_Y))

View File

@@ -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 showCharacter(character:Character<StagePosition, StageFacing, Actor>, appearance:Appearance, cc:Continuation):Void;
function waitForInputOrDelay(delaySeconds:Float, cc:Continuation):Void;
function showDialog(character:Character<StagePosition, StageFacing, Actor>, dialog:String, cc:Continuation):Void;
function showDialog(type:SpeechType<StagePosition, StageFacing, Actor>, wryly:String, dialog:String, cc:Continuation):Void;
}

View File

@@ -75,5 +75,10 @@
// TODO moveCharacter remove them, add them to another scene
// TODO moveCharacterAndFollow remove them, add them to another scene, set that the scene
(method doDialog [actorName text cc]
(director.showDialog (dictGet .characters (_currentScene) actorName) text cc))
(method normalSpeech [actorName wryly text cc]
(director.showDialog (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc))
(method onPhoneSpeech [actorName wryly text cc]
(director.showDialog (ifLet [charOnScreen (dictGet .characters (_currentScene) actorName)]
(OnScreen charOnScreen)
(FromPhone (dictGet actors actorName))) wryly text cc))

View File

@@ -19,6 +19,14 @@ typedef Character<StagePosition, StageFacing, Actor> = {
actor:Actor
};
enum SpeechType<StagePosition, StageFacing, Actor> {
OffScreen(actor:Actor);
TextMessage(actor:Actor);
FromPhone(actor:Actor);
OnScreen(character:Character<StagePosition, StageFacing, Actor>);
Custom(type:String, actor:Actor, args:Dynamic);
}
typedef Scene<Set, StagePosition, StageFacing, ScreenPosition, Actor> = {
set:Set,
characters:Map<String, Character<StagePosition, StageFacing, Actor>>,