int type = cardData.charAt(0);
int color = cardData.charAt(1);
int number = cardData.charAt(2);
try {
Card newCard = null;
if ((type == Card.JOKER) || (type == Card.JOKER4)) {
newCard = new Card(type);
} else {
newCard = new Card(color, type, number);
}
newCardStr = newCard.toString();
if (!hashCards.containsKey(newCardStr)) {
hashCards.put(newCardStr, newCard);
}
receivedDeck.addElement(hashCards.get(newCardStr));
} catch (IllegalArgumentException iae) {
//#ifdef DEBUG
System.out.println(type + "/" + color + "/" + number);
//#endif
}
}
int len = data.length();
int pos = data.charAt(len - 3);
int nPlayer = data.charAt(len - 2);
int atual = data.charAt(len - 1);
manager.createGame(receivedDeck, pos, nPlayer, atual);
break;
case MOVE:
int ppos = data.charAt(2);
MultiPlayer game = manager.getGame();
if (ppos == game.getLocalPlayerPos()) {
break;
}
Player player = game.getAtualPlayer();
//It tests if player made a move but doesn't have a card.
//Player's gotten a card then played it
if (player.checkHaveCard(game.getAtualColor(),
game.getTable().getUpCard()) == Player.NONE) {
game.penalize(player, 1);
}
int card = data.charAt(1);
int color = data.charAt(3);
try {
player.setAtual(card);
Card getCard = player.getCard(card);
//It tests if the player called uno
if (player.getNumberOfCards() == 2) {
if (data.charAt(4) == 1) {
game.penalize(player, 3);
} else {
game.getCanvas().drawCallUno();
}
}
if (game.jogada(player, getCard)) {
game.getEndForm(false);
break;
}
int type = getCard.getType();
if ((type == Card.JOKER) || (type == Card.JOKER4)) {
game.setColor(color);
}
game.getCanvas().refresh();