From 021aac9914a3a5d2694a4df1b138ac78165d910b Mon Sep 17 00:00:00 2001
From: 3wc <3wc@doesthisthing.work>
Date: Wed, 14 Feb 2024 12:13:29 -0300
Subject: [PATCH] Make dialogue system work (hackily) with domkit
---
src/DialogueBox.hx | 2 +-
src/Game.hx | 124 ++++++++++++++++++++++-----------------------
2 files changed, 63 insertions(+), 63 deletions(-)
diff --git a/src/DialogueBox.hx b/src/DialogueBox.hx
index e00901c..c9299de 100644
--- a/src/DialogueBox.hx
+++ b/src/DialogueBox.hx
@@ -17,7 +17,7 @@ class DialogueBox extends h2d.Object {
if (text == null)
text = "NULL";
game = Game.current;
- game.root.add(this, 1);
+ game.root.scene.getH2dObject().getScene().add(this, 1);
bg = new h2d.ScaleGrid(Res.ui.toTile(), 5, 5, this);
bg.colorKey = 0xFF00FF;
tf = new h2d.Text(game.font, this);
diff --git a/src/Game.hx b/src/Game.hx
index 6ad44ca..5fc5c7a 100644
--- a/src/Game.hx
+++ b/src/Game.hx
@@ -8,9 +8,9 @@ import event.EventBus;
import event.ChangeSceneEvent;
import Const;
-// import DialogueBox;
-// import DialogueManager;
-// import DialogueManager.Option;
+import DialogueBox;
+import DialogueManager;
+import DialogueManager.Option;
@:uiComp("game-container")
class GameContainer extends h2d.Flow implements h2d.domkit.Object {
@@ -69,19 +69,19 @@ class Game extends hxd.App {
setGameScene(new TitleScene(root));
#end
- // font = Res.font.minecraftia_regular_6.toFont();
- // font.resizeTo(24);
- //
- // dialogueManager = new DialogueManager(dialogue, renderActions);
- //
- // var yarnText = [
- // hxd.Res.text.intro.entry.getText(),
- // ];
- // var yarnFileNames = [
- // hxd.Res.text.intro.entry.name,
- // ];
- // dialogueManager.load(yarnText, yarnFileNames);
- // dialogueManager.runNode("Intro");
+ font = Res.font.minecraftia_regular_6.toFont();
+ font.resizeTo(24);
+
+ dialogueManager = new DialogueManager(dialogue, renderActions);
+
+ var yarnText = [
+ hxd.Res.text.intro.entry.getText(),
+ ];
+ var yarnFileNames = [
+ hxd.Res.text.intro.entry.name,
+ ];
+ dialogueManager.load(yarnText, yarnFileNames);
+ dialogueManager.runNode("Intro");
}
public function new() {
@@ -98,52 +98,52 @@ class Game extends hxd.App {
style.sync();
}
- // function dialogue(manager:DialogueManager, t:String) {
- // var d = new DialogueBox(Const.W, 100, t);
- // d.y = 0;
- // d.onClick = function() {
- // manager.resume();
- // };
- //
- // curDialogue = d;
- // }
- //
- // function renderActions(manager:DialogueManager, t:Array