Browse Source

refactoring: implemented method for loading next question

master
Ozan-Can Ekinci 2 years ago
parent
commit
4cc849ee0b
  1. 32
      src/main/java/game/loadNextQuestion.java

32
src/main/java/game/loadNextQuestion.java

@ -12,49 +12,45 @@ public class loadNextQuestion implements ActionListener {
if (runGame.splitAns[4].equals("1")) { if (runGame.splitAns[4].equals("1")) {
if (e.getSource() == GameGui.AnswersBtn1) { if (e.getSource() == GameGui.AnswersBtn1) {
if (GameGui.questionNr != runGame.arrQuestions.length - 1) {
runGame StartGame = new runGame();
StartGame.run(GameGui.questionNr);
}
loadQuestions();
} else { } else {
System.exit(0); System.exit(0);
} }
} }
else if (runGame.splitAns[4].equals("2")) { else if (runGame.splitAns[4].equals("2")) {
if (e.getSource() == GameGui.AnswersBtn2) { if (e.getSource() == GameGui.AnswersBtn2) {
if (GameGui.questionNr != runGame.arrQuestions.length - 1) {
runGame StartGame = new runGame();
StartGame.run(GameGui.questionNr);
}
loadQuestions();
} else { } else {
System.exit(0); System.exit(0);
} }
} }
else if (runGame.splitAns[4].equals("3")) { else if (runGame.splitAns[4].equals("3")) {
if (e.getSource() == GameGui.AnswersBtn3) { if (e.getSource() == GameGui.AnswersBtn3) {
if (GameGui.questionNr != runGame.arrQuestions.length - 1) {
runGame StartGame = new runGame();
StartGame.run(GameGui.questionNr);
}
loadQuestions();
} else { } else {
System.exit(0); System.exit(0);
} }
} }
else if (runGame.splitAns[4].equals("4")) { else if (runGame.splitAns[4].equals("4")) {
if (e.getSource() == GameGui.AnswersBtn4) { if (e.getSource() == GameGui.AnswersBtn4) {
if (GameGui.questionNr != runGame.arrQuestions.length - 1) {
runGame StartGame = new runGame();
StartGame.run(GameGui.questionNr);
}
loadQuestions();
} else { } else {
System.exit(0); System.exit(0);
} }
} }
}
public void loadQuestions() {
if (GameGui.questionNr != runGame.arrQuestions.length - 1) {
runGame StartGame = new runGame();
StartGame.run(GameGui.questionNr);
}
} }
}
}
Loading…
Cancel
Save