diff --git a/src/main/java/solitaer/GeberStack.java b/src/main/java/solitaer/GeberStack.java index 1136daa..a974883 100644 --- a/src/main/java/solitaer/GeberStack.java +++ b/src/main/java/solitaer/GeberStack.java @@ -25,7 +25,9 @@ public class GeberStack extends BaseStack { public void swapWasteGeber() { while(wasteStack.stackIsEmpty() == false) { - this.addCard(wasteStack.removeLastCard()); + Card card = wasteStack.removeLastCard(); + card.setFaceUp(false); + this.addCard(card); } } diff --git a/src/main/java/solitaer/MyMouseListener.java b/src/main/java/solitaer/MyMouseListener.java index ee54111..2e227a2 100644 --- a/src/main/java/solitaer/MyMouseListener.java +++ b/src/main/java/solitaer/MyMouseListener.java @@ -105,9 +105,32 @@ public class MyMouseListener implements MouseInputListener { } } + // GeberStack + else if (com.getParent() instanceof GeberStack || com instanceof GeberStack) { - } + System.out.println("GeberStack"); + + if (com instanceof GeberStack) { + tempStack = (GeberStack) com; + } else { + tempStack = (GeberStack) com.getParent(); + } + + if (tempStack.stackIsEmpty()) { + // Move all from Waste to Geber + ((GeberStack) this.tempStack).swapWasteGeber(); + } else { + // Move next card to Waste + tempCard = tempStack.removeLastCard(); + tempCard.setFaceUp(true); + ((GeberStack) this.tempStack).getWastStack() + .addCard(tempCard); + + } + } + + } private void clearSaveStack(BaseStack _ziel) { // Alles wieder auf den Ursprünglichen Stack packen while (!saveStack.stackIsEmpty()) { diff --git a/src/main/java/solitaer/SolitaerGamePanel.java b/src/main/java/solitaer/SolitaerGamePanel.java index 834e22a..837bf33 100644 --- a/src/main/java/solitaer/SolitaerGamePanel.java +++ b/src/main/java/solitaer/SolitaerGamePanel.java @@ -80,6 +80,19 @@ public class SolitaerGamePanel extends JPanel { WasteStack w = new WasteStack(85, 10); GeberStack g = new GeberStack(10, 10, w); + deck.getDeck().get(34).setFaceUp(true); + w.addCard(deck.getDeck().get(34)); + deck.getDeck().get(35).setFaceUp(true); + w.addCard(deck.getDeck().get(35)); + deck.getDeck().get(36).setFaceUp(true); + w.addCard(deck.getDeck().get(36)); + deck.getDeck().get(37).setFaceUp(true); + w.addCard(deck.getDeck().get(37)); + + + g.addCard(deck.getDeck().get(38)); + + this.add(w); this.add(g);