Jonah Bauer 3 years ago
parent ce279246d6
commit dbcc91cd61

@ -0,0 +1,36 @@
package eu.jonahbauer.wizard.client.libgdx.actions;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.utils.Pool;
import com.badlogic.gdx.utils.Pools;
import lombok.Setter;
/** Removes an actor from the stage.
* @author Nathan Sweet */
public class ChangeParentAction extends Action {
private final Pool<Vector2> vectorPool = Pools.get(Vector2.class);
@Setter
private Group parent;
private boolean finished;
public boolean act (float delta) {
if (!finished) {
finished = true;
var pos = vectorPool.obtain();
pos.set(0, 0);
target.localToStageCoordinates(pos);
parent.stageToLocalCoordinates(pos);
target.setPosition(pos.x, pos.y);
parent.addActor(target);
vectorPool.free(pos);
}
return true;
}
public void restart () {
finished = false;
}
}

@ -0,0 +1,30 @@
package eu.jonahbauer.wizard.client.libgdx.actions;
import com.badlogic.gdx.scenes.scene2d.Action;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
public class MyActions extends Actions {
public static ChangeParentAction changeParent(Group parent) {
var action = action(ChangeParentAction.class);
action.setParent(parent);
return action;
}
public static <T extends Action> T target(T action, Actor target) {
action.setTarget(target);
return action;
}
static public SilentlyRemoveActorAction removeActorSilently () {
return action(SilentlyRemoveActorAction.class);
}
static public SilentlyRemoveActorAction removeActorSilently(Actor removeActor) {
var action = action(SilentlyRemoveActorAction.class);
action.setTarget(removeActor);
return action;
}
}

@ -0,0 +1,22 @@
package eu.jonahbauer.wizard.client.libgdx.actions;
import com.badlogic.gdx.scenes.scene2d.Action;
/** Removes an actor from the stage without immediately invalidating its parents. */
public class SilentlyRemoveActorAction extends Action {
private boolean removed;
public boolean act (float delta) {
if (!removed) {
removed = true;
if (target.getParent() != null) {
target.getParent().getChildren().removeValue(target, true);
}
}
return true;
}
public void restart () {
removed = false;
}
}

@ -103,12 +103,15 @@ public class CardActor extends Actor {
private Card card; private Card card;
private TextureRegion background; private TextureRegion background;
private TextureRegion border;
public CardActor(Card card, TextureAtlas atlas) { public CardActor(Card card, TextureAtlas atlas) {
this.atlas = atlas; this.atlas = atlas;
setCard(card); setCard(card);
setWidth(PREF_WIDTH); setWidth(PREF_WIDTH);
setHeight(PREF_HEIGHT); setHeight(PREF_HEIGHT);
setColor(0.8f, 0.8f, 0.8f, 1.0f);
border = atlas.findRegion(GameAtlas.CARDS_BORDER2);
} }
public void setCard(Card card) { public void setCard(Card card) {
@ -122,6 +125,7 @@ public class CardActor extends Actor {
batch.setColor(color.r, color.g, color.b, color.a * parentAlpha); batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
float height = getWidth() * ASPECT_RATIO; float height = getWidth() * ASPECT_RATIO;
batch.draw(background, getX(), getY() + getHeight() - height, getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(), getScaleY(), getRotation()); batch.draw(background, getX(), getY() + getHeight() - height, getOriginX(), getOriginY(), getWidth(), height, getScaleX(), getScaleY(), getRotation());
batch.draw(border, getX(), getY() + getHeight() - height, getOriginX(), getOriginY(), getWidth(), height, getScaleX(), getScaleY(), getRotation());
} }
} }

