refactored the GameStates
This commit is contained in:
parent
49d958652a
commit
1178730173
Binary file not shown.
BIN
bin/cards/maumau/model/Canceled.class
Normal file
BIN
bin/cards/maumau/model/Canceled.class
Normal file
Binary file not shown.
BIN
bin/cards/maumau/model/Finished.class
Normal file
BIN
bin/cards/maumau/model/Finished.class
Normal file
Binary file not shown.
BIN
bin/cards/maumau/model/GameState.class
Normal file
BIN
bin/cards/maumau/model/GameState.class
Normal file
Binary file not shown.
BIN
bin/cards/maumau/model/Initialized.class
Normal file
BIN
bin/cards/maumau/model/Initialized.class
Normal file
Binary file not shown.
BIN
bin/cards/maumau/model/JackChosen.class
Normal file
BIN
bin/cards/maumau/model/JackChosen.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/cards/maumau/model/Normal.class
Normal file
BIN
bin/cards/maumau/model/Normal.class
Normal file
Binary file not shown.
BIN
bin/cards/maumau/model/SevenChosen.class
Normal file
BIN
bin/cards/maumau/model/SevenChosen.class
Normal file
Binary file not shown.
BIN
bin/cards/maumau/model/SuitChosen.class
Normal file
BIN
bin/cards/maumau/model/SuitChosen.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -21,7 +21,7 @@ class ActionHandler {
|
||||
*/
|
||||
ActionHandler(MauMau game) {
|
||||
this.game = game;
|
||||
gameState = new Initialized();
|
||||
gameState = new Initialized(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cards.maumau.model.gamestate;
|
||||
package cards.maumau.model;
|
||||
|
||||
public class Canceled implements GameState{
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cards.maumau.model.gamestate;
|
||||
package cards.maumau.model;
|
||||
|
||||
public class Finished implements GameState{
|
||||
|
17
src/cards/maumau/model/GameState.java
Normal file
17
src/cards/maumau/model/GameState.java
Normal file
@ -0,0 +1,17 @@
|
||||
package cards.maumau.model;
|
||||
|
||||
import cards.Card;
|
||||
import cards.Suit;
|
||||
|
||||
|
||||
public interface GameState {
|
||||
public void addPlayer(Player player);
|
||||
public void startGame();
|
||||
public void finishGame();
|
||||
public void cancelGame();
|
||||
public void chooseCard(Card c);
|
||||
public void chooseSuit(Suit suit);
|
||||
public void skip();
|
||||
public void no7();
|
||||
boolean canPlay(Card c);
|
||||
}
|
16
src/cards/maumau/model/Initialized.java
Normal file
16
src/cards/maumau/model/Initialized.java
Normal file
@ -0,0 +1,16 @@
|
||||
package cards.maumau.model;
|
||||
|
||||
public class Initialized implements GameState {
|
||||
|
||||
private final ActionHandler handler;
|
||||
|
||||
Initialized(ActionHandler handler) {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
public void addPlayer(Player player) {
|
||||
handler.getGame().getPlayerHandler().addPlayer(player);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package cards.maumau.model.gamestate;
|
||||
package cards.maumau.model;
|
||||
|
||||
public class JackChosen implements GameState{
|
||||
|
@ -61,7 +61,7 @@ public class MauMau {
|
||||
*
|
||||
* @return The player handler.
|
||||
*/
|
||||
PlayerHandler getPlayerHandler() {
|
||||
public PlayerHandler getPlayerHandler() {
|
||||
return playerHandler;
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public class MauMau {
|
||||
*
|
||||
* @return The card handler.
|
||||
*/
|
||||
CardHandler getCardHandler() {
|
||||
public CardHandler getCardHandler() {
|
||||
return cardHandler;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cards.maumau.model.gamestate;
|
||||
package cards.maumau.model;
|
||||
|
||||
public class Normal implements GameState{
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cards.maumau.model.gamestate;
|
||||
package cards.maumau.model;
|
||||
|
||||
public class SevenChosen implements GameState{
|
||||
|
@ -1,4 +1,4 @@
|
||||
package cards.maumau.model.gamestate;
|
||||
package cards.maumau.model;
|
||||
|
||||
public class SuitChosen implements GameState{
|
||||
|
@ -1,5 +0,0 @@
|
||||
package cards.maumau.model.gamestate;
|
||||
|
||||
public interface GameState {
|
||||
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package cards.maumau.model.gamestate;
|
||||
|
||||
|
||||
public class Initialized implements GameState {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user