1
0
mirror of https://github.com/Klagarge/PokeHES.git synced 2025-07-17 21:31:10 +00:00

dialog ok

This commit is contained in:
Fastium
2022-06-10 19:33:24 +02:00
parent 4c47120c40
commit 0fe608e183
10 changed files with 149 additions and 69 deletions

View File

@ -11,16 +11,6 @@ public class FightData {
private File file;
private static final String REGEX = ",";
/*
public static void main(String[] args) {
FightData d = new FightData("enemi");
d.readFile();
for(Attack a : d.attacks){
System.out.println(a);
}
}
*/
public FightData(String name) {
file = new File("./resources/Battle/Fight/" + name + ".csv");
}
@ -42,9 +32,12 @@ public class FightData {
bf.close();
} catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
}

12
src/Text/Line.java Normal file
View File

@ -0,0 +1,12 @@
package Text;
public class Line {
public String line;
public boolean attackOn;
Line( String line, boolean attackOn){
this.line = line;
this.attackOn = attackOn;
}
}

View File

@ -12,7 +12,7 @@ public class SpeechData {
public SpeechData(String name){
file = new File("./resources/Battle/Fight/" + name + ".csv");
file = new File("./resources/Battle/Speech/" + name + ".txt");
}
public void readFile() {

View File

@ -6,7 +6,16 @@ public class TextEnemy {
public FightData fightData;
public SpeechData speechData;
Vector<Line> line = new Vector<Line>();
public Vector<Line> lines = new Vector<Line>();
public static void main(String[] args) {
TextEnemy t = new TextEnemy("enemi");
t.generateText();
for(Line l : t.lines) {
System.out.println(l.line);
}
}
public TextEnemy(String name){
//generate the vector of fight
@ -20,33 +29,24 @@ public class TextEnemy {
}
public void generateText(){
int i =0;
int i =1;
//introduction line
line.add(new Line(speechData.getSpeechs(i++), false));
for(int j=0; i<4;i++){
lines.add(new Line(speechData.getSpeechs(0), false));
for(int j=0; j<4;j++){
//attack and answer (number on vector : 1-4)
line.add(new Line(
speechData.getSpeechs(i++) + fightData.getAttack(j).attack + "? ("+fightData.getAttack(j).xp+ ") " + "\n" +
fightData.getAttack(j).answer1 + "\n" +
fightData.getAttack(j).answer2 + "\n" +
fightData.getAttack(j).answer3 + "\n" +
fightData.getAttack(j).answer4, true ));
lines.add(new Line(
speechData.getSpeechs(i++) + fightData.getAttack(j).attack + "? ("+fightData.getAttack(j).xp+ ") " + "\n" +
fightData.getAttack(j).answer1 + "\n" +
fightData.getAttack(j).answer2 + "\n" +
fightData.getAttack(j).answer3 + "\n" +
fightData.getAttack(j).answer4, true));
// TODO mélanger les attaques aléatoirement
}
//finish (win and death)
line.add(new Line(speechData.getSpeechs(i++), false));
line.add(new Line(speechData.getSpeechs(i++), false));
lines.add(new Line(speechData.getSpeechs(5), false));
lines.add(new Line(speechData.getSpeechs(6), false));
}
}
class Line {
String line;
boolean attackOn;
Line( String line, boolean attackOn){
this.line = line;
this.attackOn = attackOn;
}
}