From 83b821135cbb64ca50d4e8e031ade3c6bb3596c3 Mon Sep 17 00:00:00 2001 From: adam Date: Wed, 11 May 2022 21:31:17 +0200 Subject: [PATCH 1/5] feat: dialogue popup implemented --- assets/close-button.png | Bin 0 -> 2861 bytes assets/left-arrow.png | Bin 0 -> 9350 bytes assets/npc-frame.png | Bin 0 -> 3070 bytes assets/right-arrow.png | Bin 0 -> 3341 bytes .../java/io/rpg/controller/Controller.java | 4 + .../io/rpg/controller/PopupController.java | 13 +++ .../io/rpg/view/popups/DialoguePopup.java | 81 +++++++++++++++++ .../rpg/viewmodel/DialoguePopupViewModel.java | 84 ++++++++++++++++++ .../io/rpg/viewmodel/dialogue-popup-view.fxml | 65 ++++++++++++++ 9 files changed, 247 insertions(+) create mode 100644 assets/close-button.png create mode 100644 assets/left-arrow.png create mode 100644 assets/npc-frame.png create mode 100644 assets/right-arrow.png create mode 100644 src/main/java/io/rpg/view/popups/DialoguePopup.java create mode 100644 src/main/java/io/rpg/viewmodel/DialoguePopupViewModel.java create mode 100644 src/main/resources/io/rpg/viewmodel/dialogue-popup-view.fxml diff --git a/assets/close-button.png b/assets/close-button.png new file mode 100644 index 0000000000000000000000000000000000000000..a4461576b17a6732d6c150bcfb07918b5e4a770b GIT binary patch literal 2861 zcmZ9OYg80R7JzS67c<=m*bK;PKpGerH9kfqf&`^`2`G#tqM{qIiD*O(j*5zpgc?-D z2naq=Fk%ETGsckUDv1v|Vj`|4PShyALTlWWP1LZ_qr|k!4*9utPMv$JPTe2(obTNF zHf5Sq++71)0l+;iHR&w?>`XBb#u+rzE?jU1W?4d77R$1??@d;mN6wNuV;O+gt-g&G z#P92?@GnfxE}XJ>Ug65zrE_8B%9X?O3l=V$lWUnfeDTtEYoEjhI3EqjOwUU0?d^4@ z|F_1KK3d|u(iFaBo&qGR$^K{F{n!@(u0?4{@mWQ6kMCZn)~9$U|KKysfi;5?;&i6Fw$p?S@x%A2Df8E}4ac%%^y4YANzv#;@!|>B22htOjXG?dQ z@d%g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-fIuI@V&|>JmY(9IEEwWRWBI=le}p_ z5GRpYV{Bv2kMOF={(6e09Ju<{V8yI)T<>^%rAA$a(6J^i_C~j43*=MF)+L9gR2d?Q zjCEiQB~)Et!fsM8%S&AqV#1`#K%bDYZ&?IkB$75l6O{UWiw4znZ|orqBkVx`7XXd6 zMo>tMtbRpru23SN{B0yWMc?uPlHvVtN@u?j8hA052^0^~+d#yN+o-G34I4;cQx1Orcmy}vc0W!LH-h`~SFe(QbtCiL_F17;0S A$p8QV literal 0 HcmV?d00001 diff --git a/assets/npc-frame.png b/assets/npc-frame.png new file mode 100644 index 0000000000000000000000000000000000000000..134b70b7d8075814d2c9736c67377d6da862666e GIT binary patch literal 3070 zcmeH}>sQhV8pm4DuIgFZzkO(gz0+uya zD(udh7f`9CK~sU_EQ%K{IgL^pa!dsk1(SkR1O`zNxviZu|H8iO#rHhtdCv3dd!FZf zKM%f*kK3`$XB!9v+Hv;G$%`P6N8kr--3$VOyh}L6>*dp%XRcyFAWzW;dCZ?^d%iy0 zmwPHH_YyiYw;=si2B@H*AUHb*iAAK}%m_x`%Ay-%eL$e?WoJ(wzl^IhjLVvjoP|r? z-ly&H+mzb0Jw3v+(;L%RR>0gaa7aM)=-vK%SPFgvyu`P+g1G6<%s@TIv1MC)IPurM zXRjR@Ka4&b2{$R#nMM9IPIK$amrXIBGcM^20RRcSBXH(xB-=U0a1#stkV3wzP*-$A zpvoz=ld^mj)Noa7gtVZ`nCqAToBYV##?XB6KCcEf<7huGzpy}#NEVV)8mX28sO6UH zaH|5c`(N=2pGFBnXdIptJl9lWi0Frd5^;Z3$rq4DQ{S7DqvG#q#mslZs0rPae`X7hxbbzhd6{zsoZT+#vsIcjj zNF!5|AfaGPaG^FzKAemUq3U9!mt?g8Vu8xYMWqB#!#EX~jqgZBOZLgrUALg_^rx(@ zexB3Fe`7W8s{wrzx22VTnpurY)kdBAk6@3T#)@8>g$mfZD3xW5CO6rR#SvxX=IGtJ z`d^7t>WXeiqu1PC!_sj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f4uJgB3#Td)U^pk2QrtP2Q|T_w0RYeq9ti#OY4(m)mp-2UifmhANH;mDOGbC zh$RQ;=CCa1cZrgvzSsn9p?X|%W=wbO26C^VGnHcJtw?Wntt3&8QqDy(J%gDX34;P9 zjzp)KyeqRTT+wkU_Vw+0=EZ))1xBQM(RVn41RHdqG7f3sb@nCYC_xm;K37^zz5|W1 z95Lf?4-&FGU+3Q_n-J-=6|jyux`bs5R@74fx<;r;P(b^Qk(yqMg=MHN$bxo^*(G`N zfNXTDRPU&5CDG6S0j7yh=OO-^P&`fKN>RPd*4M3fCrEVIh6=R8Y@%tTi2VcAHvbfB lGK=h3H7k2!W^|Kok13oW2{av~S!Z|9*;DZ+IVY~&`5(I=qJIDY literal 0 HcmV?d00001 diff --git a/assets/right-arrow.png b/assets/right-arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..c5f8a80269bd031b37f10e185950f095f744ee69 GIT binary patch literal 3341 zcmeHJdr(u^9sUInP##gyg^|Zy#kFJc)w-)F>y56ci>`n!A!8uLEnTsK1jP^x1g?)Y zYXu_f_}WDTQ3Htv?1~X05GxOnt*Ced7=a+x(90uPrh<%}n}oPcnduhwWp)k9l4I zt~DXSn<7&420Fre-;VMc%yB8Pa~J+Ges=uXOA7+&B{5= zfILUOVo=%n_0*Vx%6KQRstxj$ky7^6lIrlPKi4rBSd*cXNcLTnu~aHkI4R;)XdomV zHY(As8xpEq8Yhn_QFgu$0q```6JPVHO*JFtU_ryaW=FVRpp*Yfeb~$zO)aU+EHXI2 zB&#!~>e+cIrDFLFlKjOEu*PI1{&p{$s%R*}+XJY142&;~($&0QYX^G^y>;(4WcmYy z<^~*9)yx5qJyS;^=`^w?WnInN24}#0@2kjM8#z`sj@u|4jgE_?*eD}?x22Ud;yux% zb?TtG*;Da-v55|#Ii)PA#w};P8BkVeGfW9}>A) zKu-cmmy)zMo?4xJ)QR;p2n>98=aqEK*2`)|BZ>PO_HPQnLZH*`Y zZ~V_J0_J}NC+wFci3Rb376tXW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aZ%K)jsRM&jl)F_Ov`my!fj&xT5SWD4j!v2N84;tX>ol; z%dPZV;io7hk!EJ|TDphK3i}l{OvXhH*)Z`na-pY9P7;MA+klQ2mI7LCnW;i6;o0Oy z@1cXVoJ)E&nLEvFzK0ImfJt`WiIp}jqdb4Vc&rYg-&y{+3!Q|FzIn2l&axkVS*4{IS$`>7V0Ju3{~iEBwuA;Nzu0^H EA6!H-m;e9( literal 0 HcmV?d00001 diff --git a/src/main/java/io/rpg/controller/Controller.java b/src/main/java/io/rpg/controller/Controller.java index c4bebae8..f7cdc4ae 100644 --- a/src/main/java/io/rpg/controller/Controller.java +++ b/src/main/java/io/rpg/controller/Controller.java @@ -176,6 +176,10 @@ public void onMouseClickedEvent(MouseClickedEvent event) { popupController.openTextImagePopup("Picked up an item!", objectView.getImage(), getWindowCenterX(), getWindowCenterY()); objectView.setVisible(false); } + + if (object instanceof DialogGameObject) { + popupController.openDialoguePopup("", objectView.getImage(), getWindowCenterX(), getWindowCenterY()); //TODO load text from config + } } logger.info("Controller notified on click from " + event.source()); } diff --git a/src/main/java/io/rpg/controller/PopupController.java b/src/main/java/io/rpg/controller/PopupController.java index 2a0b2c65..24ca335e 100644 --- a/src/main/java/io/rpg/controller/PopupController.java +++ b/src/main/java/io/rpg/controller/PopupController.java @@ -1,6 +1,7 @@ package io.rpg.controller; import io.rpg.model.object.Question; +import io.rpg.view.popups.DialoguePopup; import io.rpg.view.popups.QuestionPopup; import io.rpg.view.popups.TextImagePopup; import io.rpg.view.popups.TextPopup; @@ -59,6 +60,18 @@ public void openQuestionPopup(Question question, int x, int y) { popupStage.setY(y - popupScene.getHeight() / 2); } + public void openDialoguePopup(String text, Image npcImage, int x, int y) { + DialoguePopup popupScene = new DialoguePopup(text, npcImage); + popupStage.setScene(popupScene); + + popupStage.show(); + + popupStage.setX(x - popupScene.getWidth() / 2); + popupStage.setY(y - popupScene.getHeight() / 2); + + popupScene.setCloseButtonCallback(event -> popupStage.hide()); + } + public void hidePopup() { popupStage.hide(); } diff --git a/src/main/java/io/rpg/view/popups/DialoguePopup.java b/src/main/java/io/rpg/view/popups/DialoguePopup.java new file mode 100644 index 00000000..f3fa24f8 --- /dev/null +++ b/src/main/java/io/rpg/view/popups/DialoguePopup.java @@ -0,0 +1,81 @@ +package io.rpg.view.popups; + +import io.rpg.viewmodel.DialoguePopupViewModel; +import javafx.event.EventHandler; +import javafx.fxml.FXMLLoader; +import javafx.scene.Group; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.image.Image; +import javafx.scene.input.MouseEvent; +import javafx.scene.paint.Color; + +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +public class DialoguePopup extends Scene { + + private final DialoguePopupViewModel viewModel; + private final List textPages; + private int currentPage = 0; + + public DialoguePopup(String text, Image npcImage, String backgroundPath, String buttonPath) { + this(text, npcImage); + viewModel.setBackgroundImage(backgroundPath); + viewModel.setCloseButtonImage(buttonPath); + } + + public DialoguePopup(String text, Image npcImage) { + super(new Group(), Color.TRANSPARENT); + FXMLLoader loader = new FXMLLoader(Objects.requireNonNull(DialoguePopupViewModel.class.getResource("dialogue-popup-view.fxml"))); + Parent root = null; + + try { + root = loader.load(); + } catch (IOException e) { + e.printStackTrace(); + } + this.setRoot(root); + + viewModel = loader.getController(); + viewModel.setNpcImage(npcImage); + viewModel.setBackgroundImage("file:assets/popup-background.png"); //images do not load from fxml on my computer + viewModel.setCloseButtonImage("file:assets/close-button.png"); + viewModel.setNextButtonImage("file:assets/right-arrow.png"); + viewModel.setPreviousButtonImage("file:assets/left-arrow.png"); + viewModel.setNpcFrameImage("file:assets/npc-frame.png"); + this.setFill(Color.TRANSPARENT); + + textPages = List.of(text.split("(?<=\\G.{200})")); //split text into 200-letter pages + viewModel.setText(textPages.get(currentPage)); + if (textPages.size() == 1) { + viewModel.setNextVisibility(false); + } + viewModel.setPreviousVisibility(false); + viewModel.setNextButtonOnClick(event -> nextPage()); + viewModel.setPreviousButtonOnClick(event -> previousPage()); + } + + public void setCloseButtonCallback(EventHandler callback) { + viewModel.setCloseButtonOnClick(callback); + } + + public void nextPage() { + currentPage++; + viewModel.setText(textPages.get(currentPage)); + if (currentPage == textPages.size() - 1) { + viewModel.setNextVisibility(false); + } + viewModel.setPreviousVisibility(true); + } + + public void previousPage() { + currentPage--; + viewModel.setText(textPages.get(currentPage)); + if (currentPage == 0) { + viewModel.setPreviousVisibility(false); + } + viewModel.setNextVisibility(true); + } +} diff --git a/src/main/java/io/rpg/viewmodel/DialoguePopupViewModel.java b/src/main/java/io/rpg/viewmodel/DialoguePopupViewModel.java new file mode 100644 index 00000000..3e138757 --- /dev/null +++ b/src/main/java/io/rpg/viewmodel/DialoguePopupViewModel.java @@ -0,0 +1,84 @@ +package io.rpg.viewmodel; + +import javafx.event.EventHandler; +import javafx.fxml.FXML; +import javafx.scene.control.Button; +import javafx.scene.control.ScrollPane; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.input.MouseEvent; +import javafx.scene.layout.Pane; +import javafx.scene.layout.StackPane; +import javafx.scene.text.Text; + +public class DialoguePopupViewModel { + + @FXML private Pane backgroundPane; + @FXML private StackPane npcFramePane; + @FXML private ImageView backgroundImage; + @FXML private ImageView npcImage; + @FXML private ImageView npcFrameImage; + @FXML private Text text; + @FXML private Button closeButton; + @FXML private Button nextButton; + @FXML private Button previousButton; + + public void setText(String text) { + this.text.setText(text); + } + + public void setNpcImage(Image image) { + npcImage.setImage(image); + } + + public void setBackgroundImage(String url) { + Image image = new Image(url); + backgroundImage.setImage(image); + } + + public void setCloseButtonImage(String url) { + ImageView imageView = new ImageView(url); + imageView.setFitWidth(16); + imageView.setPreserveRatio(true); + closeButton.setGraphic(imageView); + } + + public void setNextButtonImage(String url) { + ImageView imageView = new ImageView(url); + imageView.setFitWidth(26); + imageView.setPreserveRatio(true); + nextButton.setGraphic(imageView); + } + + public void setPreviousButtonImage(String url) { + ImageView imageView = new ImageView(url); + imageView.setFitWidth(26); + imageView.setPreserveRatio(true); + previousButton.setGraphic(imageView); + } + + public void setNpcFrameImage(String url) { + Image image = new Image(url); + npcFrameImage.setImage(image); + } + + public void setCloseButtonOnClick(EventHandler callback) { + closeButton.setOnMouseClicked(callback); + } + + public void setNextVisibility(boolean value) { + nextButton.setVisible(value); + } + + public void setPreviousVisibility(boolean value) { + previousButton.setVisible(value); + } + + public void setNextButtonOnClick(EventHandler callback) { + nextButton.setOnMouseClicked(callback); + } + + public void setPreviousButtonOnClick(EventHandler callback) { + previousButton.setOnMouseClicked(callback); + } +} diff --git a/src/main/resources/io/rpg/viewmodel/dialogue-popup-view.fxml b/src/main/resources/io/rpg/viewmodel/dialogue-popup-view.fxml new file mode 100644 index 00000000..21d2a3c5 --- /dev/null +++ b/src/main/resources/io/rpg/viewmodel/dialogue-popup-view.fxml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 83f16a6fbfc1efd9943c7413594d1c6b75d5d29b Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 12 May 2022 14:06:15 +0200 Subject: [PATCH 2/5] added todos --- src/main/java/io/rpg/controller/Controller.java | 4 ++-- src/main/java/io/rpg/view/popups/DialoguePopup.java | 9 ++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/io/rpg/controller/Controller.java b/src/main/java/io/rpg/controller/Controller.java index f7cdc4ae..05d66639 100644 --- a/src/main/java/io/rpg/controller/Controller.java +++ b/src/main/java/io/rpg/controller/Controller.java @@ -177,8 +177,8 @@ public void onMouseClickedEvent(MouseClickedEvent event) { objectView.setVisible(false); } - if (object instanceof DialogGameObject) { - popupController.openDialoguePopup("", objectView.getImage(), getWindowCenterX(), getWindowCenterY()); //TODO load text from config + if (object instanceof DialogGameObject) { //TODO: change action invocation to GameObject.onAction() + popupController.openDialoguePopup("", objectView.getImage(), getWindowCenterX(), getWindowCenterY()); //TODO: load text from config } } logger.info("Controller notified on click from " + event.source()); diff --git a/src/main/java/io/rpg/view/popups/DialoguePopup.java b/src/main/java/io/rpg/view/popups/DialoguePopup.java index f3fa24f8..4276bbd1 100644 --- a/src/main/java/io/rpg/view/popups/DialoguePopup.java +++ b/src/main/java/io/rpg/view/popups/DialoguePopup.java @@ -20,10 +20,10 @@ public class DialoguePopup extends Scene { private final List textPages; private int currentPage = 0; - public DialoguePopup(String text, Image npcImage, String backgroundPath, String buttonPath) { + public DialoguePopup(String text, Image npcImage, String backgroundPath, String npcFramePath) { this(text, npcImage); viewModel.setBackgroundImage(backgroundPath); - viewModel.setCloseButtonImage(buttonPath); + viewModel.setNpcFrameImage(npcFramePath); } public DialoguePopup(String text, Image npcImage) { @@ -40,11 +40,6 @@ public DialoguePopup(String text, Image npcImage) { viewModel = loader.getController(); viewModel.setNpcImage(npcImage); - viewModel.setBackgroundImage("file:assets/popup-background.png"); //images do not load from fxml on my computer - viewModel.setCloseButtonImage("file:assets/close-button.png"); - viewModel.setNextButtonImage("file:assets/right-arrow.png"); - viewModel.setPreviousButtonImage("file:assets/left-arrow.png"); - viewModel.setNpcFrameImage("file:assets/npc-frame.png"); this.setFill(Color.TRANSPARENT); textPages = List.of(text.split("(?<=\\G.{200})")); //split text into 200-letter pages From 4613f2d88a78e0061f36231597aa5e1cc32571ef Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 17 May 2022 17:05:01 +0200 Subject: [PATCH 3/5] chore: dialogue as Action --- src/main/java/io/rpg/controller/Controller.java | 9 +++++---- .../io/rpg/model/actions/DialogueAction.java | 17 +++++++++++++++++ .../java/io/rpg/model/object/GameObject.java | 3 +++ 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/main/java/io/rpg/model/actions/DialogueAction.java diff --git a/src/main/java/io/rpg/controller/Controller.java b/src/main/java/io/rpg/controller/Controller.java index acc65276..0aa91d9e 100644 --- a/src/main/java/io/rpg/controller/Controller.java +++ b/src/main/java/io/rpg/controller/Controller.java @@ -2,6 +2,7 @@ import io.rpg.model.actions.Action; import io.rpg.model.actions.ActionConsumer; +import io.rpg.model.actions.DialogueAction; import io.rpg.model.actions.LocationChangeAction; import io.rpg.model.data.KeyboardEvent; import io.rpg.model.data.MouseClickedEvent; @@ -104,6 +105,10 @@ private void onAction(LocationChangeAction action) { mainStage.setScene(nextView); } + private void onAction(DialogueAction action) { + popupController.openDialoguePopup(action.text, action.image, getWindowCenterX(), getWindowCenterY()); //TODO: load text from config + } + public Scene getView() { return currentView; } @@ -181,10 +186,6 @@ public void onMouseClickedEvent(MouseClickedEvent event) { } else if (button.equals(MouseButton.SECONDARY)) { object.onRightClick(); } - - if (object instanceof DialogGameObject) { //TODO: change action invocation to GameObject.onAction() - popupController.openDialoguePopup("", objectView.getImage(), getWindowCenterX(), getWindowCenterY()); //TODO: load text from config - } } logger.info("Controller notified on click from " + event.source()); diff --git a/src/main/java/io/rpg/model/actions/DialogueAction.java b/src/main/java/io/rpg/model/actions/DialogueAction.java new file mode 100644 index 00000000..fe69c79e --- /dev/null +++ b/src/main/java/io/rpg/model/actions/DialogueAction.java @@ -0,0 +1,17 @@ +package io.rpg.model.actions; + +import javafx.scene.image.Image; + +/** + * Class for storing local data needed to perform a dialogue action. + */ + +public class DialogueAction implements Action { + public final String text; + public final Image image; + + public DialogueAction(String text, Image image) { + this.text = text; + this.image = image; + } +} diff --git a/src/main/java/io/rpg/model/object/GameObject.java b/src/main/java/io/rpg/model/object/GameObject.java index b4b4f4d3..31b92ac9 100644 --- a/src/main/java/io/rpg/model/object/GameObject.java +++ b/src/main/java/io/rpg/model/object/GameObject.java @@ -2,6 +2,7 @@ import io.rpg.model.actions.Action; import io.rpg.model.actions.BaseActionEmitter; +import io.rpg.model.actions.DialogueAction; import io.rpg.model.data.GameObjectStateChange; import io.rpg.model.data.Position; import java.lang.reflect.Field; @@ -11,6 +12,7 @@ import javafx.beans.property.SimpleObjectProperty; import javafx.beans.value.ObservableValue; import javafx.geometry.Point2D; +import javafx.scene.image.Image; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,6 +54,7 @@ public GameObject(@NotNull String tag, @NotNull Position position) { this.exactPositionProperty = new SimpleObjectProperty<>(new Point2D(position.col, position.row)); this.onLeftClickAction = Action.VOID; this.onRightClickAction = Action.VOID; + this.onLeftClickAction = new DialogueAction("", new Image("file:assets/zombie.png")); //TODO: read action config from file } /** From ac797c394bcd1bb0567e5fc6d8575aab2438b370 Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 17 May 2022 18:16:04 +0200 Subject: [PATCH 4/5] fix: fixed code to pass tests --- src/main/java/io/rpg/model/object/GameObject.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/io/rpg/model/object/GameObject.java b/src/main/java/io/rpg/model/object/GameObject.java index 31b92ac9..fd1fce76 100644 --- a/src/main/java/io/rpg/model/object/GameObject.java +++ b/src/main/java/io/rpg/model/object/GameObject.java @@ -54,7 +54,6 @@ public GameObject(@NotNull String tag, @NotNull Position position) { this.exactPositionProperty = new SimpleObjectProperty<>(new Point2D(position.col, position.row)); this.onLeftClickAction = Action.VOID; this.onRightClickAction = Action.VOID; - this.onLeftClickAction = new DialogueAction("", new Image("file:assets/zombie.png")); //TODO: read action config from file } /** From 7bd9b39235956fc00cfa5848fa0fd4b2e61c87a9 Mon Sep 17 00:00:00 2001 From: Kacper Kafara Date: Sun, 22 May 2022 18:13:05 +0200 Subject: [PATCH 5/5] refact: remove redundant whitespace --- src/main/java/io/rpg/model/actions/DialogueAction.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/io/rpg/model/actions/DialogueAction.java b/src/main/java/io/rpg/model/actions/DialogueAction.java index fe69c79e..153c5827 100644 --- a/src/main/java/io/rpg/model/actions/DialogueAction.java +++ b/src/main/java/io/rpg/model/actions/DialogueAction.java @@ -5,7 +5,6 @@ /** * Class for storing local data needed to perform a dialogue action. */ - public class DialogueAction implements Action { public final String text; public final Image image;