Merge remote-tracking branch 'origin/dev/client_beck' into dev/client_beck

# Conflicts:
#	Projekte/mdga/client/src/main/java/pp/mdga/client/NotificationSynchronizer.java
#	Projekte/mdga/model/src/main/java/pp.mdga/server/Lobby.java
This commit is contained in:
Felix Koppe
2024-11-30 12:48:49 +01:00
213 changed files with 41087 additions and 3244 deletions

View File

@@ -0,0 +1,32 @@
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000076fb04e70b48, pid=112363, tid=112397
#
# JRE version: OpenJDK Runtime Environment Temurin-20.0.2+9 (20.0.2+9) (build 20.0.2+9)
# Java VM: OpenJDK 64-Bit Server VM Temurin-20.0.2+9 (20.0.2+9, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C [libLLVM.so.18.1+0x1070b48] llvm::EVT::isExtendedVector() const+0x8
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /home/cedric/ProgProjekt/Gruppe-01/Projekte/mdga/client/core.112363)
#
# If you would like to submit a bug report, please visit:
# https://github.com/adoptium/adoptium-support/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- S U M M A R Y ------------
Command Line: -Ddebugger.agent.enable.coroutines=true -Djava.util.logging.config.file=logging.properties -Dkotlinx.coroutines.debug.enable.creation.stack.trace=false -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=127.0.0.1:37129 -javaagent:/usr/share/idea/plugins/java/lib/rt/debugger-agent.jar -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -ea pp.mdga.client.MdgaApp
Host: AMD Ryzen 5 8640HS w/ Radeon 760M Graphics, 12 cores, 14G, Manjaro Linux
Time: Fri Nov 29 22:02:46 2024 CET elapsed time: 26.893420 seconds (0d 0h 0m 26s)
--------------- T H R E A D ---------------
Current thread (0x000076fbec5e6dd0): JavaThread "jME3 Main" [_thread_in_native, id=112397, stack(0x000076fbd00fe000,0x000076fbd01fe000)]
Stack: [0x000076fbd00fe000,0x000076fbd01fe000], sp=0x000076fbd01f4ef8, free space=987k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libLLVM.so.18.1+0x1070b48] llvm::EVT::isExtendedVector() const+0x8

View File

