added multiline dialogues

This commit is contained in:
musilto9 2020-03-14 00:41:25 +01:00
parent 2fcab62a88
commit 42df08befc
10 changed files with 39 additions and 11 deletions

View File

@ -52,6 +52,8 @@ public class InteractionCell extends Cell {
readNextLine();
}
else {
if (data.contains("<br/>"))
data = "<html>" + data + "</html>";
dialog.hideText();
dialog.setText(data);
dialog.showText();

View File

@ -1,6 +1,7 @@
package ruscz.game.gameOfProd.Dialog;
import ruscz.game.gameOfProd.Image.ImageDialog;
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
import javax.swing.*;
import java.awt.*;
@ -41,10 +42,10 @@ public class Dialog {
Font f1 = new Font("Times New Roman", Font.PLAIN, 20);
JLabel text = new JLabel();
text.setText(string);
text.setFont(f1);
text.setForeground(Color.red);
text.setVisible(true);
text.setText(string);
Dimension size = text.getPreferredSize();
if (imageDialog != null) {
@ -73,6 +74,8 @@ public class Dialog {
public void showText() {
charNumber = 0;
if (text.contains("<html>"))
charNumber = 6;
dialogBar.setVisible(true);
timer = new Timer(20, new ActionListener() {
@Override

View File

@ -158,16 +158,19 @@ public class WindowOfFreeMove extends JFrame {
m1.addMoveToEvent(new EventMoveToCell(4, 3, 8, 1, m4, this));
m1.addInteractionEvent(new InteractionCell(3,5,"first-dialog", new Dialog(dialogBar), m1.getImageCell()));
m1.addInteractionEvent(new InteractionCell(5, 5, "dialog-test", new Dialog(dialogBar), m1.getImageCell()));
m1.addInteractionEvent(new TriggerCell(2,2,"second-dialog", new Dialog(dialogBar), m1.getImageCell()));
m1.addInteractionEvent(new TriggerCell(4,6,"roses-are-red", new Dialog(dialogBar), m1.getImageCell()));
m2.addMoveToEvent(new EventMoveToCell(2, 1, 8, 8, m3, this));
m2.addMoveToEvent(new EventMoveToCell(1, 3, 8, 1, m1, this));
m2.addInteractionEvent(new TriggerCell(7,2,"qa-tester", new Dialog(dialogBar), m1.getImageCell()));
m3.addMoveToEvent(new EventMoveToCell(3, 1, 8, 8, m4, this));
m3.addMoveToEvent(new EventMoveToCell(2, 3, 8, 1, m2, this));
m3.addInteractionEvent(new TriggerCell(2,5,"boobs", new Dialog(dialogBar), m1.getImageCell()));
m4.addMoveToEvent(new EventMoveToCell(4, 1, 8, 8, m1, this));
m4.addMoveToEvent(new EventMoveToCell(3, 3, 8, 1, m3, this));
m4.addInteractionEvent(new TriggerCell(3,3,"javascript", new Dialog(dialogBar), m1.getImageCell()));
m1.getImageCell().readMapFile("m1-tileset");
m2.getImageCell().readMapFile("m1-tileset");

View File

@ -0,0 +1,4 @@
What did one boob say to the other?
You are my breastfriend
*badumm tits*
<end>

View File

@ -1,5 +1,4 @@
Keep out
<image> BaetoriceFace.png
This sign can't stop me
because I can't read
This sign can't stop me<br/>because I can't read
<end>

View File

@ -1,5 +1,4 @@
Keep out
...
or enter
I'm a sign not a cop
or enter<br/>I'm a sign not a cop
<end>

View File

@ -0,0 +1,4 @@
Dad: Why are your eyes red son?
Son: I smoke weed
Dad: Don't lie, you're crying because<br/>you have been coding in javascript
<end>

View File

@ -0,0 +1,16 @@
A QA tester walks into a bar:
He orders a beer.
He orders 3 beers.
He orders 2976412836 beers.
He orders 0 beers.
He orders -1 beers.
He orders q beers.
He orders nothing.
Él ordena una cerveza.
He orders a deer.
He tries to leave without paying.
He starts ordering one beer<br/>then throws himself out of window.
He orders a beer, gets his receipt<br/>then tries to go back.
He orders a beer, goes to the door of the bar<br/>throws handful of cookies onto the street ...
... then goes back to see if barman<br/>still recognises him.
<end>

View File

@ -0,0 +1,3 @@
Roses are red<br/>violets are blue
unexpected "{"<br/>on line 32
<end>

View File

@ -1,5 +0,0 @@
Roses are read
violets are blue
unexpected "{"
on line 32
<end>