This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
JRummikub/src/jrummikub/control/RoundControl.java

70 lines
1.3 KiB
Java
Raw Normal View History

package jrummikub.control;
import jrummikub.model.IGameState;
import jrummikub.model.IHand;
import jrummikub.model.Position;
import jrummikub.util.IListener;
import jrummikub.view.IView;
public class RoundControl {
private IGameState gameState;
private IView view;
public RoundControl(IGameState gameState, IView view) {
this.gameState = gameState;
this.view = view;
}
public void startRound() {
deal();
view.getStartTurnEvent().add(new IListener() {
@Override
public void handle() {
startTurn();
}
});
view.enableStartTurnPanel(true);
view.getTablePanel().setStoneSets(gameState.getTable().clone());
}
private void startTurn() {
TurnControl turnControl = new TurnControl(gameState.getActivePlayer()
.getHand(), gameState.getTable(), view);
}
void deal() {
for (int i = 0; i < gameState.getPlayerCount(); i++) {
IHand hand = gameState.getPlayer(i).getHand();
for (int j = 0; j < 7; j++) {
hand.drop(gameState.getGameHeap().drawStone(), new Position(j, 0));
hand.drop(gameState.getGameHeap().drawStone(), new Position(j, 1));
}
}
}
private void endOfTurn() {
}
private void ruleCheck() {
}
private void resetTable() {
}
private void preparePlayerTurn() {
}
private void dealStone() {
}
}