@@ -3,11 +3,11 @@
public enum Asset {
bigTent,
cardStack,
cir,
heer,
cir("Models/cir/cir_newOrigin.obj"),
heer("Models/heer/heer_newOrigin.obj"),
jet,
lw,
marine,
lw("Models/lw/lw_newOrigin.obj"),
marine("Models/marine/marine_newOrigin.obj"),
node_home_blue("Models/node_home/node_home.j3o", "Models/node_home/node_home_blue_diff.png"),
node_wait_blue("Models/node_home/node_home.j3o", "Models/node_home/node_home_blue_diff.png"),
node_home_black("Models/node_home/node_home.j3o", "Models/node_home/node_home_black_diff.png"),
@@ -27,9 +27,12 @@ public enum Asset {
shield_ring("Models/shield_ring/shield_ring.obj", null),
tree_small("Models/tree_small/tree_small.obj", "Models/tree_small/tree_small_diff.png"),
tree_big("Models/tree_big/tree_big.obj", "Models/tree_big/tree_big_diff.png"),
turboCard,
swapCard,
shieldCard,
turboCard("Models/turboCard/turboCard.obj", "Models/turboCard/turboCard_diff.png"),
turboSymbol("Models/turboCard/turboSymbol.obj", "Models/turboCard/turboCard_diff.png"),
swapCard("Models/swapCard/swapCard.obj", "Models/swapCard/swapCard_diff.png"),
swapSymbol("Models/swapCard/swapSymbol.obj", "Models/swapCard/swapCard_diff.png"),
shieldCard("Models/shieldCard/shieldCard.obj", "Models/shieldCard/shieldCard_diff.png"),
shieldSymbol("Models/shieldCard/shieldSymbol.obj", "Models/shieldCard/shieldCard_diff.png"),
dice("Models/dice/dice.obj", "Models/dice/dice_diff.jpeg")
;
@@ -51,6 +54,13 @@ public enum Asset {
this.size = 1f;
}
Asset(String modelPath) {
String folderFileName = "./" + root + name() + "/" + name();
this.modelPath = modelPath;
this.diffPath = folderFileName + "_diff.png";;
this.size = 1f;
}
Asset(float size) {
String folderFileName = "./" + root + name() + "/" + name();
this.modelPath = folderFileName + ".j3o";

View File

@@ -1,5 +1,6 @@
package pp.mdga.client;
import com.jme3.collision.CollisionResult;
import com.jme3.collision.CollisionResults;
import com.jme3.input.InputManager;
import com.jme3.input.KeyInput;
@@ -17,6 +18,7 @@
import pp.mdga.client.board.PieceControl;
import pp.mdga.client.gui.CardControl;
import pp.mdga.client.view.GameView;
import pp.mdga.game.Color;
import pp.mdga.game.Piece;
public class InputSynchronizer {
@@ -41,6 +43,7 @@ public class InputSynchronizer {
private void setupInput() {
inputManager.addMapping("Settings", new KeyTrigger(KeyInput.KEY_ESCAPE));
inputManager.addMapping("Forward", new KeyTrigger(KeyInput.KEY_RETURN));
inputManager.addMapping("RotateRightMouse", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
inputManager.addMapping("MouseLeft", new MouseAxisTrigger(MouseInput.AXIS_X, false)); // Left movement
@@ -52,7 +55,7 @@ private void setupInput() {
inputManager.addMapping("Click", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addListener(actionListener, "Settings", "RotateRightMouse", "Click", "Test");
inputManager.addListener(actionListener, "Settings", "Forward", "RotateRightMouse", "Click", "Test");
inputManager.addListener(analogListener, "MouseLeft", "MouseRight", "MouseScrollUp", "MouseScrollDown");
}
@@ -64,25 +67,28 @@ public void onAction(String name, boolean isPressed, float tpf) {
if (name.equals("Settings") && isPressed) {
app.getView().pressEscape();
}
if (name.equals("Forward") && isPressed) {
app.getView().pressForward();
}
if (name.equals("RotateRightMouse")) {
rightMousePressed = isPressed;
}
if(name.equals("Click") && isPressed) {
if (app.getView() instanceof GameView gameView) {
CardControl cardLayerSelect = checkHover(gameView.getGuiHandler().getCardLayerCamera(), gameView.getGuiHandler().getCardLayer().getRootNode(), CardControl.class);
CardControl cardLayerSelect = checkHover(gameView.getGuiHandler().getCardLayerCamera(), gameView.getGuiHandler().getCardLayerRootNode(), CardControl.class);
OutlineControl boardSelect = checkHover(app.getCamera(), app.getRootNode(), OutlineControl.class);
if(cardLayerSelect != null) {
//cardSelect
cardLayerSelect.outline();
if(cardLayerSelect.isSelectable()) gameView.getGuiHandler().selectCard(cardLayerSelect);
}
if(cardLayerSelect == null && boardSelect != null) {
else if(boardSelect != null) {
//boardSelect
if(boardSelect instanceof PieceControl pieceControl){
if(pieceControl.isSelectable()) gameView.getBoardHandler().pieceSelect(pieceControl);
}
if(boardSelect instanceof NodeControl nodeControl){
// nodeControl.outline();
//
}
}
else {
@@ -93,7 +99,8 @@ public void onAction(String name, boolean isPressed, float tpf) {
}
if(name.equals("Test") &&isPressed){
test = true;
if(app.getView() instanceof GameView gameView){
}
}
}
};
@@ -115,6 +122,7 @@ else if (name.equals("MouseScrollDown")) {
}
else if (name.equals("MouseLeft") || name.equals("MouseRight") || name.equals("MouseVertical")){
hoverPiece();
hoverCard();
}
}
};
@@ -123,8 +131,23 @@ private <T extends AbstractControl> T checkHover(Camera cam, Node root, Class<T>
CollisionResults results = new CollisionResults();
Ray ray = new Ray(cam.getLocation(), getMousePos(cam).subtract(cam.getLocation()).normalize());
root.collideWith(ray, results);
for(CollisionResult collisionResult : results){
if(collisionResult.getGeometry().getControl(controlType) != null) return collisionResult.getGeometry().getControl(controlType);
}
return null;
}
private <T extends AbstractControl> T checkHoverOrtho(Camera cam, Node root, Class<T> controlType) {
CollisionResults results = new CollisionResults();
Vector3f mousePos = getMousePos(cam);
mousePos.setZ(cam.getLocation().getZ());
Ray ray = new Ray(mousePos, getMousePos(cam).subtract(mousePos).normalize());
root.collideWith(ray, results);
if (results.size() > 0) {
return results.getClosestCollision().getGeometry().getControl(controlType);
for(CollisionResult res : results ){
T control = res.getGeometry().getControl(controlType);
if(control != null) return control;
}
}
return null;
}
@@ -143,33 +166,26 @@ private void hoverPiece() {
}
}
private void hoverCardOutline() {
private void hoverCard() {
if (app.getView() instanceof GameView gameView) {
CardControl control = checkHover(gameView.getGuiHandler().getCardLayerCamera(), gameView.getGuiHandler().getCardLayer().getRootNode(), CardControl.class);
CardControl control = checkCard(gameView);
if (control != null) {
if(control != hoverCard){
pieceOff();
cardOff();
hoverCard = control;
hoverCard.outline();
hoverCard.hover();
}
}
else pieceOff();
else cardOff();
}
}
private void hoverAction(){
}
private PieceControl checkPiece(){
return checkHover(app.getCamera(), app.getRootNode(), PieceControl.class);
}
private void outlineOff(OutlineControl outline) {
if (outline != null) outline.deOutline();
outline = null;
private CardControl checkCard(GameView gameView){
return checkHoverOrtho(gameView.getGuiHandler().getCardLayerCamera(), gameView.getGuiHandler().getCardLayerRootNode(), CardControl.class);
}
private void pieceOff(){
@@ -177,9 +193,16 @@ private void pieceOff(){
hoverPiece = null;
}
private void cardOff(){
if(hoverCard != null) hoverCard.hoverOff();
hoverCard = null;
}
private Vector3f getMousePos(Camera cam){
Vector2f mousePositionScreen = inputManager.getCursorPosition();
return cam.getWorldCoordinates(mousePositionScreen, 0);
Vector3f world = cam.getWorldCoordinates(mousePositionScreen, 0);
if (cam.isParallelProjection()) world.setZ(0);
return world;
}
public float getRotation() {

View File

@@ -1,18 +1,11 @@
package pp.mdga.client;
import com.jme3.app.SimpleApplication;
import com.jme3.renderer.RenderManager;
import com.simsilica.lemur.GuiGlobals;
import pp.mdga.client.acoustic.AcousticHandler;
import pp.mdga.client.animation.AnimationHandler;
import com.jme3.system.AppSettings;
import pp.mdga.client.view.*;
import pp.mdga.game.Color;
import pp.mdga.notification.*;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class MdgaApp extends SimpleApplication {
private AnimationHandler animationHandler;
@@ -22,21 +15,21 @@ public class MdgaApp extends SimpleApplication {
private ModelSyncronizer modelSyncronizer;
MdgaView view = null;
private MdgaState state = MdgaState.GAME;
private MdgaState state = null;
private static float resolutionFactor = 1.8f;
private static float imageScale = 1.5f;
private MdgaView mainView;
private MdgaView lobbyView;
private MdgaView gameView;
private MdgaView ceremonyView;
public static void main(String[] args) {
AppSettings settings = new AppSettings(true);
settings.setSamples(128);
settings.setCenterWindow(true);
int width = (int)(1280 * resolutionFactor);
int height = (int)(720 * resolutionFactor);
settings.setWidth(width);
settings.setHeight(height);
settings.setWidth(1920);
settings.setHeight(1080);
settings.setVSync(false);
MdgaApp app = new MdgaApp();
@@ -47,52 +40,29 @@ public static void main(String[] args) {
@Override
public void simpleInitApp() {
GuiGlobals.initialize(this);
inputManager.deleteMapping("SIMPLEAPP_Exit");
flyCam.setEnabled(false);
animationHandler = new AnimationHandler(this);
acousticHandler = new AcousticHandler(this);
notificationSynchronizer = new NotificationSynchronizer(this);
inputSynchronizer = new InputSynchronizer(this);
modelSyncronizer = new ModelSyncronizer(this);
inputManager.deleteMapping("SIMPLEAPP_Exit");
inputManager.deleteMapping("FLYCAM_ZoomIn");
inputManager.deleteMapping("FLYCAM_ZoomOut");
inputManager.deleteMapping("FLYCAM_RotateDrag");
flyCam.setEnabled(false);
GuiGlobals.initialize(this);
mainView = new MainView(this);
lobbyView = new LobbyView(this);
gameView = new GameView(this);
ceremonyView = new CeremonyView(this);
enter(state);
List<UUID> test = new ArrayList<>();
UUID player0 = UUID.randomUUID();
test.add(player0);
UUID player1 = UUID.randomUUID();
test.add(player1);
test.add(UUID.randomUUID());
test.add(UUID.randomUUID());
List<UUID> test_1 = new ArrayList<>();
UUID player0_1 = UUID.randomUUID();
test_1.add(player0_1);
UUID player1_1 = UUID.randomUUID();
test_1.add(player1_1);
test_1.add(UUID.randomUUID());
test_1.add(UUID.randomUUID());
notificationSynchronizer.addTestNotification(new PlayerInGameNotification(Color.AIRFORCE, test, "Player 1"));
notificationSynchronizer.addTestNotification(new PlayerInGameNotification(Color.NAVY, test_1, "Player 2"));
notificationSynchronizer.addTestNotification(new MovePieceNotification(player0, 0, true));
notificationSynchronizer.addTestNotification(new MovePieceNotification(player0_1, 20, true));
notificationSynchronizer.addTestNotification(new MovePieceNotification(player0_1, 20, 21));
notificationSynchronizer.addTestNotification(new MovePieceNotification(player1, 0, true));
notificationSynchronizer.addTestNotification(new MovePieceNotification(player0, 0, 7));
// notificationSynchronizer.addTestNotification(new SelectableMoveNotification(new ArrayList<>(List.of(player0, player1)), new ArrayList<>(List.of(7,3)), new ArrayList<>(List.of(false, false))));
notificationSynchronizer.addTestNotification(new SwapPieceNotification(player0, player0_1));
// notificationSynchronizer.addTestNotification(new SelectableSwapNotification(new ArrayList<>(List.of(player0, player1)), new ArrayList<>(List.of(player0_1))));
enter(MdgaState.MAIN);
}
@Override
public void simpleUpdate(float tpf) {
view.update();
view.update(tpf);
acousticHandler.update();
notificationSynchronizer.update();
}
@@ -106,16 +76,16 @@ public void enter(MdgaState state) {
switch (state) {
case MAIN:
view = new MainView(this);
view = mainView;
break;
case LOBBY:
view = new LobbyView(this);
view = lobbyView;
break;
case GAME:
view = new GameView(this);
view = gameView;
break;
case CEREMONY:
view = new CeremonyView(this);
view = ceremonyView;
break;
case NONE:
throw new RuntimeException("cant enter state NONE");
@@ -126,10 +96,6 @@ public void enter(MdgaState state) {
view.enter();
}
public void afteGameCleanup() {
//TODO
}
public AnimationHandler getAnimationHandler() {
return animationHandler;
}
@@ -140,8 +106,8 @@ public AcousticHandler getAcousticHandler() {
public MdgaState getState() {return state; }
public float getResolutionFactor() {
return resolutionFactor;
public float getImageScale() {
return imageScale;
}
public MdgaView getView() {
@@ -153,4 +119,6 @@ public ModelSyncronizer getModelSyncronizer() {
}
public InputSynchronizer getInputSyncronizer() { return inputSynchronizer; }
public NotificationSynchronizer getNotificationSynchronizer() { return notificationSynchronizer; }
}

View File

@@ -0,0 +1,123 @@
package pp.mdga.client;
import pp.mdga.client.view.CeremonyView;
import pp.mdga.client.view.GameView;
import pp.mdga.client.view.LobbyView;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
import pp.mdga.notification.AcquireCardNotification;
import pp.mdga.notification.DrawCardNotification;
import pp.mdga.notification.TskSelectNotification;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ModelSynchronizer {
private static final Logger LOGGER = Logger.getLogger(ModelSynchronizer.class.getName());
private MdgaApp app;
ModelSynchronizer(MdgaApp app) {
this.app = app;
}
public void animationEnd() {
}
public void selectSwap(UUID a, UUID b) {
// TODO call from somewhere
LOGGER.log(Level.INFO, "selectPiece");
}
public void selectPiece(UUID piece) {
// TODO call from somewhere
LOGGER.log(Level.INFO, "selectPiece");
}
public void selectCard(BonusCard card) {
// TODO call from somewhere
LOGGER.log(Level.INFO, "selectCard");
}
public void confirm() {
LOGGER.log(Level.INFO, "confirm");
}
public void selectTsk(Color color) {
// TODO call from somewhere
LOGGER.log(Level.INFO, "selectTsk: {0}", color);
LobbyView view = (LobbyView) app.getView();
view.setTaken(color, true, true, "OwnPlayerName");
}
public void unselectTsk() {
// TODO call from somewhere
LOGGER.log(Level.INFO, "unselectTsk");
}
public void rolledDice() {
// TODO call from somewhere
LOGGER.log(Level.INFO, "rolledDice");
}
public void setName(String name) {
// TODO call from somewhere
LOGGER.log(Level.INFO, "setName: {0}", name);
}
public void setReady() {
LOGGER.log(Level.INFO, "setReady");
enter(MdgaState.GAME);
}
public void setHost(int port) {
// TODO call from somewhere
LOGGER.log(Level.INFO, "setHost: {0}", port);
enter(MdgaState.LOBBY);
}
public void setJoin(String ip, int port) {
// TODO call from somewhere
LOGGER.log(Level.INFO, "setJoin with IP: {0}, Port: {1}", new Object[]{ip, port});
enter(MdgaState.LOBBY);
}
public void leave() {
LOGGER.log(Level.INFO, "leave");
enter(MdgaState.MAIN);
}
public void enter(MdgaState state) {
LOGGER.log(Level.INFO, "enter: {0}", state);
app.enter(state);
if (state == MdgaState.CEREMONY) {
CeremonyView ceremonyView = (CeremonyView) app.getView();
ceremonyView.addCeremonyParticipant(Color.AIRFORCE, 1, "ugidffdg");
ceremonyView.addCeremonyParticipant(Color.ARMY, 2, "ugidffdg");
ceremonyView.addCeremonyParticipant(Color.NAVY, 3, "ugidffdg");
ceremonyView.addCeremonyParticipant(Color.CYBER, 4, "ugidffdg");
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
ceremonyView.addStatisticsRow("Gesamt", 1, 2, 3, 4, 5, 6);
}
if (state == MdgaState.GAME) {
GameView gameView = (GameView) app.getView();
app.getNotificationSynchronizer().addTestNotification(new DrawCardNotification(Color.AIRFORCE, BonusCard.SHIELD));
}
if (state == MdgaState.LOBBY) {
LobbyView lobbyView = (LobbyView) app.getView();
app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.CYBER, "blablabupp", false));
app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.ARMY, "Spieler 2", false));
lobbyView.setReady(Color.ARMY, true);
}
}
}

View File

@@ -1,72 +0,0 @@
package pp.mdga.client;
import pp.mdga.client.view.LobbyView;
import pp.mdga.game.Color;
public class ModelSyncronizer {
private MdgaApp app;
ModelSyncronizer(MdgaApp app) {
this.app = app;
}
public void selectPiece() {
//TODO call from somewhere
System.out.println("selectPiece");
}
public void selectCard() {
//TODO call from somewhere
System.out.println("selectCard");
}
public void selectTsk(Color color) {
//TODO call from somewhere
System.out.println("selectTsk: " + color);
LobbyView view = (LobbyView) app.getView();
view.setTaken(color, true, true, "OwnPlayerName");
}
public void unselectTsk() {
//TODO call from somewhere
System.out.println("unselectTsk");
}
public void rolledDice() {
//TODO call from somewhere
System.out.println("rolledDice");
}
public void setName(String name) {
//TODO call from somewhere
System.out.println("setName:" + name);
}
public void setReady() {
//TODO call from somewhere
System.out.println("setReady");
app.enter(MdgaState.GAME);
}
public void setHost(int port) {
//TODO call from somewhere
System.out.println("setHost: " + port);
app.enter(MdgaState.LOBBY);
}
public void setJoin(String ip, int port) {
//TODO call from somewhere
System.out.println("setJoin");
app.enter(MdgaState.LOBBY);
}
public void leave() {
System.out.println("leave");
app.enter(MdgaState.MAIN);
}
public void enter(MdgaState state) {
System.out.println("enter:" + state);
app.enter(state);
}
}

View File

@@ -1,7 +1,11 @@
package pp.mdga.client;
import pp.mdga.client.board.BoardHandler;
import pp.mdga.client.gui.GuiHandler;
import pp.mdga.client.view.CeremonyView;
import pp.mdga.client.view.GameView;
import pp.mdga.client.view.LobbyView;
import pp.mdga.game.Color;
import pp.mdga.notification.*;
import java.util.ArrayList;
@@ -53,12 +57,12 @@ private void handleMain(Notification notification) {
private void handleLobby(Notification notification) {
LobbyView lobbyView = (LobbyView) app.getView();
if (notification instanceof TskSelectNotification) {
TskSelectNotification n = (TskSelectNotification)notification;
if (notification instanceof TskSelectNotification n) {
lobbyView.setTaken(n.getColor(), true, n.isSelf(), n.getName());
} else if (notification instanceof TskUnselectNotification) {
TskUnselectNotification n = (TskUnselectNotification)notification;
} else if (notification instanceof TskUnselectNotification n) {
lobbyView.setTaken(n.getColor(), false, false, null);
//} else if(notification instanceof LobbyReadyNotification lobbyReadyNotification) {
// lobbyView.setReady(lobbyReadyNotification.getColor(), lobbyReadyNotification.isReady()):
} else if (notification instanceof GameNotification) {
app.enter(MdgaState.GAME);
} else {
@@ -68,6 +72,8 @@ private void handleLobby(Notification notification) {
private void handleGame(Notification notification) {
GameView gameView = (GameView) app.getView();
GuiHandler guiHandler = gameView.getGuiHandler();
BoardHandler boardHandler = gameView.getBoardHandler();
if (notification instanceof AcquireCardNotification) {
// Handle AcquireCardNotification
@@ -75,56 +81,96 @@ private void handleGame(Notification notification) {
gameView.getGuiHandler().setActivePlayer(n.getColor());
} else if (notification instanceof CeremonyNotification) {
app.enter(MdgaState.CEREMONY);
CeremonyView ceremonyView = (CeremonyView) app.getView();
int size = n.getNames().size();
if (n.getPiecesThrown().size() != size ||
n.getPiecesLost().size() != size ||
n.getBonusCardsPlayed().size() != size ||
n.getSixes().size() != size ||
n.getNodesMoved().size() != size ||
n.getBonusNodes().size() != size) {
throw new IllegalArgumentException("All data lists in CeremonyNotification must have the same size.");
}
for (int i = 0; i < size; i++) {
Color color = n.getColors().get(i);
String name = n.getNames().get(i);
int v1 = n.getPiecesThrown().get(i);
int v2 = n.getPiecesLost().get(i);
int v3 = n.getBonusCardsPlayed().get(i);
int v4 = n.getSixes().get(i);
int v5 = n.getNodesMoved().get(i);
int v6 = n.getBonusNodes().get(i);
ceremonyView.addCeremonyParticipant(color, i, name);
ceremonyView.addStatisticsRow(name, v1, v2, v3, v4, v5, v6);
}
} else if (notification instanceof DiceNowNotification) {
// Handle DiceNowNotification
} else if (notification instanceof DicingNotification) {
// Handle DicingNotification
} else if (notification instanceof DrawCardNotification) {
// Handle DrawCardNotification
guiHandler.showDice();
} else if (notification instanceof DicingNotification n) {
//TODO ???
} else if (notification instanceof DrawCardNotification n) {
guiHandler.drawCard(n.getColor());
} else if (notification instanceof HomeMoveNotification home) {
gameView.getBoardHandler().moveHomePiece(home.getPieceId(), home.getHomeIndex());
boardHandler.moveHomePiece(home.getPieceId(), home.getHomeIndex());
guiHandler.hideText();
} else if (notification instanceof InterruptNotification) {
// Handle InterruptNotification
//TODO ???
} else if (notification instanceof MovePieceNotification n) {
if(n.isMoveStart()) {
//StartMove
gameView.getBoardHandler().movePieceStart(n.getPiece(), n.getMoveIndex());
boardHandler.movePieceStart(n.getPiece(), n.getMoveIndex());
}
else {
//InfieldMove
gameView.getBoardHandler().movePiece(n.getPiece(), n.getStartIndex(), n.getMoveIndex());
boardHandler.movePiece(n.getPiece(), n.getStartIndex(), n.getMoveIndex());
}
} else if (notification instanceof ThrowPieceNotification n) {
boardHandler.throwPiece(n.getPieceId());
} else if (notification instanceof NoShieldNotification n) {
boardHandler.unshieldPiece(n.getPieceId());
} else if (notification instanceof PlayCardNotification n) {
switch(n.getCard()){
case SWAP -> guiHandler.swap();
case TURBO -> guiHandler.turbo();
case SHIELD -> guiHandler.shield();
default -> throw new RuntimeException("invalid card");
}
} else if (notification instanceof NoShieldNotification) {
NoShieldNotification n = (NoShieldNotification)notification;
gameView.getBoardHandler().unshieldPiece(n.getPieceId());
} else if (notification instanceof PlayCardNotification) {
// Handle PlayCardNotification
} else if (notification instanceof PlayerInGameNotification n) {
// Handle PlayerInGameNotification
gameView.getBoardHandler().addPlayer(n.getColor(),n.getPiecesList());
gameView.getGuiHandler().addPlayer(n.getColor(),n.getName());
boardHandler.addPlayer(n.getColor(),n.getPiecesList());
guiHandler.addPlayer(n.getColor(),n.getName());
} else if (notification instanceof ResumeNotification) {
// Handle ResumeNotification
} else if (notification instanceof RollDiceNotification) {
// Handle RollDiceNotification
} else if (notification instanceof SelectableCardsNotification) {
// Handle SelectableCardsNotification
} else if (notification instanceof ShieldActiveNotification) {
ShieldActiveNotification n = (ShieldActiveNotification)notification;
gameView.getBoardHandler().shieldPiece(n.getPieceId());
} else if (notification instanceof ShieldSuppressedNotification) {
ShieldSuppressedNotification n = (ShieldSuppressedNotification)notification;
gameView.getBoardHandler().suppressShield(n.getPieceId());
//TODO
} else if (notification instanceof RollDiceNotification n) {
if(n.getColor() == gameView.getOwnColor()){
guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
}
else {
if (n.isTurbo()) guiHandler.showRolledDiceMult(n.getEyes(), n.getMultiplier(), n.getColor());
else guiHandler.showRolledDice(n.getEyes(), n.getColor());
}
} else if (notification instanceof SelectableCardsNotification n) {
guiHandler.setSelectableCards(n.getCards());
} else if (notification instanceof ShieldActiveNotification n) {
boardHandler.shieldPiece(n.getPieceId());
} else if (notification instanceof ShieldSuppressedNotification n) {
boardHandler.suppressShield(n.getPieceId());
} else if (notification instanceof StartDialogNotification) {
app.enter(MdgaState.MAIN);
} else if (notification instanceof SwapPieceNotification n) {
gameView.getBoardHandler().swapPieces(n.getFirstPiece(), n.getSecondPiece());
boardHandler.swapPieces(n.getFirstPiece(), n.getSecondPiece());
guiHandler.swap();
} else if (notification instanceof WaitMoveNotification) {
// Handle WaitMoveNotification
//TODO ???
} else if (notification instanceof SelectableMoveNotification n) {
gameView.getBoardHandler().outlineMove(n.getPieces(), n.getMoveIndexe(), n.getHomeMoves());
boardHandler.outlineMove(n.getPieces(), n.getMoveIndexe(), n.getHomeMoves());
} else if (notification instanceof SelectableSwapNotification n) {
gameView.getBoardHandler().outlineSwap(n.getOwnPieces(), n.getEnemyPieces());
boardHandler.outlineSwap(n.getOwnPieces(), n.getEnemyPieces());
} else if (notification instanceof SelectableShieldNotification n) {
boardHandler.outlineShield(n.getOwnPieces());
} else if (notification instanceof TurboActiveNotification){
guiHandler.turbo();
} else {
throw new RuntimeException("notification not expected: " + notification.toString());
}

View File

@@ -5,6 +5,7 @@
import pp.mdga.client.MdgaState;
import java.util.*;
import java.util.prefs.Preferences;
public class AcousticHandler {
private MdgaApp app;
@@ -23,14 +24,20 @@ public class AcousticHandler {
private GameMusic scheduled = null; // Scheduled track to play next
private GameMusic old = null; // Old track being faded out
private float mainVolume = 1.0f;
private float mainVolume = 0.0f;
private float musicVolume = 1.0f;
private float soundVolume = 1.0f;
private ArrayList<GameSound> sounds = new ArrayList<>();
private Preferences prefs = Preferences.userNodeForPackage(AcousticHandler.class);
public AcousticHandler(MdgaApp app) {
this.app = app;
mainVolume = prefs.getFloat("mainVolume", 1.0f);
musicVolume = prefs.getFloat("musicVolume", 1.0f);
soundVolume = prefs.getFloat("soundVolume", 1.0f);
}
/**
@@ -67,7 +74,19 @@ public void playSound(MdgaSound sound) {
assets.add(new SoundAssetDelayVolume(SoundAsset.LOST, 1.0f, 0.0f));
break;
case VICTORY:
assets.add(new SoundAssetDelayVolume(SoundAsset.VICTORY, 1.0f, 2.0f));
assets.add(new SoundAssetDelayVolume(SoundAsset.VICTORY, 1.0f, 0.0f));
break;
case BUTTON_PRESSED:
assets.add(new SoundAssetDelayVolume(SoundAsset.BUTTON_PRESS, 0.7f, 0.0f));
break;
case WRONG_INPUT:
assets.add(new SoundAssetDelayVolume(SoundAsset.ERROR, 1.0f, 0.0f));
break;
case UI_CLICK:
assets.add(new SoundAssetDelayVolume(SoundAsset.UI_CLICK, 0.8f, 0.0f));
break;
case START:
assets.add(new SoundAssetDelayVolume(SoundAsset.START, 0.8f, 0.2f));
break;
default:
@@ -362,6 +381,7 @@ public float getSoundVolume() {
*/
public void setMainVolume(float mainVolume) {
this.mainVolume = mainVolume;
prefs.putFloat("mainVolume", mainVolume);
}
/**
@@ -371,6 +391,7 @@ public void setMainVolume(float mainVolume) {
*/
public void setMusicVolume(float musicVolume) {
this.musicVolume = musicVolume;
prefs.putFloat("musicVolume", musicVolume);
}
/**
@@ -380,6 +401,7 @@ public void setMusicVolume(float musicVolume) {
*/
public void setSoundVolume(float soundVolume) {
this.soundVolume = soundVolume;
prefs.putFloat("soundVolume", soundVolume);
}
/**

View File

@@ -19,5 +19,9 @@ public enum MdgaSound {
DESELECT,
HURRY,
VICTORY,
LOST
LOST,
BUTTON_PRESSED,
WRONG_INPUT,
UI_CLICK,
START,
}

View File

@@ -17,7 +17,11 @@ enum SoundAsset {
DESELECT(""),
HURRY(""),
VICTORY("LevelUp2.wav"),
LOST("GameOver.wav");
LOST("GameOver.wav"),
BUTTON_PRESS("menu_button.ogg"),
ERROR("error_sound.ogg"),
UI_CLICK("uiclick.ogg"),
START("gamestart.ogg");
private final String path;

View File

@@ -9,6 +9,7 @@
import com.jme3.scene.control.AbstractControl;
import pp.mdga.client.Asset;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.gui.DiceControl;
import pp.mdga.game.Color;
import java.util.*;
@@ -20,9 +21,6 @@ public class BoardHandler {
private final MdgaApp app;
private final PileControl drawPile = null;
private final PileControl discardPile = null;
private ArrayList<NodeControl> infield;
private Map<UUID, PieceControl> pieces;
@@ -31,7 +29,6 @@ public class BoardHandler {
private Map<Color, List<NodeControl>> waitingNodesMap;
private Map<Color, List<PieceControl>> waitingPiecesMap;
private Map<UUID, Color> pieceColor;
private Set<OutlineControl> outlineControls;
private Node node;
@@ -39,23 +36,39 @@ public class BoardHandler {
private boolean isInitialised;
private boolean scheduleInit = false;
private boolean scheduleShutdown = false;
private List<PieceControl> selectableOwnPieces = new ArrayList<>();
private List<PieceControl> selectableEnemyPieces = new ArrayList<>();
private List<PieceControl> selectableOwnPieces;
private List<PieceControl> selectableEnemyPieces;
private List<NodeControl> outlineNodes;
private PieceControl selectedOwnPiece;
private PieceControl selectedEnemyPiece;
private DiceControl diceControl;
public BoardHandler(MdgaApp app, FilterPostProcessor fpp) {
if(app == null) throw new RuntimeException("app is null");
this.isInitialised = false;
this.app = app;
this.fpp = fpp;
selectedEnemyPiece = null;
isInitialised = false;
node = new Node("BoardHandler root node");
}
public void init() {
isInitialised = true;
selectableOwnPieces = new ArrayList<>();
selectableEnemyPieces = new ArrayList<>();
outlineNodes = new ArrayList<>();
selectedOwnPiece = null;
selectedEnemyPiece = null;
initMap();
app.getRootNode().attachChild(node);
}
public void shutdown(){
clearSelectable();
isInitialised = false;
initMap();
app.getRootNode().detachChild(node);
}
private void addFigureToPlayerMap(Color col, AssetOnMap assetOnMap) {
@@ -64,22 +77,15 @@ private void addFigureToPlayerMap(Color col, AssetOnMap assetOnMap) {
}
private void initMap() {
if (isInitialised) return;
this.isInitialised = true;
this.node = new Node("Asset Node");
this.pieces = new HashMap<>();
this.colorAssetsMap = new HashMap<>();
this.infield = new ArrayList<>(40);
this.homeNodesMap = new HashMap<>();
this.waitingNodesMap = new HashMap<>();
this.waitingPiecesMap = new HashMap<>();
this.pieceColor = new HashMap<>();
this.outlineControls = new HashSet<>();
pieces = new HashMap<>();
colorAssetsMap = new HashMap<>();
infield = new ArrayList<>(40);
homeNodesMap = new HashMap<>();
waitingNodesMap = new HashMap<>();
waitingPiecesMap = new HashMap<>();
pieceColor = new HashMap<>();
diceControl = new DiceControl(app.getAssetManager());
diceControl.create(new Vector3f(0,0,0), 0.7f, true);
List<AssetOnMap> assetOnMaps = MapLoader.loadMap(MAP_NAME);
@@ -164,7 +170,7 @@ private float getRotationMove(Vector3f prev, Vector3f next) {
return newRot;
}
private void movePiece_rek(UUID uuid, int curIndex, int moveIndex){
private void movePieceRek(UUID uuid, int curIndex, int moveIndex){
if (curIndex == moveIndex) return;
curIndex = (curIndex + 1) % infield.size();
@@ -176,7 +182,7 @@ private void movePiece_rek(UUID uuid, int curIndex, int moveIndex){
movePieceToNode(pieceControl, nodeControl);
movePiece_rek(uuid, curIndex, moveIndex);
movePieceRek(uuid, curIndex, moveIndex);
}
private <T, E> List<T> addItemToMapList(Map<E,List<T>> map, E key, T item){
@@ -186,11 +192,24 @@ private <T, E> List<T> addItemToMapList(Map<E,List<T>> map, E key, T item){
return list;
}
private <T, E> List<T> removeItemFromMapList(Map<E,List<T>> map, E key, T item){
private <T, E> void removeItemFromMapList(Map<E,List<T>> map, E key, T item){
List<T> list = map.getOrDefault(key, new ArrayList<>());
list.remove(item);
map.put(key, list);
return list;
}
private Vector3f getWaitingPos(Color color){
return getMeanPosition(waitingNodesMap.get(color).stream().map(NodeControl::getLocation).toList());
}
public static Vector3f getMeanPosition(List<Vector3f> vectors) {
if (vectors.isEmpty()) return new Vector3f(0, 0, 0);
Vector3f sum = new Vector3f(0, 0, 0);
for (Vector3f v : vectors) {
sum.addLocal(v);
}
return sum.divide(vectors.size());
}
//public methods****************************************************************************************************
@@ -255,7 +274,7 @@ public void movePieceStart(UUID uuid, int nodeIndex){
public void movePiece(UUID uuid, int curIndex, int moveIndex){
if (!isInitialised) throw new RuntimeException("BoardHandler is not initialized");
movePiece_rek(uuid, curIndex, moveIndex);
movePieceRek(uuid, curIndex, moveIndex);
}
public void throwPiece(UUID uuid){
@@ -294,47 +313,25 @@ public void suppressShield(UUID uuid){
public void swapPieces(UUID piece1, UUID piece2){
if (!isInitialised) throw new RuntimeException("BoardHandler is not initialized");
PieceControl piece1_control = pieces.get(piece1);
PieceControl piece2_control = pieces.get(piece2);
PieceControl piece1Control = pieces.get(piece1);
PieceControl piece2Control = pieces.get(piece2);
if(piece1_control == null) throw new RuntimeException("piece1 UUID is not valid");
if(piece2_control == null) throw new RuntimeException("piece2 UUID is not valid");
if(piece1Control == null) throw new RuntimeException("piece1 UUID is not valid");
if(piece2Control == null) throw new RuntimeException("piece2 UUID is not valid");
float rot1 = piece1_control.getRotation();
float rot2 = piece2_control.getRotation();
float rot1 = piece1Control.getRotation();
float rot2 = piece2Control.getRotation();
piece1_control.setRotation(rot2);
piece2_control.setRotation(rot1);
piece1Control.setRotation(rot2);
piece2Control.setRotation(rot1);
Vector3f pos1 = piece1_control.getLocation().clone();
Vector3f pos2 = piece2_control.getLocation().clone();
Vector3f pos1 = piece1Control.getLocation().clone();
Vector3f pos2 = piece2Control.getLocation().clone();
piece1_control.setLocation(pos2);
piece2_control.setLocation(pos1);
piece1Control.setLocation(pos2);
piece2Control.setLocation(pos1);
}
public void init() {
// outlineControls.forEach((outlineControl) -> {
// outlineControl.outline(outlineControl.getColor());
// });
isInitialised = true;
scheduleInit = false;
app.getRootNode().attachChild(node);
}
public void shutdown(){
outlineControls.forEach((outlineControl) -> {
outlineControl.deOutline();
});
isInitialised = false;
scheduleShutdown = false;
app.getRootNode().detachChild(node);
}
//List<Pieces>
//List<NodesIndexe>
public void highlight(UUID uuid, boolean bool){
if (!isInitialised) throw new RuntimeException("BoardHandler is not initialized");
@@ -343,23 +340,6 @@ public void highlight(UUID uuid, boolean bool){
}
public void deOutline(UUID uuid){
if (!isInitialised) throw new RuntimeException("BoardHandler is not initialized");
pieces.get(uuid).deOutline();
outlineControls.remove(pieces.get(uuid));
}
public void outline(int index){
// infield.get(index).outline();
outlineControls.add(infield.get(index));
}
//called when (dice) moveNum is received from server to display the movable pieces and corresponding moveNodes
public void outlineMove(List<UUID> pieces, List<Integer> moveIndexe, List<Boolean> homeMoves) {
if(pieces.size() != moveIndexe.size() || pieces.size() != homeMoves.size()) throw new RuntimeException("arrays are not the same size");
@@ -385,6 +365,7 @@ public void outlineMove(List<UUID> pieces, List<Integer> moveIndexe, List<Boolea
pieceControl.highlight(false);
pieceControl.setHoverable(true);
pieceControl.setSelectable(true);
outlineNodes.add(nodeControl);
selectableOwnPieces.add(pieceControl);
}
}
@@ -413,6 +394,21 @@ public void outlineSwap(List<UUID> ownPieces, List<UUID> enemyPieces){
}
}
public void outlineShield(List<UUID> pieces){
selectableOwnPieces.clear();
selectableEnemyPieces.clear();
selectedOwnPiece = null;
selectedEnemyPiece = null;
for (UUID uuid : pieces){
PieceControl p = this.pieces.get(uuid);
p.highlight(false);
p.setHoverable(true);
p.setSelectable(true);
selectableOwnPieces.add(p);
}
}
//called from inputSynchronizer when a piece is selectable
public void pieceSelect(PieceControl pieceSelected) {
boolean isSelected = pieceSelected.isSelected();
@@ -449,29 +445,37 @@ else if(selectableEnemyPieces.contains(pieceSelected)) {
public void clearSelectable(){
for(PieceControl p : selectableEnemyPieces) {
p.unSelect();
p.unHighlight();
p.setSelectable(false);
}
for(PieceControl p : selectableOwnPieces) {
p.unSelect();
p.unHighlight();
p.setSelectable(false);
}
for(NodeControl n : outlineNodes){
n.deOutline();
}
outlineNodes.clear();
selectableEnemyPieces.clear();
selectableOwnPieces.clear();
selectedEnemyPiece = null;
selectedOwnPiece = null;
}
public void deOutline(int index){
infield.get(index).deOutline();
outlineControls.remove(infield.get(index));
}
public void enableHover(UUID uuid){
pieces.get(uuid).setHoverable(true);
}
public void showDice(Color color){
node.attachChild(diceControl.getSpatial());
diceControl.setPos(getWaitingPos(color).add(new Vector3f(0,0,4)));
diceControl.spin();
}
public void hideDice(){
diceControl.hide();
}
}

View File

@@ -4,9 +4,14 @@
import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.scene.Spatial;
import com.jme3.shadow.DirectionalLightShadowFilter;
import com.jme3.shadow.EdgeFilteringMode;
import com.jme3.util.SkyFactory;
import com.jme3.util.SkyFactory.EnvMapType;
import pp.mdga.client.MdgaApp;
public class CameraHandler {
@@ -17,8 +22,21 @@ public class CameraHandler {
private static final int SHADOWMAP_SIZE = 1024 * 8;
public CameraHandler(MdgaApp app, FilterPostProcessor fpp){
private Vector3f defaultCameraPosition;
private Quaternion defaultCameraRotation;
FilterPostProcessor fpp;
DirectionalLightShadowFilter dlsf;
Spatial sky;
public CameraHandler(MdgaApp app, FilterPostProcessor fpp) {
this.app = app;
this.fpp = fpp;
// Save the default camera state
this.defaultCameraPosition = app.getCamera().getLocation().clone();
this.defaultCameraRotation = app.getCamera().getRotation().clone();
sun = new DirectionalLight();
sun.setColor(ColorRGBA.White);
@@ -27,19 +45,35 @@ public CameraHandler(MdgaApp app, FilterPostProcessor fpp){
ambient = new AmbientLight();
ambient.setColor(new ColorRGBA(0.3f, 0.3f, 0.3f, 1));
DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(app.getAssetManager(), SHADOWMAP_SIZE, 4);
dlsf = new DirectionalLightShadowFilter(app.getAssetManager(), SHADOWMAP_SIZE, 4);
dlsf.setLight(sun);
dlsf.setEnabled(true);
dlsf.setEdgeFilteringMode(EdgeFilteringMode.PCFPOISSON);
dlsf.setShadowIntensity(0.7f);
fpp.addFilter(dlsf);
sky = SkyFactory.createSky(app.getAssetManager(), "Images/sky/sky.dds", EnvMapType.EquirectMap).rotate(FastMath.HALF_PI*1,0,FastMath.HALF_PI*0.2f);
}
public void init() {
app.getRootNode().addLight(sun);
app.getRootNode().addLight(ambient);
app.getRootNode().attachChild(sky);
fpp.addFilter(dlsf);
}
public void shutdown() {
app.getRootNode().removeLight(sun);
app.getRootNode().removeLight(ambient);
app.getRootNode().detachChild(sky);
// Reset the camera to its default state
app.getCamera().setLocation(defaultCameraPosition);
app.getCamera().setRotation(defaultCameraRotation);
fpp.removeFilter(dlsf);
}
public void update(float scroll, float rotation) {

View File

@@ -5,6 +5,7 @@
import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.AbstractControl;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.board.Outline.SelectObjectOutliner;
@@ -12,17 +13,21 @@
public class OutlineControl extends AbstractControl {
private static final int THICKNESS_DEFAULT = 6;
private final SelectObjectOutliner outlineOwn;
private MdgaApp app;
public OutlineControl(MdgaApp app, FilterPostProcessor fpp){
this.app = app;
outlineOwn = new SelectObjectOutliner(THICKNESS_DEFAULT, fpp, app.getRenderManager(), app.getAssetManager(), app.getCamera());
}
public OutlineControl(MdgaApp app, FilterPostProcessor fpp, Camera cam){
this.app = app;
outlineOwn = new SelectObjectOutliner(THICKNESS_DEFAULT, fpp, app.getRenderManager(), app.getAssetManager(), cam);
}
public OutlineControl(MdgaApp app, FilterPostProcessor fpp, Camera cam, int thickness){
this.app = app;
outlineOwn = new SelectObjectOutliner(thickness, fpp, app.getRenderManager(), app.getAssetManager(), cam);
}
@@ -48,4 +53,23 @@ protected void controlUpdate(float tpf) {
protected void controlRender(RenderManager rm, ViewPort vp) {
}
public void initSpatial(){
}
@Override
public void setSpatial(Spatial spatial){
if(this.spatial == null && spatial != null){
super.setSpatial(spatial);
initSpatial();
}
else{
super.setSpatial(spatial);
}
}
public MdgaApp getApp() {
return app;
}
}

View File

@@ -32,9 +32,9 @@ public class PieceControl extends OutlineControl {
private static final ColorRGBA OUTLINE_ENEMY_HOVER_COLOR = ColorRGBA.Green;
private static final ColorRGBA OUTLINE_OWN_SELECT_COLOR = ColorRGBA.Cyan;
private static final ColorRGBA OUTLINE_ENEMY_SELECT_COLOR = ColorRGBA.Orange;
private static final int OUTLINE_HIGHLIGHT_WIDTH = 6;
private static final int OUTLINE_HOVER_WIDTH = 6;
private static final int OUTLINE_SELECT_WIDTH = 8;
private static final int OUTLINE_HIGHLIGHT_WIDTH = 8;
private static final int OUTLINE_HOVER_WIDTH = 8;
private static final int OUTLINE_SELECT_WIDTH = 10;
private final Node parentNode;
private boolean enemy;
@@ -87,16 +87,6 @@ public void setLocation(Vector3f loc){
}
@Override
public void setSpatial(Spatial spatial){
if(this.spatial == null && spatial != null){
super.setSpatial(spatial);
initSpatial();
}
else{
super.setSpatial(spatial);
}
}
public void initSpatial(){
setRotation(this.initRotation);
@@ -143,8 +133,6 @@ public Material getMaterial(){
return ((Geometry) getSpatial()).getMaterial();
}
//highlight own/enemy figure to select
public void highlight(boolean enemy) {
this.enemy = enemy;
highlight = true;
@@ -153,9 +141,9 @@ public void highlight(boolean enemy) {
public void unHighlight(){
highlight = false;
deOutline();
}
public void hover(){
if(!hoverable) return;
super.outline(enemy ? OUTLINE_ENEMY_HOVER_COLOR : OUTLINE_OWN_HOVER_COLOR, OUTLINE_HOVER_WIDTH);
@@ -194,8 +182,4 @@ public boolean isSelectable() {
public void setHoverable(boolean hoverable) {
this.hoverable = hoverable;
}
public void deOutline() {
super.deOutline();
}
}

View File

@@ -0,0 +1,56 @@
package pp.mdga.client.button;
import com.jme3.font.BitmapFont;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
public abstract class AbstractButton {
public static final ColorRGBA BUTTON_NORMAL = ColorRGBA.fromRGBA255(169, 165, 104, 255);
public static final ColorRGBA BUTTON_PRESSED = ColorRGBA.fromRGBA255(105, 117, 89, 255);
public static final ColorRGBA TEXT_NORMAL = ColorRGBA.Black;
public static final ColorRGBA TEXT_PRESSED = ColorRGBA.fromRGBA255( 180, 195, 191, 255);
public static final float HORIZONTAL = 16;
public static final float VERTICAL = 9;
protected BitmapFont font;
protected final MdgaApp app;
protected final Node node;
protected Vector2f pos;
protected float fontSizeFactor = 1.0f;
protected float fontSize;
protected float horizontalStep;
protected float verticalStep;
protected float heightStep;
protected float widthStep;
protected boolean adjust = false;
public AbstractButton(MdgaApp app, Node node) {
this.app = app;
this.node = node;
font = app.getAssetManager().loadFont("Fonts/Gunplay.fnt");
}
public abstract void show();
public abstract void hide();
public void setPos(Vector2f pos) {
this.pos = pos;
}
protected void calculateRelative() {
fontSize = fontSizeFactor * 15 * (float)app.getCamera().getWidth() / 720;
horizontalStep = (float)app.getCamera().getWidth() / HORIZONTAL;
verticalStep = (float)app.getCamera().getHeight() / VERTICAL;
heightStep = verticalStep / 2;
widthStep = horizontalStep / 2;
}
}

View File

@@ -0,0 +1,21 @@
package pp.mdga.client.button;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
public class ButtonLeft extends ClickButton {
public ButtonLeft(MdgaApp app, Node node, Runnable action, String label, int narrowFactor) {
super(app, node, action, label, new Vector2f( 5, 2), new Vector2f(0.5f * narrowFactor, 1.8f));
}
@Override
public void onHover() {
}
@Override
public void onUnHover() {
}
}

View File

@@ -0,0 +1,23 @@
package pp.mdga.client.button;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
public class ButtonRight extends ClickButton {
public ButtonRight(MdgaApp app, Node node, Runnable action, String label, int narrowFactor) {
super(app, node, action, label, new Vector2f( 5, 2), new Vector2f(HORIZONTAL - 0.5f * narrowFactor, 1.8f));
adjust = true;
}
@Override
public void onHover() {
}
@Override
public void onUnHover() {
}
}

View File

@@ -0,0 +1,178 @@
package pp.mdga.client.button;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import pp.mdga.client.Asset;
import pp.mdga.client.MdgaApp;
import pp.mdga.game.Color;
public class CeremonyButton extends ClickButton {
public enum Pos {
FIRST,
SECOND,
THIRD,
LOST,
}
static final float WIDTH = 4.0f;
private final Node node3d;
private boolean rotate = false;
private Spatial model;
private float rot = 180;
private LobbyButton.Taken taken = LobbyButton.Taken.NOT;
private LabelButton label;
public CeremonyButton(MdgaApp app, Node node, Node node3d, Color tsk, Pos pos, String name) {
super(app, node, () -> {} , "", new Vector2f(WIDTH, 7), new Vector2f(0, 0));
this.node3d = node3d;
label = new LabelButton(app, node, name, new Vector2f( WIDTH, 1), new Vector2f(0, 0));
final float mid = HORIZONTAL / 2;
final float uiSpacing = 1.4f;
final float figSpacingX = 0.9f;
final float figSpacingY = 0.25f;
float uiX = mid;
float uiY = 6;
float figX = 0;
float figY = -0.32f;
Asset asset = switch (tsk) {
case CYBER -> {
instance.setText("CIR");
yield Asset.cir;
}
case AIRFORCE -> {
instance.setText("Luftwaffe");
yield Asset.lw;
}
case ARMY -> {
instance.setText("Heer");
yield Asset.heer;
}
case NAVY -> {
instance.setText("Marine");
yield Asset.marine;
}
};
switch (pos) {
case FIRST:
rotate = true;
uiX = 0;
uiY -= 0;
figX = 0;
figY -= 1 * figSpacingY;
break;
case SECOND:
adjust = true;
label.adjust = true;
uiX -= uiSpacing;
uiY -= 1;
figX -= figSpacingX;
figY -= 2 * figSpacingY;
figY -= 0.1f;
break;
case THIRD:
uiX += uiSpacing;
uiY -= 1.5f;
figX += figSpacingX;
figY -= 3 * figSpacingY;
figY -= 0.07f;
break;
case LOST:
adjust = true;
label.adjust = true;
uiX -= 1 * uiSpacing + 0.4f;
uiX -= WIDTH / 2;
uiY -= 2;
figX -= 2 * figSpacingX;
figY -= 4 * figSpacingY;
break;
}
setPos(new Vector2f(uiX, uiY));
label.setPos(new Vector2f(uiX, uiY + 1));
createModel(asset, new Vector3f(figX, figY, 6));
}
@Override
public void onHover() {
ColorRGBA buttonNormal = ColorRGBA.Gray.clone();// BUTTON_NORMAL.clone();
buttonNormal.a = 0.01f;
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonNormal);
instance.setBackground(background);
}
@Override
public void onUnHover() {
ColorRGBA buttonNormal = ColorRGBA.Gray.clone();// BUTTON_NORMAL.clone();
buttonNormal.a = 0.01f;
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonNormal);
instance.setBackground(background);
}
@Override
public void show() {
release();
calculateRelative();
setRelative();
node.attachChild(instance);
node3d.attachChild(model);
label.show();
}
@Override
public void hide() {
node.detachChild(instance);
node3d.detachChild(model);
label.hide();
}
public void update(float tpf) {
if(rotate) {
rot += 140.0f * tpf;
rot %= 360;
} else {
rot = 180;
}
model.setLocalRotation(new Quaternion().fromAngles((float) Math.toRadians(90), (float) Math.toRadians(rot), (float) Math.toRadians(180)));
}
private void createModel(Asset asset, Vector3f pos) {
String modelName = asset.getModelPath();
String texName = asset.getDiffPath();
model = app.getAssetManager().loadModel(modelName);
model.scale(asset.getSize() / 2);
model.rotate((float) Math.toRadians(90), (float) Math.toRadians(rot), (float) Math.toRadians(180));
model.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
model.setLocalTranslation(pos);
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
mat.setTexture("DiffuseMap", app.getAssetManager().loadTexture(texName));
model.setMaterial(mat);
}
}

View File

@@ -0,0 +1,108 @@
package pp.mdga.client.button;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.HAlignment;
import com.simsilica.lemur.VAlignment;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.acoustic.MdgaSound;
public abstract class ClickButton extends AbstractButton {
protected final Runnable action;
protected String label;
protected Vector2f size;
protected Button instance;
ClickButton(MdgaApp app, Node node, Runnable action, String label, Vector2f size, Vector2f pos) {
super(app, node);
this.action = action;
this.label = label;
this.pos = pos;
this.size = size;
instance = new Button(label);
instance.addClickCommands((button) -> { app.getAcousticHandler().playSound(MdgaSound.BUTTON_PRESSED); action.run(); });
instance.setTextHAlignment(HAlignment.Center);
instance.setTextVAlignment(VAlignment.Center);
instance.addCommands(Button.ButtonAction.HighlightOn, (button) -> click());
instance.addCommands(Button.ButtonAction.HighlightOff, (button) -> release());
instance.setFont(font);
instance.setFocusColor(TEXT_NORMAL);
calculateRelative();
setRelative();
}
@Override
public void show() {
release();
calculateRelative();
setRelative();
node.attachChild(instance);
}
@Override
public void hide() {
node.detachChild(instance);
}
protected abstract void onHover();
protected abstract void onUnHover();
protected void click() {
instance.setColor(TEXT_PRESSED);
instance.setHighlightColor(TEXT_PRESSED);
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_PRESSED);
instance.setBackground(background);
app.getAcousticHandler().playSound(MdgaSound.UI_CLICK);
onHover();
};
protected void release() {
instance.setColor(TEXT_NORMAL);
instance.setHighlightColor(TEXT_NORMAL);
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_NORMAL);
instance.setBackground(background);
onUnHover();
};
protected void setRelative() {
instance.setFontSize(fontSize);
instance.setPreferredSize(new Vector3f(size.x * widthStep, size.y * heightStep, 0));
float xAdjust = 0.0f;
if(adjust) {
xAdjust = instance.getPreferredSize().x;
}
instance.setLocalTranslation(pos.x * horizontalStep - xAdjust, pos.y * verticalStep, -1);
final float horizontalMid = ((float)app.getCamera().getWidth() / 2) - (instance.getPreferredSize().x / 2);
final float verticalMid = ((float)app.getCamera().getHeight() / 2) - instance.getPreferredSize().y / 2;
if(0 == pos.x) {
instance.setLocalTranslation(horizontalMid, instance.getLocalTranslation().y, instance.getLocalTranslation().z);
}
if(0 == pos.y) {
instance.setLocalTranslation(instance.getLocalTranslation().x, verticalMid, instance.getLocalTranslation().z);
}
}
}

View File

@@ -0,0 +1,102 @@
package pp.mdga.client.button;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.simsilica.lemur.*;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import pp.mdga.client.MdgaApp;
public class InputButton extends AbstractButton {
private Label label;
private TextField field;
private Container container = new Container();
private final int maxLenght;
protected Vector2f size;
public InputButton(MdgaApp app, Node node, String label, int maxLenght) {
super(app, node);
this.label = new Label(label);
this.maxLenght = maxLenght;
this.label.setColor(TEXT_NORMAL);
field = new TextField("");
field.setColor(TEXT_NORMAL);
field.setTextHAlignment(HAlignment.Left);
field.setTextVAlignment(VAlignment.Center);
QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(BUTTON_NORMAL);
field.setBackground(grayBackground);
this.label.setFont(font);
field.setFont(font);
pos = new Vector2f( 0, 0);
size = new Vector2f(5.5f, 1);
container.addChild(this.label);
container.addChild(field);
}
@Override
public void show() {
calculateRelative();
setRelative();
node.attachChild(container);
}
@Override
public void hide() {
node.detachChild(container);
}
public void update() {
String text = field.getText();
int length = text.length();
if (length > maxLenght) {
field.setText(text.substring(0, maxLenght));
}
}
protected void setRelative() {
this.label.setFontSize(fontSize);
field.setFontSize(fontSize);
field.setPreferredSize(new Vector3f(size.x * widthStep, size.y * heightStep, 0));
float xAdjust = 0.0f;
if(adjust) {
xAdjust = container.getPreferredSize().x;
}
container.setLocalTranslation(pos.x * horizontalStep - xAdjust, pos.y * verticalStep, -1);
final float horizontalMid = ((float)app.getCamera().getWidth() / 2) - (container.getPreferredSize().x / 2);
final float verticalMid = ((float)app.getCamera().getHeight() / 2) - container.getPreferredSize().y / 2;
if(0 == pos.x) {
container.setLocalTranslation(horizontalMid, container.getLocalTranslation().y, -1);
}
if(0 == pos.y) {
container.setLocalTranslation(container.getLocalTranslation().x, verticalMid, -1);
}
}
public String getString() {
return field.getText();
}
public void setString(String string) { field.setText(string); }
public void reset() {
field.setText("");
}
}

View File

@@ -0,0 +1,63 @@
package pp.mdga.client.button;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import pp.mdga.client.MdgaApp;
public class LabelButton extends ClickButton{
private ColorRGBA text = TEXT_NORMAL;
private ColorRGBA button = BUTTON_NORMAL;
public LabelButton(MdgaApp app, Node node, String label, Vector2f size, Vector2f pos) {
super(app, node, () -> {}, label, size, pos);
}
@Override
public void show() {
release();
calculateRelative();
setRelative();
instance.setFontSize(fontSize / 2);
node.attachChild(instance);
}
@Override
public void hide() {
node.detachChild(instance);
}
@Override
public void onHover() {
instance.setColor(text);
instance.setHighlightColor(text);
QuadBackgroundComponent background = new QuadBackgroundComponent(button);
instance.setBackground(background);
}
@Override
public void onUnHover() {
instance.setColor(text);
instance.setHighlightColor(text);
QuadBackgroundComponent background = new QuadBackgroundComponent(button);
instance.setBackground(background);
}
public void setText(String text) {
instance.setText(text);
}
public void setColor(ColorRGBA text, ColorRGBA button) {
this.text = text;
this.button = button;
hide();
show();
}
}

View File

@@ -0,0 +1,218 @@
package pp.mdga.client.button;
import com.jme3.light.AmbientLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import pp.mdga.client.Asset;
import pp.mdga.client.MdgaApp;
import pp.mdga.game.Color;
public class LobbyButton extends ClickButton {
public enum Taken {
NOT,
SELF,
OTHER,
}
static final ColorRGBA LOBBY_TAKEN = ColorRGBA.fromRGBA255(193,58,59, 25);
static final ColorRGBA LOBBY_READY = ColorRGBA.fromRGBA255(55,172,190, 25);
static final ColorRGBA LOBBY_READY_HOVER = ColorRGBA.fromRGBA255(17,211,218, 25);
static final ColorRGBA LOBBY_SELF_NORMAL = ColorRGBA.fromRGBA255(34,103,24, 25);
static final ColorRGBA LOBBY_SELF_HOVER = ColorRGBA.fromRGBA255(42,151,19, 25);
static final float WIDTH = 4.0f;
private final Node node3d;
private boolean rotate = false;
private Spatial model;
private float rot = 180;
private Taken taken = Taken.NOT;
private LabelButton label;
private boolean isReady = false;
public LobbyButton(MdgaApp app, Node node, Node node3d, Runnable action, Color tsk) {
super(app, node, action, "", new Vector2f(WIDTH, 7), new Vector2f(0, 0));
this.node3d = node3d;
label = new LabelButton(app, node, "- leer -", new Vector2f( WIDTH, 1), new Vector2f(0, 0));
final float mid = HORIZONTAL / 2;
final float uiSpacing = 0.4f;
final float figSpacing = 0.51f;
float uiX = mid;
float figX = 0;
Asset asset = null;
switch (tsk) {
case CYBER:
adjust = true;
label.adjust = true;
uiX -= 3 * uiSpacing;
uiX -= WIDTH / 2;
asset = Asset.cir;
figX -= 3 * figSpacing;
instance.setText("CIR");
break;
case AIRFORCE:
adjust = true;
label.adjust = true;
uiX -= uiSpacing;
asset = Asset.lw;
figX -= figSpacing;
instance.setText("Luftwaffe");
break;
case ARMY:
uiX += uiSpacing;
asset = Asset.heer;
figX += figSpacing;
instance.setText("Heer");
break;
case NAVY:
uiX += 3 * uiSpacing;
uiX += WIDTH / 2;
asset = Asset.marine;
figX += 3 * figSpacing;
instance.setText("Marine");
break;
}
setPos(new Vector2f(uiX, 6));
label.setPos(new Vector2f(uiX, 7));
createModel(asset, new Vector3f(figX, -0.55f, 6));
}
@Override
public void onHover() {
ColorRGBA buttonPressed = BUTTON_PRESSED.clone();
switch (taken) {
case NOT:
buttonPressed.a = 0.3f;
break;
case SELF:
buttonPressed = LOBBY_SELF_HOVER;
break;
case OTHER:
buttonPressed = LOBBY_TAKEN;
break;
}
if(isReady) {
buttonPressed = LOBBY_READY_HOVER;
}
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonPressed);
instance.setBackground(background);
rotate = true;
}
@Override
public void onUnHover() {
ColorRGBA buttonNormal = ColorRGBA.Gray.clone();// BUTTON_NORMAL.clone();
switch (taken) {
case NOT:
buttonNormal.a = 0.1f;
break;
case SELF:
buttonNormal = LOBBY_SELF_NORMAL;
break;
case OTHER:
buttonNormal = LOBBY_TAKEN;
break;
}
if(isReady) {
buttonNormal = LOBBY_READY;
}
QuadBackgroundComponent background = new QuadBackgroundComponent(buttonNormal);
instance.setBackground(background);
rotate = false;
}
@Override
public void show() {
release();
calculateRelative();
setRelative();
node.attachChild(instance);
node3d.attachChild(model);
label.show();
}
@Override
public void hide() {
node.detachChild(instance);
node3d.detachChild(model);
label.hide();
}
public void update(float tpf) {
if(rotate) {
rot += 140.0f * tpf;
rot %= 360;
} else {
rot = 180;
}
model.setLocalRotation(new Quaternion().fromAngles((float) Math.toRadians(90), (float) Math.toRadians(rot), (float) Math.toRadians(180)));
}
private void createModel(Asset asset, Vector3f pos) {
String modelName = asset.getModelPath();
String texName = asset.getDiffPath();
model = app.getAssetManager().loadModel(modelName);
model.scale(asset.getSize() / 2);
model.rotate((float) Math.toRadians(90), (float) Math.toRadians(rot), (float) Math.toRadians(180));
model.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
model.setLocalTranslation(pos);
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
mat.setTexture("DiffuseMap", app.getAssetManager().loadTexture(texName));
model.setMaterial(mat);
}
public Taken getTaken() {
return taken;
}
public void setTaken(Taken taken, String name) {
this.taken = taken;
if(taken == Taken.NOT) {
label.setText("- leer -");
isReady = false;
} else {
label.setText(name);
}
onUnHover();
}
public void setReady(boolean isReady) {
this.isReady = isReady;
}
}

View File

@@ -0,0 +1,21 @@
package pp.mdga.client.button;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
public class MenuButton extends ClickButton {
public MenuButton(MdgaApp app, Node node, Runnable action, String label) {
super(app, node, action, label, new Vector2f( 5.5f, 2), new Vector2f(0, 0));
}
@Override
public void onHover() {
}
@Override
public void onUnHover() {
}
}

View File

@@ -0,0 +1,34 @@
package pp.mdga.client.button;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import com.simsilica.lemur.HAlignment;
import com.simsilica.lemur.VAlignment;
import com.simsilica.lemur.component.IconComponent;
import pp.mdga.client.MdgaApp;
public class SettingsButton extends ClickButton {
private IconComponent icon;
public SettingsButton(MdgaApp app, Node node, Runnable action) {
super(app, node, action, "", new Vector2f(2, 2), new Vector2f(HORIZONTAL - 0.5f, VERTICAL - 0.5f));
adjust = true;
icon = new IconComponent("Images/zahnrad.png");
icon.setIconScale(0.1f * app.getImageScale());
icon.setHAlignment(HAlignment.Center);
icon.setVAlignment(VAlignment.Center);
instance.setIcon(icon);
}
@Override
public void onHover() {
}
@Override
public void onUnHover() {
}
}

View File

@@ -0,0 +1,109 @@
package pp.mdga.client.button;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.simsilica.lemur.*;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import pp.mdga.client.MdgaApp;
public class SliderButton extends AbstractButton {
private Label label;
private Slider slider;
private Container container = new Container();
protected Vector2f size;
public SliderButton(MdgaApp app, Node node, String label) {
super(app, node);
this.label = new Label(label);
this.label.setColor(TEXT_NORMAL);
slider = new Slider("slider");
slider.getDecrementButton().setText(" - ");
slider.getDecrementButton().setFont(font);
slider.getDecrementButton().setFocusColor(TEXT_NORMAL);
slider.getDecrementButton().setTextVAlignment(VAlignment.Bottom);
slider.getDecrementButton().setColor(TEXT_NORMAL);
slider.getDecrementButton().setHighlightColor(TEXT_NORMAL);
slider.getIncrementButton().setText(" + ");
slider.getIncrementButton().setFont(font);
slider.getIncrementButton().setFocusColor(TEXT_NORMAL);
slider.getIncrementButton().setTextVAlignment(VAlignment.Bottom);
slider.getIncrementButton().setColor(TEXT_NORMAL);
slider.getIncrementButton().setHighlightColor(TEXT_NORMAL);
slider.getThumbButton().setText("X");
slider.getThumbButton().setFont(font);
slider.getThumbButton().setFocusColor(TEXT_NORMAL);
slider.getThumbButton().setColor(TEXT_NORMAL);
slider.getThumbButton().setHighlightColor(TEXT_NORMAL);
QuadBackgroundComponent background = new QuadBackgroundComponent(BUTTON_NORMAL);
slider.setBackground(background);
this.label.setFont(font);
pos = new Vector2f( 0, 0);
size = new Vector2f(5.5f, 1);
container.addChild(this.label);
container.addChild(slider);
}
@Override
public void show() {
calculateRelative();
setRelative();
node.attachChild(container);
}
@Override
public void hide() {
node.detachChild(container);
}
protected void setRelative() {
this.label.setFontSize(fontSize);
slider.getDecrementButton().setFontSize(fontSize);
slider.getIncrementButton().setFontSize(fontSize);
slider.getThumbButton().setFontSize(fontSize);
slider.setPreferredSize(new Vector3f(size.x * widthStep, size.y * heightStep, 0));
float xAdjust = 0.0f;
if(adjust) {
xAdjust = container.getPreferredSize().x;
}
container.setLocalTranslation(pos.x * horizontalStep - xAdjust, pos.y * verticalStep, -1);
final float horizontalMid = ((float)app.getCamera().getWidth() / 2) - (container.getPreferredSize().x / 2);
final float verticalMid = ((float)app.getCamera().getHeight() / 2) - container.getPreferredSize().y / 2;
if(0 == pos.x) {
container.setLocalTranslation(horizontalMid, container.getLocalTranslation().y, -1);
}
if(0 == pos.y) {
container.setLocalTranslation(container.getLocalTranslation().x, verticalMid, -1);
}
}
public float getPercent() {
return (float) slider.getModel().getPercent();
}
public void setPercent(float percent) {
slider.getModel().setPercent(percent);
}
}

View File

@@ -0,0 +1,82 @@
package pp.mdga.client.dialog;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.button.MenuButton;
import pp.mdga.client.button.SliderButton;
import pp.mdga.client.view.MdgaView;
public class AudioSettingsDialog extends Dialog {
private final MdgaView view;
private SliderButton mainVolume;
private SliderButton musicVolume;
private SliderButton soundVolume;
private MenuButton backButton;
private boolean active = false;
public AudioSettingsDialog(MdgaApp app, Node node, MdgaView view) {
super(app, node);
this.view = view;
mainVolume = new SliderButton(app, node, "Gesamt Lautstärke");
musicVolume = new SliderButton(app, node, "Musik Lautstärke");
soundVolume = new SliderButton(app, node, "Effekt Lautstärke");
backButton = new MenuButton(app, node, view::leaveAudioSettings, "Zurück");
float offset = 1.0f;
mainVolume.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.75f;
musicVolume.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.75f;
soundVolume.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.75f * 1.3f;
backButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.75f;
}
@Override
protected void onShow() {
active = true;
mainVolume.setPercent(app.getAcousticHandler().getMainVolume());
musicVolume.setPercent(app.getAcousticHandler().getMusicVolume());
soundVolume.setPercent(app.getAcousticHandler().getSoundVolume());
backButton.show();
mainVolume.show();
musicVolume.show();
soundVolume.show();
}
@Override
protected void onHide() {
active = false;
backButton.hide();
mainVolume.hide();
musicVolume.hide();
soundVolume.hide();
}
public void update() {
if(!active) {
return;
}
app.getAcousticHandler().setMainVolume(mainVolume.getPercent());
app.getAcousticHandler().setMusicVolume(musicVolume.getPercent());
app.getAcousticHandler().setSoundVolume(soundVolume.getPercent());
}
}

View File

@@ -0,0 +1,105 @@
package pp.mdga.client.dialog;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.button.AbstractButton;
import pp.mdga.client.button.LabelButton;
import pp.mdga.client.button.MenuButton;
import java.util.ArrayList;
public class CeremonyDialog extends Dialog {
private ArrayList<ArrayList<LabelButton>> labels;
float offsetX;
public CeremonyDialog(MdgaApp app, Node node) {
super(app, node);
prepare();
}
@Override
protected void onShow() {
for (ArrayList<LabelButton> row : labels) {
for (LabelButton b : row) {
b.show();
}
}
}
@Override
protected void onHide() {
for (ArrayList<LabelButton> row : labels) {
for (LabelButton b : row) {
b.hide();
}
}
}
public void addStatisticsRow(String name, int v1, int v2, int v3, int v4, int v5, int v6) {
float offsetYSmall = 0.5f;
ArrayList<LabelButton> row = new ArrayList<>();
Vector2f sizeSmall = new Vector2f(4, 1.2f);
row.add(new LabelButton(app, node, name, sizeSmall, new Vector2f()));
row.add(new LabelButton(app, node, "" + v1, sizeSmall, new Vector2f()));
row.add(new LabelButton(app, node, "" + v2, sizeSmall, new Vector2f()));
row.add(new LabelButton(app, node, "" + v3, sizeSmall, new Vector2f()));
row.add(new LabelButton(app, node, "" + v4, sizeSmall, new Vector2f()));
row.add(new LabelButton(app, node, "" + v5, sizeSmall, new Vector2f()));
row.add(new LabelButton(app, node, "" + v6, sizeSmall, new Vector2f()));
ColorRGBA colorText = AbstractButton.TEXT_NORMAL.clone();
colorText.a = 0.1f;
ColorRGBA colorButton = AbstractButton.BUTTON_NORMAL.clone();
colorButton.a = 0.1f;
int j = 0;
for (LabelButton b : row) {
if(j > 0) {
b.setColor(colorText, colorButton);
}
b.setPos(new Vector2f(offsetX, MenuButton.VERTICAL - offsetYSmall));
offsetYSmall += 0.8f;
j++;
}
offsetX += 2.3f;
labels.add(row);
}
public void prepare() {
offsetX = 0.5f;
labels = new ArrayList<>();
ArrayList<LabelButton> first = new ArrayList<>();
Vector2f size = new Vector2f(4, 1.2f);
first.add(new LabelButton(app, node, "", size, new Vector2f()));
first.add(new LabelButton(app, node, "Figuren geworfen", size, new Vector2f()));
first.add(new LabelButton(app, node, "Figuren verloren", size, new Vector2f()));
first.add(new LabelButton(app, node, "Verwendete Bonuskarten", size, new Vector2f()));
first.add(new LabelButton(app, node, "Gewürfelte 6en", size, new Vector2f()));
first.add(new LabelButton(app, node, "Gelaufene Felder", size, new Vector2f()));
first.add(new LabelButton(app, node, "Bonusfeldern erreicht", size, new Vector2f()));
float offsetY = 0.5f;
for (LabelButton b : first) {
b.setPos(new Vector2f(offsetX, MenuButton.VERTICAL - offsetY));
offsetY += 0.8f;
}
offsetX += 2.3f;
labels.add(first);
}
}

View File

@@ -1,82 +1,32 @@
package pp.mdga.client.dialog;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.HAlignment;
import com.simsilica.lemur.VAlignment;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import pp.mdga.client.MdgaApp;
import static com.jme3.math.FastMath.floor;
public abstract class Dialog {
protected final ColorRGBA COLOR_DEFAULT = ColorRGBA.Gray;
protected final ColorRGBA COLOR_HOVER = ColorRGBA.DarkGray;
protected Container container;
protected final MdgaApp app;
private final Node node;
protected final Node node = new Node();
protected final float vertical_step;
protected final float horitontal_step;
private final Node root;
protected float fontSize = 35;
public Dialog(MdgaApp app, Node node) {
Dialog(MdgaApp app, Node node) {
this.app = app;
this.node = node;
this.container = new Container();
this.horitontal_step = app.getCamera().getWidth() / 16;
this.vertical_step = app.getCamera().getHeight() / 9;
int val = (int) (32 * Math.min(app.getResolutionFactor() * 0.9f, 1));
fontSize = val;
this.root = node;
}
public void show() {
node.attachChild(container);
root.attachChild(node);
onShow();
}
public void hide () {
node.detachChild(container);
public void hide() {
root.detachChild(node);
onHide();
}
protected void createButton(String label, Runnable action, Vector3f size) {
Button button = new Button(label);
button.addClickCommands(source -> action.run());
button.setFontSize(fontSize);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
button.setPreferredSize(size);
button.setTextHAlignment(HAlignment.Center);
button.setTextVAlignment(VAlignment.Center);
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
button.setBackground(background);
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(hoverBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(normalBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
container.addChild(button);
}
protected abstract void onShow();
protected abstract void onHide ();
}

View File

@@ -1,15 +0,0 @@
package pp.mdga.client.dialog;
import java.util.function.Supplier;
public class GetPercentRunnable {
private final Supplier<Float> action;
public GetPercentRunnable(Supplier<Float> action) {
this.action = action;
}
public float get() {
return action.get();
}
}

View File

@@ -1,143 +1,68 @@
package pp.mdga.client.dialog;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import com.jme3.texture.Texture;
import com.simsilica.lemur.*;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import com.simsilica.lemur.component.SpringGridLayout;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.button.ButtonLeft;
import pp.mdga.client.button.ButtonRight;
import pp.mdga.client.button.InputButton;
import pp.mdga.client.button.MenuButton;
import pp.mdga.client.view.MainView;
public class HostDialog extends Dialog {
private TextField portInput;
import java.util.prefs.Preferences;
public HostDialog(MdgaApp app, Node node, Runnable backAction) {
public class HostDialog extends Dialog {
private InputButton portInput;
private ButtonRight hostButton;
private ButtonLeft backButton;
private final MainView view;
private Preferences prefs = Preferences.userNodeForPackage(JoinDialog.class);
public HostDialog(MdgaApp app, Node node, MainView view) {
super(app, node);
QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
quad1.setMargin(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor());
container.setBackground(quad1);
this.view = view;
Texture texture = app.getAssetManager().loadTexture("Images/mdga_logo.png");
portInput = new InputButton(app, node, "Port: ", 5);
portInput.setString(prefs.get("hostPort", "11111"));
QuadBackgroundComponent b = new QuadBackgroundComponent(texture);
hostButton = new ButtonRight(app, node, view::forward, "Spiel hosten", 10);
backButton = new ButtonLeft(app, node, view::back, "Zurück", 10);
Panel imagePanel = new Panel();
imagePanel.setBackground(b);
float offset = 3.0f;
container.addChild(imagePanel).setPreferredSize(new Vector3f(texture.getImage().getWidth() / 4 * app.getResolutionFactor(), texture.getImage().getHeight() / 4 * app.getResolutionFactor(), 0));
//abstandshalter
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
createTextField();
//abstandshalter
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
Container sub = new Container(new SpringGridLayout(Axis.X, Axis.Y));
createButton(sub, "Abbrechen", backAction, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
sub.addChild(new Panel(40 * app.getResolutionFactor(), 0 * app.getResolutionFactor(), ColorRGBA.Gray));
createButton(sub, "Starten", () -> tryStart(), new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
container.addChild(sub);
}
void tryStart() {
if (null == portInput.getText()) {
portInput.setText("");
return;
}
int port = 0;
try {
port = Integer.parseInt(portInput.getText());
} catch (NumberFormatException e) {
portInput.setText("");
return;
}
if(port >= 1 && port <= 65535) {
app.getModelSyncronizer().setHost(port);
}
portInput.setText("");
portInput.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.5f;
}
@Override
public void show() {
super.show();
container.setLocalTranslation(
app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2,
app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2,
0
);
protected void onShow() {
portInput.show();
hostButton.show();
backButton.show();
}
@Override
public void hide() {
super.hide();
protected void onHide() {
portInput.hide();
hostButton.hide();
backButton.hide();
}
private void createTextField() {
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
Label nameLabel = new Label("Port:\t");
nameLabel.setFontSize(fontSize);
nameLabel.setColor(ColorRGBA.Black);
portInput = new TextField("");
portInput.setColor(ColorRGBA.Black);
portInput.setTextHAlignment(HAlignment.Left);
portInput.setFontSize(fontSize);
portInput.setSingleLine(true);
QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(ColorRGBA.DarkGray);
portInput.setBackground(grayBackground);
subContainer.addChild(nameLabel);
subContainer.addChild(portInput);
container.addChild(subContainer);
public void update() {
portInput.update();
}
protected void createButton(Container c, String label, Runnable action, Vector3f size) {
Button button = new Button(label);
button.addClickCommands(source -> action.run());
button.setFontSize(fontSize);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
button.setPreferredSize(size);
button.setTextHAlignment(HAlignment.Center);
button.setTextVAlignment(VAlignment.Center);
public String getPort() {
prefs.put("hostPort", portInput.getString());
return portInput.getString();
}
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
button.setBackground(background);
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(hoverBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(normalBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
c.addChild(button);
public void resetPort() {
portInput.reset();
prefs.put("hostPort", "11111");
}
}

View File

@@ -0,0 +1,4 @@
package pp.mdga.client.dialog;
public class InterruptDialog {
}

View File

@@ -1,192 +1,88 @@
package pp.mdga.client.dialog;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import com.jme3.texture.Texture;
import com.simsilica.lemur.*;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import com.simsilica.lemur.component.SpringGridLayout;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.acoustic.AcousticHandler;
import pp.mdga.client.button.ButtonLeft;
import pp.mdga.client.button.ButtonRight;
import pp.mdga.client.button.InputButton;
import pp.mdga.client.button.MenuButton;
import pp.mdga.client.view.MainView;
import java.util.regex.Pattern;
import java.util.prefs.Preferences;
public class JoinDialog extends Dialog {
private TextField portInput;
private TextField ipInput;
private InputButton ipInput;
private InputButton portInput;
public JoinDialog(MdgaApp app, Node node, Runnable backAction) {
private ButtonRight joinButton;
private ButtonLeft backButton;
private final MainView view;
private Preferences prefs = Preferences.userNodeForPackage(JoinDialog.class);
public JoinDialog(MdgaApp app, Node node, MainView view) {
super(app, node);
QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
quad1.setMargin(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor());
container.setBackground(quad1);
this.view = view;
Texture texture = app.getAssetManager().loadTexture("Images/mdga_logo.png");
ipInput = new InputButton(app, node, "Ip: ", 15);
portInput = new InputButton(app, node, "Port: ", 5);
portInput.setString(prefs.get("joinPort", "11111"));
ipInput.setString(prefs.get("joinIp", ""));
QuadBackgroundComponent b = new QuadBackgroundComponent(texture);
joinButton = new ButtonRight(app, node, view::forward, "Spiel beitreten", 10);
backButton = new ButtonLeft(app, node, view::back, "Zurück", 10);
Panel imagePanel = new Panel();
imagePanel.setBackground(b);
float offset = 3.0f;
container.addChild(imagePanel).setPreferredSize(new Vector3f(texture.getImage().getWidth() / 4 * app.getResolutionFactor(), texture.getImage().getHeight() / 4 * app.getResolutionFactor(), 0));
ipInput.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.5f;
//abstandshalter
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
createIpField();
//abstandshalter
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
createPortField();
//abstandshalter
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
Container sub = new Container(new SpringGridLayout(Axis.X, Axis.Y));
createButton(sub, "Abbrechen", backAction, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
sub.addChild(new Panel(40 * app.getResolutionFactor(), 0 * app.getResolutionFactor(), ColorRGBA.Gray));
createButton(sub, "Beitreten", () -> tryJoin(), new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
container.addChild(sub);
}
void tryJoin() {
if (null == portInput.getText()) {
portInput.setText("");
ipInput.setText("");
return;
}
int port = 0;
try {
port = Integer.parseInt(portInput.getText());
} catch (NumberFormatException e) {
portInput.setText("");
ipInput.setText("");
return;
}
if(!(port >= 1 && port <= 65535)) {
portInput.setText("");
ipInput.setText("");
return;
}
if (null == ipInput.getText()) {
portInput.setText("");
ipInput.setText("");
return;
}
String ipv4Pattern = "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
if(!Pattern.matches(ipv4Pattern, ipInput.getText())) {
portInput.setText("");
ipInput.setText("");
return;
}
app.getModelSyncronizer().setJoin(ipInput.getText(), port);
portInput.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.5f;
}
@Override
public void show() {
super.show();
container.setLocalTranslation(
app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2,
app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2,
0
);
protected void onShow() {
ipInput.show();
portInput.show();
joinButton.show();
backButton.show();
}
@Override
public void hide() {
super.hide();
protected void onHide() {
ipInput.hide();
portInput.hide();
joinButton.hide();
backButton.hide();
}
private void createPortField() {
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
Label nameLabel = new Label("Port:\t");
nameLabel.setFontSize(fontSize);
nameLabel.setColor(ColorRGBA.Black);
portInput = new TextField("");
portInput.setColor(ColorRGBA.Black);
portInput.setTextHAlignment(HAlignment.Left);
portInput.setFontSize(fontSize);
portInput.setSingleLine(true);
QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(ColorRGBA.DarkGray);
portInput.setBackground(grayBackground);
subContainer.addChild(nameLabel);
subContainer.addChild(portInput);
container.addChild(subContainer);
public void update() {
ipInput.update();
portInput.update();
}
private void createIpField() {
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
Label nameLabel = new Label("Ip:\t");
nameLabel.setFontSize(fontSize);
nameLabel.setColor(ColorRGBA.Black);
ipInput = new TextField("");
ipInput.setColor(ColorRGBA.Black);
ipInput.setTextHAlignment(HAlignment.Left);
ipInput.setFontSize(fontSize);
ipInput.setSingleLine(true);
QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(ColorRGBA.DarkGray);
ipInput.setBackground(grayBackground);
subContainer.addChild(nameLabel);
subContainer.addChild(ipInput);
container.addChild(subContainer);
public String getIpt() {
prefs.put("joinIp", ipInput.getString());
return ipInput.getString();
}
protected void createButton(Container c, String label, Runnable action, Vector3f size) {
Button button = new Button(label);
button.addClickCommands(source -> action.run());
button.setFontSize(fontSize);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
button.setPreferredSize(size);
button.setTextHAlignment(HAlignment.Center);
button.setTextVAlignment(VAlignment.Center);
public void resetIp() {
ipInput.reset();
prefs.put("joinIp", "");
}
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
button.setBackground(background);
public String getPort() {
prefs.put("joinPort", portInput.getString());
return portInput.getString();
}
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(hoverBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(normalBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
c.addChild(button);
public void resetPort() {
portInput.reset();
prefs.put("joinPort", "11111");
}
}

View File

@@ -1,165 +0,0 @@
package pp.mdga.client.dialog;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.Command;
import com.simsilica.lemur.HAlignment;
import com.simsilica.lemur.VAlignment;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import pp.mdga.client.MdgaApp;
import pp.mdga.game.Color;
public class LobbyButtonDialog extends Dialog {
private final int pos;
private Button button;
private Command<Button> clickCommand;
private boolean taken = false;
private final String label;
private int val;
public LobbyButtonDialog(MdgaApp app, Node node, String label, int pos) {
super(app, node);
clickCommand = (Button source) -> {
toggleButton();
};
this.pos = pos;
this.label = label;
this.button = new Button(label);
this.button.setFontSize(fontSize);
val = pos;
createNotTakenButton(new Vector3f(170 * app.getResolutionFactor(), 250 * app.getResolutionFactor(), 0));
}
@Override
public void show() {
super.show();
float x = ((2 + (4 * pos)) * horitontal_step) - ((0.33333333f * pos) * container.getPreferredSize().x);
float y = 6 * vertical_step;
container.setLocalTranslation(x, y, 0);
}
@Override
public void hide() {
super.hide();
}
public void setTaken(boolean isTaken, boolean self, String name) {
taken = isTaken;
if(isTaken) {
createTakenButton(new Vector3f(170 * app.getResolutionFactor(), 250 * app.getResolutionFactor(), 0), self);
button.setText(label + "\n\n" + name);
} else {
createNotTakenButton(new Vector3f(170 * app.getResolutionFactor(), 250 * app.getResolutionFactor(), 0));
button.setText(label);
}
}
protected void createNotTakenButton(Vector3f size) {
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
button.setPreferredSize(size);
button.setTextHAlignment(HAlignment.Center);
button.setTextVAlignment(VAlignment.Center);
if(button.getClickCommands() != null) {
button.removeClickCommands(clickCommand);
}
button.addClickCommands(clickCommand);
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
button.setBackground(background);
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(hoverBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(normalBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
container.addChild(button);
}
private void toggleButton() {
if(taken) {
app.getModelSyncronizer().unselectTsk();
}
else {
app.getModelSyncronizer().selectTsk(Color.values()[val]);
}
}
protected void createTakenButton(Vector3f size, boolean self) {
ColorRGBA color_a;
ColorRGBA color_b;
if(button.getClickCommands() != null) {
button.removeClickCommands(clickCommand);
}
if(!self) {
color_a = ColorRGBA.Red;
color_b = ColorRGBA.Red;
} else {
color_a = ColorRGBA.Green;
color_b = ColorRGBA.Yellow;
button.addClickCommands(clickCommand);
}
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
button.setPreferredSize(size);
button.setTextHAlignment(HAlignment.Center);
button.setTextVAlignment(VAlignment.Center);
QuadBackgroundComponent background = new QuadBackgroundComponent(color_a);
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
button.setBackground(background);
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(color_b);
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(hoverBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(color_a);
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(normalBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
container.addChild(button);
}
}

View File

@@ -1,15 +0,0 @@
package pp.mdga.client.dialog;
import java.util.function.Consumer;
public class PercentRunnable {
private final Consumer<Float> action;
public PercentRunnable(Consumer<Float> action) {
this.action = action;
}
public void run(float percent) {
action.accept(percent);
}
}

View File

@@ -1,78 +0,0 @@
package pp.mdga.client.dialog;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.texture.Texture;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.HAlignment;
import com.simsilica.lemur.Panel;
import com.simsilica.lemur.VAlignment;
import com.simsilica.lemur.component.IconComponent;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import pp.mdga.client.MdgaApp;
public class SettingsButtonDialog extends Dialog {
private IconComponent icon;
public SettingsButtonDialog(MdgaApp app, Node node, String label, Runnable action) {
super(app, node);
icon = new IconComponent("Images/zahnrad.png");
icon.setIconScale(0.1f * app.getResolutionFactor());
createButton(label, action, new Vector3f(60 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
}
@Override
public void show() {
super.show();
float x = (15.5f * horitontal_step) - container.getPreferredSize().x;
float y = 8.5f * vertical_step;
container.setLocalTranslation(x, y, 0);
}
@Override
public void hide() {
super.hide();
}
@Override
protected void createButton(String label, Runnable action, Vector3f size) {
Button button = new Button(label);
button.addClickCommands(source -> action.run());
button.setFontSize(fontSize);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
button.setPreferredSize(size);
button.setTextHAlignment(HAlignment.Center);
button.setTextVAlignment(VAlignment.Center);
QuadBackgroundComponent background = new QuadBackgroundComponent(COLOR_DEFAULT);
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
button.setBackground(background);
button.setIcon(icon);
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(COLOR_HOVER);
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(hoverBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
button.setIcon(icon);
});
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(COLOR_DEFAULT);
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(normalBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
button.setIcon(icon);
});
container.addChild(button);
}
}

View File

@@ -1,112 +1,52 @@
package pp.mdga.client.dialog;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.texture.Texture;
import com.simsilica.lemur.*;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import com.simsilica.lemur.component.SpringGridLayout;
import com.simsilica.lemur.event.CursorListener;
import com.simsilica.lemur.event.CursorMotionEvent;
import com.simsilica.lemur.event.MouseEventControl;
import pp.mdga.client.MdgaApp;
import com.simsilica.lemur.*;
import com.simsilica.lemur.style.*;
import java.util.HashMap;
import pp.mdga.client.button.InputButton;
import pp.mdga.client.button.MenuButton;
import pp.mdga.client.view.MainView;
import pp.mdga.client.view.MdgaView;
public class SettingsDialog extends Dialog {
private TextField nameInput;
private MenuButton videoButton;
private MenuButton audioButton;
private MenuButton backButton;
private HashMap<Slider, PercentRunnable> map = new HashMap<Slider, PercentRunnable>();
private HashMap<Slider, GetPercentRunnable> map2 = new HashMap<Slider, GetPercentRunnable>();
private final MdgaView view;
public SettingsDialog(MdgaApp app, Node node, String path) {
public SettingsDialog(MdgaApp app, Node node, MdgaView view) {
super(app, node);
QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
quad1.setMargin(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor());
container.setBackground(quad1);
this.view = view;
Texture texture = app.getAssetManager().loadTexture(path);
videoButton = new MenuButton(app, node, view::enterVideoSettings, "Video");
audioButton = new MenuButton(app, node, view::enterAudioSettings, "Audio");
backButton = new MenuButton(app, node, view::leaveSettings, "Zurück");
QuadBackgroundComponent b = new QuadBackgroundComponent(texture);
float offset = 2.0f;
Panel imagePanel = new Panel();
imagePanel.setBackground(b);
videoButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.25f;
container.addChild(imagePanel).setPreferredSize(new Vector3f((texture.getImage().getWidth() / 2) * app.getResolutionFactor(), (texture.getImage().getHeight() / 2) * app.getResolutionFactor(), 0));
audioButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.25f;
//abstandshalter
container.addChild(new Panel(80 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
backButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.25f;
}
@Override
public void show() {
super.show();
container.setLocalTranslation(
app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2,
app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2,
0
);
protected void onShow() {
videoButton.show();
audioButton.show();
backButton.show();
}
@Override
public void hide() {
super.hide();
}
public void addButton(String label, Runnable action, Vector3f size) {
createButton(label, action, size);
}
public void addSlider(String label, PercentRunnable action, GetPercentRunnable action2, Vector3f size, int start) {
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
Slider slider = new Slider("slider");
QuadBackgroundComponent background = new QuadBackgroundComponent(ColorRGBA.DarkGray);
slider.setBackground(background);
slider.setPreferredSize(size);
slider.setModel(new DefaultRangedValueModel(0, 100, start));
slider.setPreferredSize(new Vector3f(150 * app.getResolutionFactor(), 30 * app.getResolutionFactor(), 0));
slider.getDecrementButton().setText(" - ");
slider.getIncrementButton().setText(" + ");
slider.getDecrementButton().setFontSize(25 * app.getResolutionFactor());
slider.getIncrementButton().setFontSize(25 * app.getResolutionFactor());
Label nameLabel = new Label(label);
nameLabel.setFontSize(fontSize);
nameLabel.setColor(ColorRGBA.Black);
nameLabel.setPreferredSize(new Vector3f(150 * app.getResolutionFactor(), 10 * app.getResolutionFactor(), 0));
subContainer.addChild(nameLabel);
subContainer.addChild(slider);
container.addChild(subContainer);
map.put(slider, action);
map2.put(slider, action2);
//abstandshalter
container.addChild(new Panel(20 * app.getResolutionFactor(), 10 * app.getResolutionFactor(), ColorRGBA.Gray));
}
public void initVolume() {
map2.forEach((slider, runnable) -> {
double val = (double) runnable.get();
slider.getModel().setPercent(val);
});
}
public void update() {
map.forEach((slider, runnable) -> {
float val = (float) slider.getModel().getPercent();
runnable.run(val);
});
protected void onHide() {
videoButton.hide();
audioButton.hide();
backButton.hide();
}
}

View File

@@ -1,28 +0,0 @@
package pp.mdga.client.dialog;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
public class SingleButtonLeftDialog extends Dialog {
public SingleButtonLeftDialog(MdgaApp app, Node node, String label, Runnable action) {
super(app, node);
createButton(label, action, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
}
@Override
public void show() {
super.show();
float x = 2 * horitontal_step;
float y = 1.8f * vertical_step;
container.setLocalTranslation(x, y, 0);
}
@Override
public void hide() {
super.hide();
}
}

View File

@@ -1,28 +0,0 @@
package pp.mdga.client.dialog;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
public class SingleButtonRightDialog extends Dialog {
public SingleButtonRightDialog(MdgaApp app, Node node, String label, Runnable action) {
super(app, node);
createButton(label, action, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
}
@Override
public void show() {
super.show();
float x = (14 * horitontal_step) - container.getPreferredSize().x;
float y = 1.8f * vertical_step;
container.setLocalTranslation(x, y, 0);
}
@Override
public void hide() {
super.hide();
}
}

View File

@@ -1,66 +0,0 @@
package pp.mdga.client.dialog;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.HAlignment;
import com.simsilica.lemur.VAlignment;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import pp.mdga.client.MdgaApp;
public class SingleButtonTopRight extends Dialog {
public SingleButtonTopRight(MdgaApp app, Node node, String label, Runnable action) {
super(app, node);
createButton(label, action, new Vector3f(170 * app.getResolutionFactor(), 60 * app.getResolutionFactor(), 0));
}
@Override
public void show() {
super.show();
float x = (14 * horitontal_step) - container.getPreferredSize().x;
float y = 8.5f * vertical_step;
container.setLocalTranslation(x, y, 0);
}
@Override
public void hide() {
super.hide();
}
protected void createButton(String label, Runnable action, Vector3f size) {
Button button = new Button(label);
button.addClickCommands(source -> action.run());
button.setFontSize(fontSize);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
button.setPreferredSize(size);
button.setTextHAlignment(HAlignment.Center);
button.setTextVAlignment(VAlignment.Center);
QuadBackgroundComponent background = new QuadBackgroundComponent(ColorRGBA.Red);
background.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
button.setBackground(background);
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOn, (source) -> {
QuadBackgroundComponent hoverBackground = new QuadBackgroundComponent(ColorRGBA.Yellow);
hoverBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(hoverBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
button.addCommands(com.simsilica.lemur.Button.ButtonAction.HighlightOff, (source) -> {
QuadBackgroundComponent normalBackground = new QuadBackgroundComponent(ColorRGBA.Red);
normalBackground.setMargin(5 * app.getResolutionFactor(), 5 * app.getResolutionFactor());
source.setBackground(normalBackground);
button.setHighlightColor(ColorRGBA.White);
button.setColor(ColorRGBA.Black);
});
container.addChild(button);
}
}

View File

@@ -1,86 +1,189 @@
package pp.mdga.client.dialog;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.texture.Texture;
import com.simsilica.lemur.*;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import com.simsilica.lemur.component.SpringGridLayout;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.button.InputButton;
import pp.mdga.client.button.MenuButton;
import pp.mdga.client.view.MainView;
import java.util.Random;
import java.util.random.RandomGenerator;
public class StartDialog extends Dialog {
private TextField nameInput;
private InputButton nameInput;
public StartDialog(MdgaApp app, Node node) {
private MenuButton hostButton;
private MenuButton joinButton;
private MenuButton endButton;
private final MainView view;
public StartDialog(MdgaApp app, Node node, MainView view) {
super(app, node);
QuadBackgroundComponent quad1 = new QuadBackgroundComponent(ColorRGBA.Gray);
quad1.setMargin(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor());
container.setBackground(quad1);
this.view = view;
Texture texture = app.getAssetManager().loadTexture("Images/mdga_logo.png");
nameInput = new InputButton(app, node, "Name: ", 16);
QuadBackgroundComponent b = new QuadBackgroundComponent(texture);
hostButton = new MenuButton(app, node, () -> view.forward(true), "Spiel hosten");
joinButton = new MenuButton(app, node, () -> view.forward(false), "Spiel beitreten");
endButton = new MenuButton(app, node, app::stop, "Spiel beenden");
Panel imagePanel = new Panel();
imagePanel.setBackground(b);
float offset = 2.0f;
container.addChild(imagePanel).setPreferredSize(new Vector3f(texture.getImage().getWidth() / 4, texture.getImage().getHeight() / 4, 0));
nameInput.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.5f;
//abstandshalter
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
hostButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.25f;
createTextField();
joinButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.25f;
//abstandshalter
container.addChild(new Panel(100 * app.getResolutionFactor(), 50 * app.getResolutionFactor(), ColorRGBA.Gray));
endButton.setPos(new Vector2f(0, MenuButton.VERTICAL -offset));
offset += 1.25f;
}
@Override
public void show() {
super.show();
protected void onShow() {
nameInput.show();
container.setLocalTranslation(
app.getCamera().getWidth() / 2 - container.getPreferredSize().x / 2,
app.getCamera().getHeight() / 2 + container.getPreferredSize().y / 2,
0
);
hostButton.show();
joinButton.show();
endButton.show();
}
@Override
public void hide() {
super.hide();
protected void onHide ()
{
nameInput.hide();
hostButton.hide();
joinButton.hide();
endButton.hide();
}
public void addButton(String label, Runnable action, Vector3f size) {
createButton(label, action, size);
}
private void createTextField() {
Container subContainer = new Container(new SpringGridLayout(Axis.X, Axis.Y));
Label nameLabel = new Label("Name:\t");
nameLabel.setFontSize(fontSize);
nameLabel.setColor(ColorRGBA.Black);
nameInput = new TextField("");
nameInput.setColor(ColorRGBA.Black);
nameInput.setTextHAlignment(HAlignment.Left);
nameInput.setFontSize(fontSize);
nameInput.setSingleLine(true);
QuadBackgroundComponent grayBackground = new QuadBackgroundComponent(ColorRGBA.DarkGray);
nameInput.setBackground(grayBackground);
subContainer.addChild(nameLabel);
subContainer.addChild(nameInput);
container.addChild(subContainer);
public void update() {
nameInput.update();
}
public String getName() {
return nameInput.getText();
String name = nameInput.getString();
if (name == null || name.trim().isEmpty()) {
String[] names = {
"PixelPirat",
"NoobJäger",
"LagMeister",
"KnopfDrücker",
"SpawnCamper",
"AFKHeld",
"RageQuitter",
"GameOverPro",
"Checkpoint",
"RespawnHeld",
"Teebeutel",
"GlitchHexer",
"QuickScope",
"LootSammler",
"EpicLauch",
"KartoffelPro",
"StilleKlinge",
"TastenHeld",
"PixelKrieger",
"HacknSlash",
"JoystickJoe",
"SpawnFalle",
"OneHitWanda",
"CamperKing",
"GameGenie",
"HighPing",
"CheesePro",
"Speedy",
"GigaGamer",
"LevelNoob",
"SkillTobi",
"HeadshotMax",
"PentaPaul",
"CritKarl",
"ManaLeerer",
"Nachlader",
"ClutchKönig",
"FriendlyFe",
"ZonenHeld",
"SchleichKatze",
"ShotgunPro",
"SniperUdo",
"BossHunter",
"HeldenNoob",
"KillFranz",
"FragKarl",
"TeamNiete",
"LootPaul",
"UltraNoob",
"ProfiScout",
"PunkteKlaus",
"KrüppelKill",
"PixelNinja",
"NoobCrusher",
"LagBoss",
"SpawnKing",
"AFKSlayer",
"RespawnPro",
"Killjoy",
"GameBreaker",
"FastFingers",
"LootKing",
"QuickFlick",
"SilentShot",
"HackGod",
"GlitchHero",
"SpeedyBot",
"AimWizard",
"FragMaster",
"OneTapPro",
"KnifeLord",
"MetaHunter",
"PingWarrior",
"KeyBash",
"ClutchPro",
"ScopeBot",
"TrollMage",
"PowerLooter",
"TankHero",
"CampLord",
"SmurfSlayer",
"SkillThief",
"SniperGod",
"LevelHack",
"GhostAim",
"BossTamer",
"ShotgunJoe",
"AimRider",
"KillCount",
"PixelManiac",
"TrollOver",
"SneakPro",
"ReloadKing",
"SpawnTrap",
"LagLover",
"MetaHater",
"BoomMaker",
"WipeLord",
"CarryPro",
"ProBaiter",
"GameWarden",
};
Random random = new Random();
name = names[random.nextInt(names.length)];
}
return name;
}
}

View File

@@ -0,0 +1,48 @@
package pp.mdga.client.dialog;
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.button.MenuButton;
import pp.mdga.client.view.MdgaView;
public class VideoSettingsDialog extends Dialog {
private MenuButton backButton;
private final MdgaView view;
private boolean active = false;
public VideoSettingsDialog(MdgaApp app, Node node, MdgaView view) {
super(app, node);
this.view = view;
backButton = new MenuButton(app, node, view::leaveVideoSettings, "Zurück");
float offset = 2.0f;
backButton.setPos(new Vector2f(0, MenuButton.VERTICAL - offset));
offset += 1.25f;
}
@Override
protected void onShow() {
active = true;
backButton.show();
}
@Override
protected void onHide() {
active = false;
backButton.hide();
}
public void update() {
if(!active) {
return;
}
}
}

View File

@@ -0,0 +1,128 @@
package pp.mdga.client.gui;
import com.jme3.asset.AssetManager;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.system.AppSettings;
import pp.mdga.client.Asset;
import pp.mdga.game.Color;
public class ActionTextHandler {
private Node root;
private BitmapFont font;
private AppSettings appSettings;
public ActionTextHandler(Node guiNode, AssetManager assetManager, AppSettings appSettings){
root = new Node("actionTextRoot");
guiNode.attachChild(root);
root.setLocalTranslation(center(appSettings.getWidth(), appSettings.getHeight(), Vector3f.ZERO));
font = assetManager.loadFont("Fonts/Gunplay.fnt");
this.appSettings = appSettings;
}
private Node createTextWithSpacing(String[] textArr, float spacing, float size, ColorRGBA[] colorArr) {
if(textArr.length != colorArr.length) throw new RuntimeException("text and color are not the same length");
Node textNode = new Node("TextWithSpacing");
Node center = new Node();
float xOffset = 0;
for(int i = 0; i < textArr.length; i++){
String text = textArr[i];
ColorRGBA color = colorArr[i];
for (char c : text.toCharArray()) {
BitmapText letter = new BitmapText(font);
letter.setColor(color);
letter.setSize(size);
letter.setText(Character.toString(c));
letter.setLocalTranslation(xOffset, letter.getHeight()/2, 0);
center.attachChild(letter);
xOffset += letter.getLineWidth() + spacing;
}
}
center.setLocalTranslation(new Vector3f(-xOffset/2,0,0));
textNode.attachChild(center);
return textNode;
}
private Node createTextWithSpacing(String text, float spacing, float size, ColorRGBA color) {
return createTextWithSpacing(new String[]{text}, spacing, size, new ColorRGBA[]{color});
}
private Vector3f center(float width, float height, Vector3f pos){
return new Vector3f(pos.x+width/2, pos.y+height/2,0);
}
private Node createTopText(String name, float spacing, float size, ColorRGBA color, float top){
return createTopText(new String[]{name}, spacing, size, new ColorRGBA[]{color}, top);
}
private Node createTopText(String[] name, float spacing, float size, ColorRGBA color[], float top){
Node text = createTextWithSpacing(name, spacing, size, color);
text.setLocalTranslation(0, (appSettings.getHeight()/2f)*0.8f-top,0);
root.attachChild(text);
return text;
}
private Vector3f centerText(float width, float height, Vector3f pos){
return center(-width, height, pos);
}
public void activePlayer(String name, Color color){
createTopText(new String[]{name," ist dran"}, 10,90,new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
}
public void ownActive(Color color){
createTopText(new String[]{"Du"," bist dran"}, 10,90,new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
}
public void diceNum(int diceNum, String name, Color color){
createTopText(new String[]{name," würfelt:"}, 10,90,new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0);
createTopText(String.valueOf(diceNum), 10, 100, ColorRGBA.White, 100);
}
public void diceNumMult(int diceNum,int mult, String name, Color color){
createTopText(new String[]{name," würfelt:"}, 10,90,new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0);
createTopText(new String[]{String.valueOf(diceNum), " x" + mult + " = " + (diceNum*mult)}, 20, 100, new ColorRGBA[]{ColorRGBA.White,ColorRGBA.Red}, 100);
}
public void ownDice(int diceNum){
createTopText(String.valueOf(diceNum), 10, 100, ColorRGBA.White, 0);
}
public void ownDiceMult(int diceNum, int mult){
createTopText(new String[]{String.valueOf(diceNum), " x" + mult + " = " + (diceNum*mult)}, 20, 100, new ColorRGBA[]{ColorRGBA.White,ColorRGBA.Red}, 0);
}
public void drawCard(String name, Color color){
createTopText(new String[]{name," erhält eine Bonuskarte"}, 7,70, new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
}
public void drawCardOwn(Color color){
createTopText(new String[]{"Du"," erhälst eine Bonuskarte"}, 5,70, new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
}
private ColorRGBA playerColorToColorRGBA(Color color){
return switch (color){
case ARMY -> ColorRGBA.Green;
case NAVY -> ColorRGBA.Blue;
case CYBER -> ColorRGBA.Orange;
case AIRFORCE -> ColorRGBA.Black;
};
}
public void hide(){
root.detachAllChildren();
}
}

View File

@@ -1,24 +1,153 @@
package pp.mdga.client.gui;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.control.AbstractControl;
import com.jme3.scene.shape.Box;
import com.jme3.scene.shape.Cylinder;
import com.jme3.scene.shape.Sphere;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.board.OutlineControl;
import java.awt.*;
public class CardControl extends OutlineControl {
private static final ColorRGBA OUTLINE_COLOR = ColorRGBA.Yellow;
private static final int OUTLINE_THICKNESS = 9;
public CardControl(MdgaApp app, FilterPostProcessor fpp, Camera cam){
private static final ColorRGBA HIGHLIGHT_COLOR = ColorRGBA.Yellow;
private static final int HIGHLIGHT_WIDTH = 9;
private static final ColorRGBA HOVER_COLOR = ColorRGBA.Green;
private static final int HOVER_WIDTH = 12;
private static final ColorRGBA SELECT_COLOR = ColorRGBA.Blue;
private static final int SELECT_WIDTH = 13;
private static final int OUTLINE_THICKNESS = 9;
private boolean hoverable;
private boolean highlight;
private boolean selectable;
private boolean select;
private Node root;
private BitmapText num;
public CardControl(MdgaApp app, FilterPostProcessor fpp, Camera cam, Node root){
super(app, fpp, cam, OUTLINE_THICKNESS);
this.root = root;
Node rootNum = createNum();
rootNum.setLocalTranslation(new Vector3f(0.35f,0.8f,0));
root.attachChild(rootNum);
}
private Node createNum(){
Node rootNum = new Node("root Num");
Geometry circle = new Geometry("circle", new Sphere(20,20,1));
circle.setLocalTranslation(new Vector3f(0.03f,0.01f,1));
circle.setLocalScale(0.2f);
Material mat = new Material(getApp().getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Black);
circle.setMaterial(mat);
root.attachChild(circle);
BitmapFont guiFont = getApp().getAssetManager().loadFont("Fonts/Gunplay.fnt");
num = new BitmapText(guiFont);
num.setSize(0.3f);
num.setText("1");
num.setColor(ColorRGBA.White);
num.setLocalTranslation(-num.getLineWidth() / 2, num.getHeight() / 2, 2);
rootNum.attachChild(circle);
rootNum.attachChild(num);
return rootNum;
}
public void setNumCard(int num){
this.num.setText(String.valueOf(num));
}
public Node getRoot() {
return root;
}
@Override
public void initSpatial(){
}
public void outline(){
super.outline(OUTLINE_COLOR);
}
private final static Vector3f HIGHLIGHT_Y = new Vector3f(0,0.4f,0);
public void setHighlight() {
this.highlight = true;
root.setLocalTranslation(root.getLocalTranslation().add(HIGHLIGHT_Y));
highlight();
}
public void highlight() {
super.outline(HIGHLIGHT_COLOR, HIGHLIGHT_WIDTH);
}
public void unHighlight(){
highlight = false;
root.setLocalTranslation(root.getLocalTranslation().subtract(HIGHLIGHT_Y));
deOutline();
}
public void hover(){
if(!hoverable) return;
super.outline(HOVER_COLOR, HOVER_WIDTH);
}
public void hoverOff(){
if(!hoverable) return;
if(select) select();
else if(highlight) highlight();
else deOutline();
}
public void select(){
if(!selectable) return;
select = true;
super.outline(SELECT_COLOR, SELECT_WIDTH);
}
public void unSelect(){
if(!selectable) return;
select = false;
if(highlight) highlight();
else deOutline();
}
public void setSelectable(boolean selectable){
this.selectable = selectable;
}
public boolean isSelected() {
return select;
}
public boolean isSelectable() {
return selectable;
}
public void setHoverable(boolean hoverable) {
this.hoverable = hoverable;
}
}

View File

@@ -3,7 +3,9 @@
import com.jme3.app.Application;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.post.filters.ComposeFilter;
@@ -12,6 +14,9 @@
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.shadow.DirectionalLightShadowFilter;
import com.jme3.shadow.DirectionalLightShadowRenderer;
import com.jme3.shadow.EdgeFilteringMode;
import com.jme3.texture.Image;
import com.jme3.texture.Texture2D;
import pp.mdga.client.Asset;
@@ -48,6 +53,22 @@ public void initialize(AppStateManager stateManager, Application app ) {
view.attachScene(root);
fpp.setFrameBufferFormat(Image.Format.RGBA8);
fpp.addFilter(new ComposeFilter(backTexture));
DirectionalLight sun = new DirectionalLight();
sun.setColor(ColorRGBA.White);
sun.setDirection(new Vector3f(.5f,-.5f,-1));
root.addLight(sun);
final int SHADOWMAP_SIZE=1024*8;
DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(app.getAssetManager(), SHADOWMAP_SIZE, 3);
dlsf.setLight(sun);
dlsf.setEnabled(true);
dlsf.setEdgeFilteringMode(EdgeFilteringMode.PCFPOISSON);
dlsf.setShadowIntensity(.5f);
fpp.addFilter(dlsf);
view.addProcessor(fpp);
if(!init) init = true;

View File

@@ -0,0 +1,214 @@
package pp.mdga.client.gui;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.renderer.Camera;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.texture.Texture2D;
import pp.mdga.client.Asset;
import pp.mdga.client.MdgaApp;
import pp.mdga.game.BonusCard;
import java.util.*;
public class CardLayerHandler {
private static final Vector3f START = new Vector3f(-1.8f, -3.5f, 0);
private static final Vector3f MARGIN = new Vector3f(1.8f, 0, 0);
private static final float CARDLAYER_CAMERA_ZOOM = 4;
private final MdgaApp app;
private final FilterPostProcessor fpp;
private final Texture2D backTexture;
private Camera cardLayerCamera;
private CardLayer cardLayer;
private DiceControl diceControl;
private final Map<BonusCard, CardControl> bonusCardControlMap = new HashMap<>();
private final Map<BonusCard, Integer> bonusCardIntegerMap = new HashMap<>();
private final Set<CardControl> selectableCards = new HashSet<>();
private BonusCard cardSelect = null;
public CardLayerHandler(MdgaApp app, Texture2D backTexture) {
this.app = app;
this.fpp = new FilterPostProcessor(app.getAssetManager());
this.backTexture = backTexture;
}
public void init() {
cardLayerCamera = createOverlayCam();
cardLayer = new CardLayer(fpp, cardLayerCamera, backTexture);
app.getStateManager().attach(cardLayer);
diceControl = new DiceControl(app.getAssetManager());
diceControl.create(new Vector3f(0, 0, 0), 1f, false);
}
public void shutdown() {
if (cardLayer != null) {
cardLayer.shutdown();
}
cardLayer = null;
}
public void rollDice(int rollNum, Runnable actionAfter) {
if (!(1 <= rollNum && rollNum <= 6)) throw new RuntimeException("rollNum is not in the range [1,6]");
diceControl.rollDice(rollNum, actionAfter);
}
public void showDice() {
cardLayer.addSpatial(diceControl.getSpatial());
diceControl.spin();
}
public void hideDice() {
diceControl.hide();
}
public void addCard(BonusCard card) {
if (card == BonusCard.HIDDEN) throw new RuntimeException("Can't add hidden card to GUI");
if (!bonusCardControlMap.containsKey(card)) {
CardControl control = createCard(bonusToAsset(card), nextPos());
bonusCardControlMap.put(card, control);
cardLayer.addSpatial(control.getRoot());
}
int newNum = bonusCardIntegerMap.getOrDefault(card, 0) + 1;
bonusCardIntegerMap.put(card, newNum);
bonusCardControlMap.get(card).setNumCard(newNum);
}
public void clearSelectableCards() {
for (CardControl control : selectableCards) {
control.setSelectable(false);
control.setHoverable(false);
control.unHighlight();
control.unSelect();
}
selectableCards.clear();
cardSelect = null;
}
public void setSelectableCards(List<BonusCard> select) {
for (BonusCard card : select) {
selectableCards.add(bonusCardControlMap.get(card));
}
for (CardControl control : selectableCards) {
control.setSelectable(true);
control.setHoverable(true);
control.setHighlight();
}
}
public void selectCard(CardControl cardControl) {
if (cardControl.isSelected()) {
cardControl.unSelect();
cardSelect = null;
} else {
for (CardControl control : selectableCards) {
control.unSelect();
}
cardControl.select();
cardSelect = getKeyByValue(bonusCardControlMap, cardControl);
}
}
public Camera getCardLayerCamera() {
return cardLayerCamera;
}
public void shield(){
SymbolControl control = createSymbol(Asset.shieldSymbol);
cardLayer.addSpatial(control.getSpatial());
control.shield();
}
public void swap(){
SymbolControl control = createSymbol(Asset.swapSymbol);
cardLayer.addSpatial(control.getSpatial());
control.swap();
}
public void turbo(){
SymbolControl control = createSymbol(Asset.turboSymbol);
cardLayer.addSpatial(control.getSpatial());
control.turbo();
}
private Asset bonusToAsset(BonusCard card) {
return switch (card) {
case TURBO -> Asset.turboCard;
case SHIELD -> Asset.shieldCard;
case SWAP -> Asset.swapCard;
case HIDDEN -> throw new RuntimeException("HIDDEN is not allowed in GUI");
};
}
private Vector3f nextPos() {
return START.add(MARGIN.mult(bonusCardControlMap.size()));
}
private Camera createOverlayCam() {
Camera originalCam = app.getCamera();
Camera overlayCam = new Camera(originalCam.getWidth(), originalCam.getHeight());
overlayCam.setParallelProjection(true);
float aspect = (float) originalCam.getWidth() / originalCam.getHeight();
float size = CARDLAYER_CAMERA_ZOOM;
overlayCam.setFrustum(-1000, 1000, -aspect * size, aspect * size, size, -size);
overlayCam.setLocation(new Vector3f(0, 0, 10));
overlayCam.lookAt(new Vector3f(0, 0, 0), Vector3f.UNIT_Y);
return overlayCam;
}
private <K, V> K getKeyByValue(Map<K, V> map, V value) {
for (Map.Entry<K, V> entry : map.entrySet()) {
if (entry.getValue().equals(value)) {
return entry.getKey();
}
}
return null;
}
public void test() {
addCard(BonusCard.SHIELD);
addCard(BonusCard.SHIELD);
addCard(BonusCard.TURBO);
addCard(BonusCard.SWAP);
}
private CardControl createCard(Asset card, Vector3f pos){
Node rootCard = new Node("Root Card");
Spatial spatial = app.getAssetManager().loadModel(card.getModelPath());
rootCard.attachChild(spatial);
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
mat.setTexture("DiffuseMap", app.getAssetManager().loadTexture(card.getDiffPath()));
spatial.setMaterial(mat);
spatial.setLocalScale(1f);
rootCard.setLocalTranslation(pos);
spatial.rotate((float)Math.toRadians(90), (float)Math.toRadians(180), (float)Math.toRadians(180));
spatial.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
CardControl control = new CardControl(app, fpp, cardLayer.getOverlayCam(), rootCard);
spatial.addControl(control);
return control;
}
private SymbolControl createSymbol(Asset asset){
Spatial spatial = app.getAssetManager().loadModel(asset.getModelPath());
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", app.getAssetManager().loadTexture(asset.getDiffPath()));
spatial.setMaterial(mat);
spatial.setLocalScale(1f);
spatial.rotate((float)Math.toRadians(90), (float)Math.toRadians(180), (float)Math.toRadians(180));
SymbolControl control = new SymbolControl();
spatial.addControl(control);
return control;
}
public CardLayer getCardLayer(){
return cardLayer;
}
}

View File

@@ -1,36 +1,48 @@
package pp.mdga.client.gui;
import com.jme3.asset.AssetManager;
import com.jme3.material.Material;
import com.jme3.math.FastMath;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.AbstractControl;
import pp.mdga.client.Asset;
import java.util.Random;
import static com.jme3.material.Materials.LIGHTING;
import static com.jme3.material.Materials.UNSHADED;
public class DiceControl extends AbstractControl {
private final Random random = new Random();
private Quaternion targetRotation; // Final rotation of the dice
private final Vector3f angularVelocity = new Vector3f(); // Rotational velocity (radians/sec)
private float deceleration = 0.5f; // Friction-like deceleration
private Quaternion targetRotation;
private final Vector3f angularVelocity = new Vector3f();
private float deceleration = 0.5f;
private float timeElapsed = 0.0f;
private float rollDuration = 1f;
private static final int ANGULAR_MIN = 5;
private static final int ANGULAR_MAX = 15;
private static final int ANGULAR_SPIN = 10;
private boolean isRolling = false;
private boolean slerp = false;
private float timeElapsed = 0.0f;
private float rollDuration = 0.0001f;
private boolean spin = false;
private final AssetManager assetManager;
private Runnable actionAfter;
public DiceControl(AssetManager assetManager){
this.assetManager = assetManager;
}
@Override
protected void controlUpdate(float tpf) {
if (isRolling) {
if(!slerp) {
// Apply rotational velocity to the dice
Quaternion currentRotation = spatial.getLocalRotation();
Quaternion deltaRotation = new Quaternion();
deltaRotation.fromAngles(
angularVelocity.x * tpf,
angularVelocity.y * tpf,
angularVelocity.z * tpf
);
spatial.setLocalRotation(currentRotation.mult(deltaRotation));
spinWithAngularVelocity(tpf);
// Gradually reduce rotational velocity (simulate deceleration)
angularVelocity.subtractLocal(
@@ -47,53 +59,62 @@ protected void controlUpdate(float tpf) {
if (timeElapsed > 1.0f) timeElapsed = 1.0f;
// Quaternion interpolated = new Quaternion();
// interpolated.slerp(spatial.getLocalRotation(), targetRotation, progress);
// spatial.setLocalRotation(interpolated);
Quaternion interpolated = spatial.getLocalRotation().clone();
interpolated.nlerp(targetRotation, lerp(timeElapsed));
interpolated.slerp(targetRotation, timeElapsed);
spatial.setLocalRotation(interpolated);
// Stop rolling once duration is complete
if (timeElapsed >= 1.0f) {
isRolling = false;
slerp = false;
actionAfter.run();
}
}
}else if(spin){
spinWithAngularVelocity(tpf);
}
}
private void spinWithAngularVelocity(float tpf){
Quaternion currentRotation = spatial.getLocalRotation();
Quaternion deltaRotation = new Quaternion();
deltaRotation.fromAngles(
angularVelocity.x * tpf,
angularVelocity.y * tpf,
angularVelocity.z * tpf
);
spatial.setLocalRotation(currentRotation.mult(deltaRotation));
}
@Override
protected void controlRender(RenderManager rm, ViewPort vp) {
// No custom rendering needed
}
public void rollDice(int diceNum) {
if (isRolling) return; // Prevent re-rolling during animation
// Set high initial rotational velocity
public void rollDice(int diceNum, Runnable actionAfter) {
if (isRolling) return;
spin = false;
slerp = false;
this.actionAfter = actionAfter;
angularVelocity.set(
random.nextFloat() * 1000f + 200f, // X-axis speed
random.nextFloat() * 1000f + 200f, // Y-axis speed
random.nextFloat() * 1000f + 200f // Z-axis speed
FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX),
FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX),
FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX)
);
// Set final target rotation for the diceNum
targetRotation = getRotationForDiceNum(diceNum);
isRolling = true;
}
private Quaternion getRotationForDiceNum(int diceNum) {
// Define specific rotations for each dice face (adjust based on your dice model)
return switch (diceNum) {
case 1 -> new Quaternion().fromAngleAxis((float) (1 * (Math.PI / 2)), Vector3f.UNIT_X); //
case 2 -> new Quaternion().fromAngleAxis((float) (1 * (Math.PI / 2)), Vector3f.UNIT_Y); //
case 3 -> new Quaternion().fromAngleAxis((float) (0 * (Math.PI / 2)), Vector3f.UNIT_X); //
case 4 -> new Quaternion().fromAngleAxis((float) (2 * (Math.PI / 2)), Vector3f.UNIT_Y); //
case 5 -> new Quaternion().fromAngleAxis((float) (3 * (Math.PI / 2)), Vector3f.UNIT_Y); //
case 6 -> new Quaternion().fromAngleAxis((float) (3 * (Math.PI / 2)), Vector3f.UNIT_X); //
case 1 -> new Quaternion().fromAngleAxis((float) (1 * (Math.PI / 2)), Vector3f.UNIT_X);
case 2 -> new Quaternion().fromAngleAxis((float) (1 * (Math.PI / 2)), Vector3f.UNIT_Y);
case 3 -> new Quaternion().fromAngleAxis((float) (0 * (Math.PI / 2)), Vector3f.UNIT_X);
case 4 -> new Quaternion().fromAngleAxis((float) (2 * (Math.PI / 2)), Vector3f.UNIT_Y);
case 5 -> new Quaternion().fromAngleAxis((float) (3 * (Math.PI / 2)), Vector3f.UNIT_Y);
case 6 -> new Quaternion().fromAngleAxis((float) (3 * (Math.PI / 2)), Vector3f.UNIT_X);
default -> throw new IllegalArgumentException("Invalid dice number: " + diceNum);
};
}
@@ -102,4 +123,49 @@ public static float lerp(float t) {
return (float) Math.sqrt(1 - Math.pow(t - 1, 2));
}
public void randomRotation() {
Quaternion randomRotation = new Quaternion();
randomRotation.fromAngles(
FastMath.nextRandomFloat() * FastMath.TWO_PI, // Random X rotation
FastMath.nextRandomFloat() * FastMath.TWO_PI, // Random Y rotation
FastMath.nextRandomFloat() * FastMath.TWO_PI // Random Z rotation
);
spatial.setLocalRotation(randomRotation);
}
public void spin(){
angularVelocity.set(ANGULAR_SPIN,ANGULAR_SPIN,ANGULAR_SPIN);
spin = true;
}
public void hide(){
spatial.removeFromParent();
spin = false;
isRolling = false;
slerp = false;
}
public void create(Vector3f pos, float scale, boolean shadow){
Spatial spatial = assetManager.loadModel(Asset.dice.getModelPath());
Material mat;
if(shadow){
mat = new Material(assetManager, LIGHTING);
mat.setTexture("DiffuseMap", assetManager.loadTexture(Asset.dice.getDiffPath()));
spatial.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
}
else{
mat = new Material(assetManager, UNSHADED);
mat.setTexture("ColorMap", assetManager.loadTexture(Asset.dice.getDiffPath()));
}
spatial.setMaterial(mat);
spatial.setLocalScale(scale);
spatial.setLocalTranslation(pos);
spatial.rotate((float)Math.toRadians(90), (float)Math.toRadians(180), (float)Math.toRadians(180));
spatial.addControl(this);
}
public void setPos(Vector3f pos){
spatial.setLocalTranslation(pos);
}
}

View File

@@ -1,206 +1,118 @@
package pp.mdga.client.gui;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.renderer.Camera;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.texture.Texture2D;
import pp.mdga.client.Asset;
import pp.mdga.client.MdgaApp;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
import java.util.*;
import java.util.List;
public class GuiHandler {
private final MdgaApp app;
private final CardLayerHandler cardLayerHandler;
private final PlayerNameHandler playerNameHandler;
private final ActionTextHandler actionTextHandler;
private final Color ownColor;
private MdgaApp app;
private CardLayer cardLayer;
private Map<UUID, CardControl> ownCardsMap;
private BitmapFont playerFont;
private Node playerNameNode;
private List<Color> playerOrder;
Map<Color, String> colorNameMap;
private static final Vector3f START = new Vector3f(-3,-3,0);
private static final Vector3f MARGIN = new Vector3f(2.5f,0,0);
private final FilterPostProcessor fpp;
Texture2D backTexture;
private Camera cardLayerCamera;
public GuiHandler(MdgaApp app, Texture2D backTexture) {
public GuiHandler(MdgaApp app, Texture2D backTexture, Color ownColor) {
this.app = app;
this.fpp = new FilterPostProcessor(app.getAssetManager());
this.backTexture = backTexture;
cardLayerCamera = createOverlayCam();
this.ownColor = ownColor;
cardLayerHandler = new CardLayerHandler(app, backTexture);
playerNameHandler = new PlayerNameHandler(app.getGuiNode(), app.getAssetManager(), app.getContext().getSettings());
actionTextHandler = new ActionTextHandler(app.getGuiNode(), app.getAssetManager(), app.getContext().getSettings());
}
public void init(){
cardLayer = new CardLayer(fpp, cardLayerCamera, backTexture);
app.getStateManager().attach(cardLayer);
ownCardsMap = new HashMap<>();
playerFont = app.getAssetManager().loadFont("Fonts/Gunplay.fnt");
playerNameNode = new Node("player name node");
app.getGuiNode().attachChild(playerNameNode);
playerOrder = new ArrayList<>();
colorNameMap = new HashMap<>();
public void init() {
cardLayerHandler.init();
}
public void shutdown() {
cardLayerHandler.shutdown();
public void shutdown(){
if(cardLayer != null){
cardLayer.shutdown();
}
cardLayer = null;
ownCardsMap = null;
}
private Asset bonusToAsset(BonusCard card){
return switch (card){
case TURBO -> Asset.turboCard;
case SHIELD -> Asset.shieldCard;
case SWAP -> Asset.swapCard;
case HIDDEN -> throw new RuntimeException("HIDDEN is not allowed in GUI");
};
public void rollDice(int rollNum, int mult) {
cardLayerHandler.rollDice(rollNum, ()->{
if(mult == -1) actionTextHandler.ownDice(rollNum);
else actionTextHandler.ownDiceMult(rollNum, mult);
hideDice();
//TODO send Model finished
});
}
public void addCard(BonusCard card, UUID uuid) {
CardControl control = createCard(bonusToAsset(card), nextPos());
ownCardsMap.put(uuid, control);
cardLayer.addSpatial(control.getSpatial());
public void showRolledDiceMult(int rollNum, int mult, Color color) {
String name = playerNameHandler.getName(color);
if(mult == -1) actionTextHandler.diceNum(rollNum, name, color);
else actionTextHandler.diceNumMult(rollNum, mult, name, color);
}
public void showDice(){
DiceControl control = createDice();
cardLayer.addSpatial(control.getSpatial());
control.rollDice(1);
public void showRolledDice(int rollNum, Color color) {
actionTextHandler.diceNum(rollNum, playerNameHandler.getName(color), color);
}
private DiceControl createDice() {
Spatial spatial = app.getAssetManager().loadModel(Asset.dice.getModelPath());
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", app.getAssetManager().loadTexture(Asset.dice.getDiffPath()));
spatial.setMaterial(mat);
spatial.setLocalScale(1f);
spatial.setLocalTranslation(new Vector3f(0,0,0));
spatial.rotate((float)Math.toRadians(90), (float)Math.toRadians(180), (float)Math.toRadians(180));
DiceControl control = new DiceControl();
spatial.addControl(control);
return control;
public void showDice() {
cardLayerHandler.showDice();
}
public void deleteCard(UUID uuid){
if(!ownCardsMap.containsKey(uuid)) throw new RuntimeException("uuid dont exist in ownCardsmap");
cardLayer.deleteSpatial(ownCardsMap.get(uuid).getSpatial());
ownCardsMap.remove(uuid);
public void hideDice() {
cardLayerHandler.hideDice();
}
private Vector3f nextPos() {
return START.add(MARGIN.mult(ownCardsMap.size()));
public void addCard(pp.mdga.game.BonusCard card) {
cardLayerHandler.addCard(card);
}
private CardControl createCard(Asset card, Vector3f pos){
Spatial spatial = app.getAssetManager().loadModel(card.getModelPath());
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", app.getAssetManager().loadTexture(card.getDiffPath()));
spatial.setMaterial(mat);
spatial.setLocalScale(1f);
spatial.setLocalTranslation(pos);
spatial.rotate((float)Math.toRadians(90), (float)Math.toRadians(180), (float)Math.toRadians(180));
CardControl control = new CardControl(app, fpp, cardLayer.getOverlayCam());
spatial.addControl(control);
return control;
public void clearSelectableCards() {
cardLayerHandler.clearSelectableCards();
}
private void drawPlayers(){
playerNameNode.detachAllChildren();
float paddingTop = 10;
float paddingLeft = 15;
float margin = 35;
for(int i = 0; i < playerOrder.size(); i++) {
Color color = playerOrder.get(i);
if(!colorNameMap.containsKey(color)) throw new RuntimeException(color + " isn't mapped to a name");
String name = colorNameMap.get(color);
renderName(name, paddingTop + margin * i, paddingLeft, i == 0);
}
public void setSelectableCards(List<pp.mdga.game.BonusCard> select) {
cardLayerHandler.setSelectableCards(select);
}
private void renderName(String name, float paddingTop, float paddingLeft, boolean first){
BitmapText hudText = new BitmapText(playerFont);
//renderedSize = 45
hudText.setSize(28);
hudText.setColor(first ? ColorRGBA.Blue : ColorRGBA.White);
hudText.setText(name);
int screenHeight = app.getContext().getSettings().getHeight();
hudText.setLocalTranslation(paddingLeft, screenHeight - paddingTop, 0);
playerNameNode.attachChild(hudText);
}
public void setPlayers(List<String> names, List<Color> colors){
if(names.size() != colors.size()) throw new RuntimeException("names and colors are not the same size");
for(int i = 0; i < names.size(); i++){
colorNameMap.put(colors.get(i), names.get(i));
}
this.playerOrder = new ArrayList<>(colors);
drawPlayers();
}
public void addPlayer(Color color, String name){
colorNameMap.put(color, name);
playerOrder.add(color);
drawPlayers();
}
public void setActivePlayer(Color color){
Color lastFirst = playerOrder.remove(0);
playerOrder.remove(color);
playerOrder.add(0,color);
playerOrder.add(lastFirst);
drawPlayers();
}
private Camera createOverlayCam(){
Camera originalCam = app.getCamera();
Camera overlayCam = new Camera(originalCam.getWidth(), originalCam.getHeight());
overlayCam.setParallelProjection(false);
overlayCam.setFrustum(originalCam.getFrustumNear(), originalCam.getFrustumFar(), originalCam.getFrustumLeft(), originalCam.getFrustumRight(),originalCam.getFrustumTop(), originalCam.getFrustumBottom());
overlayCam.setFov(originalCam.getFov());
overlayCam.setLocation(new Vector3f(0, 0, 10));
overlayCam.lookAt(new Vector3f(0,0,0), Vector3f.UNIT_Y);
return overlayCam;
}
public void test(){
UUID uuid = UUID.randomUUID();
addCard(BonusCard.SHIELD, uuid);
addCard(BonusCard.TURBO, UUID.randomUUID());
addCard(BonusCard.SWAP, UUID.randomUUID());
showDice();
public void selectCard(CardControl cardControl) {
cardLayerHandler.selectCard(cardControl);
}
public Camera getCardLayerCamera() {
return cardLayerCamera;
return cardLayerHandler.getCardLayerCamera();
}
public CardLayer getCardLayer(){
return cardLayer;
public Node getCardLayerRootNode(){
return cardLayerHandler.getCardLayer().getRootNode();
}
public void addPlayer(Color color, String name) {
playerNameHandler.addPlayer(color, name, color == ownColor);
}
public void setActivePlayer(Color color) {
playerNameHandler.setActivePlayer(color);
if (ownColor == color) actionTextHandler.ownActive(color);
else actionTextHandler.activePlayer(playerNameHandler.getName(color), color);
}
public void shield(){
cardLayerHandler.shield();
}
public void swap(){
cardLayerHandler.swap();
}
public void turbo(){
cardLayerHandler.turbo();
}
public void hideText(){
actionTextHandler.hide();
}
public void drawCard(Color color) {
if (ownColor == color) actionTextHandler.drawCardOwn(color);
else actionTextHandler.drawCard(playerNameHandler.getName(color), color);
}

View File

@@ -0,0 +1,126 @@
package pp.mdga.client.gui;
import com.jme3.asset.AssetManager;
import com.jme3.font.BitmapFont;
import com.jme3.font.BitmapText;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.system.AppSettings;
import com.jme3.ui.Picture;
import pp.mdga.game.Color;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PlayerNameHandler {
private final BitmapFont playerFont;
private final Node playerNameNode;
private final List<Color> playerOrder;
private final Map<Color, String> colorNameMap;
private final AppSettings appSettings;
private final AssetManager assetManager;
private Color ownColor;
private static final float PADDING_TOP = 35;
private static final float PADDING_LEFT = 50;
private static final float MARGIN_NAMES = 50;
private static final float IMAGE_SIZE = 50;
private static final float TEXT_SIZE = 28;
private static final ColorRGBA NORMAL_COLOR = ColorRGBA.White;
private static final ColorRGBA ACTIVE_COLOR = ColorRGBA.Blue;
private static final ColorRGBA OWN_COLOR = ColorRGBA.Cyan;
private final Node guiNode;
public PlayerNameHandler(Node guiNode, AssetManager assetManager, AppSettings appSettings){
this.guiNode = guiNode;
playerFont = assetManager.loadFont("Fonts/Gunplay.fnt");
playerNameNode = new Node("player name node");
playerOrder = new ArrayList<>();
colorNameMap = new HashMap<>();
this.appSettings = appSettings;
this.assetManager = assetManager;
}
public void show() {
guiNode.attachChild(playerNameNode);
}
public void hide() {
guiNode.detachChild(playerNameNode);
}
private void drawPlayers(){
playerNameNode.detachAllChildren();
for(int i = 0; i < playerOrder.size(); i++) {
Color color = playerOrder.get(i);
if(!colorNameMap.containsKey(color)) throw new RuntimeException(color + " isn't mapped to a name");
Node nameParent = new Node("nameParent");
nameParent.attachChild(createName(colorNameMap.get(color), i == 0, color == ownColor));
nameParent.attachChild(createColor(color));
nameParent.setLocalTranslation(50,appSettings.getWindowHeight()-PADDING_TOP- MARGIN_NAMES *i,0);
playerNameNode.attachChild(nameParent);
}
}
private String imagePath(Color color){
String root = "./Images/name_pictures/";
return switch(color){
case ARMY -> root+"HEER_IMAGE.png";
case NAVY -> root+"MARINE_IMAGE.png";
case CYBER -> root+"CIR_IMAGE.png";
case AIRFORCE -> root+"LW_IMAGE.png";
};
}
private Spatial createColor(Color color) {
Picture pic = new Picture("HUD Picture");
pic.setImage(assetManager, imagePath(color), true);
pic.setWidth(IMAGE_SIZE);
pic.setHeight(IMAGE_SIZE);
pic.setPosition(-pic.getWidth()/2,-pic.getHeight()/2);
return pic;
}
private Spatial createName(String name, boolean first, boolean own){
BitmapText hudText = new BitmapText(playerFont);
//renderedSize = 45
hudText.setSize(TEXT_SIZE);
hudText.setColor(first ? ACTIVE_COLOR : own ? OWN_COLOR : NORMAL_COLOR);
hudText.setText(name);
hudText.setLocalTranslation(PADDING_LEFT,hudText.getHeight()/2, 0);
return hudText;
}
public void addPlayer(Color color, String name, boolean own){
if(own) ownColor = color;
colorNameMap.put(color, name);
playerOrder.add(color);
drawPlayers();
}
public void setActivePlayer(Color color) {
Color lastFirst = playerOrder.remove(0);
playerOrder.remove(color);
playerOrder.add(0, color);
playerOrder.add(lastFirst);
drawPlayers();
}
public String getName(Color color){
return colorNameMap.get(color);
}
}

View File

@@ -0,0 +1,147 @@
package pp.mdga.client.gui;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.control.AbstractControl;
import pp.mdga.game.BonusCard;
public class SymbolControl extends AbstractControl {
private boolean zoomingIn = false;
private boolean zoomingOut = false;
private float zoomSpeed = 1f;
private float zoomFactor = 3f;
private float progress = 0;
private BonusCard state;
private float rotationSpeed = 0.8f;
private Quaternion initialRotation = null;
private float Y = 5;
@Override
protected void controlUpdate(float tpf) {
if(state == null) return;
switch (state){
case SHIELD -> shieldUpdate(tpf);
case SWAP -> swapUpdate(tpf);
case TURBO -> turboUpdate(tpf);
case HIDDEN -> throw new RuntimeException("forbidden state");
}
}
@Override
protected void controlRender(RenderManager rm, ViewPort vp) {
}
private void shieldUpdate(float tpf){
if (zoomingIn) {
progress += tpf * zoomSpeed;
if (progress > 1) progress = 1;
spatial.setLocalScale(lerp(0, zoomFactor, easeOut(progress)));
if (progress >= 1) {
zoomingIn = false;
zoomingOut = true;
progress = 0;
}
} else if (zoomingOut) {
progress += tpf * zoomSpeed;
spatial.setLocalScale(lerp(zoomFactor, 0, easeIn(progress)));
if (progress > 1) {
zoomingIn = false;
spatial.removeFromParent();
state = null;
progress = 0;
}
}
}
private void swapUpdate(float tpf){
if (initialRotation == null) {
initialRotation = spatial.getLocalRotation().clone();
}
progress += tpf*rotationSpeed;
if(progress < 0) return;
float angle = lerp(0, 360, easeInOut(progress));
Quaternion newRotation = new Quaternion();
newRotation.fromAngleAxis((float) Math.toRadians(angle), new Vector3f(0, 1, 0));
spatial.setLocalRotation(initialRotation.mult(newRotation));
if (progress >= 1.2f) {
state = null;
initialRotation = null;
progress = 0;
spatial.removeFromParent();
}
}
private void turboUpdate(float tpf){
if (zoomingIn) {
progress += tpf * zoomSpeed;
if (progress > 1) progress = 1;
float y = lerp(-Y,0, easeOut(progress));
spatial.setLocalTranslation(0,y,0);
if (progress >= 1) {
zoomingIn = false;
zoomingOut = true;
progress = 0;
}
} else if (zoomingOut) {
progress += tpf * zoomSpeed;
float y = lerp(0,Y, easeIn(progress));
spatial.setLocalTranslation(0,y,0);
if (progress > 1) {
zoomingIn = false;
spatial.removeFromParent();
state = null;
}
}
}
public void shield(){
if(state != null) throw new RuntimeException("another state is avtive");
state = BonusCard.SHIELD;
zoomingIn = true;
zoomingOut = false;
progress = 0;
spatial.setLocalScale(1f);
}
public void swap(){
if(state != null) throw new RuntimeException("another state is avtive");
spatial.setLocalScale(3);
state = BonusCard.SWAP;
progress = -0.2f;
}
public void turbo(){
if(state != null) throw new RuntimeException("another state is avtive");
spatial.setLocalScale(2);
state = BonusCard.TURBO;
zoomingIn = true;
zoomingOut = false;
progress = 0;
}
private static float lerp(float start, float end, float t) {
return (1 - t) * start + t * end;
}
private static float easeOut(float t) {
return (float) Math.sqrt(1 - Math.pow(t - 1, 2));
}
private float easeInOut(float t) {
if(t>1) t=1;
return (float) -(Math.cos(Math.PI * t) - 1) / 2;
}
private float easeIn(float t) {
return t * t * t * t;
}
}

View File

@@ -0,0 +1,82 @@
package pp.mdga.client.gui;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.AbstractControl;
public class ZoomControl extends AbstractControl {
private boolean zoomingIn = false;
private boolean zoomingOut = false;
private float progress = 0;
private float zoomSpeed = 1f;
private float zoomFactor = 1f;
public ZoomControl(){}
public ZoomControl(float speed) {
zoomSpeed = speed;
}
@Override
public void setSpatial(Spatial spatial){
if(this.spatial == null && spatial != null){
super.setSpatial(spatial);
initSpatial();
}
}
private void initSpatial() {
zoomingIn = true;
}
@Override
protected void controlUpdate(float tpf) {
if (zoomingIn) {
progress += tpf * zoomSpeed;
if (progress > 1) progress = 1;
spatial.setLocalScale(lerp(0, zoomFactor, easeOut(progress)));
if (progress >= 1) {
zoomingIn = false;
zoomingOut = true;
progress = 0;
}
} else if (zoomingOut) {
progress += tpf * zoomSpeed;
spatial.setLocalScale(lerp(zoomFactor, 0, easeIn(progress)));
if (progress > 1) {
zoomingOut = false;
end();
}
}
}
private void end(){
spatial.removeFromParent();
spatial.removeControl(this);
}
@Override
protected void controlRender(RenderManager rm, ViewPort vp) {
}
private static float lerp(float start, float end, float t) {
return (1 - t) * start + t * end;
}
// private static float easeOut(float t) {
// return (float) Math.sqrt(1 - Math.pow(t - 1, 2));
// }
private float easeOut(float x) {
return x == 1 ? 1 : (float) (1 - Math.pow(2, -10 * x));
}
// private float easeIn(float t) {
// return t * t * t * t;
// }
private float easeIn(float x) {
return x == 0 ? 0 : (float) Math.pow(2, 10 * x - 10);
}
}

View File

@@ -86,71 +86,71 @@ private void processNextMessage() {
}
private void initializeSerializables() {
Serializer.registerClass(AnimationEnd.class);
Serializer.registerClass(ClientStartGame.class);
Serializer.registerClass(DeselectTSK.class);
Serializer.registerClass(ForceContinueGame.class);
Serializer.registerClass(StartGame.class);
Serializer.registerClass(JoinServer.class);
Serializer.registerClass(LeaveGame.class);
Serializer.registerClass(LobbyNotReady.class);
Serializer.registerClass(LobbyReady.class);
Serializer.registerClass(NoPowerCard.class);
Serializer.registerClass(RequestBriefing.class);
Serializer.registerClass(RequestDie.class);
Serializer.registerClass(RequestMove.class);
Serializer.registerClass(RequestPlayCard.class);
Serializer.registerClass(SelectCard.class);
Serializer.registerClass(SelectedPieces.class);
Serializer.registerClass(SelectTSK.class);
Serializer.registerClass(AnimationEndMessage.class);
Serializer.registerClass(ClientStartGameMessage.class);
Serializer.registerClass(DeselectTSKMessage.class);
Serializer.registerClass(ForceContinueGameMessage.class);
Serializer.registerClass(StartGameMessage.class);
Serializer.registerClass(JoinServerMessage.class);
Serializer.registerClass(LeaveGameMessage.class);
Serializer.registerClass(LobbyNotReadyMessage.class);
Serializer.registerClass(LobbyReadyMessage.class);
Serializer.registerClass(NoPowerCardMessage.class);
Serializer.registerClass(RequestBriefingMessage.class);
Serializer.registerClass(RequestDieMessage.class);
Serializer.registerClass(RequestMoveMessage.class);
Serializer.registerClass(RequestPlayCardMessage.class);
Serializer.registerClass(SelectCardMessage.class);
Serializer.registerClass(SelectedPiecesMessage.class);
Serializer.registerClass(SelectTSKMessage.class);
Serializer.registerClass(ActivePlayer.class);
Serializer.registerClass(AnyPiece.class);
Serializer.registerClass(Briefing.class);
Serializer.registerClass(ActivePlayerMessage.class);
Serializer.registerClass(AnyPieceMessage.class);
Serializer.registerClass(BriefingMessage.class);
Serializer.registerClass(CeremonyMessage.class);
Serializer.registerClass(Die.class);
Serializer.registerClass(DiceAgain.class);
Serializer.registerClass(DiceNow.class);
Serializer.registerClass(EndOfTurn.class);
Serializer.registerClass(LobbyAccept.class);
Serializer.registerClass(LobbyDeny.class);
Serializer.registerClass(LobbyPlayerJoin.class);
Serializer.registerClass(LobbyPlayerLeave.class);
Serializer.registerClass(DieMessage.class);
Serializer.registerClass(DiceAgainMessage.class);
Serializer.registerClass(DiceNowMessage.class);
Serializer.registerClass(EndOfTurnMessage.class);
Serializer.registerClass(LobbyAcceptMessage.class);
Serializer.registerClass(LobbyDenyMessage.class);
Serializer.registerClass(LobbyPlayerJoinMessage.class);
Serializer.registerClass(LobbyPlayerLeaveMessage.class);
Serializer.registerClass(MoveMessage.class);
Serializer.registerClass(NoTurn.class);
Serializer.registerClass(PauseGame.class);
Serializer.registerClass(PlayCard.class);
Serializer.registerClass(PossibleCard.class);
Serializer.registerClass(PossiblePiece.class);
Serializer.registerClass(RankingResponse.class);
Serializer.registerClass(RankingRollAgain.class);
Serializer.registerClass(ReconnectBriefing.class);
Serializer.registerClass(ResumeGame.class);
Serializer.registerClass(ServerStartGame.class);
Serializer.registerClass(StartPiece.class);
Serializer.registerClass(UpdateReady.class);
Serializer.registerClass(UpdateTSK.class);
Serializer.registerClass(WaitPiece.class);
Serializer.registerClass(NoTurnMessage.class);
Serializer.registerClass(PauseGameMessage.class);
Serializer.registerClass(PlayCardMessage.class);
Serializer.registerClass(PossibleCardMessage.class);
Serializer.registerClass(PossiblePieceMessage.class);
Serializer.registerClass(RankingResponseMessage.class);
Serializer.registerClass(RankingRollAgainMessage.class);
Serializer.registerClass(ReconnectBriefingMessage.class);
Serializer.registerClass(ResumeGameMessage.class);
Serializer.registerClass(ServerStartGameMessage.class);
Serializer.registerClass(StartPieceMessage.class);
Serializer.registerClass(UpdateReadyMessage.class);
Serializer.registerClass(UpdateTSKMessage.class);
Serializer.registerClass(WaitPieceMessage.class);
}
private void registerListeners() {
myServer.addMessageListener(this, AnimationEnd.class);
myServer.addMessageListener(this, ClientStartGame.class);
myServer.addMessageListener(this, DeselectTSK.class);
myServer.addMessageListener(this, ForceContinueGame.class);
myServer.addMessageListener(this, StartGame.class);
myServer.addMessageListener(this, JoinServer.class);
myServer.addMessageListener(this, LeaveGame.class);
myServer.addMessageListener(this, LobbyNotReady.class);
myServer.addMessageListener(this, LobbyReady.class);
myServer.addMessageListener(this, NoPowerCard.class);
myServer.addMessageListener(this, RequestBriefing.class);
myServer.addMessageListener(this, RequestDie.class);
myServer.addMessageListener(this, RequestMove.class);
myServer.addMessageListener(this, RequestPlayCard.class);
myServer.addMessageListener(this, SelectCard.class);
myServer.addMessageListener(this, SelectedPieces.class);
myServer.addMessageListener(this, SelectTSK.class);
myServer.addMessageListener(this, AnimationEndMessage.class);
myServer.addMessageListener(this, ClientStartGameMessage.class);
myServer.addMessageListener(this, DeselectTSKMessage.class);
myServer.addMessageListener(this, ForceContinueGameMessage.class);
myServer.addMessageListener(this, StartGameMessage.class);
myServer.addMessageListener(this, JoinServerMessage.class);
myServer.addMessageListener(this, LeaveGameMessage.class);
myServer.addMessageListener(this, LobbyNotReadyMessage.class);
myServer.addMessageListener(this, LobbyReadyMessage.class);
myServer.addMessageListener(this, NoPowerCardMessage.class);
myServer.addMessageListener(this, RequestBriefingMessage.class);
myServer.addMessageListener(this, RequestDieMessage.class);
myServer.addMessageListener(this, RequestMoveMessage.class);
myServer.addMessageListener(this, RequestPlayCardMessage.class);
myServer.addMessageListener(this, SelectCardMessage.class);
myServer.addMessageListener(this, SelectedPiecesMessage.class);
myServer.addMessageListener(this, SelectTSKMessage.class);
myServer.addConnectionListener(this);
}
@@ -186,7 +186,7 @@ public void connectionRemoved(Server server, HostedConnection hostedConnection)
* @param id as the id of the disconnected player.
*/
public void handleDisconnect(int id) {
this.logic.received(new Disconnected(), id);
this.logic.received(new DisconnectedMessage(), id);
}
public void exit(int exitValue) { //NON-NLS

View File

@@ -1,13 +1,20 @@
package pp.mdga.client.view;
import com.jme3.light.AmbientLight;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import pp.mdga.client.dialog.SingleButtonLeftDialog;
import pp.mdga.client.dialog.SingleButtonRightDialog;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.MdgaState;
import pp.mdga.client.acoustic.MdgaSound;
import pp.mdga.client.button.ButtonLeft;
import pp.mdga.client.button.ButtonRight;
import pp.mdga.client.button.CeremonyButton;
import pp.mdga.client.dialog.CeremonyDialog;
import pp.mdga.game.Color;
import java.util.ArrayList;
public class CeremonyView extends MdgaView {
private enum SubState {
AWARD_CEREMONY,
STATISTICS,
@@ -15,54 +22,100 @@ private enum SubState {
private SubState state;
private SingleButtonRightDialog continueButton;
private SingleButtonLeftDialog backButton;
private Geometry background;
private ButtonLeft backButton;
private ButtonRight continueButton;
private ArrayList<CeremonyButton> ceremonyButtons;
private CeremonyDialog ceremonyDialog;
private AmbientLight ambient = new AmbientLight();
public CeremonyView(MdgaApp app) {
super(app);
continueButton = new SingleButtonRightDialog(app, node, "Weiter", () -> forward());
backButton = new SingleButtonLeftDialog(app, node, "Zurück", () -> back());
backButton = new ButtonLeft(app, guiNode, this::back, "Zurück", 1);
continueButton = new ButtonRight(app, guiNode, this::forward, "Weiter", 1);
ceremonyButtons = new ArrayList<>(4);
ceremonyDialog = new CeremonyDialog(app, guiNode);
ambient.setColor(new ColorRGBA(0.3f, 0.3f, 0.3f, 1));
}
@Override
public void onEnter() {
enterSub(SubState.AWARD_CEREMONY);
rootNode.addLight(ambient);
app.getAcousticHandler().playSound(MdgaSound.VICTORY);
}
@Override
public void onLeave() {
continueButton.hide();
backButton.hide();
continueButton.hide();
if(null != background) {
guiNode.detachChild(background);
}
ceremonyButtons.clear();
rootNode.removeLight(ambient);
ceremonyDialog.prepare();
}
@Override
protected void onEnterOverlay(Overlay overlay) {
}
@Override
protected void onLeaveOverlay(Overlay overlay) {
}
@Override
protected void onUpdate(float tpf) {
for (CeremonyButton c : ceremonyButtons) {
c.update(tpf);
}
}
private void awardCeremony() {
background = createBackground("Images/b1.png");
node.attachChild(background);
continueButton.show();
backButton.hide();
for (CeremonyButton c : ceremonyButtons) {
c.show();
}
}
private void statistics() {
background = createBackground("Images/b2.png");
node.attachChild(background);
//background = createBackground("Images/b2.png");
//guiNode.attachChild(background);
continueButton.show();
backButton.show();
continueButton.show();
ceremonyDialog.show();
}
private void enterSub(SubState state) {
this.state = state;
if(null != background) {
node.detachChild(background);
}
backButton.hide();
continueButton.hide();
for (CeremonyButton c : ceremonyButtons) {
c.hide();
}
ceremonyDialog.hide();
if(null != background) {
guiNode.detachChild(background);
}
switch (state) {
case AWARD_CEREMONY:
@@ -74,7 +127,7 @@ private void enterSub(SubState state) {
}
}
private void forward() {
public void forward() {
switch (state) {
case AWARD_CEREMONY:
enterSub(SubState.STATISTICS);
@@ -95,4 +148,18 @@ private void back() {
break;
}
}
public void addCeremonyParticipant(Color color, int pos, String name) {
CeremonyButton button = new CeremonyButton(app, guiNode, rootNode, color, CeremonyButton.Pos.values()[pos - 1], name);
ceremonyButtons.add(button);
if(state.equals(SubState.AWARD_CEREMONY)) {
button.show();
}
}
public void addStatisticsRow(String name, int v1, int v2, int v3, int v4, int v5, int v6) {
ceremonyDialog.addStatisticsRow(name, v1, v2, v3, v4, v5, v6);
}
}

View File

@@ -7,33 +7,48 @@
import com.jme3.input.controls.MouseButtonTrigger;
import com.jme3.post.FilterPostProcessor;
import com.jme3.post.filters.ComposeFilter;
import com.jme3.renderer.ViewPort;
import com.jme3.shadow.DirectionalLightShadowFilter;
import com.jme3.shadow.EdgeFilteringMode;
import com.jme3.texture.FrameBuffer;
import com.jme3.texture.Image;
import com.jme3.texture.Texture2D;
import pp.mdga.client.MdgaState;
import pp.mdga.client.acoustic.MdgaSound;
import pp.mdga.client.board.BoardHandler;
import pp.mdga.client.board.CameraHandler;
import pp.mdga.client.dialog.SingleButtonLeftDialog;
import pp.mdga.client.dialog.SingleButtonRightDialog;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.MdgaState;
import pp.mdga.client.button.ButtonLeft;
import pp.mdga.client.button.ButtonRight;
import pp.mdga.client.button.SettingsButton;
import pp.mdga.client.gui.GuiHandler;
import pp.mdga.game.Color;
public class GameView extends MdgaView {
private BoardHandler boardHandler;
private CameraHandler camera;
private GuiHandler guiHandler;
private SingleButtonLeftDialog leaveButton;
private SingleButtonRightDialog continueButton;
private ButtonRight cheatButton; //TODO
private ButtonLeft leaveButton;
private ButtonRight confirmButton;
private Color ownColor = null;
private FilterPostProcessor fpp;
public GameView(MdgaApp app) {
super(app);
//Filter für Outline: Reihenfolge CameraHandler(dlsf) -> BoardHandler -> viewPort.addProcessor einhalten!
FilterPostProcessor fpp = new FilterPostProcessor(app.getAssetManager());
cheatButton = new ButtonRight(app, settingsNode, () -> app.getModelSyncronizer().enter(MdgaState.CEREMONY), "CHEAT", 1);
leaveButton = new ButtonLeft(app, settingsNode, () -> app.getModelSyncronizer().leave(), "Spiel verlassen", 1);
confirmButton = new ButtonRight(app, settingsNode, () -> app.getModelSyncronizer().confirm(), "Bestätigen", 1);
fpp = new FilterPostProcessor(app.getAssetManager());
this.camera = new CameraHandler(app, fpp);
this.boardHandler = new BoardHandler(app, fpp);
app.getViewPort().addProcessor(fpp);
this.boardHandler = new BoardHandler(app, rootNode, fpp);
FrameBuffer backFrameBuffer = new FrameBuffer(app.getCamera().getWidth(), app.getCamera().getHeight(), 1);
Texture2D backTexture = new Texture2D(app.getCamera().getWidth(), app.getCamera().getHeight(), Image.Format.RGBA8);
@@ -41,11 +56,8 @@ public GameView(MdgaApp app) {
backFrameBuffer.addColorTarget(FrameBuffer.FrameBufferTarget.newTarget(backTexture));
app.getViewPort().setOutputFrameBuffer(backFrameBuffer);
this.guiHandler = new GuiHandler(app, backTexture);
leaveButton = new SingleButtonLeftDialog(app, settingsNode, "Verlassen", () -> leaveGame());
continueButton = new SingleButtonRightDialog(app, node, "Weiter", () -> app.getModelSyncronizer().enter(MdgaState.CEREMONY));
guiHandler = new GuiHandler(app, guiNode, backTexture, ownColor);
}
@Override
@@ -53,54 +65,44 @@ public void onEnter() {
camera.init();
boardHandler.init();
guiHandler.init();
continueButton.show();
app.getViewPort().addProcessor(fpp);
// boardHandler.addPlayer(Color.AIRFORCE, test);
// boardHandler.movePieceStart(player0, 0);
// boardHandler.enableHover(player0);
// boardHandler.enableHover(player1);
// boardHandler.highlight(player0, true);
// boardHandler.outline(player0, true);
// boardHandler.outline(10);
guiHandler.test();
app.getAcousticHandler().playSound(MdgaSound.START);
}
@Override
public void onLeave() {
continueButton.hide();
camera.shutdown();
boardHandler.shutdown();
guiHandler.shutdown();
app.getViewPort().removeProcessor(fpp);
}
@Override
public void onUpdate() {
public void onUpdate(float tpf) {
camera.update(app.getInputSyncronizer().getScroll(), app.getInputSyncronizer().getRotation());
}
@Override
protected void enterExtendedSettings() {
leaveButton.show();
protected void onEnterOverlay(Overlay overlay) {
if(overlay == Overlay.SETTINGS) {
leaveButton.show();
cheatButton.show();
}
}
@Override
protected void leaveExtendedSettings() {
leaveButton.hide();
protected void onLeaveOverlay(Overlay overlay) {
if(overlay == Overlay.SETTINGS) {
leaveButton.hide();
cheatButton.hide();
}
}
private void leaveGame() {
leaveSettings(false);
app.getModelSyncronizer().leave();
app.afteGameCleanup();
}
public BoardHandler getBoardHandler() {
@@ -110,4 +112,12 @@ public BoardHandler getBoardHandler() {
public GuiHandler getGuiHandler() {
return guiHandler;
}
public void setOwnColor(Color ownColor) {
this.ownColor = ownColor;
}
public Color getOwnColor() {
return ownColor;
}
}

View File

@@ -1,58 +1,199 @@
package pp.mdga.client.view;
import com.jme3.asset.TextureKey;
import com.jme3.light.AmbientLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.scene.Geometry;
import pp.mdga.client.dialog.LobbyButtonDialog;
import pp.mdga.client.dialog.SingleButtonLeftDialog;
import pp.mdga.client.dialog.SingleButtonRightDialog;
import com.jme3.scene.Spatial;
import com.jme3.texture.Texture;
import com.jme3.util.SkyFactory;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.button.ButtonLeft;
import pp.mdga.client.button.ButtonRight;
import pp.mdga.client.button.LobbyButton;
import pp.mdga.client.button.SettingsButton;
import pp.mdga.game.Color;
import java.util.ArrayList;
public class LobbyView extends MdgaView {
private Geometry background;
private SingleButtonRightDialog readyButton;
private SingleButtonLeftDialog leaveButton;
private ButtonLeft leaveButton;
private ButtonRight readyButton;
private ArrayList<LobbyButtonDialog> lobbyButtons = new ArrayList<>();
private LobbyButton cyberButton;
private LobbyButton airforceButton;
private LobbyButton armyButton;
private LobbyButton navyButton;
private AmbientLight ambient = new AmbientLight();
public LobbyView(MdgaApp app) {
super(app);
background = createBackground("Images/lobby.png");
node.attachChild(background);
//TextureKey key = new TextureKey("lobby.png", false);
//Texture skyTexture = app.getAssetManager().loadTexture(key);
//Spatial sky = SkyFactory.createSky(app.getAssetManager(), skyTexture, SkyFactory.EnvMapType.SphereMap);
//rootNode.attachChild(sky);
readyButton = new SingleButtonRightDialog(app, node, "Fertig", () -> app.getModelSyncronizer().setReady());
leaveButton = new SingleButtonLeftDialog(app, node, "Verlassen", () -> app.getModelSyncronizer().leave());
leaveButton = new ButtonLeft(app, guiNode, this::leaveLobby, "Verlassen", 1);
readyButton = new ButtonRight(app, guiNode, this::ready, "Bereit", 1);
lobbyButtons.add(new LobbyButtonDialog(app, node, "HEER", 0));
lobbyButtons.add(new LobbyButtonDialog(app, node, "MARINE", 1));
lobbyButtons.add(new LobbyButtonDialog(app, node, "CIR", 2));
lobbyButtons.add(new LobbyButtonDialog(app, node, "LUFTWAFFE", 3));
cyberButton = new LobbyButton(app, guiNode, rootNode, () -> toggleTsk(Color.CYBER), Color.CYBER);
airforceButton = new LobbyButton(app, guiNode, rootNode, () -> toggleTsk(Color.AIRFORCE), Color.AIRFORCE);
armyButton = new LobbyButton(app, guiNode, rootNode, () -> toggleTsk(Color.ARMY), Color.ARMY);
navyButton = new LobbyButton(app, guiNode, rootNode, () -> toggleTsk(Color.NAVY), Color.NAVY);
ambient.setColor(new ColorRGBA(0.3f, 0.3f, 0.3f, 1));
}
@Override
public void onEnter() {
readyButton.show();
leaveButton.show();
app.getCamera().setParallelProjection(true);
float aspect = (float) app.getCamera().getWidth() / app.getCamera().getHeight();
float size = 1.65f;
app.getCamera().setFrustum(-1000, 1000, -aspect * size, aspect * size, size, -size);
for (LobbyButtonDialog b : lobbyButtons) {
b.show();
}
leaveButton.show();
readyButton.show();
cyberButton.show();
airforceButton.show();
armyButton.show();
navyButton.show();
rootNode.addLight(ambient);
}
@Override
public void onLeave() {
for (LobbyButtonDialog b : lobbyButtons) {
b.hide();
}
readyButton.hide();
leaveButton.hide();
readyButton.hide();
airforceButton.hide();
armyButton.hide();
navyButton.hide();
cyberButton.hide();
rootNode.removeLight(ambient);
app.getCamera().setParallelProjection(false);
app.getCamera().setFrustumPerspective(
45.0f,
(float) app.getCamera().getWidth() / app.getCamera().getHeight(),
0.1f,
1000.0f
);
app.getCamera().setLocation(new Vector3f(0, 0, 10));
app.getCamera().lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);
}
@Override
protected void onUpdate(float tpf) {
airforceButton.update(tpf);
armyButton.update(tpf);
navyButton.update(tpf);
cyberButton.update(tpf);
}
@Override
protected void onEnterOverlay(Overlay overlay) {
}
@Override
protected void onLeaveOverlay(Overlay overlay)
{
}
public void setTaken(Color color, boolean isTaken, boolean isSelf, String name) {
lobbyButtons.get(color.ordinal()).setTaken(isTaken, isSelf, name);
LobbyButton.Taken taken;
if(isTaken) {
if(isSelf) {
taken = LobbyButton.Taken.SELF;
} else {
taken = LobbyButton.Taken.OTHER;
}
} else {
taken = LobbyButton.Taken.NOT;
}
switch (color) {
case CYBER:
cyberButton.setTaken(taken, name);
break;
case AIRFORCE:
airforceButton.setTaken(taken, name);
break;
case ARMY:
armyButton.setTaken(taken, name);
break;
case NAVY:
navyButton.setTaken(taken, name);
break;
}
}
public void setReady(Color color, boolean isReady) {
switch (color) {
case CYBER:
cyberButton.setReady(isReady);
break;
case AIRFORCE:
airforceButton.setReady(isReady);
break;
case ARMY:
armyButton.setReady(isReady);
break;
case NAVY:
navyButton.setReady(isReady);
break;
}
}
private void toggleTsk(Color color) {
LobbyButton.Taken taken = LobbyButton.Taken.NOT;
switch (color) {
case CYBER:
taken = cyberButton.getTaken();
break;
case AIRFORCE:
taken = airforceButton.getTaken();
break;
case ARMY:
taken = armyButton.getTaken();
break;
case NAVY:
taken = navyButton.getTaken();
break;
}
switch (taken) {
case NOT:
app.getModelSyncronizer().selectTsk(color);
break;
case SELF:
app.getModelSyncronizer().unselectTsk();
break;
case OTHER:
//nothing
break;
}
}
private void ready() {
app.getModelSyncronizer().setReady();
//TODO: playSound
}
private void leaveLobby() {
app.getModelSyncronizer().leave();
//TODO: playSound
}
}

View File

@@ -1,79 +1,220 @@
package pp.mdga.client.view;
import com.jme3.scene.Geometry;
import pp.mdga.client.dialog.Dialog;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.MdgaState;
import pp.mdga.client.acoustic.MdgaSound;
import pp.mdga.client.button.ButtonRight;
import pp.mdga.client.button.MenuButton;
import pp.mdga.client.button.SettingsButton;
import pp.mdga.client.dialog.HostDialog;
import pp.mdga.client.dialog.JoinDialog;
import pp.mdga.client.dialog.StartDialog;
import pp.mdga.client.MdgaApp;
import com.jme3.math.Vector3f;
public class MainView extends MdgaView {
private enum SubState {
HOST,
JOIN,
MAIN,
}
private SubState state;
private Geometry background;
private StartDialog dialog;
private Dialog subDialog;
private StartDialog startDialog;
private JoinDialog joinDialog;
private HostDialog hostDialog;
public MainView(MdgaApp app) {
super(app);
background = createBackground("Images/powercards.png");
node.attachChild(background);
Vector3f size = new Vector3f(280, 60, 0);
dialog = new StartDialog(app, node);
dialog.addButton("Spiel beitreten", () -> enterJoin(), size);
dialog.addButton("Spiel hosten", () -> enterHost(), size);
dialog.addButton("Einstellungen", () -> enterSettings(false), size);
dialog.addButton("Spiel beenden", () -> app.stop(), size);
startDialog = new StartDialog(app, guiNode, this);
joinDialog = new JoinDialog(app, guiNode, this);
hostDialog = new HostDialog(app, guiNode, this);
}
@Override
public void onEnter() {
dialog.show();
background = createBackground("Images/main.png");
guiNode.attachChild(background);
enterSub(SubState.MAIN);
}
@Override
public void onLeave() {
dialog.hide();
startDialog.hide();
joinDialog.hide();
hostDialog.hide();
if(subDialog != null) {
subDialog.hide();
subDialog = null;
guiNode.detachChild(background);
}
@Override
public void onUpdate(float tpf) {
startDialog.update();
joinDialog.update();
hostDialog.update();
}
@Override
protected void onEnterOverlay(Overlay overlay) {
}
@Override
protected void onLeaveOverlay(Overlay overlay)
{
}
private void joinMenu() {
startDialog.hide();
hostDialog.hide();
joinDialog.show();
}
private void hostMenu() {
startDialog.hide();
joinDialog.hide();
hostDialog.show();
}
private void mainMenu() {
joinDialog.hide();
hostDialog.hide();
startDialog.show();
}
private void tryHost() {
int port = 0;
String text = hostDialog.getPort();
try {
port = Integer.parseInt(text);
if(port >= 1 && port <= 65535) {
app.getModelSyncronizer().setName(startDialog.getName());
app.getModelSyncronizer().setHost(port);
//app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
return;
}
} catch (NumberFormatException e) {
//nothing
}
hostDialog.resetPort();
app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
}
private void tryJoin() {
int port = 0;
String ip = joinDialog.getIpt();
String portText = hostDialog.getPort();
try {
// Validate the port
port = Integer.parseInt(portText);
if (port < 1 || port > 65535) {
throw new IllegalArgumentException("Invalid port");
}
// Validate the IP address
if (isValidIpAddress(ip)) {
app.getModelSyncronizer().setName(startDialog.getName());
app.getModelSyncronizer().setJoin(ip, port);
return;
}
} catch (IllegalArgumentException e) {
// Invalid input, fall through to reset
}
hostDialog.resetPort();
joinDialog.resetIp();
app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
}
private boolean isValidIpAddress(String ip) {
String ipRegex =
"^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\." +
"(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\." +
"(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\." +
"(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$";
return ip != null && ip.matches(ipRegex);
}
private void enterSub(SubState state) {
this.state = state;
if(null != background) {
rootNode.detachChild(background);
}
switch (state) {
case HOST:
hostMenu();
break;
case JOIN:
joinMenu();
break;
case MAIN:
mainMenu();
break;
}
}
private void enterJoin() {
app.getModelSyncronizer().setName(dialog.getName());
subDialog = new JoinDialog(app, node, () -> leaveJoin());
dialog.hide();
subDialog.show();
public void forward() {
switch (state) {
case HOST:
tryHost();
break;
case JOIN:
tryJoin();
break;
case MAIN:
throw new RuntimeException("call forward(boolean host) insted of forward()");
}
}
private void leaveJoin() {
subDialog.hide();
dialog.show();
subDialog = null;
public void forward(boolean host) {
switch (state) {
case HOST:
tryHost();
break;
case JOIN:
tryJoin();
break;
case MAIN:
if(host) {
enterSub(SubState.HOST);
//TODO playSound
} else {
enterSub(SubState.JOIN);
//TODO: playSound
}
break;
}
}
private void enterHost() {
app.getModelSyncronizer().setName(dialog.getName());
subDialog = new HostDialog(app, node, () -> leaveHost());
dialog.hide();
subDialog.show();
}
private void leaveHost() {
subDialog.hide();
dialog.show();
subDialog = null;
public void back() {
switch (state) {
case HOST:
enterSub(SubState.MAIN);
//TODO: playSound
break;
case JOIN:
enterSub(SubState.MAIN);
//TODO: playSound
break;
case MAIN:
//nothing
break;
}
}
}

View File

@@ -2,83 +2,49 @@
import com.jme3.asset.TextureKey;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.math.Vector2f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Quad;
import com.jme3.texture.Texture;
import pp.mdga.client.dialog.GetPercentRunnable;
import pp.mdga.client.dialog.PercentRunnable;
import pp.mdga.client.dialog.SettingsButtonDialog;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.acoustic.MdgaSound;
import pp.mdga.client.button.*;
import pp.mdga.client.dialog.AudioSettingsDialog;
import pp.mdga.client.dialog.SettingsDialog;
import pp.mdga.client.dialog.VideoSettingsDialog;
public abstract class MdgaView {
public enum Overlay {
INTERRUPT,
SETTINGS,
}
protected MdgaApp app;
protected Node node;
protected Node rootNode = new Node();
protected Node guiNode = new Node();
protected Node settingsNode = new Node();
protected int depth = 0;
private boolean isVideo = false;
private boolean isAudio = false;
private SettingsButton settingsButton;
protected Node settingsNode;
protected Node audioSettingsNode;
protected Node videoSettingsNode;
private SettingsDialog settingsDialog;
private VideoSettingsDialog videoSettingsDialog;
private AudioSettingsDialog audioSettingsDialog;
private SettingsButtonDialog settingsButton;
private Geometry settingsBackground;
private Geometry audioBackground;
private Geometry videoBackground;
private SettingsDialog settings;
private SettingsDialog audio;
private SettingsDialog video;
private static final String IMAGE_ROOT = "Images/";
private int settingsDepth = 0;
public MdgaView(MdgaApp app) {
this.app = app;
this.node = new Node();
settingsButton = new SettingsButton(app, guiNode, this::enterSettings);
this.settingsNode = new Node();
this.audioSettingsNode = new Node();
this.videoSettingsNode = new Node();
this.settingsButton = new SettingsButtonDialog(app, node, "", () -> enterSettings(false));
this.settingsBackground = createBackground(IMAGE_ROOT + "background/zahnräder.png");
settingsNode.attachChild(settingsBackground);
this.audioBackground = createBackground(IMAGE_ROOT + "background/lautsprecher.png");
audioSettingsNode.attachChild(audioBackground);
this.videoBackground = createBackground(IMAGE_ROOT + "background/monitors.png");
videoSettingsNode.attachChild(videoBackground);
Vector3f size = new Vector3f(280, 60, 0);
this.settings = new SettingsDialog(app, settingsNode, IMAGE_ROOT + "zahnrad.png");
this.settings.addButton("Video", () -> enterVideo(), size);
this.settings.addButton("Audio", () -> enterAudio(), size);
this.settings.addButton("Zurück", () -> leaveSettings(false), size);
this.audio = new SettingsDialog(app, audioSettingsNode, IMAGE_ROOT + "audio_icon.png");
this.audio.addSlider("Lautstärke", new PercentRunnable(app.getAcousticHandler()::setMainVolume), new GetPercentRunnable(app.getAcousticHandler()::getMainVolume), size, (int) app.getAcousticHandler().getMainVolume() * 100);
this.audio.addSlider("Musik", new PercentRunnable(app.getAcousticHandler()::setMusicVolume), new GetPercentRunnable(app.getAcousticHandler()::getMusicVolume), size, (int) app.getAcousticHandler().getMusicVolume() * 100);
this.audio.addSlider("Sound", new PercentRunnable(app.getAcousticHandler()::setSoundVolume), new GetPercentRunnable(app.getAcousticHandler()::getSoundVolume), size, (int) app.getAcousticHandler().getSoundVolume() * 100);
this.audio.addButton("Zurück", () -> leaveAudio(), size);
this.video = new SettingsDialog(app, videoSettingsNode, IMAGE_ROOT + "monitor.png");
this.video.addButton("A", () -> System.out.println("A"), size);
this.video.addButton("B", () -> System.out.println("B"), size);
this.video.addButton("Zurück", () -> leaveVideo(), size);
settingsDialog = new SettingsDialog(app, settingsNode, this);
videoSettingsDialog = new VideoSettingsDialog(app, settingsNode, this);
audioSettingsDialog = new AudioSettingsDialog(app, settingsNode, this);
}
public void enter() {
app.getGuiNode().attachChild(node);
audio.initVolume();
app.getRootNode().attachChild(rootNode);
app.getGuiNode().attachChild(guiNode);
settingsButton.show();
@@ -86,123 +52,139 @@ public void enter() {
}
public void leave() {
onLeave();
app.getRootNode().detachChild(rootNode);
app.getGuiNode().detachChild(guiNode);
settingsButton.hide();
app.getGuiNode().detachChild(node);
while (settingsDepth > 0) {
pressEscape();
}
onLeave();
}
public void update() {
audio.update();
onUpdate();
public void enterOverlay(Overlay overlay) {
app.getGuiNode().detachChild(guiNode);
onEnterOverlay(overlay);
}
public void leaveOverlay(Overlay overlay) {
app.getGuiNode().attachChild(guiNode);
onLeaveOverlay(overlay);
}
public void update(float tpf) {
videoSettingsDialog.update();
audioSettingsDialog.update();
onUpdate(tpf);
}
protected abstract void onEnter();
protected abstract void onLeave();
protected void onUpdate() {}
protected void onUpdate(float tpf) {}
protected abstract void onEnterOverlay(Overlay overlay);
protected abstract void onLeaveOverlay(Overlay overlay);
protected Geometry createBackground(String texturePath) {
TextureKey key = new TextureKey(texturePath, true);
Texture backgroundTexture = app.getAssetManager().loadTexture(key);
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
Geometry background = new Geometry("Background", quad);
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", backgroundTexture);
Quad quad = new Quad(app.getCamera().getWidth(), app.getCamera().getHeight());
Geometry background = new Geometry("Background", quad);
background.setMaterial(mat);
background.setLocalTranslation(0, 0, -1);
background.setLocalTranslation(0, 0, -2);
return background;
}
protected void enterExtendedSettings() {}
protected void leaveExtendedSettings() {}
protected void enterSettings(boolean soft) {
leave();
public void enterSettings() {
enterOverlay(Overlay.SETTINGS);
app.getGuiNode().attachChild(settingsNode);
settingsDialog.show();
if(!soft) {
depth++;
enterExtendedSettings();
}
settings.show();
settingsDepth++;
}
protected void leaveSettings(boolean soft) {
settings.hide();
public void leaveSettings() {
leaveOverlay(Overlay.SETTINGS);
app.getGuiNode().detachChild(settingsNode);
settingsDialog.hide();
if(!soft) {
leaveExtendedSettings();
enter();
depth--;
}
settingsDepth--;
}
protected void enterAudio() {
leaveSettings(true);
public void enterVideoSettings() {
settingsDialog.hide();
videoSettingsDialog.show();
depth++;
isAudio = true;
app.getGuiNode().attachChild(audioSettingsNode);
audio.show();
settingsDepth++;
}
protected void leaveAudio() {
audio.hide();
public void leaveVideoSettings() {
settingsDialog.show();
videoSettingsDialog.hide();
app.getGuiNode().detachChild(audioSettingsNode);
isAudio = false;
depth--;
enterSettings(true);
settingsDepth--;
}
protected void enterVideo() {
leaveSettings(true);
public void enterAudioSettings() {
settingsDialog.hide();
audioSettingsDialog.show();
app.getGuiNode().attachChild(videoSettingsNode);
depth++;
isVideo = true;
video.show();
settingsDepth++;
}
protected void leaveVideo() {
video.hide();
public void leaveAudioSettings() {
settingsDialog.show();
audioSettingsDialog.hide();
app.getGuiNode().detachChild(videoSettingsNode);
settingsDepth--;
}
depth--;
isVideo = false;
enterSettings(true);
private void leaveAdvanced() {
settingsDialog.show();
audioSettingsDialog.hide();
videoSettingsDialog.hide();
settingsDepth--;
}
public void pressEscape() {
if(depth == 0) {
enterSettings(false);
} else if(depth == 1) {
leaveSettings(false);
}
else if (depth == 2){
if(isVideo) {
leaveVideo();
}
if(isAudio) {
leaveAudio();
}
if(settingsDepth == 0) {
enterSettings();
} else if(settingsDepth == 1) {
leaveSettings();
} else {
throw new RuntimeException();
leaveAdvanced();
}
}
public void pressForward() {
if(this instanceof MainView mainView) {
mainView.forward(false);
app.getAcousticHandler().playSound(MdgaSound.BUTTON_PRESSED);
}
if(this instanceof LobbyView lobbyView) {
app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
}
if(this instanceof GameView gameView) {
app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
}
if(this instanceof CeremonyView ceremonyView) {
ceremonyView.forward();
}
}
}

View File

@@ -1,195 +1,195 @@
info face=null size=45 bold=0 italic=0 charset=ASCII unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1
common lineHeight=55 base=26 scaleW=512 scaleH=512 pages=1 packed=0
info face=null size=178 bold=0 italic=0 charset=ASCII unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1
common lineHeight=214 base=26 scaleW=2048 scaleH=2048 pages=1 packed=0
page id=0 file="Gunplay.png"
chars count=255
char id=9 x=0 y=11 width=0 height=55 xoffset=0 yoffset=0 xadvance=-1 page=0 chnl=0
char id=10 x=0 y=11 width=0 height=55 xoffset=0 yoffset=0 xadvance=-1 page=0 chnl=0
char id=13 x=0 y=11 width=0 height=55 xoffset=0 yoffset=0 xadvance=-1 page=0 chnl=0
char id=32 x=0 y=11 width=0 height=55 xoffset=0 yoffset=0 xadvance=14 page=0 chnl=0
char id=33 x=0 y=11 width=9 height=55 xoffset=2 yoffset=0 xadvance=12 page=0 chnl=0
char id=34 x=9 y=11 width=15 height=55 xoffset=2 yoffset=0 xadvance=17 page=0 chnl=0
char id=35 x=24 y=11 width=24 height=55 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=0
char id=36 x=48 y=11 width=20 height=55 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=0
char id=37 x=68 y=11 width=37 height=55 xoffset=1 yoffset=0 xadvance=38 page=0 chnl=0
char id=38 x=105 y=11 width=32 height=55 xoffset=1 yoffset=0 xadvance=32 page=0 chnl=0
char id=39 x=137 y=11 width=7 height=55 xoffset=2 yoffset=0 xadvance=9 page=0 chnl=0
char id=40 x=144 y=11 width=10 height=55 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=0
char id=41 x=154 y=11 width=10 height=55 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=0
char id=42 x=164 y=11 width=17 height=55 xoffset=1 yoffset=0 xadvance=17 page=0 chnl=0
char id=43 x=181 y=11 width=21 height=55 xoffset=0 yoffset=0 xadvance=21 page=0 chnl=0
char id=44 x=202 y=11 width=9 height=55 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=0
char id=45 x=211 y=11 width=15 height=55 xoffset=2 yoffset=0 xadvance=18 page=0 chnl=0
char id=46 x=226 y=11 width=9 height=55 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=0
char id=47 x=235 y=11 width=25 height=55 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=0
char id=48 x=260 y=11 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=49 x=286 y=11 width=15 height=55 xoffset=0 yoffset=0 xadvance=15 page=0 chnl=0
char id=50 x=301 y=11 width=26 height=55 xoffset=1 yoffset=0 xadvance=27 page=0 chnl=0
char id=51 x=327 y=11 width=25 height=55 xoffset=1 yoffset=0 xadvance=26 page=0 chnl=0
char id=52 x=352 y=11 width=28 height=55 xoffset=0 yoffset=0 xadvance=27 page=0 chnl=0
char id=53 x=380 y=11 width=24 height=55 xoffset=1 yoffset=0 xadvance=26 page=0 chnl=0
char id=54 x=404 y=11 width=25 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=55 x=429 y=11 width=23 height=55 xoffset=1 yoffset=0 xadvance=23 page=0 chnl=0
char id=56 x=452 y=11 width=25 height=55 xoffset=1 yoffset=0 xadvance=26 page=0 chnl=0
char id=57 x=477 y=11 width=26 height=55 xoffset=1 yoffset=0 xadvance=28 page=0 chnl=0
char id=58 x=503 y=11 width=8 height=55 xoffset=2 yoffset=0 xadvance=10 page=0 chnl=0
char id=59 x=0 y=66 width=9 height=55 xoffset=1 yoffset=0 xadvance=10 page=0 chnl=0
char id=60 x=9 y=66 width=14 height=55 xoffset=0 yoffset=0 xadvance=14 page=0 chnl=0
char id=61 x=23 y=66 width=22 height=55 xoffset=2 yoffset=0 xadvance=24 page=0 chnl=0
char id=62 x=45 y=66 width=14 height=55 xoffset=2 yoffset=0 xadvance=15 page=0 chnl=0
char id=63 x=59 y=66 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=64 x=82 y=66 width=32 height=55 xoffset=1 yoffset=0 xadvance=34 page=0 chnl=0
char id=65 x=114 y=66 width=29 height=55 xoffset=0 yoffset=0 xadvance=28 page=0 chnl=0
char id=66 x=143 y=66 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=67 x=169 y=66 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=68 x=195 y=66 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=69 x=221 y=66 width=21 height=55 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=0
char id=70 x=242 y=66 width=21 height=55 xoffset=2 yoffset=0 xadvance=22 page=0 chnl=0
char id=71 x=263 y=66 width=25 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=72 x=288 y=66 width=25 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=73 x=313 y=66 width=9 height=55 xoffset=2 yoffset=0 xadvance=12 page=0 chnl=0
char id=74 x=322 y=66 width=16 height=55 xoffset=0 yoffset=0 xadvance=16 page=0 chnl=0
char id=75 x=338 y=66 width=28 height=55 xoffset=2 yoffset=0 xadvance=29 page=0 chnl=0
char id=76 x=366 y=66 width=20 height=55 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=0
char id=77 x=386 y=66 width=35 height=55 xoffset=2 yoffset=0 xadvance=38 page=0 chnl=0
char id=78 x=421 y=66 width=27 height=55 xoffset=2 yoffset=0 xadvance=30 page=0 chnl=0
char id=79 x=448 y=66 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=80 x=474 y=66 width=25 height=55 xoffset=2 yoffset=0 xadvance=27 page=0 chnl=0
char id=81 x=0 y=121 width=26 height=55 xoffset=1 yoffset=0 xadvance=28 page=0 chnl=0
char id=82 x=26 y=121 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=83 x=52 y=121 width=28 height=55 xoffset=1 yoffset=0 xadvance=29 page=0 chnl=0
char id=84 x=80 y=121 width=27 height=55 xoffset=0 yoffset=0 xadvance=26 page=0 chnl=0
char id=85 x=107 y=121 width=26 height=55 xoffset=2 yoffset=0 xadvance=29 page=0 chnl=0
char id=86 x=133 y=121 width=29 height=55 xoffset=0 yoffset=0 xadvance=27 page=0 chnl=0
char id=87 x=162 y=121 width=42 height=55 xoffset=0 yoffset=0 xadvance=41 page=0 chnl=0
char id=88 x=204 y=121 width=31 height=55 xoffset=0 yoffset=0 xadvance=31 page=0 chnl=0
char id=89 x=235 y=121 width=29 height=55 xoffset=0 yoffset=0 xadvance=28 page=0 chnl=0
char id=90 x=264 y=121 width=25 height=55 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=0
char id=91 x=289 y=121 width=8 height=55 xoffset=2 yoffset=0 xadvance=10 page=0 chnl=0
char id=92 x=297 y=121 width=25 height=55 xoffset=0 yoffset=0 xadvance=24 page=0 chnl=0
char id=93 x=322 y=121 width=8 height=55 xoffset=2 yoffset=0 xadvance=10 page=0 chnl=0
char id=94 x=330 y=121 width=23 height=55 xoffset=1 yoffset=0 xadvance=23 page=0 chnl=0
char id=95 x=353 y=121 width=31 height=55 xoffset=-1 yoffset=0 xadvance=28 page=0 chnl=0
char id=96 x=384 y=121 width=14 height=55 xoffset=-1 yoffset=0 xadvance=13 page=0 chnl=0
char id=97 x=398 y=121 width=24 height=55 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=0
char id=98 x=422 y=121 width=22 height=55 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=0
char id=99 x=444 y=121 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=100 x=467 y=121 width=22 height=55 xoffset=1 yoffset=0 xadvance=23 page=0 chnl=0
char id=101 x=489 y=121 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=102 x=0 y=176 width=17 height=55 xoffset=0 yoffset=0 xadvance=16 page=0 chnl=0
char id=103 x=17 y=176 width=22 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=104 x=39 y=176 width=22 height=55 xoffset=2 yoffset=0 xadvance=24 page=0 chnl=0
char id=105 x=61 y=176 width=8 height=55 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=0
char id=106 x=69 y=176 width=14 height=55 xoffset=-4 yoffset=0 xadvance=10 page=0 chnl=0
char id=107 x=83 y=176 width=24 height=55 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=0
char id=108 x=107 y=176 width=8 height=55 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=0
char id=109 x=115 y=176 width=34 height=55 xoffset=2 yoffset=0 xadvance=36 page=0 chnl=0
char id=110 x=149 y=176 width=22 height=55 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=0
char id=111 x=171 y=176 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=112 x=194 y=176 width=22 height=55 xoffset=2 yoffset=0 xadvance=24 page=0 chnl=0
char id=113 x=216 y=176 width=22 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=114 x=238 y=176 width=15 height=55 xoffset=2 yoffset=0 xadvance=17 page=0 chnl=0
char id=115 x=253 y=176 width=22 height=55 xoffset=1 yoffset=0 xadvance=23 page=0 chnl=0
char id=116 x=275 y=176 width=17 height=55 xoffset=0 yoffset=0 xadvance=16 page=0 chnl=0
char id=117 x=292 y=176 width=22 height=55 xoffset=2 yoffset=0 xadvance=24 page=0 chnl=0
char id=118 x=314 y=176 width=24 height=55 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=0
char id=119 x=338 y=176 width=36 height=55 xoffset=0 yoffset=0 xadvance=36 page=0 chnl=0
char id=120 x=374 y=176 width=25 height=55 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=0
char id=121 x=399 y=176 width=24 height=55 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=0
char id=122 x=423 y=176 width=20 height=55 xoffset=1 yoffset=0 xadvance=21 page=0 chnl=0
char id=123 x=443 y=176 width=17 height=55 xoffset=0 yoffset=0 xadvance=17 page=0 chnl=0
char id=124 x=460 y=176 width=6 height=55 xoffset=2 yoffset=0 xadvance=8 page=0 chnl=0
char id=125 x=466 y=176 width=16 height=55 xoffset=1 yoffset=0 xadvance=17 page=0 chnl=0
char id=126 x=482 y=176 width=22 height=55 xoffset=3 yoffset=0 xadvance=27 page=0 chnl=0
char id=161 x=0 y=231 width=9 height=55 xoffset=2 yoffset=0 xadvance=12 page=0 chnl=0
char id=162 x=9 y=231 width=20 height=55 xoffset=2 yoffset=0 xadvance=22 page=0 chnl=0
char id=163 x=29 y=231 width=23 height=55 xoffset=1 yoffset=0 xadvance=23 page=0 chnl=0
char id=164 x=52 y=231 width=19 height=55 xoffset=3 yoffset=0 xadvance=24 page=0 chnl=0
char id=165 x=71 y=231 width=29 height=55 xoffset=1 yoffset=0 xadvance=30 page=0 chnl=0
char id=166 x=100 y=231 width=6 height=55 xoffset=2 yoffset=0 xadvance=8 page=0 chnl=0
char id=167 x=106 y=231 width=23 height=55 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=0
char id=168 x=129 y=231 width=16 height=55 xoffset=2 yoffset=0 xadvance=19 page=0 chnl=0
char id=169 x=145 y=231 width=38 height=55 xoffset=1 yoffset=0 xadvance=39 page=0 chnl=0
char id=170 x=183 y=231 width=17 height=55 xoffset=1 yoffset=0 xadvance=18 page=0 chnl=0
char id=171 x=200 y=231 width=18 height=55 xoffset=2 yoffset=0 xadvance=22 page=0 chnl=0
char id=172 x=218 y=231 width=25 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=174 x=243 y=231 width=23 height=55 xoffset=1 yoffset=0 xadvance=23 page=0 chnl=0
char id=175 x=266 y=231 width=15 height=55 xoffset=2 yoffset=0 xadvance=18 page=0 chnl=0
char id=176 x=281 y=231 width=17 height=55 xoffset=1 yoffset=0 xadvance=18 page=0 chnl=0
char id=177 x=298 y=231 width=22 height=55 xoffset=3 yoffset=0 xadvance=27 page=0 chnl=0
char id=178 x=320 y=231 width=13 height=55 xoffset=2 yoffset=0 xadvance=15 page=0 chnl=0
char id=179 x=333 y=231 width=12 height=55 xoffset=2 yoffset=0 xadvance=14 page=0 chnl=0
char id=180 x=345 y=231 width=14 height=55 xoffset=2 yoffset=0 xadvance=15 page=0 chnl=0
char id=182 x=359 y=231 width=18 height=55 xoffset=3 yoffset=0 xadvance=22 page=0 chnl=0
char id=183 x=377 y=231 width=9 height=55 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=0
char id=184 x=386 y=231 width=10 height=55 xoffset=2 yoffset=0 xadvance=12 page=0 chnl=0
char id=185 x=396 y=231 width=8 height=55 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=0
char id=186 x=404 y=231 width=17 height=55 xoffset=1 yoffset=0 xadvance=19 page=0 chnl=0
char id=187 x=421 y=231 width=18 height=55 xoffset=2 yoffset=0 xadvance=22 page=0 chnl=0
char id=188 x=439 y=231 width=32 height=55 xoffset=2 yoffset=0 xadvance=34 page=0 chnl=0
char id=189 x=471 y=231 width=31 height=55 xoffset=2 yoffset=0 xadvance=35 page=0 chnl=0
char id=190 x=0 y=286 width=34 height=55 xoffset=0 yoffset=0 xadvance=34 page=0 chnl=0
char id=191 x=34 y=286 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=192 x=57 y=286 width=29 height=55 xoffset=0 yoffset=0 xadvance=28 page=0 chnl=0
char id=193 x=86 y=286 width=29 height=55 xoffset=0 yoffset=0 xadvance=28 page=0 chnl=0
char id=194 x=115 y=286 width=29 height=55 xoffset=0 yoffset=0 xadvance=28 page=0 chnl=0
char id=195 x=144 y=286 width=29 height=55 xoffset=0 yoffset=0 xadvance=28 page=0 chnl=0
char id=196 x=173 y=286 width=29 height=55 xoffset=0 yoffset=0 xadvance=28 page=0 chnl=0
char id=197 x=202 y=286 width=29 height=55 xoffset=0 yoffset=0 xadvance=28 page=0 chnl=0
char id=198 x=231 y=286 width=32 height=55 xoffset=0 yoffset=0 xadvance=33 page=0 chnl=0
char id=199 x=263 y=286 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=200 x=289 y=286 width=21 height=55 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=0
char id=201 x=310 y=286 width=21 height=55 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=0
char id=202 x=331 y=286 width=21 height=55 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=0
char id=203 x=352 y=286 width=21 height=55 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=0
char id=204 x=373 y=286 width=13 height=55 xoffset=-1 yoffset=0 xadvance=12 page=0 chnl=0
char id=205 x=386 y=286 width=15 height=55 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=0
char id=206 x=401 y=286 width=17 height=55 xoffset=-2 yoffset=0 xadvance=12 page=0 chnl=0
char id=207 x=418 y=286 width=17 height=55 xoffset=-2 yoffset=0 xadvance=12 page=0 chnl=0
char id=208 x=435 y=286 width=29 height=55 xoffset=1 yoffset=0 xadvance=30 page=0 chnl=0
char id=209 x=464 y=286 width=27 height=55 xoffset=2 yoffset=0 xadvance=30 page=0 chnl=0
char id=210 x=0 y=341 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=211 x=26 y=341 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=212 x=52 y=341 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=213 x=78 y=341 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=214 x=104 y=341 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=215 x=130 y=341 width=18 height=55 xoffset=2 yoffset=0 xadvance=21 page=0 chnl=0
char id=216 x=148 y=341 width=26 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=217 x=174 y=341 width=26 height=55 xoffset=2 yoffset=0 xadvance=29 page=0 chnl=0
char id=218 x=200 y=341 width=26 height=55 xoffset=2 yoffset=0 xadvance=29 page=0 chnl=0
char id=219 x=226 y=341 width=26 height=55 xoffset=2 yoffset=0 xadvance=29 page=0 chnl=0
char id=220 x=252 y=341 width=26 height=55 xoffset=2 yoffset=0 xadvance=29 page=0 chnl=0
char id=221 x=278 y=341 width=29 height=55 xoffset=0 yoffset=0 xadvance=28 page=0 chnl=0
char id=222 x=307 y=341 width=20 height=55 xoffset=2 yoffset=0 xadvance=22 page=0 chnl=0
char id=223 x=327 y=341 width=25 height=55 xoffset=1 yoffset=0 xadvance=26 page=0 chnl=0
char id=224 x=352 y=341 width=24 height=55 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=0
char id=225 x=376 y=341 width=24 height=55 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=0
char id=226 x=400 y=341 width=24 height=55 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=0
char id=227 x=424 y=341 width=24 height=55 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=0
char id=228 x=448 y=341 width=24 height=55 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=0
char id=229 x=472 y=341 width=24 height=55 xoffset=1 yoffset=0 xadvance=25 page=0 chnl=0
char id=230 x=0 y=396 width=37 height=55 xoffset=1 yoffset=0 xadvance=38 page=0 chnl=0
char id=231 x=37 y=396 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=232 x=60 y=396 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=233 x=83 y=396 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=234 x=106 y=396 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=235 x=129 y=396 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=236 x=152 y=396 width=14 height=55 xoffset=-2 yoffset=0 xadvance=11 page=0 chnl=0
char id=237 x=166 y=396 width=14 height=55 xoffset=2 yoffset=0 xadvance=11 page=0 chnl=0
char id=238 x=180 y=396 width=16 height=55 xoffset=-2 yoffset=0 xadvance=11 page=0 chnl=0
char id=239 x=196 y=396 width=16 height=55 xoffset=-2 yoffset=0 xadvance=11 page=0 chnl=0
char id=240 x=212 y=396 width=25 height=55 xoffset=2 yoffset=0 xadvance=28 page=0 chnl=0
char id=241 x=237 y=396 width=22 height=55 xoffset=2 yoffset=0 xadvance=25 page=0 chnl=0
char id=242 x=259 y=396 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=243 x=282 y=396 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=244 x=305 y=396 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=245 x=328 y=396 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=246 x=351 y=396 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=247 x=374 y=396 width=15 height=55 xoffset=2 yoffset=0 xadvance=18 page=0 chnl=0
char id=248 x=389 y=396 width=23 height=55 xoffset=1 yoffset=0 xadvance=24 page=0 chnl=0
char id=249 x=412 y=396 width=22 height=55 xoffset=2 yoffset=0 xadvance=24 page=0 chnl=0
char id=250 x=434 y=396 width=22 height=55 xoffset=2 yoffset=0 xadvance=24 page=0 chnl=0
char id=251 x=456 y=396 width=22 height=55 xoffset=2 yoffset=0 xadvance=24 page=0 chnl=0
char id=252 x=478 y=396 width=22 height=55 xoffset=2 yoffset=0 xadvance=24 page=0 chnl=0
char id=253 x=0 y=451 width=24 height=55 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=0
char id=254 x=24 y=451 width=22 height=55 xoffset=2 yoffset=0 xadvance=23 page=0 chnl=0
char id=255 x=46 y=451 width=24 height=55 xoffset=0 yoffset=0 xadvance=23 page=0 chnl=0
char id=9 x=0 y=46 width=6 height=220 xoffset=0 yoffset=0 xadvance=-1 page=0 chnl=0
char id=10 x=6 y=46 width=6 height=220 xoffset=0 yoffset=0 xadvance=-1 page=0 chnl=0
char id=13 x=12 y=46 width=6 height=220 xoffset=0 yoffset=0 xadvance=-1 page=0 chnl=0
char id=32 x=18 y=46 width=6 height=220 xoffset=0 yoffset=0 xadvance=59 page=0 chnl=0
char id=33 x=24 y=46 width=40 height=220 xoffset=8 yoffset=0 xadvance=49 page=0 chnl=0
char id=34 x=64 y=46 width=62 height=220 xoffset=8 yoffset=0 xadvance=71 page=0 chnl=0
char id=35 x=126 y=46 width=95 height=220 xoffset=3 yoffset=0 xadvance=95 page=0 chnl=0
char id=36 x=221 y=46 width=84 height=220 xoffset=4 yoffset=0 xadvance=86 page=0 chnl=0
char id=37 x=305 y=46 width=148 height=220 xoffset=6 yoffset=0 xadvance=153 page=0 chnl=0
char id=38 x=453 y=46 width=127 height=220 xoffset=6 yoffset=0 xadvance=131 page=0 chnl=0
char id=39 x=580 y=46 width=31 height=220 xoffset=8 yoffset=0 xadvance=39 page=0 chnl=0
char id=40 x=611 y=46 width=44 height=220 xoffset=4 yoffset=0 xadvance=44 page=0 chnl=0
char id=41 x=655 y=46 width=44 height=220 xoffset=4 yoffset=0 xadvance=44 page=0 chnl=0
char id=42 x=699 y=46 width=71 height=220 xoffset=4 yoffset=0 xadvance=71 page=0 chnl=0
char id=43 x=770 y=46 width=86 height=220 xoffset=3 yoffset=0 xadvance=85 page=0 chnl=0
char id=44 x=856 y=46 width=38 height=220 xoffset=7 yoffset=0 xadvance=43 page=0 chnl=0
char id=45 x=894 y=46 width=65 height=220 xoffset=8 yoffset=0 xadvance=75 page=0 chnl=0
char id=46 x=959 y=46 width=39 height=220 xoffset=8 yoffset=0 xadvance=48 page=0 chnl=0
char id=47 x=998 y=46 width=102 height=220 xoffset=1 yoffset=0 xadvance=97 page=0 chnl=0
char id=48 x=1100 y=46 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=49 x=1207 y=46 width=61 height=220 xoffset=2 yoffset=0 xadvance=64 page=0 chnl=0
char id=50 x=1268 y=46 width=104 height=220 xoffset=6 yoffset=0 xadvance=111 page=0 chnl=0
char id=51 x=1372 y=46 width=100 height=220 xoffset=6 yoffset=0 xadvance=106 page=0 chnl=0
char id=52 x=1472 y=46 width=111 height=220 xoffset=3 yoffset=0 xadvance=109 page=0 chnl=0
char id=53 x=1583 y=46 width=98 height=220 xoffset=7 yoffset=0 xadvance=105 page=0 chnl=0
char id=54 x=1681 y=46 width=104 height=220 xoffset=8 yoffset=0 xadvance=112 page=0 chnl=0
char id=55 x=1785 y=46 width=92 height=220 xoffset=6 yoffset=0 xadvance=93 page=0 chnl=0
char id=56 x=1877 y=46 width=100 height=220 xoffset=7 yoffset=0 xadvance=107 page=0 chnl=0
char id=57 x=0 y=266 width=105 height=220 xoffset=7 yoffset=0 xadvance=112 page=0 chnl=0
char id=58 x=105 y=266 width=36 height=220 xoffset=8 yoffset=0 xadvance=43 page=0 chnl=0
char id=59 x=141 y=266 width=37 height=220 xoffset=7 yoffset=0 xadvance=43 page=0 chnl=0
char id=60 x=178 y=266 width=59 height=220 xoffset=1 yoffset=0 xadvance=58 page=0 chnl=0
char id=61 x=237 y=266 width=92 height=220 xoffset=8 yoffset=0 xadvance=97 page=0 chnl=0
char id=62 x=329 y=266 width=59 height=220 xoffset=8 yoffset=0 xadvance=61 page=0 chnl=0
char id=63 x=388 y=266 width=96 height=220 xoffset=4 yoffset=0 xadvance=98 page=0 chnl=0
char id=64 x=484 y=266 width=132 height=220 xoffset=4 yoffset=0 xadvance=136 page=0 chnl=0
char id=65 x=616 y=266 width=120 height=220 xoffset=1 yoffset=0 xadvance=114 page=0 chnl=0
char id=66 x=736 y=266 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=67 x=843 y=266 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=68 x=950 y=266 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=69 x=1057 y=266 width=87 height=220 xoffset=8 yoffset=0 xadvance=93 page=0 chnl=0
char id=70 x=1144 y=266 width=87 height=220 xoffset=8 yoffset=0 xadvance=91 page=0 chnl=0
char id=71 x=1231 y=266 width=105 height=220 xoffset=8 yoffset=0 xadvance=114 page=0 chnl=0
char id=72 x=1336 y=266 width=105 height=220 xoffset=8 yoffset=0 xadvance=114 page=0 chnl=0
char id=73 x=1441 y=266 width=41 height=220 xoffset=8 yoffset=0 xadvance=50 page=0 chnl=0
char id=74 x=1482 y=266 width=63 height=220 xoffset=3 yoffset=0 xadvance=67 page=0 chnl=0
char id=75 x=1545 y=266 width=114 height=220 xoffset=8 yoffset=0 xadvance=118 page=0 chnl=0
char id=76 x=1659 y=266 width=83 height=220 xoffset=8 yoffset=0 xadvance=87 page=0 chnl=0
char id=77 x=1742 y=266 width=142 height=220 xoffset=8 yoffset=0 xadvance=151 page=0 chnl=0
char id=78 x=1884 y=266 width=111 height=220 xoffset=8 yoffset=0 xadvance=121 page=0 chnl=0
char id=79 x=0 y=486 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=80 x=107 y=486 width=105 height=220 xoffset=8 yoffset=0 xadvance=108 page=0 chnl=0
char id=81 x=212 y=486 width=107 height=220 xoffset=6 yoffset=0 xadvance=113 page=0 chnl=0
char id=82 x=319 y=486 width=107 height=220 xoffset=8 yoffset=0 xadvance=113 page=0 chnl=0
char id=83 x=426 y=486 width=112 height=220 xoffset=6 yoffset=0 xadvance=117 page=0 chnl=0
char id=84 x=538 y=486 width=107 height=220 xoffset=3 yoffset=0 xadvance=105 page=0 chnl=0
char id=85 x=645 y=486 width=107 height=220 xoffset=8 yoffset=0 xadvance=116 page=0 chnl=0
char id=86 x=752 y=486 width=117 height=220 xoffset=1 yoffset=0 xadvance=111 page=0 chnl=0
char id=87 x=869 y=486 width=169 height=220 xoffset=1 yoffset=0 xadvance=165 page=0 chnl=0
char id=88 x=1038 y=486 width=123 height=220 xoffset=3 yoffset=0 xadvance=124 page=0 chnl=0
char id=89 x=1161 y=486 width=119 height=220 xoffset=2 yoffset=0 xadvance=115 page=0 chnl=0
char id=90 x=1280 y=486 width=101 height=220 xoffset=5 yoffset=0 xadvance=104 page=0 chnl=0
char id=91 x=1381 y=486 width=37 height=220 xoffset=8 yoffset=0 xadvance=44 page=0 chnl=0
char id=92 x=1418 y=486 width=102 height=220 xoffset=1 yoffset=0 xadvance=97 page=0 chnl=0
char id=93 x=1520 y=486 width=37 height=220 xoffset=8 yoffset=0 xadvance=44 page=0 chnl=0
char id=94 x=1557 y=486 width=95 height=220 xoffset=4 yoffset=0 xadvance=96 page=0 chnl=0
char id=95 x=1652 y=486 width=125 height=220 xoffset=-1 yoffset=0 xadvance=115 page=0 chnl=0
char id=96 x=1777 y=486 width=57 height=220 xoffset=-2 yoffset=0 xadvance=56 page=0 chnl=0
char id=97 x=1834 y=486 width=98 height=220 xoffset=7 yoffset=0 xadvance=103 page=0 chnl=0
char id=98 x=1932 y=486 width=91 height=220 xoffset=8 yoffset=0 xadvance=96 page=0 chnl=0
char id=99 x=0 y=706 width=91 height=220 xoffset=7 yoffset=0 xadvance=98 page=0 chnl=0
char id=100 x=91 y=706 width=90 height=220 xoffset=4 yoffset=0 xadvance=96 page=0 chnl=0
char id=101 x=181 y=706 width=91 height=220 xoffset=7 yoffset=0 xadvance=98 page=0 chnl=0
char id=102 x=272 y=706 width=70 height=220 xoffset=1 yoffset=0 xadvance=66 page=0 chnl=0
char id=103 x=342 y=706 width=89 height=220 xoffset=6 yoffset=0 xadvance=96 page=0 chnl=0
char id=104 x=431 y=706 width=91 height=220 xoffset=8 yoffset=0 xadvance=96 page=0 chnl=0
char id=105 x=522 y=706 width=37 height=220 xoffset=8 yoffset=0 xadvance=46 page=0 chnl=0
char id=106 x=559 y=706 width=57 height=220 xoffset=-14 yoffset=0 xadvance=44 page=0 chnl=0
char id=107 x=616 y=706 width=98 height=220 xoffset=8 yoffset=0 xadvance=101 page=0 chnl=0
char id=108 x=714 y=706 width=37 height=220 xoffset=8 yoffset=0 xadvance=46 page=0 chnl=0
char id=109 x=751 y=706 width=138 height=220 xoffset=8 yoffset=0 xadvance=147 page=0 chnl=0
char id=110 x=889 y=706 width=91 height=220 xoffset=8 yoffset=0 xadvance=100 page=0 chnl=0
char id=111 x=980 y=706 width=91 height=220 xoffset=7 yoffset=0 xadvance=99 page=0 chnl=0
char id=112 x=1071 y=706 width=91 height=220 xoffset=8 yoffset=0 xadvance=96 page=0 chnl=0
char id=113 x=1162 y=706 width=90 height=220 xoffset=5 yoffset=0 xadvance=96 page=0 chnl=0
char id=114 x=1252 y=706 width=65 height=220 xoffset=8 yoffset=0 xadvance=69 page=0 chnl=0
char id=115 x=1317 y=706 width=91 height=220 xoffset=6 yoffset=0 xadvance=96 page=0 chnl=0
char id=116 x=1408 y=706 width=73 height=220 xoffset=1 yoffset=0 xadvance=68 page=0 chnl=0
char id=117 x=1481 y=706 width=91 height=220 xoffset=8 yoffset=0 xadvance=100 page=0 chnl=0
char id=118 x=1572 y=706 width=99 height=220 xoffset=1 yoffset=0 xadvance=95 page=0 chnl=0
char id=119 x=1671 y=706 width=146 height=220 xoffset=3 yoffset=0 xadvance=144 page=0 chnl=0
char id=120 x=1817 y=706 width=102 height=220 xoffset=4 yoffset=0 xadvance=103 page=0 chnl=0
char id=121 x=1919 y=706 width=99 height=220 xoffset=2 yoffset=0 xadvance=96 page=0 chnl=0
char id=122 x=0 y=926 width=84 height=220 xoffset=5 yoffset=0 xadvance=86 page=0 chnl=0
char id=123 x=84 y=926 width=67 height=220 xoffset=3 yoffset=0 xadvance=68 page=0 chnl=0
char id=124 x=151 y=926 width=27 height=220 xoffset=8 yoffset=0 xadvance=36 page=0 chnl=0
char id=125 x=178 y=926 width=67 height=220 xoffset=6 yoffset=0 xadvance=68 page=0 chnl=0
char id=126 x=245 y=926 width=93 height=220 xoffset=12 yoffset=0 xadvance=110 page=0 chnl=0
char id=161 x=338 y=926 width=40 height=220 xoffset=8 yoffset=0 xadvance=49 page=0 chnl=0
char id=162 x=378 y=926 width=82 height=220 xoffset=8 yoffset=0 xadvance=90 page=0 chnl=0
char id=163 x=460 y=926 width=93 height=220 xoffset=5 yoffset=0 xadvance=95 page=0 chnl=0
char id=164 x=553 y=926 width=80 height=220 xoffset=12 yoffset=0 xadvance=97 page=0 chnl=0
char id=165 x=633 y=926 width=119 height=220 xoffset=4 yoffset=0 xadvance=120 page=0 chnl=0
char id=166 x=752 y=926 width=27 height=220 xoffset=8 yoffset=0 xadvance=35 page=0 chnl=0
char id=167 x=779 y=926 width=95 height=220 xoffset=8 yoffset=0 xadvance=100 page=0 chnl=0
char id=168 x=874 y=926 width=68 height=220 xoffset=8 yoffset=0 xadvance=78 page=0 chnl=0
char id=169 x=942 y=926 width=153 height=220 xoffset=7 yoffset=0 xadvance=157 page=0 chnl=0
char id=170 x=1095 y=926 width=68 height=220 xoffset=7 yoffset=0 xadvance=75 page=0 chnl=0
char id=171 x=1163 y=926 width=77 height=220 xoffset=8 yoffset=0 xadvance=88 page=0 chnl=0
char id=172 x=1240 y=926 width=102 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=174 x=1342 y=926 width=93 height=220 xoffset=5 yoffset=0 xadvance=95 page=0 chnl=0
char id=175 x=1435 y=926 width=65 height=220 xoffset=8 yoffset=0 xadvance=75 page=0 chnl=0
char id=176 x=1500 y=926 width=70 height=220 xoffset=6 yoffset=0 xadvance=73 page=0 chnl=0
char id=177 x=1570 y=926 width=93 height=220 xoffset=12 yoffset=0 xadvance=110 page=0 chnl=0
char id=178 x=1663 y=926 width=55 height=220 xoffset=8 yoffset=0 xadvance=63 page=0 chnl=0
char id=179 x=1718 y=926 width=53 height=220 xoffset=8 yoffset=0 xadvance=60 page=0 chnl=0
char id=180 x=1771 y=926 width=60 height=220 xoffset=9 yoffset=0 xadvance=61 page=0 chnl=0
char id=182 x=1831 y=926 width=73 height=220 xoffset=14 yoffset=0 xadvance=92 page=0 chnl=0
char id=183 x=1904 y=926 width=39 height=220 xoffset=8 yoffset=0 xadvance=48 page=0 chnl=0
char id=184 x=1943 y=926 width=44 height=220 xoffset=8 yoffset=0 xadvance=48 page=0 chnl=0
char id=185 x=1987 y=926 width=33 height=220 xoffset=9 yoffset=0 xadvance=46 page=0 chnl=0
char id=186 x=0 y=1146 width=69 height=220 xoffset=7 yoffset=0 xadvance=78 page=0 chnl=0
char id=187 x=69 y=1146 width=77 height=220 xoffset=8 yoffset=0 xadvance=88 page=0 chnl=0
char id=188 x=146 y=1146 width=128 height=220 xoffset=10 yoffset=0 xadvance=139 page=0 chnl=0
char id=189 x=274 y=1146 width=126 height=220 xoffset=9 yoffset=0 xadvance=140 page=0 chnl=0
char id=190 x=400 y=1146 width=135 height=220 xoffset=3 yoffset=0 xadvance=138 page=0 chnl=0
char id=191 x=535 y=1146 width=97 height=220 xoffset=4 yoffset=0 xadvance=98 page=0 chnl=0
char id=192 x=632 y=1146 width=120 height=220 xoffset=1 yoffset=0 xadvance=114 page=0 chnl=0
char id=193 x=752 y=1146 width=120 height=220 xoffset=1 yoffset=0 xadvance=114 page=0 chnl=0
char id=194 x=872 y=1146 width=120 height=220 xoffset=1 yoffset=0 xadvance=114 page=0 chnl=0
char id=195 x=992 y=1146 width=120 height=220 xoffset=1 yoffset=0 xadvance=114 page=0 chnl=0
char id=196 x=1112 y=1146 width=120 height=220 xoffset=1 yoffset=0 xadvance=114 page=0 chnl=0
char id=197 x=1232 y=1146 width=120 height=220 xoffset=1 yoffset=0 xadvance=114 page=0 chnl=0
char id=198 x=1352 y=1146 width=131 height=220 xoffset=1 yoffset=0 xadvance=133 page=0 chnl=0
char id=199 x=1483 y=1146 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=200 x=1590 y=1146 width=87 height=220 xoffset=8 yoffset=0 xadvance=93 page=0 chnl=0
char id=201 x=1677 y=1146 width=87 height=220 xoffset=8 yoffset=0 xadvance=93 page=0 chnl=0
char id=202 x=1764 y=1146 width=87 height=220 xoffset=8 yoffset=0 xadvance=93 page=0 chnl=0
char id=203 x=1851 y=1146 width=87 height=220 xoffset=8 yoffset=0 xadvance=93 page=0 chnl=0
char id=204 x=1938 y=1146 width=56 height=220 xoffset=-3 yoffset=0 xadvance=50 page=0 chnl=0
char id=205 x=0 y=1366 width=60 height=220 xoffset=2 yoffset=0 xadvance=50 page=0 chnl=0
char id=206 x=60 y=1366 width=69 height=220 xoffset=-6 yoffset=0 xadvance=50 page=0 chnl=0
char id=207 x=129 y=1366 width=68 height=220 xoffset=-5 yoffset=0 xadvance=50 page=0 chnl=0
char id=208 x=197 y=1366 width=117 height=220 xoffset=5 yoffset=0 xadvance=123 page=0 chnl=0
char id=209 x=314 y=1366 width=111 height=220 xoffset=8 yoffset=0 xadvance=121 page=0 chnl=0
char id=210 x=425 y=1366 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=211 x=532 y=1366 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=212 x=639 y=1366 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=213 x=746 y=1366 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=214 x=853 y=1366 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=215 x=960 y=1366 width=77 height=220 xoffset=8 yoffset=0 xadvance=85 page=0 chnl=0
char id=216 x=1037 y=1366 width=107 height=220 xoffset=8 yoffset=0 xadvance=115 page=0 chnl=0
char id=217 x=1144 y=1366 width=107 height=220 xoffset=8 yoffset=0 xadvance=116 page=0 chnl=0
char id=218 x=1251 y=1366 width=107 height=220 xoffset=8 yoffset=0 xadvance=116 page=0 chnl=0
char id=219 x=1358 y=1366 width=107 height=220 xoffset=8 yoffset=0 xadvance=116 page=0 chnl=0
char id=220 x=1465 y=1366 width=107 height=220 xoffset=8 yoffset=0 xadvance=116 page=0 chnl=0
char id=221 x=1572 y=1366 width=119 height=220 xoffset=2 yoffset=0 xadvance=115 page=0 chnl=0
char id=222 x=1691 y=1366 width=84 height=220 xoffset=8 yoffset=0 xadvance=92 page=0 chnl=0
char id=223 x=1775 y=1366 width=99 height=220 xoffset=7 yoffset=0 xadvance=106 page=0 chnl=0
char id=224 x=1874 y=1366 width=98 height=220 xoffset=7 yoffset=0 xadvance=103 page=0 chnl=0
char id=225 x=0 y=1586 width=98 height=220 xoffset=7 yoffset=0 xadvance=103 page=0 chnl=0
char id=226 x=98 y=1586 width=98 height=220 xoffset=7 yoffset=0 xadvance=103 page=0 chnl=0
char id=227 x=196 y=1586 width=98 height=220 xoffset=7 yoffset=0 xadvance=103 page=0 chnl=0
char id=228 x=294 y=1586 width=98 height=220 xoffset=7 yoffset=0 xadvance=103 page=0 chnl=0
char id=229 x=392 y=1586 width=98 height=220 xoffset=7 yoffset=0 xadvance=103 page=0 chnl=0
char id=230 x=490 y=1586 width=148 height=220 xoffset=7 yoffset=0 xadvance=155 page=0 chnl=0
char id=231 x=638 y=1586 width=91 height=220 xoffset=7 yoffset=0 xadvance=98 page=0 chnl=0
char id=232 x=729 y=1586 width=91 height=220 xoffset=7 yoffset=0 xadvance=98 page=0 chnl=0
char id=233 x=820 y=1586 width=91 height=220 xoffset=7 yoffset=0 xadvance=98 page=0 chnl=0
char id=234 x=911 y=1586 width=91 height=220 xoffset=7 yoffset=0 xadvance=98 page=0 chnl=0
char id=235 x=1002 y=1586 width=91 height=220 xoffset=7 yoffset=0 xadvance=98 page=0 chnl=0
char id=236 x=1093 y=1586 width=56 height=220 xoffset=-5 yoffset=0 xadvance=46 page=0 chnl=0
char id=237 x=1149 y=1586 width=61 height=220 xoffset=8 yoffset=0 xadvance=46 page=0 chnl=0
char id=238 x=1210 y=1586 width=69 height=220 xoffset=-8 yoffset=0 xadvance=46 page=0 chnl=0
char id=239 x=1279 y=1586 width=67 height=220 xoffset=-7 yoffset=0 xadvance=46 page=0 chnl=0
char id=240 x=1346 y=1586 width=105 height=220 xoffset=8 yoffset=0 xadvance=112 page=0 chnl=0
char id=241 x=1451 y=1586 width=91 height=220 xoffset=8 yoffset=0 xadvance=100 page=0 chnl=0
char id=242 x=1542 y=1586 width=91 height=220 xoffset=7 yoffset=0 xadvance=99 page=0 chnl=0
char id=243 x=1633 y=1586 width=91 height=220 xoffset=7 yoffset=0 xadvance=99 page=0 chnl=0
char id=244 x=1724 y=1586 width=91 height=220 xoffset=7 yoffset=0 xadvance=99 page=0 chnl=0
char id=245 x=1815 y=1586 width=91 height=220 xoffset=7 yoffset=0 xadvance=99 page=0 chnl=0
char id=246 x=1906 y=1586 width=91 height=220 xoffset=7 yoffset=0 xadvance=99 page=0 chnl=0
char id=247 x=0 y=1806 width=65 height=220 xoffset=8 yoffset=0 xadvance=75 page=0 chnl=0
char id=248 x=65 y=1806 width=91 height=220 xoffset=7 yoffset=0 xadvance=99 page=0 chnl=0
char id=249 x=156 y=1806 width=91 height=220 xoffset=8 yoffset=0 xadvance=100 page=0 chnl=0
char id=250 x=247 y=1806 width=91 height=220 xoffset=8 yoffset=0 xadvance=100 page=0 chnl=0
char id=251 x=338 y=1806 width=91 height=220 xoffset=8 yoffset=0 xadvance=100 page=0 chnl=0
char id=252 x=429 y=1806 width=91 height=220 xoffset=8 yoffset=0 xadvance=100 page=0 chnl=0
char id=253 x=520 y=1806 width=99 height=220 xoffset=2 yoffset=0 xadvance=96 page=0 chnl=0
char id=254 x=619 y=1806 width=91 height=220 xoffset=8 yoffset=0 xadvance=96 page=0 chnl=0
char id=255 x=710 y=1806 width=99 height=220 xoffset=2 yoffset=0 xadvance=96 page=0 chnl=0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 293 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 3.1 MiB

View File

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,582 @@
# Blender 3.6.5
# www.blender.org
o Shield.001
v 0.331177 0.029684 0.498915
v 0.331177 0.029684 -0.019826
v 0.324814 0.029684 -0.113625
v 0.305971 0.029684 -0.203821
v 0.275372 0.029684 -0.286945
v 0.234192 0.029684 -0.359804
v 0.184014 0.029684 -0.419598
v 0.126767 0.029684 -0.464029
v 0.064650 0.029684 -0.491389
v 0.000000 0.029684 -0.500628
v 0.000000 0.029684 0.498915
v 0.318062 -0.020828 0.485801
v 0.318062 -0.020828 -0.019381
v 0.311791 -0.020828 -0.111832
v 0.293331 -0.020828 -0.200195
v 0.263432 -0.020828 -0.281417
v 0.223370 -0.020828 -0.352299
v 0.174868 -0.020828 -0.410095
v 0.120002 -0.020828 -0.452678
v 0.061012 -0.020828 -0.478662
v 0.000000 -0.020828 0.498915
v 0.331177 -0.020828 0.498915
v 0.000000 -0.020828 -0.500628
v 0.331177 -0.020828 -0.019826
v 0.324814 -0.020828 -0.113625
v 0.305971 -0.020828 -0.203821
v 0.275372 -0.020828 -0.286945
v 0.234192 -0.020828 -0.359804
v 0.184014 -0.020828 -0.419598
v 0.126767 -0.020828 -0.464029
v 0.064650 -0.020828 -0.491389
v 0.000000 -0.020828 -0.485507
v 0.000000 -0.020828 0.485800
v 0.000000 -0.020828 0.000147
v 0.318062 -0.030185 0.485801
v 0.318062 -0.030185 -0.019381
v 0.311791 -0.030185 -0.111832
v 0.293331 -0.030185 -0.200195
v 0.263432 -0.030185 -0.281417
v 0.223370 -0.030185 -0.352299
v 0.174868 -0.030185 -0.410095
v 0.120002 -0.030185 -0.452678
v 0.061012 -0.030185 -0.478662
v 0.000000 -0.030185 0.498915
v 0.331177 -0.030185 0.498915
v 0.000000 -0.030185 -0.500628
v 0.331177 -0.030185 -0.019826
v 0.324814 -0.030185 -0.113625
v 0.305971 -0.030185 -0.203821
v 0.275372 -0.030185 -0.286945
v 0.234192 -0.030185 -0.359804
v 0.184014 -0.030185 -0.419598
v 0.126767 -0.030185 -0.464029
v 0.064650 -0.030185 -0.491389
v 0.000000 -0.030185 -0.485507
v 0.000000 -0.030185 0.485800
v -0.331177 0.029684 0.498915
v -0.331177 0.029684 -0.019826
v -0.324814 0.029684 -0.113625
v -0.305971 0.029684 -0.203821
v -0.275372 0.029684 -0.286945
v -0.234192 0.029684 -0.359804
v -0.184014 0.029684 -0.419598
v -0.126767 0.029684 -0.464029
v -0.064650 0.029684 -0.491389
v -0.318062 -0.020828 0.485801
v -0.318062 -0.020828 -0.019381
v -0.311791 -0.020828 -0.111832
v -0.293331 -0.020828 -0.200195
v -0.263432 -0.020828 -0.281417
v -0.223370 -0.020828 -0.352299
v -0.174868 -0.020828 -0.410095
v -0.120002 -0.020828 -0.452678
v -0.061012 -0.020828 -0.478662
v -0.331177 -0.020828 0.498915
v -0.331177 -0.020828 -0.019826
v -0.324814 -0.020828 -0.113625
v -0.305971 -0.020828 -0.203821
v -0.275372 -0.020828 -0.286945
v -0.234192 -0.020828 -0.359804
v -0.184014 -0.020828 -0.419598
v -0.126767 -0.020828 -0.464029
v -0.064650 -0.020828 -0.491389
v -0.318062 -0.030185 0.485801
v -0.318062 -0.030185 -0.019381
v -0.311791 -0.030185 -0.111832
v -0.293331 -0.030185 -0.200195
v -0.263432 -0.030185 -0.281417
v -0.223370 -0.030185 -0.352299
v -0.174868 -0.030185 -0.410095
v -0.120002 -0.030185 -0.452678
v -0.061012 -0.030185 -0.478662
v -0.331177 -0.030185 0.498915
v -0.331177 -0.030185 -0.019826
v -0.324814 -0.030185 -0.113625
v -0.305971 -0.030185 -0.203821
v -0.275372 -0.030185 -0.286945
v -0.234192 -0.030185 -0.359804
v -0.184014 -0.030185 -0.419598
v -0.126767 -0.030185 -0.464029
v -0.064650 -0.030185 -0.491389
vn 0.6574 0.6894 -0.3043
vn 0.8218 -0.0000 -0.5698
vn 0.5971 0.6870 -0.4141
vn -0.5120 -0.0000 0.8590
vn -0.6935 -0.0000 0.7205
vn 0.7153 0.6919 -0.0985
vn 0.9994 -0.0000 -0.0339
vn 0.9907 -0.0000 -0.1364
vn 1.0000 -0.0000 -0.0000
vn 0.2021 0.6777 -0.7070
vn 0.1415 -0.0000 -0.9899
vn 0.1046 0.6729 -0.7323
vn 0.6935 -0.0000 -0.7205
vn 0.5059 0.6840 -0.5256
vn 0.9612 -0.0000 -0.2757
vn 0.6949 0.6910 -0.1993
vn 0.0437 0.7064 0.7064
vn 0.7142 0.6996 -0.0242
vn -0.0000 0.7071 0.7071
vn -0.0000 -0.0000 1.0000
vn 0.5120 -0.0000 -0.8590
vn 0.3751 0.6806 -0.6294
vn 0.9075 -0.0000 -0.4201
vn 0.2748 -0.0000 -0.9615
vn -0.0000 -1.0000 -0.0000
vn -0.8218 -0.0000 0.5698
vn -0.9075 -0.0000 0.4201
vn -0.1115 -0.0000 0.9938
vn -0.2603 -0.0000 0.9655
vn -0.9612 -0.0000 0.2757
vn -0.9994 -0.0000 0.0339
vn -1.0000 -0.0000 -0.0000
vn -0.9907 -0.0000 0.1364
vn -0.0000 -0.0000 -1.0000
vn -0.8218 -0.0000 -0.5698
vn -0.9075 -0.0000 -0.4201
vn 0.6935 -0.0000 0.7205
vn 0.5120 -0.0000 0.8590
vn -0.9907 -0.0000 -0.1364
vn -0.9994 -0.0000 -0.0339
vn -0.1415 -0.0000 -0.9899
vn -0.2748 -0.0000 -0.9615
vn -0.6935 -0.0000 -0.7205
vn -0.9612 -0.0000 -0.2757
vn -0.5120 -0.0000 -0.8590
vn 0.8218 -0.0000 0.5698
vn 0.9075 -0.0000 0.4201
vn 0.2603 -0.0000 0.9655
vn 0.1115 -0.0000 0.9938
vn 0.9612 -0.0000 0.2757
vn 0.9994 -0.0000 0.0339
vn 0.9907 -0.0000 0.1364
vn -0.0000 1.0000 -0.0000
vt 0.852452 0.926767
vt 0.863932 0.943326
vt 0.852452 0.943326
vt 0.416217 0.784524
vt 0.414091 0.772054
vt 0.416217 0.772054
vt 0.852452 0.887374
vt 0.863932 0.866055
vt 0.863932 0.887374
vt 0.550685 0.744478
vt 0.539205 0.630661
vt 0.539205 0.741041
vt 0.348119 0.828570
vt 0.336639 0.813877
vt 0.348119 0.813877
vt 0.863932 0.956916
vt 0.852452 0.956916
vt 0.863932 0.907874
vt 0.852452 0.907874
vt 0.852452 0.748155
vt 0.852452 0.866055
vt 0.643871 0.823767
vt 0.632391 0.748497
vt 0.643871 0.748497
vt 0.348119 0.855700
vt 0.336639 0.842689
vt 0.348119 0.842689
vt 0.863932 0.926767
vt 0.336639 0.828570
vt 0.980591 0.564665
vt 0.984787 0.584748
vt 0.913922 0.610199
vt 0.866059 0.956916
vt 0.537078 0.741041
vt 0.537078 0.744478
vt 0.630264 0.517300
vt 0.632391 0.530436
vt 0.630264 0.530436
vt 0.866059 0.943326
vt 0.632391 0.546546
vt 0.630264 0.546546
vt 0.416217 0.811798
vt 0.414091 0.797931
vt 0.416217 0.797931
vt 0.866059 0.926767
vt 0.632391 0.565007
vt 0.630264 0.565007
vt 0.334512 0.813877
vt 0.434232 0.744478
vt 0.506522 0.741497
vt 0.509502 0.744478
vt 0.505096 0.605666
vt 0.509502 0.626577
vt 0.506522 0.626678
vt 0.500901 0.585583
vt 0.508056 0.605259
vt 0.494105 0.567123
vt 0.503773 0.584759
vt 0.485000 0.551012
vt 0.496819 0.565866
vt 0.473976 0.537876
vt 0.487459 0.549307
vt 0.461506 0.528198
vt 0.476055 0.535717
vt 0.448099 0.522293
vt 0.463044 0.525618
vt 0.434232 0.517300
vt 0.434232 0.520737
vt 0.336639 0.855700
vt 0.334512 0.842689
vt 0.632391 0.823767
vt 0.630264 0.748497
vt 0.414091 0.784524
vt 0.334512 0.828570
vt 0.539205 0.520281
vt 0.539205 0.517300
vt 0.537078 0.517300
vt 0.630264 0.606102
vt 0.632391 0.720921
vt 0.630264 0.720921
vt 0.863932 0.748155
vt 0.866059 0.866055
vt 0.630264 0.585090
vt 0.632391 0.606102
vt 0.866059 0.887374
vt 0.182971 0.916633
vt 0.180845 0.844343
vt 0.182971 0.844343
vt 0.632391 0.585090
vt 0.866059 0.907874
vt 0.600561 0.530890
vt 0.589081 0.547450
vt 0.589081 0.530890
vt 0.414091 0.851542
vt 0.416217 0.839072
vt 0.416217 0.851542
vt 0.600561 0.586842
vt 0.589081 0.608161
vt 0.589081 0.586842
vt 0.348119 0.799183
vt 0.600561 0.517300
vt 0.589081 0.517300
vt 0.600561 0.566342
vt 0.589081 0.566342
vt 0.600561 0.608161
vt 0.589081 0.726061
vt 0.643871 0.899038
vt 0.336639 0.785065
vt 0.348119 0.772054
vt 0.348119 0.785065
vt 0.600561 0.547450
vt 0.336639 0.799183
vt 0.913922 0.720579
vt 0.841633 0.720579
vt 0.602688 0.517300
vt 0.893635 0.938640
vt 0.895762 0.951776
vt 0.893635 0.951776
vt 0.602688 0.530890
vt 0.895762 0.922530
vt 0.893635 0.922530
vt 0.414091 0.825665
vt 0.416217 0.825665
vt 0.602688 0.547450
vt 0.895762 0.904069
vt 0.893635 0.904069
vt 0.361942 0.741497
vt 0.434232 0.741497
vt 0.358961 0.626577
vt 0.363367 0.605666
vt 0.361942 0.626678
vt 0.360408 0.605259
vt 0.367563 0.585583
vt 0.364690 0.584759
vt 0.374359 0.567123
vt 0.371645 0.565866
vt 0.383464 0.551012
vt 0.381004 0.549307
vt 0.394488 0.537876
vt 0.392409 0.535717
vt 0.406958 0.528198
vt 0.405420 0.525618
vt 0.420365 0.522293
vt 0.419538 0.519400
vt 0.334512 0.785065
vt 0.336639 0.772054
vt 0.630264 0.899038
vt 0.632391 0.899038
vt 0.334512 0.799183
vt 0.895762 0.748155
vt 0.893635 0.862974
vt 0.893635 0.748155
vt 0.602688 0.608161
vt 0.600561 0.726061
vt 0.895762 0.862974
vt 0.893635 0.883986
vt 0.602688 0.586842
vt 0.182971 0.772054
vt 0.602688 0.566342
vt 0.550685 0.517300
vt 0.539205 0.744478
vt 0.986212 0.605761
vt 0.986212 0.720579
vt 0.913922 0.499819
vt 0.941197 0.507280
vt 0.927789 0.501375
vt 0.953667 0.516959
vt 0.964690 0.530095
vt 0.973795 0.546205
vt 0.632391 0.517300
vt 0.414091 0.811798
vt 0.448925 0.519400
vt 0.334512 0.855700
vt 0.630264 0.823767
vt 0.537078 0.520281
vt 0.866059 0.748155
vt 0.180845 0.916633
vt 0.414091 0.839072
vt 0.841633 0.605761
vt 0.843058 0.584748
vt 0.847254 0.564665
vt 0.854049 0.546205
vt 0.863155 0.530095
vt 0.874178 0.516959
vt 0.886648 0.507280
vt 0.900055 0.501375
vt 0.895762 0.938640
vt 0.358961 0.744478
vt 0.334512 0.772054
vt 0.602688 0.726061
vt 0.895762 0.883986
vt 0.180845 0.772054
vt 0.591727 0.581771
vt 0.592669 0.565234
vt 0.601155 0.522724
vt 0.866647 0.820446
vt 0.866647 0.893741
vt 0.855496 0.893741
vt 0.593938 0.550739
vt 0.595485 0.538844
vt 0.597249 0.530005
vt 0.599163 0.524562
vt 0.601155 0.721574
vt 0.590950 0.618375
vt 0.591146 0.599714
vt 0.590950 0.721574
vt 0.855496 0.752511
vt 0.857673 0.753816
vt 0.859764 0.757682
vt 0.864768 0.782703
vt 0.863381 0.772408
vt 0.861692 0.763960
vt 0.865798 0.794448
vt 0.866433 0.807192
s 1
f 5/1/1 28/2/2 6/3/3
f 19/4/4 41/5/5 18/6/5
f 3/7/6 24/8/7 25/9/8
f 10/10/9 34/11/9 32/12/9
f 9/13/10 23/14/11 10/15/12
f 6/3/3 29/16/13 7/17/14
f 3/7/6 26/18/15 4/19/16
f 1/20/17 24/8/7 2/21/18
f 11/22/19 22/23/20 1/24/17
f 7/25/14 30/26/21 8/27/22
f 4/19/16 27/28/23 5/1/1
f 8/27/22 31/29/24 9/13/10
f 15/30/25 14/31/25 34/32/25
f 28/2/2 52/33/13 29/16/13
f 32/12/9 55/34/9 46/35/9
f 18/36/5 40/37/26 17/38/26
f 27/28/23 51/39/2 28/2/2
f 17/38/26 39/40/27 16/41/27
f 32/42/28 43/43/29 20/44/29
f 26/18/15 50/45/23 27/28/23
f 16/41/27 38/46/30 15/47/30
f 31/29/24 46/48/11 23/14/11
f 44/49/25 35/50/25 45/51/25
f 37/52/25 47/53/25 36/54/25
f 38/55/25 48/56/25 37/52/25
f 39/57/25 49/58/25 38/55/25
f 40/59/25 50/60/25 39/57/25
f 41/61/25 51/62/25 40/59/25
f 42/63/25 52/64/25 41/61/25
f 43/65/25 53/66/25 42/63/25
f 35/50/25 47/53/25 45/51/25
f 46/67/25 43/65/25 55/68/25
f 29/69/13 53/70/21 30/26/21
f 21/71/20 45/72/20 22/23/20
f 19/4/4 43/43/29 42/73/4
f 30/26/21 54/74/24 31/29/24
f 33/75/9 21/76/9 44/77/9
f 13/78/31 35/79/32 12/80/32
f 22/81/9 47/82/7 24/8/7
f 14/83/33 36/84/31 13/78/31
f 24/8/7 48/85/8 25/9/8
f 12/86/34 56/87/34 33/88/34
f 15/47/30 37/89/33 14/83/33
f 25/9/8 49/90/15 26/18/15
f 80/91/35 61/92/36 62/93/35
f 90/94/37 73/95/38 72/96/37
f 77/97/39 58/98/40 59/99/39
f 23/14/41 65/100/42 10/15/41
f 81/101/43 62/93/35 63/102/43
f 78/103/44 59/99/39 60/104/44
f 76/105/40 57/106/32 58/98/40
f 57/107/20 21/71/20 11/22/20
f 82/108/45 63/109/43 64/110/45
f 79/111/36 60/104/44 61/92/36
f 83/112/42 64/110/45 65/100/42
f 34/32/25 33/113/25 66/114/25
f 99/115/43 80/91/35 81/101/43
f 71/116/46 90/117/37 72/118/37
f 98/119/35 79/111/36 80/91/35
f 88/120/47 71/116/46 70/121/47
f 92/122/48 32/42/49 74/123/48
f 97/124/36 78/103/44 79/111/36
f 87/125/50 70/121/47 69/126/50
f 46/48/41 83/112/42 23/14/41
f 44/49/25 84/127/25 56/128/25
f 94/129/25 86/130/25 85/131/25
f 95/132/25 87/133/25 86/130/25
f 96/134/25 88/135/25 87/133/25
f 97/136/25 89/137/25 88/135/25
f 98/138/25 90/139/25 89/137/25
f 99/140/25 91/141/25 90/139/25
f 100/142/25 92/143/25 91/141/25
f 84/127/25 94/129/25 85/131/25
f 46/67/25 92/143/25 101/144/25
f 100/145/45 81/146/43 82/108/45
f 93/147/20 21/71/20 75/148/20
f 73/95/38 92/122/48 74/123/48
f 101/149/42 82/108/45 83/112/42
f 84/150/9 67/151/51 66/152/9
f 94/153/40 75/154/32 76/105/40
f 85/155/51 68/156/52 67/151/51
f 95/157/39 76/105/40 77/97/39
f 56/87/34 66/158/34 33/88/34
f 68/156/52 87/125/50 69/126/50
f 96/159/44 77/97/39 78/103/44
f 5/1/1 27/28/23 28/2/2
f 19/4/4 42/73/4 41/5/5
f 3/7/6 2/21/18 24/8/7
f 21/76/9 33/75/9 11/160/9
f 11/160/9 34/11/9 10/10/9
f 10/10/9 32/12/9 23/161/9
f 34/11/9 11/160/9 33/75/9
f 9/13/10 31/29/24 23/14/11
f 6/3/3 28/2/2 29/16/13
f 3/7/6 25/9/8 26/18/15
f 1/20/9 22/81/9 24/8/7
f 11/22/19 21/71/20 22/23/20
f 7/25/14 29/69/13 30/26/21
f 4/19/16 26/18/15 27/28/23
f 8/27/22 30/26/21 31/29/24
f 14/31/25 13/162/25 34/32/25
f 13/162/25 12/163/25 34/32/25
f 12/163/25 33/113/25 34/32/25
f 34/32/25 32/164/25 19/165/25
f 32/164/25 20/166/25 19/165/25
f 34/32/25 19/165/25 18/167/25
f 18/167/25 17/168/25 34/32/25
f 17/168/25 16/169/25 34/32/25
f 16/169/25 15/30/25 34/32/25
f 28/2/2 51/39/2 52/33/13
f 32/12/9 46/35/9 23/161/9
f 18/36/5 41/170/5 40/37/26
f 27/28/23 50/45/23 51/39/2
f 17/38/26 40/37/26 39/40/27
f 32/42/28 55/171/28 43/43/29
f 26/18/15 49/90/15 50/45/23
f 16/41/27 39/40/27 38/46/30
f 31/29/24 54/74/24 46/48/11
f 44/49/25 56/128/25 35/50/25
f 37/52/25 48/56/25 47/53/25
f 38/55/25 49/58/25 48/56/25
f 39/57/25 50/60/25 49/58/25
f 40/59/25 51/62/25 50/60/25
f 41/61/25 52/64/25 51/62/25
f 42/63/25 53/66/25 52/64/25
f 43/65/25 54/172/25 53/66/25
f 35/50/25 36/54/25 47/53/25
f 46/67/25 54/172/25 43/65/25
f 29/69/13 52/173/13 53/70/21
f 21/71/20 44/174/20 45/72/20
f 19/4/4 20/44/29 43/43/29
f 30/26/21 53/70/21 54/74/24
f 33/75/9 44/77/9 56/175/9
f 13/78/31 36/84/31 35/79/32
f 22/81/9 45/176/9 47/82/7
f 14/83/33 37/89/33 36/84/31
f 24/8/7 47/82/7 48/85/8
f 12/86/34 35/177/34 56/87/34
f 15/47/30 38/46/30 37/89/33
f 25/9/8 48/85/8 49/90/15
f 80/91/35 79/111/36 61/92/36
f 90/94/37 91/178/38 73/95/38
f 77/97/39 76/105/40 58/98/40
f 23/14/41 83/112/42 65/100/42
f 81/101/43 80/91/35 62/93/35
f 78/103/44 77/97/39 59/99/39
f 76/105/40 75/154/32 57/106/32
f 57/107/20 75/148/20 21/71/20
f 82/108/45 81/146/43 63/109/43
f 79/111/36 78/103/44 60/104/44
f 83/112/42 82/108/45 64/110/45
f 66/114/25 67/179/25 34/32/25
f 67/179/25 68/180/25 34/32/25
f 68/180/25 69/181/25 34/32/25
f 69/181/25 70/182/25 34/32/25
f 70/182/25 71/183/25 34/32/25
f 71/183/25 72/184/25 34/32/25
f 72/184/25 73/185/25 34/32/25
f 73/185/25 74/186/25 32/164/25
f 32/164/25 34/32/25 73/185/25
f 99/115/43 98/119/35 80/91/35
f 71/116/46 89/187/46 90/117/37
f 98/119/35 97/124/36 79/111/36
f 88/120/47 89/187/46 71/116/46
f 92/122/48 55/171/49 32/42/49
f 97/124/36 96/159/44 78/103/44
f 87/125/50 88/120/47 70/121/47
f 46/48/41 101/149/42 83/112/42
f 44/49/25 93/188/25 84/127/25
f 94/129/25 95/132/25 86/130/25
f 95/132/25 96/134/25 87/133/25
f 96/134/25 97/136/25 88/135/25
f 97/136/25 98/138/25 89/137/25
f 98/138/25 99/140/25 90/139/25
f 99/140/25 100/142/25 91/141/25
f 100/142/25 101/144/25 92/143/25
f 84/127/25 93/188/25 94/129/25
f 46/67/25 55/68/25 92/143/25
f 100/145/45 99/189/43 81/146/43
f 93/147/20 44/174/20 21/71/20
f 73/95/38 91/178/38 92/122/48
f 101/149/42 100/145/45 82/108/45
f 84/150/9 85/155/51 67/151/51
f 94/153/40 93/190/32 75/154/32
f 85/155/51 86/191/52 68/156/52
f 95/157/39 94/153/40 76/105/40
f 56/87/34 84/192/34 66/158/34
f 68/156/52 86/191/52 87/125/50
f 96/159/44 95/157/39 77/97/39
f 4/193/16 5/194/1 10/195/12
s 0
f 58/196/53 57/197/53 11/198/53
s 1
f 5/194/1 6/199/3 10/195/12
f 6/199/3 7/200/14 10/195/12
f 7/200/14 8/201/22 10/195/12
f 8/201/22 9/202/10 10/195/12
f 10/195/12 11/203/19 2/204/18
f 4/193/16 10/195/12 3/205/6
f 11/203/19 1/206/17 2/204/18
f 2/204/18 3/205/6 10/195/12
s 0
f 11/198/53 10/207/53 58/196/53
f 10/207/53 65/208/53 64/209/53
f 61/210/53 10/207/53 62/211/53
f 64/209/53 63/212/53 10/207/53
f 63/212/53 62/211/53 10/207/53
f 61/210/53 60/213/53 10/207/53
f 60/213/53 59/214/53 10/207/53
f 59/214/53 58/196/53 10/207/53

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,275 @@
# Blender 3.6.5
# www.blender.org
o turbo.001
v 0.479911 0.031444 0.058178
v 0.008582 0.031444 0.530813
v 0.469532 0.031444 0.039992
v 0.309421 0.031444 0.039992
v 0.001804 0.031444 0.348364
v -0.304681 0.031444 0.041125
v -0.474757 0.031444 0.041125
v -0.474757 0.031444 0.059620
v -0.006999 0.031444 0.530813
v 0.479911 0.031444 -0.248942
v 0.008582 0.031444 0.223694
v 0.469532 0.031444 -0.267127
v 0.309421 0.031444 -0.267127
v 0.001804 0.031444 0.041245
v -0.304681 0.031444 -0.265994
v -0.474757 0.031444 -0.265994
v -0.474757 0.031444 -0.247499
v -0.006999 0.031444 0.223694
v 0.479911 0.031444 -0.561796
v 0.008582 0.031444 -0.092817
v 0.469532 0.031444 -0.579981
v 0.309421 0.031444 -0.579981
v 0.001804 0.031444 -0.275266
v -0.304681 0.031444 -0.578848
v -0.474757 0.031444 -0.578848
v -0.474757 0.031444 -0.560354
v -0.006999 0.031444 -0.092817
v 0.479911 -0.029054 0.058178
v 0.008582 -0.029055 0.530813
v 0.469532 -0.029054 0.039992
v 0.309421 -0.029054 0.039992
v 0.001804 -0.029055 0.348364
v -0.304681 -0.029054 0.041125
v -0.474757 -0.029055 0.041125
v -0.474757 -0.029055 0.059620
v -0.006999 -0.029055 0.530813
v 0.479911 -0.029054 -0.248942
v 0.008582 -0.029055 0.223694
v 0.469532 -0.029054 -0.267127
v 0.309421 -0.029054 -0.267127
v 0.001804 -0.029055 0.041245
v -0.304681 -0.029054 -0.265994
v -0.474757 -0.029055 -0.265994
v -0.474757 -0.029055 -0.247499
v -0.006999 -0.029055 0.223694
v 0.479911 -0.029054 -0.561796
v 0.008582 -0.029055 -0.092817
v 0.469532 -0.029054 -0.579981
v 0.309421 -0.029054 -0.579981
v 0.001804 -0.029055 -0.275266
v -0.304681 -0.029054 -0.578848
v -0.474757 -0.029055 -0.578848
v -0.474757 -0.029055 -0.560354
v -0.006999 -0.029055 -0.092817
vn 0.8685 -0.0000 -0.4957
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn -0.0000 -0.0000 -1.0000
vn -0.7080 -0.0000 -0.7062
vn -0.7097 -0.0000 0.7045
vn 0.7081 -0.0000 0.7061
vn -0.7069 -0.0000 0.7073
vn 0.7080 -0.0000 -0.7062
vn -0.7037 -0.0000 -0.7104
vn 0.7053 -0.0000 0.7089
vn 0.7037 -0.0000 -0.7105
vn -0.0000 -1.0000 -0.0000
vt 0.588715 0.839843
vt 0.583870 0.825758
vt 0.588715 0.825758
vt 0.452602 0.883467
vt 0.448296 0.897552
vt 0.448296 0.883467
vt 0.203212 0.786027
vt 0.189127 0.782563
vt 0.203212 0.782563
vt 0.077824 0.851102
vt 0.063739 0.811505
vt 0.077824 0.811505
vt 0.419186 0.782563
vt 0.405101 0.854358
vt 0.405101 0.782563
vt 0.246407 0.922613
vt 0.232322 0.786027
vt 0.246407 0.786027
vt 0.588715 0.883038
vt 0.583869 0.868953
vt 0.588715 0.868953
vt 0.409407 0.883467
vt 0.405101 0.897552
vt 0.405101 0.883467
vt 0.619270 0.531191
vt 0.633355 0.686593
vt 0.619270 0.686593
vt 0.232322 0.782563
vt 0.246407 0.782563
vt 0.462381 0.782563
vt 0.448296 0.854357
vt 0.448296 0.782563
vt 0.881817 0.837845
vt 0.867732 0.701259
vt 0.881817 0.701259
vt 0.881817 0.866955
vt 0.867732 0.904232
vt 0.867732 0.866955
vt 0.588715 0.796648
vt 0.583869 0.782563
vt 0.588715 0.782563
vt 0.619270 0.715702
vt 0.633355 0.871104
vt 0.619270 0.871104
vt 0.867732 0.697796
vt 0.881817 0.697796
vt 0.318711 0.782563
vt 0.332797 0.876581
vt 0.318711 0.876581
vt 0.505575 0.782563
vt 0.491490 0.854357
vt 0.491490 0.782563
vt 0.548770 0.876182
vt 0.534685 0.913458
vt 0.534685 0.876182
vt 0.121019 0.851102
vt 0.106934 0.811505
vt 0.121019 0.811505
vt 0.867732 0.513285
vt 0.881817 0.668686
vt 0.867732 0.668686
vt 0.361906 0.782563
vt 0.375991 0.876581
vt 0.361906 0.876581
vt 0.106934 0.880211
vt 0.111240 0.894296
vt 0.106934 0.894296
vt 0.077824 0.917488
vt 0.063739 0.880211
vt 0.077824 0.880211
vt 0.028640 0.858942
vt 0.014555 0.819345
vt 0.028640 0.819345
vt 0.203212 0.922613
vt 0.189127 0.786027
vt 0.275517 0.782563
vt 0.289602 0.876581
vt 0.275517 0.876581
vt 0.231604 0.642143
vt 0.303398 0.713761
vt 0.299165 0.753454
vt 0.374985 0.642143
vt 0.446779 0.713761
vt 0.442546 0.753454
vt 0.518366 0.642143
vt 0.590160 0.713761
vt 0.585927 0.753454
vt 0.583870 0.839843
vt 0.452602 0.897552
vt 0.063739 0.851102
vt 0.419186 0.854358
vt 0.232322 0.922613
vt 0.583869 0.883038
vt 0.409407 0.897552
vt 0.633355 0.531191
vt 0.462381 0.854357
vt 0.867732 0.837845
vt 0.881817 0.904232
vt 0.583869 0.796649
vt 0.633355 0.715702
vt 0.332797 0.782563
vt 0.505575 0.854357
vt 0.548770 0.913458
vt 0.106934 0.851102
vt 0.881817 0.513285
vt 0.375991 0.782563
vt 0.111240 0.880211
vt 0.063739 0.917488
vt 0.014555 0.858942
vt 0.189127 0.922613
vt 0.289602 0.782563
vt 0.303399 0.751038
vt 0.189127 0.643721
vt 0.189127 0.640093
vt 0.298829 0.531191
vt 0.303135 0.531191
vt 0.303135 0.570788
vt 0.446779 0.751038
vt 0.332508 0.643721
vt 0.332508 0.640093
vt 0.442210 0.531191
vt 0.446516 0.531191
vt 0.446516 0.570788
vt 0.590160 0.751038
vt 0.475889 0.643721
vt 0.475889 0.640093
vt 0.585591 0.531191
vt 0.589897 0.531191
vt 0.589897 0.570788
s 0
f 3/1/1 28/2/1 30/3/1
f 16/4/2 44/5/2 17/6/2
f 9/7/3 29/8/3 2/9/3
f 24/10/4 52/11/4 25/12/4
f 5/13/5 31/14/5 32/15/5
f 17/16/6 45/17/6 18/18/6
f 12/19/1 37/20/1 39/21/1
f 25/22/2 53/23/2 26/24/2
f 2/25/7 28/26/7 1/27/7
f 18/18/3 38/28/3 11/29/3
f 14/30/5 40/31/5 41/32/5
f 26/33/8 54/34/8 27/35/8
f 4/36/4 30/37/4 31/38/4
f 21/39/1 46/40/1 48/41/1
f 11/42/7 37/43/7 10/44/7
f 27/35/3 47/45/3 20/46/3
f 5/47/9 33/48/9 6/49/9
f 23/50/10 49/51/10 50/52/10
f 13/53/4 39/54/4 40/55/4
f 6/56/4 34/57/4 7/58/4
f 20/59/11 46/60/11 19/61/11
f 14/62/9 42/63/9 15/64/9
f 8/65/2 34/66/2 35/67/2
f 21/68/4 49/69/4 22/70/4
f 15/71/4 43/72/4 16/73/4
f 8/74/6 36/75/6 9/7/6
f 23/76/12 51/77/12 24/78/12
f 32/79/13 31/80/13 28/81/13
f 41/82/13 40/83/13 37/84/13
f 50/85/13 49/86/13 46/87/13
f 3/1/1 1/88/1 28/2/1
f 16/4/2 43/89/2 44/5/2
f 9/7/3 36/75/3 29/8/3
f 24/10/4 51/90/4 52/11/4
f 5/13/5 4/91/5 31/14/5
f 17/16/6 44/92/6 45/17/6
f 12/19/1 10/93/1 37/20/1
f 25/22/2 52/94/2 53/23/2
f 2/25/7 29/95/7 28/26/7
f 18/18/3 45/17/3 38/28/3
f 14/30/5 13/96/5 40/31/5
f 26/33/8 53/97/8 54/34/8
f 4/36/4 3/98/4 30/37/4
f 21/39/1 19/99/1 46/40/1
f 11/42/7 38/100/7 37/43/7
f 27/35/3 54/34/3 47/45/3
f 5/47/9 32/101/9 33/48/9
f 23/50/10 22/102/10 49/51/10
f 13/53/4 12/103/4 39/54/4
f 6/56/4 33/104/4 34/57/4
f 20/59/11 47/105/11 46/60/11
f 14/62/9 41/106/9 42/63/9
f 8/65/2 7/107/2 34/66/2
f 21/68/4 48/108/4 49/69/4
f 15/71/4 42/109/4 43/72/4
f 8/74/6 35/110/6 36/75/6
f 23/76/12 50/111/12 51/77/12
f 31/80/13 30/112/13 28/81/13
f 28/81/13 29/113/13 32/79/13
f 29/113/13 36/114/13 32/79/13
f 36/114/13 35/115/13 32/79/13
f 35/115/13 34/116/13 33/117/13
f 32/79/13 35/115/13 33/117/13
f 40/83/13 39/118/13 37/84/13
f 37/84/13 38/119/13 41/82/13
f 38/119/13 45/120/13 41/82/13
f 45/120/13 44/121/13 41/82/13
f 44/121/13 43/122/13 42/123/13
f 41/82/13 44/121/13 42/123/13
f 49/86/13 48/124/13 46/87/13
f 46/87/13 47/125/13 50/85/13
f 47/125/13 54/126/13 50/85/13
f 54/126/13 53/127/13 50/85/13
f 53/127/13 52/128/13 51/129/13
f 50/85/13 53/127/13 51/129/13

View File

@@ -0,0 +1,86 @@
package pp.mdga.server;
import pp.mdga.message.client.*;
import pp.mdga.message.server.ServerStartGame;
import pp.mdga.message.server.UpdateReady;
import pp.mdga.message.server.UpdateTSK;
import pp.mdga.server.automaton.GameState;
import pp.mdga.server.automaton.ServerState;
/**
* Represents the lobby state of the server.
*/
public class Lobby extends ServerState {
/**
* Constructs a new Lobby state.
*
* @param parent the parent state
* @param logic the server game logic
*/
public Lobby(ServerState parent, ServerGameLogic logic) {
super(parent, logic);
}
/**
* Handles the DeselectTSK message.
*
* @param msg the DeselectTSK message
*/
// @Override
public void receivedDeselectTSK(DeselectTSK msg, int from) {
// broadcastUpdate(new UpdateTSK());
}
/**
* Handles the LobbyNotReady message.
*
* @param msg the LobbyNotReady message
*/
// @Override
public void receivedNotReady(LobbyNotReady msg, int from) {
// broadcastUpdate(new UpdateReady());
}
/**
* Handles the LobbyReady message.
*
* @param msg the LobbyReady message
*/
// @Override
public void receivedReady(LobbyReady msg, int from) {
// broadcastUpdate(new UpdateReady());
}
/**
* Handles the SelectTSK message.
*
* @param msg the SelectTSK message
*/
// @Override
public void receivedSelectTSK(SelectTSK msg, int from) {
// broadcastUpdate(new UpdateTSK());
}
/**
* Handles the ClientStartGame message.
*
* @param msg the ClientStartGame message
*/
// @Override
public void receivedStartGame(ClientStartGame msg, int from) {
if (Boolean.TRUE.equals(logic.getGame().allRanked())) {
// broadcastUpdate(new ServerStartGame());
// parent.gotoState(new GameState(parent, logic));
}
}
@Override
public void enter() {
}
@Override
public void exit() {
}
}

View File

@@ -1,9 +1,9 @@
package pp.mdga.client;
public class Ceremony extends ClientState {
public class CeremonyState extends ClientState {
public Ceremony(ClientState parent, ClientGameLogic logic) {
public CeremonyState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -1,12 +1,14 @@
package pp.mdga.client;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
import pp.mdga.game.Game;
import pp.mdga.game.Piece;
import pp.mdga.game.PlayerData;
import pp.mdga.message.client.ClientMessage;
import pp.mdga.message.server.*;
import pp.mdga.notification.*;
import java.util.ArrayList;
import java.util.Map;
import java.util.UUID;
@@ -16,18 +18,17 @@ public class ClientGameLogic implements ServerInterpreter {
private Game game;
private final ClientSender clientSender;
private ClientState state;
private Map<UUID, Piece> pieces;
private Map<UUID, BonusCard> cards;
private final ArrayList<Notification> notifications = new ArrayList<>();
private Dialogs dialogs = new Dialogs(null, this);
private GameState gameState = new GameState(null, this);
private Ceremony ceremony = new Ceremony(null, this);
private Interrupt interrupt = new Interrupt(null, this);
private final DialogsState dialogsState = new DialogsState(null, this);
private final GameState gameState = new GameState(null, this);
private final CeremonyState ceremonyState = new CeremonyState(null, this);
private final InterruptState interruptState = new InterruptState(null, this);
public ClientGameLogic(Game game, ClientSender clientSender) {
this.game = game;
this.clientSender = clientSender;
state = dialogs;
state = dialogsState;
}
public void send(ClientMessage msg){
@@ -35,6 +36,17 @@ public void send(ClientMessage msg){
clientSender.send(msg);
}
private Piece getPiece(UUID pieceId){
for(Map.Entry<Color, PlayerData> entry : game.getBoard().getPlayerData().entrySet()){
for(Piece piece : entry.getValue().getPieces()){
if(piece.getUuid().equals(pieceId)){
return piece;
}
}
}
return null;
}
public ClientSender getClientSender(){
return clientSender;
}
@@ -48,17 +60,17 @@ public ClientState getState(){
}
@Override
public void received(ActivePlayer msg) {
public void received(ActivePlayerMessage msg) {
state.received(msg);
}
@Override
public void received(AnyPiece msg) {
public void received(AnyPieceMessage msg) {
state.received(msg);
}
@Override
public void received(Briefing msg) {
public void received(BriefingMessage msg) {
state.received(msg);
}
@@ -68,42 +80,42 @@ public void received(CeremonyMessage msg) {
}
@Override
public void received(Die msg) {
public void received(DieMessage msg) {
state.received(msg);
}
@Override
public void received(DiceAgain msg) {
public void received(DiceAgainMessage msg) {
state.received(msg);
}
@Override
public void received(DiceNow msg) {
public void received(DiceNowMessage msg) {
state.received(msg);
}
@Override
public void received(EndOfTurn msg) {
public void received(EndOfTurnMessage msg) {
state.received(msg);
}
@Override
public void received(LobbyAccept msg) {
public void received(LobbyAcceptMessage msg) {
state.received(msg);
}
@Override
public void received(LobbyDeny msg) {
public void received(LobbyDenyMessage msg) {
state.received(msg);
}
@Override
public void received(LobbyPlayerJoin msg) {
public void received(LobbyPlayerJoinMessage msg) {
state.received(msg);
}
@Override
public void received(LobbyPlayerLeave msg) {
public void received(LobbyPlayerLeaveMessage msg) {
state.received(msg);
}
@@ -113,86 +125,92 @@ public void received(MoveMessage msg) {
}
@Override
public void received(NoTurn msg) {
public void received(NoTurnMessage msg) {
state.received(msg);
}
@Override
public void received(PauseGame msg) {
public void received(PauseGameMessage msg) {
state.received(msg);
}
@Override
public void received(PlayCard msg) {
public void received(PlayCardMessage msg) {
state.received(msg);
}
@Override
public void received(PossibleCard msg) {
public void received(PossibleCardMessage msg) {
state.received(msg);
}
@Override
public void received(PossiblePiece msg) {
public void received(PossiblePieceMessage msg) {
state.received(msg);
}
@Override
public void received(RankingResponse msg) {
public void received(RankingResponseMessage msg) {
state.received(msg);
}
@Override
public void received(RankingRollAgain msg) {
public void received(RankingRollAgainMessage msg) {
state.received(msg);
}
@Override
public void received(ReconnectBriefing msg) {
public void received(ReconnectBriefingMessage msg) {
state.received(msg);
}
@Override
public void received(ResumeGame msg) {
public void received(ResumeGameMessage msg) {
state.received(msg);
}
@Override
public void received(ServerStartGame msg) {
public void received(ServerStartGameMessage msg) {
state.received(msg);
}
@Override
public void received(StartPiece msg) {
public void received(StartPieceMessage msg) {
state.received(msg);
}
@Override
public void received(UpdateReady msg) {
public void received(UpdateReadyMessage msg) {
state.received(msg);
}
@Override
public void received(UpdateTSK msg) {
public void received(UpdateTSKMessage msg) {
state.received(msg);
}
@Override
public void received(WaitPiece msg) {
public void received(WaitPieceMessage msg) {
state.received(msg);
}
@Override
public void received(Spectator msg) {
public void received(SpectatorMessage msg) {
state.received(msg);
}
@Override
public void received(SelectPieceMessage msg) {
}
public void selectPiece(UUID pieceId){
state.selectPiece(pieceId);
state.selectPiece(getPiece(pieceId));
}
//TODO: implement
public void selectCard(UUID cardId){
state.selectCard(cardId);
state.selectCard(null);
}
public void selectTsk(Color color){
@@ -211,16 +229,20 @@ public void selectReady(boolean ready){
state.selectReady();
}
public void selectHost(){
state.selectHost();
public void selectHost(String name){
state.selectHost(name);
}
public void selectLeave(){
state.selectLeave();
}
public void selectJoin(){
state.selectJoin();
public void selectJoin(String name){
state.selectJoin(name);
}
public void selectAnimationEnd(){
state.selectAnimationEnd();
}
public void selectStart(){
@@ -229,6 +251,7 @@ public void selectStart(){
public void setState(ClientState state){
this.state.exit();
state.enter();
this.state = state;
}
@@ -236,15 +259,20 @@ public GameState getGameState(){
return gameState;
}
public Ceremony getCeremony(){
return ceremony;
public CeremonyState getCeremony(){
return ceremonyState;
}
public Interrupt getInterrupt(){
return interrupt;
public InterruptState getInterrupt(){
return interruptState;
}
public Dialogs getDialogs(){
return dialogs;
public DialogsState getDialogs(){
return dialogsState;
}
public Notification getNotification(){
return notifications.remove(0);
}
}

View File

@@ -1,10 +1,11 @@
package pp.mdga.client;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
import pp.mdga.game.Piece;
import pp.mdga.message.server.*;
import java.lang.System.Logger.Level;
import java.util.UUID;
public abstract class ClientState implements Observer, ServerInterpreter {
protected static final System.Logger LOGGER = System.getLogger(ClientState.class.getName());
@@ -34,17 +35,17 @@ public String toString(){
}
@Override
public void received(ActivePlayer msg) {
public void received(ActivePlayerMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(AnyPiece msg) {
public void received(AnyPieceMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(Briefing msg) {
public void received(BriefingMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@@ -54,42 +55,42 @@ public void received(CeremonyMessage msg) {
}
@Override
public void received(Die msg) {
public void received(DieMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(DiceAgain msg) {
public void received(DiceAgainMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(DiceNow msg) {
public void received(DiceNowMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(EndOfTurn msg) {
public void received(EndOfTurnMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(LobbyAccept msg) {
public void received(LobbyAcceptMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(LobbyDeny msg) {
public void received(LobbyDenyMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(LobbyPlayerJoin msg) {
public void received(LobbyPlayerJoinMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(LobbyPlayerLeave msg) {
public void received(LobbyPlayerLeaveMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@@ -99,85 +100,90 @@ public void received(MoveMessage msg) {
}
@Override
public void received(NoTurn msg) {
public void received(NoTurnMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(PauseGame msg) {
public void received(PauseGameMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(PlayCard msg) {
public void received(PlayCardMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(PossibleCard msg) {
public void received(PossibleCardMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(PossiblePiece msg) {
public void received(PossiblePieceMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(RankingResponse msg) {
public void received(RankingResponseMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(RankingRollAgain msg) {
public void received(RankingRollAgainMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(ReconnectBriefing msg) {
public void received(ReconnectBriefingMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(ResumeGame msg) {
public void received(ResumeGameMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(ServerStartGame msg) {
public void received(ServerStartGameMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(StartPiece msg) {
public void received(StartPieceMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(UpdateReady msg) {
public void received(UpdateReadyMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(UpdateTSK msg) {
public void received(UpdateTSKMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(Spectator msg) {
public void received(SpectatorMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
@Override
public void received(WaitPiece msg) {
public void received(SelectPieceMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
public void selectPiece(UUID id) {
@Override
public void received(WaitPieceMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg);
}
public void selectPiece(Piece piece) {
LOGGER.log(Level.DEBUG, "Selecting piece not allowed.");
}
public void selectCard(UUID id) {
public void selectCard(BonusCard card) {
LOGGER.log(Level.DEBUG, "Selecting card not allowed.");
}
@@ -197,11 +203,11 @@ public void selectReady() {
LOGGER.log(Level.DEBUG, "Selecting ready not allowed.");
}
public void selectHost() {
public void selectHost(String name) {
LOGGER.log(Level.DEBUG, "Selecting host not allowed.");
}
public void selectJoin() {
public void selectJoin(String name) {
LOGGER.log(Level.DEBUG, "Selecting join not allowed.");
}
@@ -220,4 +226,8 @@ public void selectUnready(){
public void selectStart(){
LOGGER.log(Level.DEBUG, "Starting not allowed");
}
public void selectAnimationEnd(){
LOGGER.log(Level.DEBUG, "Animation end not allowed");
}
}

View File

@@ -1,53 +0,0 @@
package pp.mdga.client;
import pp.mdga.client.dialogState.DialogStates;
import pp.mdga.client.dialogState.Lobby;
import pp.mdga.client.dialogState.NetworkDialog;
import pp.mdga.client.dialogState.StartDialog;
public class Dialogs extends ClientState {
private DialogStates currentState;
private final Lobby lobby = new Lobby(this, logic);
private final NetworkDialog networkDialog = new NetworkDialog(this, logic);
private final StartDialog startDialog = new StartDialog(this, logic);
public Dialogs(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
@Override
public void exit(){
currentState.exit();
}
@Override
public void enter(){
currentState = startDialog;
}
public void setState(DialogStates newState){
currentState.exit();
currentState = newState;
currentState.enter();
}
public Lobby getLobby() {
return lobby;
}
public NetworkDialog getNetworkDialog() {
return networkDialog;
}
public StartDialog getStartDialog() {
return startDialog;
}
public void startGame(){
exit();
logic.setState(logic.getGameState());
}
}

View File

@@ -0,0 +1,72 @@
package pp.mdga.client;
import pp.mdga.client.dialogState.DialogStates;
import pp.mdga.client.dialogState.LobbyState;
import pp.mdga.client.dialogState.NetworkDialogState;
import pp.mdga.client.dialogState.StartDialogState;
import pp.mdga.game.Player;
import pp.mdga.message.server.LobbyPlayerJoinMessage;
import pp.mdga.message.server.LobbyPlayerLeaveMessage;
public class DialogsState extends ClientState {
private DialogStates currentState;
private Player ownPlayer;
private final LobbyState lobbyState = new LobbyState(this, logic);
private final NetworkDialogState networkDialogState = new NetworkDialogState(this, logic);
private final StartDialogState startDialogState = new StartDialogState(this, logic);
public DialogsState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
@Override
public void exit(){
currentState.exit();
}
@Override
public void enter(){
currentState = startDialogState;
}
public void setState(DialogStates newState){
currentState.exit();
currentState.enter();
currentState = newState;
}
public Player getOwnPlayer() {
return ownPlayer;
}
public LobbyState getLobby() {
return lobbyState;
}
public NetworkDialogState getNetworkDialog() {
return networkDialogState;
}
public StartDialogState getStartDialog() {
return startDialogState;
}
public void startGame(){
exit();
logic.setState(logic.getGameState());
}
@Override
public void received(LobbyPlayerJoinMessage msg){
currentState.received(msg);
}
@Override
public void received(LobbyPlayerLeaveMessage msg){
currentState.received(msg);
}
}

View File

@@ -6,15 +6,15 @@ public class GameState extends ClientState {
private GameStates state;
private Animation animation = new Animation(this, logic);
private DetermineStartPlayer determineStartPlayer = new DetermineStartPlayer(this, logic);
private Spectator spectator = new Spectator(this, logic);
private Turn turn = new Turn(this, logic);
private Waiting waiting = new Waiting(this, logic);
private final AnimationState animationState = new AnimationState(this, logic);
private final DetermineStartPlayerState determineStartPlayerState = new DetermineStartPlayerState(this, logic);
private final SpectatorState spectatorState = new SpectatorState(this, logic);
private final TurnState turnState = new TurnState(this, logic);
private final WaitingState waitingState = new WaitingState(this, logic);
public GameState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
state = determineStartPlayer;
state = determineStartPlayerState;
}
@Override
@@ -26,4 +26,35 @@ public void enter() {
public void exit() {
}
public void setState(GameStates newState){
state.exit();
state.enter();
state = newState;
}
@Override
public void selectAnimationEnd(){
state.selectAnimationEnd();
}
public AnimationState getAnimation() {
return animationState;
}
public DetermineStartPlayerState getDetermineStartPlayer() {
return determineStartPlayerState;
}
public SpectatorState getSpectator() {
return spectatorState;
}
public TurnState getTurn() {
return turnState;
}
public WaitingState getWaiting() {
return waitingState;
}
}

View File

@@ -1,8 +1,8 @@
package pp.mdga.client;
public class Settings extends ClientState {
public class InterruptState extends ClientState {
public Settings(ClientState parent, ClientGameLogic logic) {
public InterruptState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -1,8 +1,8 @@
package pp.mdga.client;
public class Interrupt extends ClientState {
public class SettingsState extends ClientState {
public Interrupt(ClientState parent, ClientGameLogic logic) {
public SettingsState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -3,8 +3,8 @@
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Podium extends CeremonyStates {
public Podium(ClientState parent, ClientGameLogic logic) {
public class PodiumState extends CeremonyStates {
public PodiumState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -3,8 +3,8 @@
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Statistics extends CeremonyStates {
public Statistics(ClientState parent, ClientGameLogic logic) {
public class StatisticsState extends CeremonyStates {
public StatisticsState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}

View File

@@ -1,63 +0,0 @@
package pp.mdga.client.dialogState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.Dialogs;
import pp.mdga.game.Color;
import pp.mdga.message.client.*;
import pp.mdga.message.server.ServerStartGame;
public class Lobby extends DialogStates {
private final Dialogs parent;
public Lobby(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.parent = (Dialogs) parent;
}
@Override
public void enter() {
}
@Override
public void exit() {
}
@Override
public void selectLeave() {
parent.setState(parent.getStartDialog());
}
@Override
public void selectTSK(Color color) {
logic.send(new SelectTSK(color));
}
@Override
public void deselectTSK(Color color) {
logic.send(new DeselectTSK(color));
}
@Override
public void selectReady() {
logic.send(new LobbyReady());
}
@Override
public void selectUnready(){
logic.send(new LobbyNotReady());
}
@Override
public void selectStart(){
logic.send(new StartGame());
}
@Override
public void received(ServerStartGame msg){
parent.startGame();
}
}

View File

@@ -0,0 +1,76 @@
package pp.mdga.client.dialogState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.DialogsState;
import pp.mdga.game.Color;
import pp.mdga.game.Player;
import pp.mdga.message.client.*;
import pp.mdga.message.server.LobbyPlayerJoinMessage;
import pp.mdga.message.server.LobbyPlayerLeaveMessage;
import pp.mdga.message.server.ServerStartGameMessage;
public class LobbyState extends DialogStates {
private final DialogsState parent;
public LobbyState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.parent = (DialogsState) parent;
}
@Override
public void enter() {
}
@Override
public void exit() {
}
@Override
public void selectLeave() {
parent.setState(parent.getStartDialog());
}
@Override
public void selectTSK(Color color) {
logic.send(new SelectTSKMessage(color));
}
@Override
public void deselectTSK(Color color) {
logic.send(new DeselectTSKMessage(color));
}
@Override
public void selectReady() {
logic.send(new LobbyReadyMessage());
}
@Override
public void selectUnready(){
logic.send(new LobbyNotReadyMessage());
}
@Override
public void selectStart(){
logic.send(new StartGameMessage());
}
@Override
public void received(ServerStartGameMessage msg){
parent.startGame();
}
@Override
public void received(LobbyPlayerJoinMessage msg){
logic.getGame().getPlayers().put(msg.getId(), new Player(msg.getName()));
}
@Override
public void received(LobbyPlayerLeaveMessage msg){
logic.getGame().getPlayers().remove(msg.getId());
}
}

View File

@@ -2,15 +2,15 @@
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.Dialogs;
import pp.mdga.client.DialogsState;
public class NetworkDialog extends DialogStates {
public class NetworkDialogState extends DialogStates {
private final Dialogs parent;
private final DialogsState parent;
public NetworkDialog(ClientState parent, ClientGameLogic logic) {
public NetworkDialogState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.parent = (Dialogs) parent;
this.parent = (DialogsState) parent;
}
private boolean checkIP(String IP){
@@ -49,7 +49,8 @@ public void enter() {
public void exit() {
}
public void selectBack() {
@Override
public void selectLeave() {
parent.setState(parent.getStartDialog());
}

View File

@@ -1,37 +0,0 @@
package pp.mdga.client.dialogState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.Dialogs;
public class StartDialog extends DialogStates {
private final Dialogs parent;
public StartDialog(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.parent = (Dialogs) parent;
}
@Override
public void enter() {
}
@Override
public void exit() {
}
public void selectJoin() {
parent.setState(parent.getNetworkDialog());
}
public void selectHost() {
parent.setState(parent.getLobby());
}
public void selectLeave() {
parent.exit();
}
}

View File

@@ -0,0 +1,39 @@
package pp.mdga.client.dialogState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.DialogsState;
public class StartDialogState extends DialogStates {
private final DialogsState parent;
public StartDialogState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.parent = (DialogsState) parent;
}
@Override
public void enter() {
}
@Override
public void exit() {
}
public void selectJoin(String name) {
parent.getOwnPlayer().setName(name);
parent.setState(parent.getNetworkDialog());
}
public void selectHost(String name) {
parent.getOwnPlayer().setName(name);
parent.setState(parent.getLobby());
}
public void selectLeave() {
parent.exit();
}
}

View File

@@ -1,20 +0,0 @@
package pp.mdga.client.gameState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Animation extends GameStates {
public Animation(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
@Override
public void enter() {
}
@Override
public void exit() {
}
}

View File

@@ -0,0 +1,32 @@
package pp.mdga.client.gameState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.GameState;
import pp.mdga.message.client.AnimationEndMessage;
public class AnimationState extends GameStates {
private final GameState parent;
public AnimationState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.parent = (GameState) parent;
}
@Override
public void enter() {
}
@Override
public void exit() {
}
@Override
public void selectAnimationEnd(){
logic.send(new AnimationEndMessage());
parent.setState(parent.getWaiting());
}
}

View File

@@ -1,21 +0,0 @@
package pp.mdga.client.gameState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class DetermineStartPlayer extends GameStates {
public DetermineStartPlayer(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
@Override
public void enter() {
}
@Override
public void exit() {
}
}

View File

@@ -0,0 +1,46 @@
package pp.mdga.client.gameState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.GameState;
import pp.mdga.client.gameState.determineStartPlayerState.DetermineStartPlayerStates;
import pp.mdga.client.gameState.determineStartPlayerState.RollRankingDiceState;
import pp.mdga.client.gameState.determineStartPlayerState.WaitRankingState;
public class DetermineStartPlayerState extends GameStates {
private final GameState parent;
private DetermineStartPlayerStates state;
private final RollRankingDiceState rollRankingDiceState = new RollRankingDiceState(this, logic);
private final WaitRankingState waitRankingState = new WaitRankingState(this, logic);
public DetermineStartPlayerState(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
this.parent = (GameState) parent;
}
@Override
public void enter() {
state = rollRankingDiceState;
}
@Override
public void exit() {
state = null;
}
public void setState(DetermineStartPlayerStates state) {
this.state.exit();
state.enter();
this.state = state;
}
public RollRankingDiceState getRollRankingDice() {
return rollRankingDiceState;
}
public WaitRankingState getWaitRanking() {
return waitRankingState;
}
}

View File

@@ -1,20 +0,0 @@
package pp.mdga.client.gameState;
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
public class Spectator extends GameStates {
public Spectator(ClientState parent, ClientGameLogic logic) {
super(parent, logic);
}
@Override
public void enter() {
}
@Override
public void exit() {
}
}

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