@ -12,7 +12,7 @@ import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;
public class CardStack extends Group { public class CardStack extends Group {
private static final float EXPAND_DURATION = 0.25f; private static final float EXPAND_DURATION = 0.25f;
private static final float EXPANDED_ROTATION_DEVIATION = 20; private static final float EXPANDED_ROTATION_DEVIATION = 10;
private static final float COLLAPSE_DURATION = 0.25f; private static final float COLLAPSE_DURATION = 0.25f;
private static final float COLLAPSED_ROTATION_DEVIATION = 60; private static final float COLLAPSED_ROTATION_DEVIATION = 60;
private static final float COLLAPSED_POSITION_DEVIATION = 15; private static final float COLLAPSED_POSITION_DEVIATION = 15;
@ -25,13 +25,11 @@ public class CardStack extends Group {
public CardStack() { public CardStack() {
this.addActor(hover); this.addActor(hover);
this.addListener(new ClickListener() { this.addListener(new InputListener() {
@Override @Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) { public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
super.exit(event, x, y, pointer, toActor); if (pointer == -1 && event.getTarget() == hover && expanded) {
if (event.getTarget() == hover && expanded) {
expanded = false; expanded = false;
cards.forEach(Entry::collapse); cards.forEach(Entry::collapse);
} }
@ -39,9 +37,7 @@ public class CardStack extends Group {
@Override @Override
public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) { public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
super.enter(event, x, y, pointer, fromActor); if (pointer == -1 && event.getTarget() == hover && !expanded) {
if (event.getTarget() == hover && !expanded) {
expanded = true; expanded = true;
cards.forEach(Entry::expand); cards.forEach(Entry::expand);
} }

@ -1,13 +1,15 @@
package eu.jonahbauer.wizard.client.libgdx.screens; package eu.jonahbauer.wizard.client.libgdx.screens;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Interpolation; import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.scenes.scene2d.ui.*; import com.badlogic.gdx.scenes.scene2d.ui.*;
import com.badlogic.gdx.scenes.scene2d.ui.Stack;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
import eu.jonahbauer.wizard.client.libgdx.GameAtlas; import eu.jonahbauer.wizard.client.libgdx.GameAtlas;
@ -26,13 +28,13 @@ import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*; import static eu.jonahbauer.wizard.client.libgdx.actions.MyActions.*;
public class GameScreen extends MenuScreen { public class GameScreen extends MenuScreen {
private final WizardGame game; private final WizardGame game;
private TextureAtlas atlas; private TextureAtlas atlas;
private TextureRegion background; private Drawable overlay;
private final List<UUID> players; private final List<UUID> players;
@ -56,6 +58,8 @@ public class GameScreen extends MenuScreen {
private CardStack cardStack; private CardStack cardStack;
private PadOfTruth padOfTruth; private PadOfTruth padOfTruth;
private CardActor trumpCardActor; private CardActor trumpCardActor;
private VerticalGroup messages;
private Map<UUID, Seat> seats = new HashMap<>(); private Map<UUID, Seat> seats = new HashMap<>();
private Map<UUID, Label> nameLabels = new HashMap<>(); private Map<UUID, Label> nameLabels = new HashMap<>();
@ -87,7 +91,7 @@ public class GameScreen extends MenuScreen {
public void show() { public void show() {
super.show(); super.show();
atlas = new TextureAtlas(Gdx.files.internal(GameAtlas.$PATH)); atlas = new TextureAtlas(Gdx.files.internal(GameAtlas.$PATH));
background = atlas.findRegion(GameAtlas.BACKGROUND); overlay = new TextureRegionDrawable(data.uiskinAtlas.findRegion(UiskinAtlas.WHITE)).tint(new Color(0,0,0,0.5f));
seat(); seat();
prepareLabels(); prepareLabels();
@ -96,9 +100,14 @@ public class GameScreen extends MenuScreen {
handCards.setOnClickListener(card -> playCard(self, card.getCard())); handCards.setOnClickListener(card -> playCard(self, card.getCard()));
var container = new Container<>(handCards); var container = new Container<>(handCards);
container.setPosition(360, 75); container.setPosition(360, 75);
container.setSize(1200, 210); container.setSize(1200, CardActor.PREF_HEIGHT);
container.fillX(); container.fillX();
messages = new VerticalGroup().columnCenter().bottom();
messages.setPosition(360, 85 + CardActor.PREF_HEIGHT);
messages.setSize(1200, 0);
messages.setTouchable(Touchable.disabled);
padOfTruth = new PadOfTruth(data.skin, new TextureRegionDrawable(atlas.findRegion(GameAtlas.PAD_OF_TRUTH))); padOfTruth = new PadOfTruth(data.skin, new TextureRegionDrawable(atlas.findRegion(GameAtlas.PAD_OF_TRUTH)));
padOfTruth.setPosition(1910 - 636f, 10); padOfTruth.setPosition(1910 - 636f, 10);
padOfTruth.setOrigin(636f, 0); padOfTruth.setOrigin(636f, 0);
@ -108,63 +117,77 @@ public class GameScreen extends MenuScreen {
setNames(); setNames();
var trump = new TextButton("Trump", data.skin); Gdx.input.setInputProcessor(data.stage);
data.stage.addActor(container);
data.stage.addActor(cardStack);
data.stage.addActor(padOfTruth);
data.stage.addActor(messages);
data.stage.addActor(debugButtons());
}
private Group debugButtons() {
var trump = new TextButton("Trump", data.skin, "simple");
trump.align(Align.left); trump.align(Align.left);
trump.addListener(new ChangeListener() { trump.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
setTrumpCard(Card.values()[(int)(Math.random() * Card.values().length)]); onMessage(new GameMessage(new TrumpMessage(
Card.values()[(int)(Math.random() * Card.values().length)],
Card.Suit.values()[(int)(Math.random() * Card.Suit.values().length)]
)));
} }
}); });
var playCard = new TextButton("Play Card", data.skin); var playCard = new TextButton("Play Card", data.skin, "simple");
playCard.addListener(new ChangeListener() { playCard.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
var hand = hands.get(self); var hand = hands.get(self);
if (hand != null && hand.size() > 0) { if (hand != null && hand.size() > 0) {
playCard(self, hand.get((int) (Math.random() * hand.size()))); onMessage(new GameMessage(new CardMessage(
self,
hand.get((int) (Math.random() * hand.size()))
)));
} }
} }
}); });
var deal = new TextButton("Deal", data.skin); var deal = new TextButton("Deal", data.skin, "simple");
deal.addListener(new ChangeListener() { deal.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
var hand = Stream.of(Card.values()).limit(20).toList(); var hand = Stream.of(Card.values()).limit(20).toList();
setHand(self, hand); onMessage(new GameMessage(new HandMessage(self, hand)));
} }
}); });
var round = new TextButton("Round", data.skin); var round = new TextButton("Round", data.skin, "simple");
round.addListener(new ChangeListener() { round.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
startRound(); onMessage(new GameMessage(new StateMessage("starting_round")));
round.setText("Round " + GameScreen.this.round); round.setText("Round " + GameScreen.this.round);
} }
}); });
var scores = new TextButton("Scores", data.skin); var scores = new TextButton("Scores", data.skin, "simple");
scores.addListener(new ChangeListener() { scores.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
var scores = players.stream().collect(Collectors.toMap(p -> p, p -> (int) (Math.random() * 5) * 10)); var scores = players.stream().collect(Collectors.toMap(p -> p, p -> (int) (Math.random() * 5) * 10));
addScores(scores); onMessage(new GameMessage(new ScoreMessage(scores)));
} }
}); });
var predictions = new TextButton("Predictions", data.skin); var predictions = new TextButton("Predictions", data.skin, "simple");
predictions.addListener(new ChangeListener() { predictions.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
var predictions = players.stream().collect(Collectors.toMap(p -> p, p -> (int) (Math.random() * 5))); players.forEach(player -> onMessage(new GameMessage(new PredictionMessage(player, (int) (Math.random() * 5)))));
predictions.forEach((player, prediction) -> addPrediction(player, prediction));
} }
}); });
var playOtherCard = new TextButton("Play Other Card", data.skin); var playOtherCard = new TextButton("Play Other Card", data.skin, "simple");
playOtherCard.addListener(new ChangeListener() { playOtherCard.addListener(new ChangeListener() {
@Override @Override
public void changed(ChangeEvent event, Actor actor) { public void changed(ChangeEvent event, Actor actor) {
@ -172,8 +195,8 @@ public class GameScreen extends MenuScreen {
UUID player; UUID player;
do { do {
player = players.get((int) (Math.random() * players.size())); player = players.get((int) (Math.random() * players.size()));
} while (player.equals(self)); } while (self.equals(player));
playCard(player, card); onMessage(new GameMessage(new CardMessage(player, card)));
} }
}); });
@ -186,12 +209,7 @@ public class GameScreen extends MenuScreen {
buttons.addActor(playCard); buttons.addActor(playCard);
buttons.addActor(playOtherCard); buttons.addActor(playOtherCard);
buttons.addActor(scores); buttons.addActor(scores);
return buttons;
Gdx.input.setInputProcessor(data.stage);
data.stage.addActor(container);
data.stage.addActor(cardStack);
data.stage.addActor(padOfTruth);
data.stage.addActor(buttons);
} }
@Override @Override
@ -200,8 +218,8 @@ public class GameScreen extends MenuScreen {
data.extendViewport.getWorldWidth() / WizardGame.WIDTH, data.extendViewport.getWorldWidth() / WizardGame.WIDTH,
data.extendViewport.getWorldHeight() / WizardGame.HEIGHT data.extendViewport.getWorldHeight() / WizardGame.HEIGHT
); );
game.batch.draw(data.background, 0,0, scale * WizardGame.WIDTH, scale * WizardGame.HEIGHT);
game.batch.setColor(1, 1, 1, 0.25f); game.batch.setColor(1, 1, 1, 0.25f);
game.batch.draw(data.background, 0,0, scale * WizardGame.WIDTH, scale * WizardGame.HEIGHT);
game.batch.draw( game.batch.draw(
data.title, data.title,
(data.extendViewport.getWorldWidth() - data.title.getRegionWidth() * 0.75f) / 2f, (data.extendViewport.getWorldWidth() - data.title.getRegionWidth() * 0.75f) / 2f,
@ -233,7 +251,7 @@ public class GameScreen extends MenuScreen {
private void prepareLabels() { private void prepareLabels() {
for (UUID player : players) { for (UUID player : players) {
if (player.equals(self)) continue; if (self.equals(player)) continue;
var label = new Label("", data.skin); var label = new Label("", data.skin);
var seat = seats.get(player); var seat = seats.get(player);
label.setX(seat.getLabelX()); label.setX(seat.getLabelX());
@ -257,16 +275,55 @@ public class GameScreen extends MenuScreen {
private void startRound() { private void startRound() {
round++; round++;
hands.clear();
tricks.clear(); tricks.clear();
predictions.clear(); predictions.clear();
trumpSuit = null; trumpSuit = null;
trumpCard = null; trumpCard = null;
handCards.clearChildren();
cardStack.clearChildren();
if (trumpCardActor != null) { if (trumpCardActor != null) {
trumpCardActor.remove(); trumpCardActor.remove();
} }
trick = -1;
handCards.clearChildren();
hands.clear();
cardStack.clearChildren();
stack.clear();
var group = new VerticalGroup().columnCenter().space(10f);
var overlay = new Container<>(group);
overlay.setBackground(this.overlay);
overlay.setBounds(0, 0, WizardGame.WIDTH, WizardGame.HEIGHT);
overlay.setTouchable(Touchable.enabled);
var label = new Label("Round " + (round + 1), data.skin, "enchanted");
label.setFontScale(1.5f);
group.addActor(label);
data.stage.addActor(overlay);
data.stage.addAction(sequence(
delay(2.0f),
target(alpha(0.0f, .1f, Interpolation.pow2Out), overlay),
removeActor(overlay)
));
}
private void startTrick() {
trick++;
setActivePlayer(null, null);
cardStack.clearChildren();
stack.clear();
}
private void finishTrick(UUID player, List<Card> cards) {
stack.clear();
tricks.computeIfAbsent(player, p -> new ArrayList<>()).add(cards);
// TODO
} }
private void setHand(UUID player, List<Card> cards) { private void setHand(UUID player, List<Card> cards) {
@ -274,11 +331,14 @@ public class GameScreen extends MenuScreen {
hand.clear(); hand.clear();
hand.addAll(cards); hand.addAll(cards);
handCards.update(hand); if (self.equals(player)) {
handCards.update(hand);
}
} }
private void setTrumpCard(Card trumpCard) { private void setTrump(Card trumpCard, Card.Suit trumpSuit) {
this.trumpCard = trumpCard; this.trumpCard = trumpCard;
this.trumpSuit = trumpSuit;
if (trumpCardActor != null) { if (trumpCardActor != null) {
trumpCardActor.remove(); trumpCardActor.remove();
} }
@ -291,42 +351,53 @@ public class GameScreen extends MenuScreen {
trumpCardActor = new CardActor(trumpCard, atlas); trumpCardActor = new CardActor(trumpCard, atlas);
} }
var background = new Container<>(); var group = new VerticalGroup().columnCenter().space(10f);
background.setBackground(new TextureRegionDrawable(data.uiskinAtlas.findRegion(UiskinAtlas.WHITE)));
background.setColor(0.0f, 0.0f, 0.0f, 0.5f);
background.setFillParent(true);
var screen = new Stack(); var overlay = new Container<>(group);
screen.setFillParent(true); overlay.setBackground(this.overlay);
screen.add(background); overlay.setBounds(0, 0, WizardGame.WIDTH, WizardGame.HEIGHT);
overlay.setTouchable(Touchable.enabled);
var group = new VerticalGroup().align(Align.center); String text = switch (trumpSuit) {
screen.add(group); case YELLOW -> "The trump suit is [#ffff00]yellow[#ffffff].";
case GREEN -> "The trump suit is [#00ff00]green[#ffffff].";
case BLUE -> "The trump suit is [#0000ff]blue[#ffffff].";
case RED -> "The trump suit is [#ff0000]red[#ffffff].";
default -> "There is no trump suit.";
};
var label = new Label("Determining trump", data.skin); var label = new Label(text, data.skin);
label.getStyle().font.getData().markupEnabled = true;
label.setFontScale(1.5f); label.setFontScale(1.5f);
group.addActor(label); group.addActor(label);
group.addActor(trumpCardActor); group.addActor(trumpCardActor);
data.stage.addActor(overlay);
data.stage.addAction(sequence( data.stage.addAction(sequence(
run(() -> data.stage.addActor(screen)), delay(2.0f),
delay(5.0f), parallel(
removeActor(label), sequence(
addAction(moveTo(10,10, .25f), trumpCardActor), target(alpha(0.0f, .1f, Interpolation.pow2Out), overlay),
delay(.25f), removeActor(overlay)
addAction(alpha(0.0f, .1f, Interpolation.pow2Out), background), ),
delay(.1f), sequence(
run(() -> data.stage.addActor(trumpCardActor)), removeActorSilently(trumpCardActor),
removeActor(screen) target(changeParent(data.stage.getRoot()), trumpCardActor),
target(moveTo(10,10, .25f), trumpCardActor)
)
)
)); ));
} }
private void addPrediction(UUID player, int prediction) { private void addPrediction(UUID player, int prediction) {
addMessage(names.get(player) + " predicted " + prediction + ".");
predictions.put(player, prediction); predictions.put(player, prediction);
padOfTruth.setPrediction(players.indexOf(player), round, prediction); padOfTruth.setPrediction(players.indexOf(player), round, prediction);
} }
private void playCard(UUID player, Card card) { private void playCard(UUID player, Card card) {
addMessage(names.get(player) + " played a card.");
var handCard = switch (card) { var handCard = switch (card) {
case CHANGELING_JESTER, CHANGELING_WIZARD -> Card.CHANGELING; case CHANGELING_JESTER, CHANGELING_WIZARD -> Card.CHANGELING;
case CLOUD_BLUE, CLOUD_RED, CLOUD_GREEN, CLOUD_YELLOW -> Card.CLOUD; case CLOUD_BLUE, CLOUD_RED, CLOUD_GREEN, CLOUD_YELLOW -> Card.CLOUD;
@ -341,7 +412,7 @@ public class GameScreen extends MenuScreen {
CardActor actor; CardActor actor;
Seat seat; Seat seat;
if (player.equals(self)) { if (self.equals(player)) {
actor = handCards.remove(handCard); actor = handCards.remove(handCard);
seat = Seat.BOTTOM; seat = Seat.BOTTOM;
} else { } else {
@ -363,6 +434,28 @@ public class GameScreen extends MenuScreen {
} }
} }
private void setActivePlayer(UUID player, UserInputMessage.Action action) {
if (activePlayer != null) {
nameLabels.get(activePlayer.getKey()).getStyle().fontColor = Color.WHITE;
}
if (player == null && action == null) {
activePlayer = null;
} else {
activePlayer = Pair.of(player, action);
nameLabels.get(activePlayer.getKey()).getStyle().fontColor = Color.RED;
}
}
private void addMessage(String text) {
var label = new Label(text, data.skin);
label.addAction(sequence(
delay(1.5f),
alpha(0, 0.25f),
removeActor()
));
messages.addActor(label);
}
@Override @Override
public void dispose() { public void dispose() {
super.dispose(); super.dispose();
@ -373,45 +466,26 @@ public class GameScreen extends MenuScreen {
if (serverMessage instanceof GameMessage gameMessage) { if (serverMessage instanceof GameMessage gameMessage) {
var observerMessage = gameMessage.getObserverMessage(); var observerMessage = gameMessage.getObserverMessage();
if (observerMessage instanceof CardMessage card) { if (observerMessage instanceof CardMessage card) {
stack.add(Pair.of(card.getPlayer(), card.getCard())); playCard(card.getPlayer(), card.getCard());
} else if (observerMessage instanceof TrickMessage trick) { } else if (observerMessage instanceof TrickMessage trick) {
stack.clear(); finishTrick(trick.getPlayer(), trick.getCards());
tricks.computeIfAbsent(trick.getPlayer(), p -> new ArrayList<>()).add(trick.getCards());
} else if (observerMessage instanceof HandMessage hand) { } else if (observerMessage instanceof HandMessage hand) {
var cards = hands.computeIfAbsent(hand.getPlayer(), p -> new ArrayList<>()); setHand(hand.getPlayer(), hand.getHand());
cards.clear();
cards.addAll(hand.getHand());
} else if (observerMessage instanceof ScoreMessage score) { } else if (observerMessage instanceof ScoreMessage score) {
var roundScores = scores.computeIfAbsent(round, r -> new HashMap<>()); addScores(score.getPoints());
roundScores.putAll(score.getPoints());
} else if (observerMessage instanceof TrumpMessage trump) { } else if (observerMessage instanceof TrumpMessage trump) {
trumpCard = trump.getCard(); setTrump(trump.getCard(), trump.getSuit());
trumpSuit = trump.getSuit();
//Todo update TrumpCardActor if trumpSuit != null and trumpCard != null
} else if (observerMessage instanceof PredictionMessage prediction) { } else if (observerMessage instanceof PredictionMessage prediction) {
predictions.put(prediction.getPlayer(), prediction.getPrediction()); addPrediction(prediction.getPlayer(), prediction.getPrediction());
//TODO update table and label
} else if (observerMessage instanceof UserInputMessage userInput) { } else if (observerMessage instanceof UserInputMessage userInput) {
activePlayer = Pair.of(userInput.getPlayer(), userInput.getAction()); setActivePlayer(userInput.getPlayer(), userInput.getAction());
if (self.equals(userInput.getPlayer())) { if (self.equals(userInput.getPlayer())) {
// TODO do something // TODO do something
} }
} else if (observerMessage instanceof StateMessage state) { } else if (observerMessage instanceof StateMessage state) {
switch (state.getState()) { switch (state.getState()) {
case "starting_round" -> { case "starting_round" -> startRound();
round++; case "starting_trick" -> startTrick();
trick = -1;
hands.clear();
predictions.clear();
tricks.clear();
trumpSuit = null;
trumpCard = null;
}
case "starting_trick" -> {
trick++;
stack.clear();
activePlayer = null;
}
case "finished", "error" -> { case "finished", "error" -> {
// TODO do something // TODO do something
} }

@ -105,7 +105,8 @@ public abstract class MenuScreen implements Screen {
@Override @Override
public final void render(float delta) { public final void render(float delta) {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT | (Gdx.graphics.getBufferFormat().coverageSampling?GL20.GL_COVERAGE_BUFFER_BIT_NV:0));
// Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
data.extendViewport.apply(true); data.extendViewport.apply(true);
game.batch.setProjectionMatrix(data.extendViewport.getCamera().combined); game.batch.setProjectionMatrix(data.extendViewport.getCamera().combined);

@ -49,6 +49,12 @@
"downFontColor": "dark_gold", "downFontColor": "dark_gold",
"disabledFontColor" : "darker_gold" "disabledFontColor" : "darker_gold"
}, },
"simple": {
"font": "default-font",
"fontColor": "white",
"downFontColor": "light_gray",
"disabledFontColor": "light_gray"
},
"toggle": { "toggle": {
"down": "default-round-down", "down": "default-round-down",
"up": "default-round", "up": "default-round",
@ -125,6 +131,10 @@
"font": "default-font", "font": "default-font",
"fontColor": "white" "fontColor": "white"
}, },
"enchanted": {
"font": "enchanted",
"fontColor": "gold"
},
"textfield": { "textfield": {
"background": "textfield", "background": "textfield",
"font": "default-font", "font": "default-font",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 45 KiB

@ -10,6 +10,7 @@ public class DesktopLauncher {
config.setTitle("Wizard Jubilaeumsedition 2021"); config.setTitle("Wizard Jubilaeumsedition 2021");
config.setForegroundFPS(60); config.setForegroundFPS(60);
config.setWindowSizeLimits(853, 480, -1, -1); config.setWindowSizeLimits(853, 480, -1, -1);
config.setBackBufferConfig(8, 8, 8, 8, 16, 0, 32);
new Lwjgl3Application(new WizardGame(), config); new Lwjgl3Application(new WizardGame(), config);
} }
} }

Loading…
Cancel
Save