diff --git a/res/style.css b/res/style.css index 645fc7e..a384138 100644 --- a/res/style.css +++ b/res/style.css @@ -55,18 +55,16 @@ menubutton:active { flow.dialogue-container { fill-width: true; - height: 20; + min-height: 20; layout: vertical; } dialogue-box { fill-width: true; - height: 20; - /* background: tile("ui.png", 5, 5); */ - /* background-tile-pos: 1 1; */ background: blue; padding: 10; alpha: 0.9; + min-height: 20; } dialogue-options { diff --git a/res/text/rooms.yarn b/res/text/rooms.yarn index 7885f73..253a346 100644 --- a/res/text/rooms.yarn +++ b/res/text/rooms.yarn @@ -1,16 +1,20 @@ title: Room:quarters --- <> +<> <> <> +<> You: It's the crew quarters. You: Well, it will be. Set-up hasn't started yet. You: That was meant to be one of my first jobs after defrost... You: ...but it doesn't exactly seem like a priority now. +<> +<> You: Maybe there's something useful here? -> Search the lockers (perception) <> <> - < 2>> + < 0>> You: Aha! A small piece of paper with the **hangar access code**. <> <> diff --git a/src/components/DialogueBoxComponent.hx b/src/components/DialogueBoxComponent.hx index ca4b754..8cd1755 100644 --- a/src/components/DialogueBoxComponent.hx +++ b/src/components/DialogueBoxComponent.hx @@ -69,6 +69,12 @@ class DialogueOptionsComponent extends h2d.Flow implements h2d.domkit.Object { ); } } + + override function onRemove() { + for (option in this.options) + option.remove(); + super.onRemove(); + } } @:uiComp("dialogue-box") @@ -116,7 +122,6 @@ class DialogueBoxComponent extends h2d.Flow implements h2d.domkit.Object { function updateText() { if (textPos == internalText.length) { timer.stop(); - // onReady(); // if (chan != null) // chan.stop(); return; @@ -136,6 +141,13 @@ class DialogueBoxComponent extends h2d.Flow implements h2d.domkit.Object { displayedText = internalText.substr(0, textPos); } + override function onRemove() { + super.onRemove(); + // if (chan != null) + // chan.stop(); + // timer.stop(); + } + public dynamic function onClick() { if (textPos == internalText.length) Game.current.globalEventBus.publishEvent(new NextLine()); diff --git a/src/listeners/DialogueBoxController.hx b/src/listeners/DialogueBoxController.hx index 1790cb9..4061cad 100644 --- a/src/listeners/DialogueBoxController.hx +++ b/src/listeners/DialogueBoxController.hx @@ -36,25 +36,18 @@ class DialogueBoxController { eventBus.subscribe(DialogueComplete, onDialogueComplete); } - // override function onRemove() { - // super.onRemove(); - // // if (chan != null) - // // chan.stop(); - // // timer.stop(); - // } - public dynamic function onClick() {} public dynamic function onReady() {} function onLineShown(event:LineShown) { - if (dialogueBox != null) { - dialogueBox.remove(); + if (dialogueBox == null) { + var d = new DialogueBoxComponent(event.line(), this.parent); + style.addObject(d); + dialogueBox = d; + } else { + dialogueBox.internalText = event.line(); } - var d = new DialogueBoxComponent(event.line(), this.parent); - style.addObject(d); - - dialogueBox = d; } function onOptionsShown(event:OptionsShown) { @@ -69,6 +62,6 @@ class DialogueBoxController { dialogueBox.remove(); if (dialogueOptions != null) dialogueOptions.remove(); + dialogueBox = null; } - }