Add tests for hand auto-sort
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@203 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
8e73d1ab37
commit
3338af2d43
3 changed files with 130 additions and 10 deletions
|
@ -21,7 +21,7 @@ import jrummikub.util.Pair;
|
|||
import jrummikub.view.IView;
|
||||
|
||||
public class TurnControl {
|
||||
private static class HandStoneComparator implements
|
||||
static class HandStonePositionComparator implements
|
||||
Comparator<Pair<Stone, Position>> {
|
||||
@Override
|
||||
public int compare(Pair<Stone, Position> pair1,
|
||||
|
@ -161,6 +161,20 @@ public class TurnControl {
|
|||
connectorClick(set, true);
|
||||
}
|
||||
}));
|
||||
connections.add(view.getPlayerPanel().getSortByGroupsEvent()
|
||||
.add(new IListener() {
|
||||
@Override
|
||||
public void handle() {
|
||||
sortByGroups();
|
||||
}
|
||||
}));
|
||||
connections.add(view.getPlayerPanel().getSortByRunsEvent()
|
||||
.add(new IListener() {
|
||||
@Override
|
||||
public void handle() {
|
||||
sortByRuns();
|
||||
}
|
||||
}));
|
||||
|
||||
view.getPlayerPanel().getHandPanel().setStones(hand.clone());
|
||||
view.enableStartTurnPanel(false);
|
||||
|
@ -168,11 +182,11 @@ public class TurnControl {
|
|||
timer.startTimer();
|
||||
}
|
||||
|
||||
private void sortByValue() {
|
||||
private void sortByRuns() {
|
||||
|
||||
}
|
||||
|
||||
private void sortByColor() {
|
||||
private void sortByGroups() {
|
||||
|
||||
}
|
||||
|
||||
|
@ -286,7 +300,7 @@ public class TurnControl {
|
|||
handPairs.add(entry);
|
||||
}
|
||||
|
||||
Collections.sort(handPairs, new HandStoneComparator());
|
||||
Collections.sort(handPairs, new HandStonePositionComparator());
|
||||
|
||||
List<Stone> handStones = new ArrayList<Stone>();
|
||||
for (Pair<Stone, Position> entry : handPairs) {
|
||||
|
@ -338,8 +352,7 @@ public class TurnControl {
|
|||
- selectedStones.size(), newPos.getY()));
|
||||
}
|
||||
} else {
|
||||
table.drop(new StoneSet(selectedStones), new Position(pos.getX()
|
||||
+ (set.size() - selectedStones.size()) * 0.5f, pos.getY()));
|
||||
table.drop(new StoneSet(selectedStones), new Position(RoundControl.HAND_WIDTH-1, RoundControl.HAND_HEIGHT-1));
|
||||
}
|
||||
|
||||
selectedStones.clear();
|
||||
|
|
Reference in a new issue