added support for changeling and improved support for cloud and juggler

main
Jonah Bauer 3 years ago
parent e00b93d13c
commit 2b23785a6a

@ -0,0 +1,62 @@
package eu.jonahbauer.wizard.client.libgdx.actions.overlay;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import eu.jonahbauer.wizard.client.libgdx.actors.CardActor;
import eu.jonahbauer.wizard.client.libgdx.screens.GameScreen;
import eu.jonahbauer.wizard.common.model.Card;
import org.jetbrains.annotations.NotNull;
import java.util.EnumMap;
public class PlayChangelingOverlay extends Overlay implements InteractionOverlay {
public PlayChangelingOverlay(@NotNull GameScreen gameScreen, long timeout) {
super(gameScreen, timeout);
}
@Override
public Actor createContent() {
var root = new VerticalGroup().columnCenter().space(10);
var prompt = new Label(messages.get("game.overlay.play_changeling.prompt"), skin);
var cardGroup = new HorizontalGroup().space(20);
var wizard = new CardActor(Card.CHANGELING_WIZARD, atlas);
var jester = new CardActor(Card.CHANGELING_JESTER, atlas);
cardGroup.addActor(wizard);
cardGroup.addActor(jester);
cardGroup.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (isClosing()) return;
var target = event.getTarget();
if (target == wizard) {
screen.onCardClicked(Card.CHANGELING_WIZARD);
} else if (target == jester) {
screen.onCardClicked(Card.CHANGELING_JESTER);
}
}
});
root.addActor(prompt);
root.addActor(cardGroup);
var cancel = new TextButton(messages.get("game.overlay.play_changeling.cancel"), skin, "simple");
cancel.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
close();
}
});
root.addActor(cancel);
return root;
}
}

