|
|
@ -203,11 +203,11 @@ public class GameScreen extends MenuScreen {
|
|
|
|
return self.equals(uuid);
|
|
|
|
return self.equals(uuid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void onCardClicked(Card card) {
|
|
|
|
public void onCardClicked(@NotNull Card card) {
|
|
|
|
game.getClient().execute(Game.class, (s, c) -> s.onCardClicked(c, card));
|
|
|
|
game.getClient().execute(Game.class, (s, c) -> s.onCardClicked(c, card));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void onSuitClicked(Card.Suit suit) {
|
|
|
|
public void onSuitClicked(@NotNull Card.Suit suit) {
|
|
|
|
game.getClient().execute(Game.class, (s, c) -> s.onSuitClicked(c, suit));
|
|
|
|
game.getClient().execute(Game.class, (s, c) -> s.onSuitClicked(c, suit));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -241,7 +241,7 @@ public class GameScreen extends MenuScreen {
|
|
|
|
execute(() -> cardStack.clearChildren());
|
|
|
|
execute(() -> cardStack.clearChildren());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void finishTrick(UUID player) {
|
|
|
|
public void finishTrick(@NotNull UUID player) {
|
|
|
|
var seat = seats.getOrDefault(player, Seat.FALLBACK);
|
|
|
|
var seat = seats.getOrDefault(player, Seat.FALLBACK);
|
|
|
|
|
|
|
|
|
|
|
|
var action = parallel();
|
|
|
|
var action = parallel();
|
|
|
@ -272,7 +272,7 @@ public class GameScreen extends MenuScreen {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Updates the given players hand cards.
|
|
|
|
* Updates the given players hand cards.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void setHand(UUID player, List<Card> cards, boolean juggle) {
|
|
|
|
public void setHand(@NotNull UUID player, @NotNull List<Card> cards, boolean juggle) {
|
|
|
|
if (isSelf(player)) {
|
|
|
|
if (isSelf(player)) {
|
|
|
|
var sequence = sequence();
|
|
|
|
var sequence = sequence();
|
|
|
|
sequence.addAction(run(() -> {
|
|
|
|
sequence.addAction(run(() -> {
|
|
|
@ -291,7 +291,7 @@ public class GameScreen extends MenuScreen {
|
|
|
|
* Adds the prediction for the given round and player to the {@linkplain #padOfTruth pad of truth} and
|
|
|
|
* Adds the prediction for the given round and player to the {@linkplain #padOfTruth pad of truth} and
|
|
|
|
* shows a corresponding message.
|
|
|
|
* shows a corresponding message.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void addPrediction(int round, UUID player, int prediction, boolean changed) {
|
|
|
|
public void addPrediction(int round, @NotNull UUID player, int prediction, boolean changed) {
|
|
|
|
if (isSelf(player)) {
|
|
|
|
if (isSelf(player)) {
|
|
|
|
addMessage(game.messages.format("game.action." + (changed ? "change" : "make") + "_prediction.self", prediction));
|
|
|
|
addMessage(game.messages.format("game.action." + (changed ? "change" : "make") + "_prediction.self", prediction));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -299,13 +299,16 @@ public class GameScreen extends MenuScreen {
|
|
|
|
addMessage(game.messages.format("game.action." + (changed ? "change" : "make") + "_prediction.other", name, prediction));
|
|
|
|
addMessage(game.messages.format("game.action." + (changed ? "change" : "make") + "_prediction.other", name, prediction));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
execute(() -> padOfTruth.setPrediction(orderedPlayers.indexOf(player), round, prediction));
|
|
|
|
var index = orderedPlayers.indexOf(player);
|
|
|
|
|
|
|
|
if (index == -1) throw new NoSuchElementException();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
execute(() -> padOfTruth.setPrediction(index, round, prediction));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Removes the card from the players hand and puts it into the {@linkplain #cardStack stack}.
|
|
|
|
* Removes the card from the players hand and puts it into the {@linkplain #cardStack stack}.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void playCard(UUID player, Card card) {
|
|
|
|
public void playCard(@NotNull UUID player, @NotNull Card card) {
|
|
|
|
if (isSelf(player)) {
|
|
|
|
if (isSelf(player)) {
|
|
|
|
addMessage(game.messages.get("game.action.play_card.self"));
|
|
|
|
addMessage(game.messages.get("game.action.play_card.self"));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -336,11 +339,11 @@ public class GameScreen extends MenuScreen {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Adds the scores for a round to the corresponding row of the {@linkplain #padOfTruth pad of truth}.
|
|
|
|
* Adds the scores for a round to the corresponding row of the {@linkplain #padOfTruth pad of truth}.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void addScores(int round, Map<UUID, Integer> scores) {
|
|
|
|
public void addScores(int round, @NotNull Map<UUID, Integer> scores) {
|
|
|
|
execute(() -> {
|
|
|
|
execute(() -> {
|
|
|
|
for (int i = 0; i < orderedPlayers.size(); i++) {
|
|
|
|
for (int i = 0; i < orderedPlayers.size(); i++) {
|
|
|
|
UUID player = orderedPlayers.get(i);
|
|
|
|
UUID player = orderedPlayers.get(i);
|
|
|
|
padOfTruth.setScore(i, round, scores.get(player));
|
|
|
|
padOfTruth.setScore(i, round, scores.getOrDefault(player, 0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -356,10 +359,10 @@ public class GameScreen extends MenuScreen {
|
|
|
|
* Highlights the given players label and sets the {@linkplain #setPersistentMessage(String) persistent message}
|
|
|
|
* Highlights the given players label and sets the {@linkplain #setPersistentMessage(String) persistent message}
|
|
|
|
* accordingly.
|
|
|
|
* accordingly.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void setActivePlayer(UUID player, UserInputMessage.Action action, long timeout) {
|
|
|
|
public void setActivePlayer(@Nullable UUID player, @Nullable UserInputMessage.Action action, long timeout) {
|
|
|
|
execute(() -> nameLabels.forEach((p, l) -> l.setStyle(p.equals(player) ? labelStyleActive : labelStyleDefault)));
|
|
|
|
execute(() -> nameLabels.forEach((p, l) -> l.setStyle(p.equals(player) ? labelStyleActive : labelStyleDefault)));
|
|
|
|
|
|
|
|
|
|
|
|
if (isSelf(player) || player == null && action == null) {
|
|
|
|
if (isSelf(player) || action == null) {
|
|
|
|
setPersistentMessage(null);
|
|
|
|
setPersistentMessage(null);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
var key = switch (action) {
|
|
|
|
var key = switch (action) {
|
|
|
@ -390,7 +393,7 @@ public class GameScreen extends MenuScreen {
|
|
|
|
* Swaps the current {@linkplain #trumpCardActor trump card} (if present) with a {@linkplain Card#WEREWOLF werewolf}
|
|
|
|
* Swaps the current {@linkplain #trumpCardActor trump card} (if present) with a {@linkplain Card#WEREWOLF werewolf}
|
|
|
|
* card on the given players hand.
|
|
|
|
* card on the given players hand.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void swapTrumpCard(UUID player) {
|
|
|
|
public void swapTrumpCard(@NotNull UUID player) {
|
|
|
|
var seat = seats.getOrDefault(player, Seat.FALLBACK);
|
|
|
|
var seat = seats.getOrDefault(player, Seat.FALLBACK);
|
|
|
|
|
|
|
|
|
|
|
|
var sequence = sequence();
|
|
|
|
var sequence = sequence();
|
|
|
@ -448,7 +451,7 @@ public class GameScreen extends MenuScreen {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//<editor-fold desc="Overlays" defaultstate="collapsed">
|
|
|
|
//<editor-fold desc="Overlays" defaultstate="collapsed">
|
|
|
|
public void showTrumpOverlay(UUID player, Card trumpCard, Card.Suit trumpSuit) {
|
|
|
|
public void showTrumpOverlay(@Nullable UUID player, @NotNull Card trumpCard, @Nullable Card.Suit trumpSuit) {
|
|
|
|
if (trumpCardActor == null) {
|
|
|
|
if (trumpCardActor == null) {
|
|
|
|
trumpCardActor = new CardActor(Card.HIDDEN, atlas);
|
|
|
|
trumpCardActor = new CardActor(Card.HIDDEN, atlas);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -460,7 +463,7 @@ public class GameScreen extends MenuScreen {
|
|
|
|
execute(new TrumpOverlay(this, players.get(player), trumpCard, trumpSuit));
|
|
|
|
execute(new TrumpOverlay(this, players.get(player), trumpCard, trumpSuit));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void showColoredCardOverlay(Card card, long timeout) {
|
|
|
|
public void showColoredCardOverlay(@NotNull Card card, long timeout) {
|
|
|
|
if (card == Card.JUGGLER) {
|
|
|
|
if (card == Card.JUGGLER) {
|
|
|
|
execute(new PlayColoredCardOverlay(this, timeout, card, Card.JUGGLER_RED, Card.JUGGLER_GREEN, Card.JUGGLER_BLUE, Card.JUGGLER_YELLOW));
|
|
|
|
execute(new PlayColoredCardOverlay(this, timeout, card, Card.JUGGLER_RED, Card.JUGGLER_GREEN, Card.JUGGLER_BLUE, Card.JUGGLER_YELLOW));
|
|
|
|
} else if (card == Card.CLOUD) {
|
|
|
|
} else if (card == Card.CLOUD) {
|
|
|
@ -587,7 +590,7 @@ public class GameScreen extends MenuScreen {
|
|
|
|
return game.messages;
|
|
|
|
return game.messages;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Action animateJuggle(List<CardActor> removed, List<CardActor> added) {
|
|
|
|
private Action animateJuggle(@NotNull List<CardActor> removed, @NotNull List<CardActor> added) {
|
|
|
|
// find left- and rightmost seat
|
|
|
|
// find left- and rightmost seat
|
|
|
|
Seat tmpLeft = null, tmpRight = null;
|
|
|
|
Seat tmpLeft = null, tmpRight = null;
|
|
|
|
for (Seat seat : seats.values()) {
|
|
|
|
for (Seat seat : seats.values()) {
|
|
|
|