2023-10-05 23:32:29 +02:00
|
|
|
/*
|
|
|
|
============================================================
|
|
|
|
This is the "Spiel" file from Author: Philipp Kotte
|
|
|
|
written on: 05 / 10 / 2023 at: 23:25
|
|
|
|
============================================================
|
|
|
|
*/
|
|
|
|
package Facade;
|
|
|
|
|
2023-10-10 17:44:25 +02:00
|
|
|
import java.io.Serializable;
|
2023-10-10 12:38:27 +02:00
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import Domain.Spieler;
|
|
|
|
import Domain.Enums.Geschlecht;
|
|
|
|
|
2023-10-10 17:44:25 +02:00
|
|
|
public class Spiel implements Serializable {
|
2023-10-05 23:32:29 +02:00
|
|
|
|
2023-10-11 11:04:46 +02:00
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
// statische Konstanten
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
// statische Attribute(zB. zähler)
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
// Attribute jedes Objektes
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
|
2023-10-10 12:38:27 +02:00
|
|
|
private boolean istGestartet;
|
|
|
|
private boolean istBeendet;
|
|
|
|
private Spieler spielerAmZug;
|
|
|
|
private int runde;
|
2023-10-10 14:09:27 +02:00
|
|
|
private HashMap<Integer, Spieler> spieler = new HashMap<>();
|
|
|
|
private boolean[] id_check = { false, false, false, false, false, false };
|
2023-10-10 12:38:27 +02:00
|
|
|
|
2023-10-11 11:04:46 +02:00
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
// Konstruktoren (default und spezifische)
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
|
2023-10-10 12:38:27 +02:00
|
|
|
public Spiel() {
|
|
|
|
this.istGestartet = false;
|
|
|
|
this.istBeendet = false;
|
|
|
|
this.spielerAmZug = null;
|
|
|
|
this.runde = 0;
|
|
|
|
};
|
2023-10-11 11:04:46 +02:00
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
// statische Methoden
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
// Getter und Setter
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
|
|
|
|
public void setSpielGestartet(boolean gestarted) {
|
|
|
|
this.istGestartet = gestarted;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSpielBeendet(boolean beendet) {
|
|
|
|
this.istBeendet = beendet;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setRunde(int runde) {
|
|
|
|
this.runde = runde;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSpielerAmZug(Spieler spieler) {
|
|
|
|
this.spielerAmZug = spieler;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
// @Overrides
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
// öffentliche Methodes
|
|
|
|
/*--------------------------------------------------------*/
|
2023-10-10 12:38:27 +02:00
|
|
|
|
|
|
|
public void addSpieler(String name, Geschlecht geschlecht) {
|
2023-10-10 14:09:27 +02:00
|
|
|
int id = 1;
|
|
|
|
while (id_check[id - 1]) {
|
|
|
|
id++;
|
|
|
|
}
|
|
|
|
Spieler temp = new Spieler(id, name, geschlecht);
|
|
|
|
this.spieler.put(id, temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void removeSpieler(int id_spieler) {
|
|
|
|
this.spieler.remove(id_spieler);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String[] getAlleSpieler() {
|
2023-10-10 15:22:09 +02:00
|
|
|
String[] spieler_text = new String[this.spieler.size()];
|
|
|
|
for (int i = 0; i < this.spieler.size() - 1; i++) {
|
|
|
|
spieler_text[i] = this.spieler.get(i).toString();
|
2023-10-10 14:09:27 +02:00
|
|
|
}
|
2023-10-10 15:22:09 +02:00
|
|
|
return spieler_text;
|
2023-10-10 12:38:27 +02:00
|
|
|
}
|
|
|
|
|
2023-10-10 14:16:24 +02:00
|
|
|
public void starteSpiel() {
|
|
|
|
this.istGestartet = true;
|
|
|
|
// Gameloop?
|
|
|
|
}
|
2023-10-10 14:09:27 +02:00
|
|
|
|
2023-10-10 15:30:47 +02:00
|
|
|
public String[] getSpielerAmZug() {
|
|
|
|
return new String[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean istSpielGestartet() {
|
|
|
|
return this.istGestartet;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean istSpielBeendet() {
|
|
|
|
return this.istBeendet;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String[][] getBlock() {
|
|
|
|
return new String[0][0];
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getGewinner() {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getRunde() {
|
|
|
|
return this.runde;
|
|
|
|
}
|
|
|
|
|
2023-10-11 11:04:46 +02:00
|
|
|
public void mischen() {
|
2023-10-10 15:30:47 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void austeilen() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ausspielen(int idKarte) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void vorhersagen(int stiche) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-10-11 11:04:46 +02:00
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
// Hilfsmethoden (privat)
|
|
|
|
/*--------------------------------------------------------*/
|
|
|
|
|
2023-10-10 14:16:24 +02:00
|
|
|
}
|