Browse Source

Refactor MouseInput

feature_solitaer_AblageStack
Alexander Hartung 3 years ago
parent
commit
24f874a09d
  1. 21
      src/main/java/solitaer/MyMouseListener.java

21
src/main/java/solitaer/MyMouseListener.java

@ -65,14 +65,9 @@ public class MyMouseListener implements MouseInputListener {
System.out.println("ERROR selectedStack in StartStack");
}
if (tempStack.cardCheck(tempStack.peekLastCard(), saveStack.peekLastCard())) {
while (!saveStack.stackIsEmpty()) {
tempStack.addCard(saveStack.removeLastCard());
}
clearSaveStack(tempStack);
} else {
// Alles wieder auf den Ursprünglichen Stack packen
while (!saveStack.stackIsEmpty()) {
selectedStack.addCard(saveStack.removeLastCard());
}
clearSaveStack(selectedStack);
}
selectedStack = null;
@ -87,7 +82,6 @@ public class MyMouseListener implements MouseInputListener {
tempStack = (AblageStack) com;
} else {
tempStack = (AblageStack) com.getParent();
}
if (saveStack.stackIsEmpty()) {
@ -105,15 +99,20 @@ public class MyMouseListener implements MouseInputListener {
}
} else {
// Alles wieder auf den Ursprünglichen Stack packen
while (!saveStack.stackIsEmpty()) {
selectedStack.addCard(saveStack.removeLastCard());
//Clear Save
clearSaveStack(selectedStack);
}
}
}
}
private void clearSaveStack(BaseStack _ziel) {
// Alles wieder auf den Ursprünglichen Stack packen
while (!saveStack.stackIsEmpty()) {
_ziel.addCard(saveStack.removeLastCard());
}
}
@Override

Loading…
Cancel
Save