Erstellung einer Facade
parent
7b77f7b381
commit
f6cc17002c
|
|
@ -1,4 +1,54 @@
|
||||||
package de.deversmann.facade;
|
package de.deversmann.facade;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Facade {
|
public class Facade {
|
||||||
|
private final CSVReader csvReader;
|
||||||
|
private final HighscoreManager_2_0 highscoreManager;
|
||||||
|
private final Zeiterfassung_2_0 zeiterfassung;
|
||||||
|
|
||||||
|
// Hier speichern wir das aktuell geladene Puzzle (mit Lösung)
|
||||||
|
private PuzzleData currentPuzzleData;
|
||||||
|
|
||||||
|
public Facade() {
|
||||||
|
this.csvReader = new CSVReader();
|
||||||
|
this.highscoreManager = new HighscoreManager_2_0();
|
||||||
|
this.zeiterfassung = new Zeiterfassung_2_0();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ladeSpielfeld(String csvPfad) throws IOException {
|
||||||
|
// Liest Puzzle + Lösung aus der CSV
|
||||||
|
this.currentPuzzleData = csvReader.readPuzzleWithSolution(csvPfad);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[][] getAktuellesPuzzle() {
|
||||||
|
return (currentPuzzleData != null)
|
||||||
|
? currentPuzzleData.getPuzzle()
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<int[]> getLoesungsKoordinaten() {
|
||||||
|
return (currentPuzzleData != null)
|
||||||
|
? currentPuzzleData.getSolutionCoordinates()
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startZeiterfassung() {
|
||||||
|
zeiterfassung.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public long stopZeiterfassung() {
|
||||||
|
zeiterfassung.stop();
|
||||||
|
return zeiterfassung.getElapsedTimeInSeconds();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addHighscore(int score) {
|
||||||
|
highscoreManager.addHighscore(score);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getAllHighscores() {
|
||||||
|
return highscoreManager.getHighscores();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue