From 66fa54be5ae54aeedcdba4aa448b7a37f4ea3903 Mon Sep 17 00:00:00 2001 From: Ozan-Can Ekinci Date: Mon, 9 Jan 2023 01:35:11 +0100 Subject: [PATCH] implemented method to check if the first answer ist correct --- QandA/Answers.txt | 6 ++++-- QandA/Questions.txt | 6 ++++-- src/main/java/game/loadNextQuestion.java | 17 +++++++++++++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/QandA/Answers.txt b/QandA/Answers.txt index f45bc92..b292e21 100644 --- a/QandA/Answers.txt +++ b/QandA/Answers.txt @@ -1,2 +1,4 @@ -187m,301m,69m,300m -erkentnisse gewinnen,zur ainsicht gelangen,eine leere ziehen,erfarungen sammeln \ No newline at end of file +right,wrong,wrong,wrong,1 +-,-,-,-,2 +-,-,-,-,3 +-,-,-,-,4 \ No newline at end of file diff --git a/QandA/Questions.txt b/QandA/Questions.txt index 385a533..dff34e0 100644 --- a/QandA/Questions.txt +++ b/QandA/Questions.txt @@ -1,2 +1,4 @@ -Wie hoch ist der Eifelturm? -Wurden alle Bierflaschen ausgetrunken, kann man aus dem Kasten nur noch ...? \ No newline at end of file +test1 +test2 +test3 +test4 \ No newline at end of file diff --git a/src/main/java/game/loadNextQuestion.java b/src/main/java/game/loadNextQuestion.java index 076980c..a4fc7f7 100644 --- a/src/main/java/game/loadNextQuestion.java +++ b/src/main/java/game/loadNextQuestion.java @@ -3,12 +3,25 @@ package game; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import Gui.GameGui; + public class loadNextQuestion implements ActionListener { @Override public void actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub - + + if (runGame.splitAns[4].equals("1")) { + if (e.getSource() == GameGui.AnswersBtn1) { + if (GameGui.questionNr != runGame.arrQuestions.length - 1) { + runGame StartGame = new runGame(); + StartGame.run(GameGui.questionNr); + } + } else { + System.exit(0); + } + } + + } }