Ehhhhh... fix stone positions in the correct place.
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@204 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
3338af2d43
commit
8a3439f736
2 changed files with 16 additions and 16 deletions
|
@ -73,17 +73,14 @@ public class RoundControl {
|
||||||
for (int i = 0; i < gameState.getPlayerCount(); i++) {
|
for (int i = 0; i < gameState.getPlayerCount(); i++) {
|
||||||
IHand hand = gameState.getNthNextPlayer(i).getHand();
|
IHand hand = gameState.getNthNextPlayer(i).getHand();
|
||||||
for (int j = 0; j < 7; j++) {
|
for (int j = 0; j < 7; j++) {
|
||||||
hand.drop(gameState.getGameHeap().drawStone(), new Position(j,
|
hand.drop(gameState.getGameHeap().drawStone(), new Position(j, 0));
|
||||||
0));
|
hand.drop(gameState.getGameHeap().drawStone(), new Position(j, 1));
|
||||||
hand.drop(gameState.getGameHeap().drawStone(), new Position(j,
|
|
||||||
1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void endOfTurn() {
|
private void endOfTurn() {
|
||||||
Set<Stone> tableDiff = tableDifference(gameState.getTable(),
|
Set<Stone> tableDiff = tableDifference(gameState.getTable(), clonedTable);
|
||||||
clonedTable);
|
|
||||||
|
|
||||||
if (!tableDiff.isEmpty()) { // Player has made a move
|
if (!tableDiff.isEmpty()) { // Player has made a move
|
||||||
if (clonedTable.isValid()) {
|
if (clonedTable.isValid()) {
|
||||||
|
@ -131,7 +128,7 @@ public class RoundControl {
|
||||||
.getActivePlayer()
|
.getActivePlayer()
|
||||||
.getHand()
|
.getHand()
|
||||||
.drop(gameState.getGameHeap().drawStone(),
|
.drop(gameState.getGameHeap().drawStone(),
|
||||||
new Position(7 + (int) (Math.random() * 6), 0.5f));
|
new Position(HAND_WIDTH - 1, HAND_HEIGHT - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dealPenalty(int count) {
|
private void dealPenalty(int count) {
|
||||||
|
|
|
@ -24,8 +24,7 @@ public class TurnControl {
|
||||||
static class HandStonePositionComparator implements
|
static class HandStonePositionComparator implements
|
||||||
Comparator<Pair<Stone, Position>> {
|
Comparator<Pair<Stone, Position>> {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Pair<Stone, Position> pair1,
|
public int compare(Pair<Stone, Position> pair1, Pair<Stone, Position> pair2) {
|
||||||
Pair<Stone, Position> pair2) {
|
|
||||||
Position pos1 = pair1.getSecond(), pos2 = pair2.getSecond();
|
Position pos1 = pair1.getSecond(), pos2 = pair2.getSecond();
|
||||||
if (pos1.getY() < pos2.getY()) {
|
if (pos1.getY() < pos2.getY()) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -81,8 +80,8 @@ public class TurnControl {
|
||||||
connections.add(view.getPlayerPanel().getEndTurnEvent()
|
connections.add(view.getPlayerPanel().getEndTurnEvent()
|
||||||
.add(endOfTurnListener));
|
.add(endOfTurnListener));
|
||||||
|
|
||||||
connections.add(view.getPlayerPanel().getHandPanel()
|
connections.add(view.getPlayerPanel().getHandPanel().getStoneClickEvent()
|
||||||
.getStoneClickEvent().add(new IListener2<Stone, Boolean>() {
|
.add(new IListener2<Stone, Boolean>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(Stone stone, Boolean collect) {
|
public void handle(Stone stone, Boolean collect) {
|
||||||
|
@ -90,8 +89,8 @@ public class TurnControl {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
connections.add(view.getPlayerPanel().getHandPanel()
|
connections.add(view.getPlayerPanel().getHandPanel().getRangeClickEvent()
|
||||||
.getRangeClickEvent().add(new IListener2<Stone, Boolean>() {
|
.add(new IListener2<Stone, Boolean>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(Stone stone, Boolean collect) {
|
public void handle(Stone stone, Boolean collect) {
|
||||||
|
@ -348,11 +347,15 @@ public class TurnControl {
|
||||||
table.drop(joinedSet, newPos);
|
table.drop(joinedSet, newPos);
|
||||||
} else {
|
} else {
|
||||||
StoneSet joinedSet = new StoneSet(selectedStones).join(newSet);
|
StoneSet joinedSet = new StoneSet(selectedStones).join(newSet);
|
||||||
table.drop(joinedSet, new Position(newPos.getX()
|
table.drop(joinedSet,
|
||||||
- selectedStones.size(), newPos.getY()));
|
new Position(newPos.getX() - selectedStones.size(), newPos.getY()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
table.drop(new StoneSet(selectedStones), new Position(RoundControl.HAND_WIDTH-1, RoundControl.HAND_HEIGHT-1));
|
table.drop(
|
||||||
|
new StoneSet(selectedStones),
|
||||||
|
new Position(
|
||||||
|
pos.getX() + (set.size() - selectedStones.size()) * 0.5f, pos
|
||||||
|
.getY()));
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedStones.clear();
|
selectedStones.clear();
|
||||||
|
|
Reference in a new issue