|
1 | 1 | package sample;
|
2 | 2 |
|
3 | 3 | import javafx.event.ActionEvent;
|
| 4 | +import javafx.fxml.FXML; |
4 | 5 | import javafx.scene.Node;
|
| 6 | +import javafx.scene.control.Hyperlink; |
| 7 | +import javafx.scene.control.TextArea; |
5 | 8 | import javafx.stage.Stage;
|
6 | 9 |
|
7 | 10 | public class HelpController {
|
| 11 | + public TextArea textArea; |
| 12 | + public Hyperlink gameRulesLink; |
| 13 | + public Hyperlink newGameLink; |
| 14 | + public Hyperlink highScoresLink; |
| 15 | + public Hyperlink watchTheTimeLink; |
| 16 | + public Hyperlink reportBugsLink; |
| 17 | + public Hyperlink helpDevelopLink; |
| 18 | + |
| 19 | + private final String gameRules = "The aim of the game is to guess the right combination of symbols. When you start a game, a sequence of four symbols is generated and your goal is to guess that combination.\n\nYou have six symbols to choose from. As soon as you select the first symbol the stopwatch starts. Depending on the difficulty level you have five, six or seven possible attempts to guess the right combination.\n\nWhen you choose your four symbols a confirmation button will appear and if you are happy with your selection you click the confirm button. At any point if you are unhappy with a symbol in its position you can undo the selection just by pressing on the desired location.\n\nAfter you click on the confirm button, the game guide grid shows up. It consists of four circles. The color of the circles indicates how close you are to guessing the right combination. When a circle is red it means that you have put a symbol in the right place, if the circle is green it means that you have guessed the right symbol but it is not in the right position, and black suggests that the symbol is completely wrong. Keep in mind that the order of circles isn't related to the order in which you have chosen your symbols. The circles just show how many of your symbols are correct and in their places and how many are just in the sequence.\n\nThe game is finished when you guess the right combination, or when you run out of attempts.\n\nAt any point you can choose to restart the game, or change the difficulty.\n\nGood luck and have fun."; |
| 20 | + private final String startANewGame = "To start a new game go to Home screen and choose one of the difficulty levels. If you choose EASY you will have 7 attempts to guess the right combination, NORMAL offers you 6 attempts and HARD means that you only get 5 attempts."; |
| 21 | + private final String highScores = "As soon as you make your first selection in a game the stopwatch starts. When you guess the right combination an alert shows up which shows your exact time and your rank. You then enter your name and click the button Done, your score is then saved.\n\nThe game keeps separate track of scores for every difficulty level.\n\nTo check your scores, click on the dropdown menu in the up left corner and choose the option Scores."; |
| 22 | + private final String watchTheTime = "Keep in mind that when you start choosing your combination that you shouldn't open other windows such as the Help, About and Scores view, because the stopwatch won't stop, and you are loosing precious time.\n\nThis is done in order to prevent the player to start the game then open another window just to stop the stopwatch so he/she can examine the combination more briefly."; |
| 23 | + private final String reportBugs = "Feel free to report any bugs and unwanted behavior of the game to my email address: abecirovic3@etf.unsa.ba"; |
| 24 | + private final String helpDevelop = "Feel free to head out to my Github and start improving this game if you like.\nMy github: https://github.com/abecirovic3.\nOr you can go to About and click the Github icon."; |
| 25 | + |
| 26 | + @FXML |
| 27 | + public void initialize() { |
| 28 | + textArea.setText(gameRules); |
| 29 | + } |
| 30 | + |
| 31 | + public void setTextAreaAction(ActionEvent actionEvent) { |
| 32 | + Hyperlink link = (Hyperlink) actionEvent.getSource(); |
| 33 | + String id = link.getId(); |
| 34 | + if (id.equals("gameRulesLink")) |
| 35 | + textArea.setText(gameRules); |
| 36 | + else if (id.equals("newGameLink")) |
| 37 | + textArea.setText(startANewGame); |
| 38 | + else if (id.equals("highScoresLink")) |
| 39 | + textArea.setText(highScores); |
| 40 | + else if (id.equals("watchTheTimeLink")) |
| 41 | + textArea.setText(watchTheTime); |
| 42 | + else if (id.equals("reportBugsLink")) |
| 43 | + textArea.setText(reportBugs); |
| 44 | + else if (id.equals("helpDevelopLink")) |
| 45 | + textArea.setText(helpDevelop); |
| 46 | + } |
8 | 47 |
|
9 | 48 | public void closeAction(ActionEvent actionEvent) {
|
10 | 49 | Node node = (Node) actionEvent.getSource();
|
|
0 commit comments