|
|
@ -59,18 +59,18 @@ public class MyMouseListener implements MouseInputListener { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//saveStack is NOT empty |
|
|
|
// saveStack is NOT empty |
|
|
|
else { |
|
|
|
if(selectedStack == null) { |
|
|
|
if (selectedStack == null) { |
|
|
|
System.out.println("ERROR selectedStack in StartStack"); |
|
|
|
} |
|
|
|
if(tempStack.cardCheck(tempStack.peekLastCard(), saveStack.peekLastCard())) { |
|
|
|
while(!saveStack.stackIsEmpty()) { |
|
|
|
if (tempStack.cardCheck(tempStack.peekLastCard(), saveStack.peekLastCard())) { |
|
|
|
while (!saveStack.stackIsEmpty()) { |
|
|
|
tempStack.addCard(saveStack.removeLastCard()); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//Alles wieder auf den Ursprünglichen Stack packen |
|
|
|
while(!saveStack.stackIsEmpty()) { |
|
|
|
// Alles wieder auf den Ursprünglichen Stack packen |
|
|
|
while (!saveStack.stackIsEmpty()) { |
|
|
|
selectedStack.addCard(saveStack.removeLastCard()); |
|
|
|
} |
|
|
|
} |
|
|
@ -78,6 +78,41 @@ public class MyMouseListener implements MouseInputListener { |
|
|
|
selectedStack = null; |
|
|
|
} |
|
|
|
} |
|
|
|
// AblageStack |
|
|
|
else if (com.getParent() instanceof AblageStack || com instanceof AblageStack) { |
|
|
|
|
|
|
|
System.out.println("AblageStack"); |
|
|
|
|
|
|
|
if (com instanceof AblageStack) { |
|
|
|
tempStack = (AblageStack) com; |
|
|
|
} else { |
|
|
|
tempStack = (AblageStack) com.getParent(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (saveStack.stackIsEmpty()) { |
|
|
|
// Move Top Card from AblageStack in Save |
|
|
|
if (tempStack.stackIsEmpty() == false) { |
|
|
|
saveStack.addCard(tempStack.removeLastCard()); |
|
|
|
selectedStack = tempStack; |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
// Move Card from Save in AblageStack |
|
|
|
if (saveStack.stackSize() == 1) { |
|
|
|
if (tempStack.cardCheck(tempStack.peekLastCard(), saveStack.peekLastCard())) { |
|
|
|
tempStack.addCard(saveStack.removeLastCard()); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
// Alles wieder auf den Ursprünglichen Stack packen |
|
|
|
while (!saveStack.stackIsEmpty()) { |
|
|
|
selectedStack.addCard(saveStack.removeLastCard()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|