Browse Source

Refactor MouseInput

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

23
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,10 +99,8 @@ 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);
}
}
@ -116,6 +108,13 @@ public class MyMouseListener implements MouseInputListener {
}
private void clearSaveStack(BaseStack _ziel) {
// Alles wieder auf den Ursprünglichen Stack packen
while (!saveStack.stackIsEmpty()) {
_ziel.addCard(saveStack.removeLastCard());
}
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub

Loading…
Cancel
Save