This commit is contained in:
2022-01-13 22:04:54 +01:00
parent ec09d22ecd
commit 448810eaba
6 changed files with 76 additions and 35 deletions

View File

@@ -7,16 +7,13 @@ import com.badlogic.gdx.Input;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.utils.I18NBundle;
import eu.jonahbauer.wizard.client.libgdx.screens.MainMenuScreen;
import eu.jonahbauer.wizard.client.libgdx.util.SavedData;
import eu.jonahbauer.wizard.client.libgdx.util.WizardAssetManager;
import lombok.Getter;
import java.util.Locale;
public class WizardGame extends Game {
public static final boolean DEBUG = true;
public static final boolean DEBUG = false;
public static final int WIDTH = 1920;
public static final int HEIGHT = 1080;

View File

@@ -111,11 +111,22 @@ public class GameScreen extends WizardScreen {
dimBehind.setColor(0, 0, 0, 0.5f);
dimBehind.setVisible(false);
dimBehind.setTouchable(Touchable.enabled);
dimBehind.setName("dim_behind");
contentRoot = new Group();
contentRoot.setName("content_root");
var contentRootWrapper = new Container<>(contentRoot);
contentRootWrapper.setSize(WizardGame.WIDTH, WizardGame.HEIGHT);
contentRootWrapper.fill().clip();
contentRootWrapper.setName("content_root_wrapper");
overlayRoot = new Group();
overlayRoot.setName("overlay_root");
stage.addActor(dimBehind);
stage.addActor(createBackground());
stage.addActor(contentRoot = new Group());
stage.addActor(overlayRoot = new Group());
stage.addActor(contentRootWrapper);
stage.addActor(overlayRoot);
stage.addActor(menu = createMenu());
labelStyleDefault = skin.get(Label.LabelStyle.class);
@@ -135,6 +146,7 @@ public class GameScreen extends WizardScreen {
messageStack.setPosition(360, 85 + CardActor.PREF_HEIGHT);
messageStack.setSize(1200, 0);
messageStack.setTouchable(Touchable.disabled);
messageStack.setName("message_stack");
padOfTruth = new PadOfTruth(skin, new TextureRegionDrawable(atlas.findRegion(GameAtlas.PAD_OF_TRUTH)));
padOfTruth.setPosition(PAD_OF_TRUTH_POSITION.x, PAD_OF_TRUTH_POSITION.y);
@@ -193,6 +205,7 @@ public class GameScreen extends WizardScreen {
(WizardGame.HEIGHT - title.getHeight()) / 2
);
group.addActor(title);
group.setName("background");
return group;
}
@@ -264,6 +277,7 @@ public class GameScreen extends WizardScreen {
menu.add(returnToMenu).row();
menu.setVisible(false);
menu.setName("menu");
return menu;
}
@@ -398,28 +412,34 @@ public class GameScreen extends WizardScreen {
public void finishTrick(@NotNull UUID player) {
var seat = seats.getOrDefault(player, Seat.FALLBACK);
var action = parallel();
var animation = parallel();
var group = new Group();
execute(sequence(
run(() -> cardStack.removeAll().forEach(card -> {
var angle = (card.getRotation() % 360 + 360) % 360;
var rotation = rotateTo(angle < 90 || angle > 270 ? 0 : 180, AnimationTimings.STACK_FINISH_ROTATE);
rotation.setUseShortestDirection(true);
run(() -> {
contentRoot.addActorAfter(cardStack, group);
action.addAction(sequence(
targeting(card, changeParent(stage.getRoot())),
parallel(
targeting(card, rotation),
targeting(card, moveTo(
seat.getFrontX() - card.getWidth() / 2,
seat.getFrontY() - card.getHeight() / 2,
AnimationTimings.STACK_FINISH_MOVE
))
),
targeting(card, alpha(0, AnimationTimings.STACK_FINISH_FADE)),
removeActor(card)
));
})),
action
cardStack.removeAll().forEach(card -> {
var angle = (card.getRotation() % 360 + 360) % 360;
var rotation = rotateTo(angle < 90 || angle > 270 ? 0 : 180, AnimationTimings.STACK_FINISH_ROTATE);
rotation.setUseShortestDirection(true);
animation.addAction(sequence(
targeting(card, changeParent(group)),
parallel(
targeting(card, rotation),
targeting(card, moveTo(
seat.getFrontX() - card.getWidth() / 2,
seat.getFrontY() - card.getHeight() / 2,
AnimationTimings.STACK_FINISH_MOVE
))
),
targeting(card, alpha(0, AnimationTimings.STACK_FINISH_FADE))
));
});
}),
animation,
removeActor(group)
));
}
@@ -814,10 +834,13 @@ public class GameScreen extends WizardScreen {
private void initTrumpCards() {
if (trumpCardActor == null) {
trumpCardActor = new CardActor(Card.HIDDEN, atlas);
trumpCardActor.setName("trump_card");
}
if (trumpSuitActor == null) {
trumpSuitActor = new CardActor(Card.HIDDEN, atlas);
trumpSuitActor.setOrigin(0, 0);
trumpSuitActor.setName("trump_suit");
}
}
@@ -825,11 +848,11 @@ public class GameScreen extends WizardScreen {
public enum Seat {
FALLBACK(WizardGame.WIDTH * 0.5f, WizardGame.HEIGHT * 0.5f, 0, 0, 0, WizardGame.WIDTH * 0.5f, WizardGame.HEIGHT * 0.5f),
BOTTOM(WizardGame.WIDTH * 0.5f, 0, 0, 0, Align.bottom, WizardGame.WIDTH * 0.5f, 300),
LEFT(0, WizardGame.HEIGHT * 0.5f, 50, WizardGame.HEIGHT * 0.5f + 110f, Align.bottomLeft, 117.5f, WizardGame.HEIGHT * 0.5f),
TOP_LEFT(WizardGame.WIDTH * 0.25f, WizardGame.HEIGHT, WizardGame.WIDTH * 0.25f, WizardGame.HEIGHT - 50, Align.top, WizardGame.WIDTH * 0.25f, WizardGame.HEIGHT - 200),
TOP(WizardGame.WIDTH * 0.5f, WizardGame.HEIGHT, WizardGame.WIDTH * 0.5f, WizardGame.HEIGHT - 50, Align.top, WizardGame.WIDTH * 0.5f, WizardGame.HEIGHT - 200),
TOP_RIGHT(WizardGame.WIDTH * 0.75f, WizardGame.HEIGHT, WizardGame.WIDTH * 0.75f, WizardGame.HEIGHT - 50, Align.top, WizardGame.WIDTH * 0.75f, WizardGame.HEIGHT - 200),
RIGHT(WizardGame.WIDTH, WizardGame.HEIGHT * 0.5f, WizardGame.WIDTH - 50, WizardGame.HEIGHT * 0.5f + 110f, Align.bottomRight, WizardGame.WIDTH - 117.5f, WizardGame.HEIGHT * 0.5f);
LEFT(-324, WizardGame.HEIGHT * 0.5f, 50, WizardGame.HEIGHT * 0.5f + 110f, Align.bottomLeft, 117.5f, WizardGame.HEIGHT * 0.5f),
TOP_LEFT(WizardGame.WIDTH * 0.25f - 144, WizardGame.HEIGHT + 289, WizardGame.WIDTH * 0.25f, WizardGame.HEIGHT - 50, Align.top, WizardGame.WIDTH * 0.25f, WizardGame.HEIGHT - 200),
TOP(WizardGame.WIDTH * 0.5f, WizardGame.HEIGHT + 324, WizardGame.WIDTH * 0.5f, WizardGame.HEIGHT - 50, Align.top, WizardGame.WIDTH * 0.5f, WizardGame.HEIGHT - 200),
TOP_RIGHT(WizardGame.WIDTH * 0.75f + 144, WizardGame.HEIGHT + 289, WizardGame.WIDTH * 0.75f, WizardGame.HEIGHT - 50, Align.top, WizardGame.WIDTH * 0.75f, WizardGame.HEIGHT - 200),
RIGHT(WizardGame.WIDTH + 324, WizardGame.HEIGHT * 0.5f, WizardGame.WIDTH - 50, WizardGame.HEIGHT * 0.5f + 110f, Align.bottomRight, WizardGame.WIDTH - 117.5f, WizardGame.HEIGHT * 0.5f);
// position of the hand, should be offscreen
private final float handX;

View File

@@ -18,7 +18,7 @@ menu.lobby.session_configuration.label=Configuration
menu.create_game.player_name.label=Player Name
menu.create_game.session_name.label=Session Name
menu.create_game.session_name.default=%s's Session
menu.create_game.session_timeout.label=Timeout (s)
menu.create_game.session_timeout.label=Time Limit (s)
menu.create_game.session_configuration.label=Configuration
menu.create_game.back=Back
menu.create_game.create=Create

View File

@@ -18,7 +18,7 @@ menu.lobby.session_configuration.label=Spielvariante
menu.create_game.player_name.label=Spielername
menu.create_game.session_name.label=Session Name
menu.create_game.session_name.default=%s's Session
menu.create_game.session_timeout.label=Timeout (s)
menu.create_game.session_timeout.label=Bedenkzeit (s)
menu.create_game.session_configuration.label=Spielvariante
menu.create_game.back=Zurück
menu.create_game.create=Erstellen