added multiline dialogues
This commit is contained in:
parent
2fcab62a88
commit
42df08befc
@ -52,6 +52,8 @@ public class InteractionCell extends Cell {
|
|||||||
readNextLine();
|
readNextLine();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (data.contains("<br/>"))
|
||||||
|
data = "<html>" + data + "</html>";
|
||||||
dialog.hideText();
|
dialog.hideText();
|
||||||
dialog.setText(data);
|
dialog.setText(data);
|
||||||
dialog.showText();
|
dialog.showText();
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package ruscz.game.gameOfProd.Dialog;
|
package ruscz.game.gameOfProd.Dialog;
|
||||||
|
|
||||||
import ruscz.game.gameOfProd.Image.ImageDialog;
|
import ruscz.game.gameOfProd.Image.ImageDialog;
|
||||||
|
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@ -41,10 +42,10 @@ public class Dialog {
|
|||||||
Font f1 = new Font("Times New Roman", Font.PLAIN, 20);
|
Font f1 = new Font("Times New Roman", Font.PLAIN, 20);
|
||||||
|
|
||||||
JLabel text = new JLabel();
|
JLabel text = new JLabel();
|
||||||
|
text.setText(string);
|
||||||
text.setFont(f1);
|
text.setFont(f1);
|
||||||
text.setForeground(Color.red);
|
text.setForeground(Color.red);
|
||||||
text.setVisible(true);
|
text.setVisible(true);
|
||||||
text.setText(string);
|
|
||||||
Dimension size = text.getPreferredSize();
|
Dimension size = text.getPreferredSize();
|
||||||
|
|
||||||
if (imageDialog != null) {
|
if (imageDialog != null) {
|
||||||
@ -73,6 +74,8 @@ public class Dialog {
|
|||||||
|
|
||||||
public void showText() {
|
public void showText() {
|
||||||
charNumber = 0;
|
charNumber = 0;
|
||||||
|
if (text.contains("<html>"))
|
||||||
|
charNumber = 6;
|
||||||
dialogBar.setVisible(true);
|
dialogBar.setVisible(true);
|
||||||
timer = new Timer(20, new ActionListener() {
|
timer = new Timer(20, new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -158,16 +158,19 @@ public class WindowOfFreeMove extends JFrame {
|
|||||||
m1.addMoveToEvent(new EventMoveToCell(4, 3, 8, 1, m4, this));
|
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(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 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(2, 1, 8, 8, m3, this));
|
||||||
m2.addMoveToEvent(new EventMoveToCell(1, 3, 8, 1, m1, 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(3, 1, 8, 8, m4, this));
|
||||||
m3.addMoveToEvent(new EventMoveToCell(2, 3, 8, 1, m2, 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(4, 1, 8, 8, m1, this));
|
||||||
m4.addMoveToEvent(new EventMoveToCell(3, 3, 8, 1, m3, 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");
|
m1.getImageCell().readMapFile("m1-tileset");
|
||||||
m2.getImageCell().readMapFile("m1-tileset");
|
m2.getImageCell().readMapFile("m1-tileset");
|
||||||
|
|||||||
4
src/main/resources/boobs.txt
Normal file
4
src/main/resources/boobs.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
What did one boob say to the other?
|
||||||
|
You are my breastfriend
|
||||||
|
*badumm tits*
|
||||||
|
<end>
|
||||||
@ -1,5 +1,4 @@
|
|||||||
Keep out
|
Keep out
|
||||||
<image> BaetoriceFace.png
|
<image> BaetoriceFace.png
|
||||||
This sign can't stop me
|
This sign can't stop me<br/>because I can't read
|
||||||
because I can't read
|
|
||||||
<end>
|
<end>
|
||||||
@ -1,5 +1,4 @@
|
|||||||
Keep out
|
Keep out
|
||||||
...
|
...
|
||||||
or enter
|
or enter<br/>I'm a sign not a cop
|
||||||
I'm a sign not a cop
|
|
||||||
<end>
|
<end>
|
||||||
4
src/main/resources/javascript.txt
Normal file
4
src/main/resources/javascript.txt
Normal 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>
|
||||||
16
src/main/resources/qa-tester.txt
Normal file
16
src/main/resources/qa-tester.txt
Normal 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>
|
||||||
3
src/main/resources/roses-are-red.txt
Normal file
3
src/main/resources/roses-are-red.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Roses are red<br/>violets are blue
|
||||||
|
unexpected "{"<br/>on line 32
|
||||||
|
<end>
|
||||||
@ -1,5 +0,0 @@
|
|||||||
Roses are read
|
|
||||||
violets are blue
|
|
||||||
unexpected "{"
|
|
||||||
on line 32
|
|
||||||
<end>
|
|
||||||
Loading…
x
Reference in New Issue
Block a user