You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.4 KiB

package model;
import launcher.Main;
import java.io.IOException;
import java.io.Serializable;
public class DataTable implements Serializable {
private static int id = 0;
private int gameId;
private int Maxscore;
private int rounds;
private double timer;
public DataTable(int levelNumber) {
id++;
this.gameId = id;
}
public DataTable() {
id++;
this.gameId = id;
this.Maxscore = 0;
this.timer = 0;
this.rounds = 0;
//this.score=score; Calcul du score avec la difficulté !
}
//Function update
public void update(int score, String name, double time, int rounds) {
this.Maxscore = score;
this.timer = time;
this.rounds = rounds;
}
public void saveGame() {
Main.getDatabase().getDatabaseFiles().add(this);
try {
Main.serialize();
} catch (IOException e) {
System.out.println("Cant close stream");
}
}
public double getTimeElapsed() {
System.out.println(this.timer);
return this.timer;
}
public int maxScore() {
System.out.println(this.Maxscore);
return this.Maxscore;
}
public int getRounds(){
System.out.println(this.rounds);
return this.rounds;
}
public int getGameID(){
System.out.println(this.gameId);
return this.gameId;
}
}