@ -18,9 +18,9 @@ import java.util.NoSuchElementException;
@Getter
@Setter
public class CardActor extends Actor {
public static final float ASPECT_RATIO = 14.4f / 9f;
public static final float ASPECT_RATIO = 400f / 260f;
public static final float PREF_WIDTH = 135;
public static final float PREF_HEIGHT = 216;
public static final float PREF_HEIGHT = 208;
private static final Map<Card, String> ATLAS_PATHS;
@ -80,12 +80,22 @@ public class CardActor extends Actor {
case GREEN_11 -> GameAtlas.CARDS_GREEN_11;
case GREEN_12 -> GameAtlas.CARDS_GREEN_12;
case GREEN_13 -> GameAtlas.CARDS_GREEN_13;
case JUGGLER, JUGGLER_BLUE, JUGGLER_GREEN, JUGGLER_RED, JUGGLER_YELLOW -> GameAtlas.CARDS_JUGGLER;
case CLOUD, CLOUD_BLUE, CLOUD_GREEN, CLOUD_RED, CLOUD_YELLOW -> GameAtlas.CARDS_CLOUD;
case JUGGLER -> GameAtlas.CARDS_JUGGLER;
case JUGGLER_BLUE -> GameAtlas.CARDS_JUGGLER_BLUE;
case JUGGLER_RED -> GameAtlas.CARDS_JUGGLER_RED;
case JUGGLER_GREEN -> GameAtlas.CARDS_JUGGLER_GREEN;
case JUGGLER_YELLOW -> GameAtlas.CARDS_JUGGLER_YELLOW;
case CLOUD -> GameAtlas.CARDS_CLOUD;
case CLOUD_GREEN -> GameAtlas.CARDS_CLOUD_GREEN;
case CLOUD_RED -> GameAtlas.CARDS_CLOUD_RED;
case CLOUD_YELLOW -> GameAtlas.CARDS_CLOUD_YELLOW;
case CLOUD_BLUE -> GameAtlas.CARDS_CLOUD_BLUE;
case BOMB -> GameAtlas.CARDS_BOMB;
case FAIRY -> GameAtlas.CARDS_FAIRY;
case DRAGON -> GameAtlas.CARDS_DRAGON;
case CHANGELING, CHANGELING_JESTER, CHANGELING_WIZARD -> GameAtlas.CARDS_CHANGELING;
case CHANGELING -> GameAtlas.CARDS_CHANGELING;
case CHANGELING_WIZARD -> GameAtlas.CARDS_CHANGELING_WIZARD;
case CHANGELING_JESTER -> GameAtlas.CARDS_CHANGELING_JESTER;
case BLUE_JESTER -> GameAtlas.CARDS_BLUE_JESTER;
case RED_JESTER -> GameAtlas.CARDS_RED_JESTER;
case GREEN_JESTER -> GameAtlas.CARDS_GREEN_JESTER;
@ -105,11 +115,9 @@ public class CardActor extends Actor {
private Card card;
private TextureRegion background;
private TextureRegion border;
private CardActor(TextureAtlas atlas) {
this.atlas = atlas;
this.border = atlas.findRegion(GameAtlas.CARDS_BORDER2);
setWidth(PREF_WIDTH);
setHeight(PREF_HEIGHT);
setOrigin(PREF_WIDTH / 2, PREF_HEIGHT / 2);
@ -150,6 +158,5 @@ public class CardActor extends Actor {
float height = getWidth() * ASPECT_RATIO;
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());
}
}

@ -733,7 +733,7 @@ public class GameScreen extends WizardScreen {
execute(new TrumpOverlay(this, players.get(player), trumpCard, trumpSuit));
}
public PlayColoredCardOverlay showColoredCardOverlay(@NotNull Card card, long timeout) {
public InteractionOverlay showSpecialCardOverlay(@NotNull Card card, long timeout) {
if (card == Card.JUGGLER) {
var overlay = new PlayColoredCardOverlay(this, timeout, card, Card.JUGGLER_RED, Card.JUGGLER_GREEN, Card.JUGGLER_BLUE, Card.JUGGLER_YELLOW);
execute(overlay);
@ -742,6 +742,10 @@ public class GameScreen extends WizardScreen {
var overlay = new PlayColoredCardOverlay(this, timeout, card, Card.CLOUD_RED, Card.CLOUD_GREEN, Card.CLOUD_BLUE, Card.CLOUD_YELLOW);
execute(overlay);
return overlay;
} else if (card == Card.CHANGELING) {
var overlay = new PlayChangelingOverlay(this, timeout);
execute(overlay);
return overlay;
} else {
throw new IllegalArgumentException();
}

@ -252,7 +252,7 @@ public final class Game extends BaseState {
hand.remove(handCard);
}
if (gameScreen != null) gameScreen.playCard(player, handCard);
if (gameScreen != null) gameScreen.playCard(player, card);
}
private void onScoreMessage(@Unmodifiable Map<@NotNull UUID, @NotNull Integer> points) {
@ -330,11 +330,11 @@ public final class Game extends BaseState {
assert gameScreen != null;
if (isActive()) {
if (currentInteraction.action() == PLAY_CARD) {
if (card == Card.CLOUD || card == Card.JUGGLER) {
if (card == Card.CLOUD || card == Card.JUGGLER || card == Card.CHANGELING) {
var oldOverlay = currentInteraction.overlay();
if (oldOverlay != null) oldOverlay.close();
currentInteraction.overlay(gameScreen.showColoredCardOverlay(card, currentInteraction.timeout()));
currentInteraction.overlay(gameScreen.showSpecialCardOverlay(card, currentInteraction.timeout()));
} else {
send(client, new PlayCardMessage(card));
}

@ -234,3 +234,6 @@ game.overlay.trump.unknown.player=The trump suit is yet to be determined by {0}
game.overlay.play_colored_card.prompt=Pick a color
game.overlay.play_colored_card.cancel=Cancel
game.overlay.play_changeling.prompt=Do you want to play the changeling as a wizard or a jester?
game.overlay.play_changeling.cancel=Cancel

@ -220,7 +220,10 @@ game.overlay.trump.green.player={0} hat die Trumpffarbe [#00ff00]grün[] gewähl
game.overlay.trump.blue.player={0} hat die Trumpffarbe [#0000ff]blau[] gewählt
game.overlay.trump.red.player={0} hat die Trumpffarbe [#ff0000]rot[] gewählt
game.overlay.trump.none.player={0} hat entschieden, dass es diese Runde keinen Trump geben wird
game.overlay.trump.unknown.player={0} muss die Trumpffarbe muss noch bestimmen
game.overlay.trump.unknown.player={0} muss die Trumpffarbe noch bestimmen
game.overlay.play_colored_card.prompt=Wähle eine Farbe
game.overlay.play_colored_card.cancel=Abbrechen
game.overlay.play_changeling.prompt=Möchtest du den Gestaltwandler als Zauberer oder als Narr spielen?
game.overlay.play_changeling.cancel=Abbrechen

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save