removed unused imports and reformatted the code for code style

This commit is contained in:
Daniel Grigencha
2024-12-11 05:34:34 +01:00
parent d8816be811
commit aa44b84648
155 changed files with 1662 additions and 3882 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,21 +0,0 @@
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000070ba272e8104, pid=54211, tid=54346
#
# 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:
# V [libjvm.so+0xee8104] SystemDictionary::find_or_define_helper(Symbol*, Handle, InstanceKlass*, JavaThread*)+0x304
#
# 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.54211)
#
# If you would like to submit a bug report, please visit:
# https://github.com/adoptium/adoptium-support/issues
#
--------------- 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 -Dkotlinx.coroutines.debug.enable.flows.stack.trace=true -Dkotlinx.coroutines.debug.enable.mutable.state.flows.stack.trace=true -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=127.0.0.1:40559 -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,

View File

@@ -1,171 +0,0 @@
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fc14e0eef41, pid=60653, tid=60689
#
# JRE version: OpenJDK Runtime Environment (21.0.5+11) (build 21.0.5+11)
# Java VM: OpenJDK 64-Bit Server VM (21.0.5+11, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C [libgallium-24.2.8-arch1.1.so+0x8eef41]
#
# 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.60653)
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
# 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 -Dkotlinx.coroutines.debug.enable.flows.stack.trace=true -Dkotlinx.coroutines.debug.enable.mutable.state.flows.stack.trace=true -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=127.0.0.1:39131 -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: Sun Dec 8 18:11:23 2024 CET elapsed time: 295.650309 seconds (0d 0h 4m 55s)
--------------- T H R E A D ---------------
Current thread (0x00007fc17ca803b0): JavaThread "jME3 Main" [_thread_in_native, id=60689, stack(0x00007fc159425000,0x00007fc159525000) (1024K)]
Stack: [0x00007fc159425000,0x00007fc159525000], sp=0x00007fc159522300, free space=1012k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libgallium-24.2.8-arch1.1.so+0x8eef41]
C [libgallium-24.2.8-arch1.1.so+0xf4a849]
C [libgallium-24.2.8-arch1.1.so+0x6ccb71]
C [libgallium-24.2.8-arch1.1.so+0x6c58ae]
C [libgallium-24.2.8-arch1.1.so+0x6c6013]
C [libgallium-24.2.8-arch1.1.so+0x6cddf8]
C [libgallium-24.2.8-arch1.1.so+0x141327]
C [libgallium-24.2.8-arch1.1.so+0x5fc8b]
C [libGLX_mesa.so.0+0x4f2e0]
C [libGLX_mesa.so.0+0x40496]
C [libGLX_mesa.so.0+0x2efa5]
J 2042 org.lwjgl.system.JNI.invokePV(JJ)V (0 bytes) @ 0x00007fc16c1abb6f [0x00007fc16c1abaa0+0x00000000000000cf]
J 4039 c1 org.lwjgl.glfw.GLFW.glfwSwapBuffers(J)V (21 bytes) @ 0x00007fc164d8684c [0x00007fc164d86760+0x00000000000000ec]
J 3912 c1 com.jme3.system.lwjgl.LwjglWindow.runLoop()V (177 bytes) @ 0x00007fc164d44b34 [0x00007fc164d442c0+0x0000000000000874]
j com.jme3.system.lwjgl.LwjglWindow.run()V+54
j java.lang.Thread.runWith(Ljava/lang/Object;Ljava/lang/Runnable;)V+5 java.base@21.0.5
j java.lang.Thread.run()V+19 java.base@21.0.5
v ~StubRoutines::call_stub 0x00007fc16bb37cc6
V [libjvm.so+0x6d0894]
V [libjvm.so+0x6d14fd]
V [libjvm.so+0x79a7be]
V [libjvm.so+0x6cac55]
V [libjvm.so+0x9d62c1]
C [libc.so.6+0x9439d]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 2042 org.lwjgl.system.JNI.invokePV(JJ)V (0 bytes) @ 0x00007fc16c1abafc [0x00007fc16c1abaa0+0x000000000000005c]
J 4039 c1 org.lwjgl.glfw.GLFW.glfwSwapBuffers(J)V (21 bytes) @ 0x00007fc164d8684c [0x00007fc164d86760+0x00000000000000ec]
J 3912 c1 com.jme3.system.lwjgl.LwjglWindow.runLoop()V (177 bytes) @ 0x00007fc164d44b34 [0x00007fc164d442c0+0x0000000000000874]
j com.jme3.system.lwjgl.LwjglWindow.run()V+54
j java.lang.Thread.runWith(Ljava/lang/Object;Ljava/lang/Runnable;)V+5 java.base@21.0.5
j java.lang.Thread.run()V+19 java.base@21.0.5
v ~StubRoutines::call_stub 0x00007fc16bb37cc6
siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x00000000000000c9
Registers:
RAX=0x0000000000000000, RBX=0x00007fc09825b2a0, RCX=0x0000000000000006, RDX=0x0000000028200000
RSP=0x00007fc159522300, RBP=0x00007fc159522310, RSI=0x00007fc0998d3604, RDI=0x00007fc09825b7a0
R8 =0x0000000000000006, R9 =0x00000000aa959a6a, R10=0x0000000000000263, R11=0x00007fc099bc36c0
R12=0x00007fc0998d35e0, R13=0x000000058bc5f100, R14=0x000000058bc5f140, R15=0x0000000000000040
RIP=0x00007fc14e0eef41, EFLAGS=0x0000000000010202, CSGSFS=0x002b000000000033, ERR=0x0000000000000004
TRAPNO=0x000000000000000e
Register to memory mapping:
RAX=0x0 is null
RBX=0x00007fc09825b2a0 points into unknown readable memory: 0x00007fc098239c40 | 40 9c 23 98 c0 7f 00 00
RCX=0x0000000000000006 is an unknown value
RDX=0x0000000028200000 is an unknown value
RSP=0x00007fc159522300 is pointing into the stack for thread: 0x00007fc17ca803b0
RBP=0x00007fc159522310 is pointing into the stack for thread: 0x00007fc17ca803b0
RSI=0x00007fc0998d3604 points into unknown readable memory: 00 00 00 00
RDI=0x00007fc09825b7a0 points into unknown readable memory: 0x00001c7c00000265 | 65 02 00 00 7c 1c 00 00
R8 =0x0000000000000006 is an unknown value
R9 =0x00000000aa959a6a is an unknown value
R10=0x0000000000000263 is an unknown value
R11=0x00007fc099bc36c0 points into unknown readable memory: 0x00007fc14e121570 | 70 15 12 4e c1 7f 00 00
R12=0x00007fc0998d35e0 points into unknown readable memory: 0x0000000000000000 | 00 00 00 00 00 00 00 00
R13=0x000000058bc5f100 is an unknown value
R14=0x000000058bc5f140 is an unknown value
R15=0x0000000000000040 is an unknown value
Top of Stack: (sp=0x00007fc159522300)
0x00007fc159522300: 00007fc09825b2a0 ffffffffffffffff
0x00007fc159522310: 00007fc1595223d0 00007fc14e74a849
0x00007fc159522320: 0000000000000000 00000000cc0016c8
0x00007fc159522330: 00007fc09920b000 00007fc100000004
0x00007fc159522340: 00007fc100000001 00007fc100000000
0x00007fc159522350: ffff800100000002 00007fc09825b7a0
0x00007fc159522360: 00007fc1595223e0 0000000100000b02
0x00007fc159522370: 0000000000000000 00007fc0983eca88
0x00007fc159522380: 00007fc100000000 00007fc099e33780
0x00007fc159522390: 00007fc159523170 b36c5690f9bb0900
0x00007fc1595223a0: 00007fc15951fd20 00007fc0983eca80
0x00007fc1595223b0: 00007fc09825b2a0 00007fc0983edb60
0x00007fc1595223c0: 00007fc098415b10 00007fc0983ec850
0x00007fc1595223d0: 00007fc159523280 00007fc14deccb71
0x00007fc1595223e0: 00000bdc00000000 00007fc100000000
0x00007fc1595223f0: 00007fc159523290 00007fc159523294
0x00007fc159522400: 00007fc159523320 00007fc159523324
0x00007fc159522410: 00007fc1595231b0 00007fc1595231b4
0x00007fc159522420: 00007fc159522860 00007fc164c8401c
0x00007fc159522430: 00007fc159523310 00007fc159523314
0x00007fc159522440: 00007fc1595232a0 00007fc1595232a4
0x00007fc159522450: 00007fc159522860 00007fc159523334
0x00007fc159522460: 00007fc159523400 00007fc159523404
0x00007fc159522470: 00007fc1595232d0 00007fc1595232d4
0x00007fc159522480: 00007fc16bc61f10 00007fc0c80123d0
0x00007fc159522490: 00007fc1595231f0 00007fc1595231f4
0x00007fc1595224a0: 00007fc1595223e0 00000000e31c914f
0x00007fc1595224b0: 00007fc159523350 00007fc159523354
0x00007fc1595224c0: 00007fc1595232e0 00007fc1595232e4
0x00007fc1595224d0: 00007f0000000000 00000000e3193478
0x00007fc1595224e0: 00007fc159523440 00007fc159523444
0x00007fc1595224f0: 00007fc159523310 00007fc159523314
Instructions: (pc=0x00007fc14e0eef41)
0x00007fc14e0eee41: 0f 1e fa 55 48 83 c6 24 48 89 e5 41 55 41 54 53
0x00007fc14e0eee51: 48 89 fb 48 83 ec 08 8b 97 00 05 00 00 44 0f b7
0x00007fc14e0eee61: 6e f0 48 8b 87 08 05 00 00 49 89 d4 45 01 ec 48
0x00007fc14e0eee71: 8d 3c 90 42 8d 14 ad 00 00 00 00 ff 15 ee 7e c3
0x00007fc14e0eee81: 01 44 89 a3 00 05 00 00 48 83 c4 08 5b 41 5c 41
0x00007fc14e0eee91: 5d 5d c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 f3
0x00007fc14e0eeea1: 0f 1e fa 55 48 89 e5 41 57 41 56 41 55 41 54 41
0x00007fc14e0eeeb1: 89 f4 53 48 89 fb 48 83 ec 08 4e 8b b4 e7 88 09
0x00007fc14e0eeec1: 00 00 8b 97 00 05 00 00 48 8b 87 08 05 00 00 45
0x00007fc14e0eeed1: 0f b7 7e 14 49 89 d5 49 8d 76 24 48 8d 3c 90 45
0x00007fc14e0eeee1: 01 fd 42 8d 14 bd 00 00 00 00 ff 15 7f 7e c3 01
0x00007fc14e0eeef1: 44 89 ab 00 05 00 00 4e 89 b4 e3 d8 09 00 00 48
0x00007fc14e0eef01: 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 90 f3
0x00007fc14e0eef11: 0f 1e fa 55 89 f0 48 89 e5 41 54 53 4c 8b a4 c7
0x00007fc14e0eef21: 88 09 00 00 48 89 fb e8 73 ff ff ff 49 8b 84 24
0x00007fc14e0eef31: 80 01 00 00 ba 00 00 20 28 48 8d bb 00 05 00 00
0x00007fc14e0eef41: 0f b6 88 c9 00 00 00 48 8b b0 b0 00 00 00 48 8b
0x00007fc14e0eef51: 83 f0 04 00 00 ff 90 00 01 00 00 49 8b 04 24 48
0x00007fc14e0eef61: 85 c0 74 13 48 89 df be ff ff ff ff 5b 41 5c 5d
0x00007fc14e0eef71: ff e0 0f 1f 44 00 00 5b 41 5c 5d c3 0f 1f 00 f3
0x00007fc14e0eef81: 0f 1e fa 66 0f ef c0 31 c9 ba 01 00 00 00 0f 11
0x00007fc14e0eef91: 87 d8 09 00 00 0f 11 87 e8 09 00 00 0f 11 87 f8
0x00007fc14e0eefa1: 09 00 00 0f 11 87 08 0a 00 00 0f 11 87 18 0a 00
0x00007fc14e0eefb1: 00 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48
0x00007fc14e0eefc1: 83 bc cf 88 09 00 00 00 74 0d 48 89 d0 48 d3 e0
0x00007fc14e0eefd1: 48 09 87 80 09 00 00 48 83 c1 01 48 83 f9 0a 75
0x00007fc14e0eefe1: de c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3
0x00007fc14e0eeff1: 0f 1e fa 55 48 89 e5 41 56 41 89 d6 41 55 41 89
0x00007fc14e0ef001: f5 8d 34 b5 28 00 00 00 41 54 49 89 fc bf 01 00
0x00007fc14e0ef011: 00 00 53 ff 15 7e 89 c3 01 48 89 c3 48 85 c0 74
0x00007fc14e0ef021: 2a 66 44 89 68 1a 41 0f b6 ce 48 8d 78 08 41 0f
0x00007fc14e0ef031: b6 94 24 97 08 00 00 49 8d b4 24 90 02 00 00 c0
Stack slot to memory mapping:
stack at sp + 0 slots: 0x00007fc09825b2a0 points into unknown readable memory: 0x00007fc098239c40 | 40 9c 23 98 c0 7f 00 00
stack at sp + 1 slots: 0xffffffffffffffff is an unknown value
stack at sp + 2 slots: 0x00007fc1595223d0 is pointing into the stack for thread: 0x00007fc17ca803b0
stack at sp + 3 slots: 0x00007fc14e74a849: <offset 0x0000000000f4a849> in /usr/lib/libgallium-24.2.8-arch1.1.so at 0x00007fc14d800000
stack at sp + 4 slots: 0x0 is null
stack at sp + 5 slots:

View File

@@ -45,8 +45,7 @@ public enum Asset {
tankShootTop("Models/tank/tankShoot_top.j3o", "Models/tank/tank_diff.png"),
treesSmallBackground("Models/treeSmall/treesSmallBackground.j3o", "Models/treeSmall/treeSmall_diff.png", 1.2f),
treesBigBackground("Models/treeBig/treesBigBackground.j3o", "Models/treeBig/treeBig_diff.png", 1.2f),
shell
;
shell;
private final String modelPath;
private final String diffPath;
@@ -83,7 +82,8 @@ public enum Asset {
Asset(String modelPath) {
String folderFileName = "./" + ROOT + name() + "/" + name();
this.modelPath = modelPath;
this.diffPath = folderFileName + "_diff.png";;
this.diffPath = folderFileName + "_diff.png";
;
this.size = 1f;
}

View File

@@ -12,19 +12,13 @@
import com.jme3.renderer.Camera;
import com.jme3.scene.Node;
import com.jme3.scene.control.AbstractControl;
import com.jme3.scene.control.Control;
import pp.mdga.client.board.NodeControl;
import pp.mdga.client.board.OutlineControl;
import pp.mdga.client.board.PieceControl;
import pp.mdga.client.gui.CardControl;
import pp.mdga.client.gui.DiceControl;
import pp.mdga.client.view.GameView;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
import pp.mdga.game.Piece;
import pp.mdga.notification.FinishNotification;
import pp.mdga.notification.MovePieceNotification;
import pp.mdga.notification.SelectableCardsNotification;
import java.util.List;
import java.util.UUID;
@@ -94,6 +88,7 @@ private void setupInput() {
inputManager.addListener(actionListener, "Settings", "Forward", "RotateRightMouse", "Click", "Left", "Right", "Test");
inputManager.addListener(analogListener, "MouseLeft", "MouseRight", "MouseScrollUp", "MouseScrollDown");
}
UUID p = null;
/**
* Handles action-based input events such as key presses and mouse clicks.
@@ -122,12 +117,10 @@ public void onAction(String name, boolean isPressed, float tpf) {
if (diceSelect != null) {
app.getModelSynchronize().rolledDice();
}
else if(cardLayerSelect != null) {
} else if (cardLayerSelect != null) {
//cardSelect
if (cardLayerSelect.isSelectable()) gameView.getGuiHandler().selectCard(cardLayerSelect);
}
else if(boardSelect != null) {
} else if (boardSelect != null) {
//boardSelect
if (boardSelect instanceof PieceControl pieceControl) {
if (pieceControl.isSelectable()) gameView.getBoardHandler().pieceSelect(pieceControl);
@@ -135,8 +128,7 @@ else if(boardSelect != null) {
if (boardSelect instanceof NodeControl nodeControl) {
//
}
}
else {
} else {
//both null
}
}
@@ -177,7 +169,6 @@ else if(boardSelect != null) {
//gameView.getGuiHandler().playCardOwn(BonusCard.SHIELD);
}
}
}
@@ -191,17 +182,13 @@ else if(boardSelect != null) {
public void onAnalog(String name, float value, float tpf) {
if (name.equals("MouseLeft") && rightMousePressed) {
rotationAngle -= value * 360f;
}
else if (name.equals("MouseRight") && rightMousePressed) {
} else if (name.equals("MouseRight") && rightMousePressed) {
rotationAngle += value * 360f;
}
else if (name.equals("MouseScrollUp")) {
} else if (name.equals("MouseScrollUp")) {
scrollValue = Math.max(1, scrollValue - 5);
}
else if (name.equals("MouseScrollDown")) {
} else if (name.equals("MouseScrollDown")) {
scrollValue = Math.min(100, scrollValue + 5);
}
else if (name.equals("MouseLeft") || name.equals("MouseRight") || name.equals("MouseVertical")){
} else if (name.equals("MouseLeft") || name.equals("MouseRight") || name.equals("MouseVertical")) {
hoverPiece();
hoverCard();
}
@@ -217,7 +204,8 @@ private <T extends AbstractControl> T checkHover(Camera cam, Node root, Class<T>
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);
if (collisionResult.getGeometry().getControl(controlType) != null)
return collisionResult.getGeometry().getControl(controlType);
}
return null;
}

View File

@@ -1,20 +1,14 @@
package pp.mdga.client;
import com.jme3.app.SimpleApplication;
import com.simsilica.lemur.GuiGlobals;
import com.sun.tools.javac.Main;
import pp.mdga.client.acoustic.AcousticHandler;
import com.jme3.system.AppSettings;
import com.simsilica.lemur.GuiGlobals;
import pp.mdga.client.acoustic.AcousticHandler;
import pp.mdga.client.animation.TimerManager;
import pp.mdga.client.dialog.JoinDialog;
import pp.mdga.client.view.*;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.prefs.Preferences;
@@ -27,40 +21,64 @@ public class MdgaApp extends SimpleApplication {
private static Preferences prefs = Preferences.userNodeForPackage(JoinDialog.class);
/** Handles acoustic effects and state-based sounds. */
/**
* Handles acoustic effects and state-based sounds.
*/
private AcousticHandler acousticHandler;
/** Synchronizes notifications throughout the application. */
/**
* Synchronizes notifications throughout the application.
*/
private NotificationSynchronizer notificationSynchronizer;
/** Manages input events and synchronization. */
/**
* Manages input events and synchronization.
*/
private InputSynchronizer inputSynchronizer;
/** Synchronizes game models. */
/**
* Synchronizes game models.
*/
private ModelSynchronizer modelSynchronizer;
/** The currently active view in the application. */
/**
* The currently active view in the application.
*/
private MdgaView view = null;
/** The current state of the application. */
/**
* The current state of the application.
*/
private MdgaState state = null;
/** Scale for rendering images. */
/**
* Scale for rendering images.
*/
private final float imageScale = prefs.getInt("scale", 1);
/** The main menu view. */
/**
* The main menu view.
*/
private MainView mainView;
/** The lobby view. */
/**
* The lobby view.
*/
private LobbyView lobbyView;
/** The game view. */
/**
* The game view.
*/
private GameView gameView;
/** The ceremony view. */
/**
* The ceremony view.
*/
private CeremonyView ceremonyView;
/** The client game logic. */
/**
* The client game logic.
*/
private final ClientGameLogic clientGameLogic;
private ExecutorService executor;

View File

@@ -177,8 +177,7 @@ private void handleGame(Notification notification) {
//StartMove
boardHandler.movePieceStartAnim(n.getPiece(), n.getMoveIndex());
waitForAnimation = true;
}
else {
} else {
//InfieldMove
boardHandler.movePieceAnim(n.getPiece(), n.getStartIndex(), n.getMoveIndex());
waitForAnimation = true;
@@ -217,8 +216,7 @@ public void run() {
if (n.getColor() == ownColor) {
guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
waitForAnimation = true;
}
else {
} else {
if (n.isTurbo()) guiHandler.showRolledDiceMult(n.getEyes(), n.getMultiplier(), n.getColor());
else guiHandler.showRolledDice(n.getEyes(), n.getColor());
}

View File

@@ -3,7 +3,8 @@
import com.jme3.math.Vector3f;
public class Util {
private Util(){}
private Util() {
}
/**
* Performs linear interpolation between two values.

View File

@@ -4,7 +4,10 @@
import pp.mdga.client.MdgaApp;
import pp.mdga.client.MdgaState;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Random;
import java.util.prefs.Preferences;
public class AcousticHandler {
@@ -226,11 +229,11 @@ private float lerp(float start, float end, float t) {
/**
* Updates the state of audio playback, handling track transitions and volume adjustments.
*
* <p>
* This method ensures smooth transitions between tracks using fade-in and fade-out effects.
* It also handles cases where no track is playing, starting a scheduled track immediately at full volume.
* The method prioritizes the latest scheduled track if multiple scheduling occurs quickly.
*
* <p>
* Behavior:
* 1. If nothing is scheduled and no track is playing, it exits early.
* 2. If a scheduled track exists and no track is playing, the scheduled track starts immediately at full volume.
@@ -239,7 +242,7 @@ private float lerp(float start, float end, float t) {
* 4. If a track transition is in progress (fading), it processes the fade-out and fade-in states.
* If a new track is scheduled during this process, it interrupts the current transition and prioritizes the new track.
* 5. If no fading is needed and a track is playing, it ensures the track's volume is updated.
*
* <p>
* Special cases:
* - If no track is playing and a new track is scheduled, it starts the track immediately without fading.
* - If a new track is scheduled during fading, it resets the transition to prioritize the new track.
@@ -291,23 +294,23 @@ private void updateVolumeAndTrack() {
/**
* Manages the fading process during audio track transitions.
*
* <p>
* This method handles the fade-out of the currently playing (old) track, manages any pause between the fade-out
* and fade-in, and initiates the fade-in for the new track if applicable. It ensures smooth transitions between
* tracks while maintaining the correct volume adjustments.
*
* <p>
* Behavior:
* 1. **Outfade:** Gradually decreases the volume of the `old` track over the duration of `FADE_DURATION`.
* Once the outfade completes, the `old` track is paused and cleared.
* 2. **Pause Handling:** Waits for a defined pause (if applicable) before initiating the infade for the next track.
* 3. **Infade:** If a `scheduled` track exists and the outfade and pause are complete, it begins playing
* the new track (`playing`) and initiates the infade process.
*
* <p>
* Key Details:
* - The outfade volume adjustment is interpolated linearly from full volume to zero using the `lerp` function.
* - The pause duration is retrieved from the scheduled track if it is specified.
* - If a new track is scheduled during the fade process, it is handled by external logic to prioritize transitions.
*
* <p>
* Preconditions:
* - `fading` is expected to be `true` when this method is called.
* - The method is invoked as part of the `updateVolumeAndTrack` process.
@@ -343,10 +346,10 @@ private void handleFadeProcess() {
/**
* Manages the fade-in process for the currently playing track.
*
* <p>
* This method gradually increases the volume of the `playing` track from zero to full volume
* over the duration of `CROSSFADE_DURATION`. It ensures a smooth transition into the new track.
*
* <p>
* Behavior:
* 1. If no track is set as `playing`, the method exits early, as there is nothing to fade in.
* 2. Linearly interpolates the volume of the `playing` track from 0.0 to 1.0 based on the elapsed
@@ -354,12 +357,12 @@ private void handleFadeProcess() {
* 3. Once the fade-in is complete (when `infadeTime` exceeds `CROSSFADE_DURATION`), the method:
* - Marks the fade process (`fading`) as complete.
* - Ensures the `playing` track is updated to its full volume.
*
* <p>
* Key Details:
* - Uses the `lerp` function to calculate the volume level for the `playing` track during the fade-in.
* - Ensures the volume is always a value between 0.0 and 1.0.
* - The `infadeTime` parameter should be relative to the start of the fade-in process.
*
* <p>
* Preconditions:
* - The `playing` track must be initialized and actively fading in for this method to have an effect.
* - The method is invoked as part of the `updateVolumeAndTrack` process.

View File

@@ -4,4 +4,5 @@
* A record that encapsulates a sound asset along with its playback settings:
* the relative volume (subVolume) and a delay before it starts playing.
*/
record SoundAssetDelayVolume(SoundAsset asset, float subVolume, float delay) {}
record SoundAssetDelayVolume(SoundAsset asset, float subVolume, float delay) {
}

View File

@@ -9,8 +9,6 @@ public ActionControl(Runnable runnable){
this.runnable = runnable;
}
protected void action() {
if (null != runnable) {
runnable.run();

View File

@@ -109,7 +109,8 @@ protected void controlUpdate(float tpf) {
}
@Override
protected void controlRender(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) {}
protected void controlRender(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) {
}
});
rootNode.attachChild(smoke);
@@ -127,7 +128,8 @@ protected void controlUpdate(float tpf) {
}
@Override
protected void controlRender(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) {}
protected void controlRender(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) {
}
});
}
}

View File

@@ -1,10 +1,9 @@
package pp.mdga.client.animation;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Geometry;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import pp.mdga.client.InitControl;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Geometry;
import static pp.mdga.client.Util.linInt;

View File

@@ -12,10 +12,6 @@
import pp.mdga.client.Asset;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.acoustic.MdgaSound;
import pp.mdga.client.board.BoardHandler;
import pp.mdga.client.view.GameView;
import java.util.UUID;
/**
* The {@code JetAnimation} class handles the animation of a jet model in a 3D environment.
@@ -88,7 +84,8 @@ private void spawnJet() {
rootNode.attachChild(jetModel);
}
/**actionAfter
/**
* actionAfter
* Animates the jet along a Bezier curve path, triggers the explosion effect at the appropriate time,
* and performs cleanup operations after the animation completes.
*/
@@ -127,7 +124,8 @@ protected void controlUpdate(float tpf) {
}
@Override
protected void controlRender(RenderManager rm, ViewPort vp) {}
protected void controlRender(RenderManager rm, ViewPort vp) {
}
});
}

View File

@@ -6,11 +6,11 @@
import com.jme3.material.RenderState;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import pp.mdga.client.InitControl;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.acoustic.MdgaSound;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class MatrixAnimation extends ActionControl {
private MdgaApp app;
@@ -53,7 +53,6 @@ protected void controlUpdate(float tpf) {
timeElapsed += tpf;
switch (state) {
case RADAR_ON -> {
if (timeElapsed >= 2f) {

View File

@@ -17,8 +17,6 @@
import pp.mdga.client.acoustic.MdgaSound;
import pp.mdga.client.board.BoardHandler;
import java.util.UUID;
/**
* The {@code MissileAnimation} class handles the animation of a missile moving along a parabolic path
* towards a target point in a 3D environment. It also triggers an explosion at the target upon impact.

View File

@@ -2,7 +2,8 @@
import com.jme3.math.Vector3f;
import static pp.mdga.client.Util.*;
import static pp.mdga.client.Util.easeInOut;
import static pp.mdga.client.Util.quadInt;
/**
* A control that smoothly moves a spatial from an initial position to an end position
@@ -94,6 +95,4 @@ private void end(){
}
}

View File

@@ -3,17 +3,12 @@
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.material.Material;
import com.jme3.material.RenderState;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Geometry;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Box;
import pp.mdga.client.Asset;
import pp.mdga.client.InitControl;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.acoustic.MdgaSound;
import pp.mdga.client.board.TankTopControl;
@@ -22,7 +17,6 @@
import java.util.TimerTask;
import static com.jme3.material.Materials.LIGHTING;
import static com.jme3.material.Materials.UNSHADED;
public class ShellAnimation extends ActionControl {
private static final float FLYING_DURATION = 1.25f;

View File

@@ -7,7 +7,6 @@
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import pp.mdga.client.InitControl;
public class ShellControl extends ActionControl {
private final Vector3f shootPos;

View File

@@ -103,7 +103,8 @@ protected void controlUpdate(float tpf) {
}
@Override
protected void controlRender(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) {}
protected void controlRender(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) {
}
});
rootNode.attachChild(smoke);
@@ -121,7 +122,8 @@ protected void controlUpdate(float tpf) {
}
@Override
protected void controlRender(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) {}
protected void controlRender(com.jme3.renderer.RenderManager rm, com.jme3.renderer.ViewPort vp) {
}
});
}
}

View File

@@ -5,4 +5,5 @@
/**
* Record for holding Asset information
*/
record AssetOnMap(Asset asset, int x, int y, float rot) {}
record AssetOnMap(Asset asset, int x, int y, float rot) {
}

View File

@@ -2,7 +2,6 @@
import com.jme3.material.Material;
import com.jme3.material.RenderState;
import com.jme3.material.RenderState.BlendMode;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
@@ -388,10 +387,12 @@ public void addPlayer(Color color, List<UUID> uuid) {
List<AssetOnMap> playerAssets = colorAssetsMap.get(color);
if (playerAssets == null) throw new RuntimeException("Assets for Player color are not defined");
if (uuid.size() != playerAssets.size()) throw new RuntimeException("UUID array and playerAssets are not the same size");
if (uuid.size() != playerAssets.size())
throw new RuntimeException("UUID array and playerAssets are not the same size");
List<NodeControl> waitNodes = waitingNodesMap.get(color);
if (waitNodes.size() != playerAssets.size()) throw new RuntimeException("waitNodes size does not match playerAssets size");
if (waitNodes.size() != playerAssets.size())
throw new RuntimeException("waitNodes size does not match playerAssets size");
for (int i = 0; i < playerAssets.size(); i++) {
@@ -583,7 +584,8 @@ private void swapPieces(PieceControl p1, PieceControl p2, Vector3f loc1, float r
* @throws RuntimeException if the sizes of the input lists do not match
*/
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");
if (pieces.size() != moveIndexe.size() || pieces.size() != homeMoves.size())
throw new RuntimeException("arrays are not the same size");
selectableEnemyPieces.clear();
selectableOwnPieces.clear();
@@ -598,8 +600,7 @@ public void outlineMove(List<UUID> pieces, List<Integer> moveIndexe, List<Boolea
if (homeMoves.get(i)) {
Color color = pieceColor.get(uuid);
nodeControl = homeNodesMap.get(color).get(moveIndexe.get(i));
}
else {
} else {
nodeControl = infield.get(moveIndexe.get(i));
}
nodeControl.highlight();
@@ -677,27 +678,23 @@ public void pieceSelect(PieceControl pieceSelected) {
pieceSelected.select();
if (selectedPieceNodeMap.get(pieceSelected) != null) selectedPieceNodeMap.get(pieceSelected).select();
selectedOwnPiece = pieceSelected;
}
else {
} else {
pieceSelected.unSelect();
if (selectedPieceNodeMap.get(pieceSelected) != null) selectedPieceNodeMap.get(pieceSelected).unSelect();
selectedOwnPiece = null;
}
}
else if(selectableEnemyPieces.contains(pieceSelected)) {
} else if (selectableEnemyPieces.contains(pieceSelected)) {
for (PieceControl p : selectableEnemyPieces) {
p.unSelect();
}
if (!isSelected) {
pieceSelected.select();
selectedEnemyPiece = pieceSelected;
}
else {
} else {
pieceSelected.unSelect();
selectedEnemyPiece = null;
}
}
else throw new RuntimeException("pieceSelected is not in own/enemySelectablePieces");
} else throw new RuntimeException("pieceSelected is not in own/enemySelectablePieces");
app.getModelSynchronize().select(getKeyByValue(pieces, selectedOwnPiece), getKeyByValue(pieces, selectedEnemyPiece));
}
@@ -881,7 +878,8 @@ public void swapPieceAnim(UUID piece1, UUID piece2){
piece1Control.getSpatial().addControl(new MoveControl(
piece1Control.getLocation().clone(),
piece2Control.getLocation().clone(),
()->{}
() -> {
}
));
piece2Control.getSpatial().addControl(new MoveControl(
piece2Control.getLocation().clone(),

View File

@@ -65,11 +65,9 @@ public static List<AssetOnMap> loadMap(String mapName) {
Asset asset = getLoadedAsset(assetName);
assetsOnMap.add(new AssetOnMap(asset, x, y, rot));
}
}
catch (IOException e) {
} catch (IOException e) {
e.printStackTrace();
}
catch (IllegalArgumentException e) {
} catch (IllegalArgumentException e) {
e.printStackTrace();
}

View File

@@ -3,9 +3,6 @@
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.control.AbstractControl;
import pp.mdga.client.MdgaApp;
/**

View File

@@ -3,8 +3,8 @@
import com.jme3.math.ColorRGBA;
import com.jme3.post.FilterPostProcessor;
import com.jme3.renderer.Camera;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.InitControl;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.outline.SelectObjectOutliner;
/**
@@ -13,7 +13,9 @@
* object, allowing it to be highlighted or deselected.
*/
public class OutlineControl extends InitControl {
/** The {@link SelectObjectOutliner} responsible for managing the outline effect. */
/**
* The {@link SelectObjectOutliner} responsible for managing the outline effect.
*/
private final SelectObjectOutliner outlineOwn;
private static final int THICKNESS_DEFAULT = 6;
private MdgaApp app;

View File

@@ -263,7 +263,9 @@ public void setSelectable(boolean selectable){
*
* @return True if the piece is selected, false otherwise.
*/
public boolean isSelected() { return select; }
public boolean isSelected() {
return select;
}
/**
* Checks if the piece is selectable.

View File

@@ -3,7 +3,6 @@
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
import com.jme3.ui.Picture;
/**
* Represents a specific implementation of a clickable button positioned on the left side.

View File

@@ -77,7 +77,8 @@ public enum Pos {
* @param name the label or name displayed on the button
*/
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));
super(app, node, () -> {
}, "", new Vector2f(WIDTH, 7), new Vector2f(0, 0));
this.node3d = node3d;

View File

@@ -38,7 +38,8 @@ public class LabelButton extends ClickButton {
* @param isButton whether this component acts as a button or a simple label
*/
public LabelButton(MdgaApp app, Node node, String label, Vector2f size, Vector2f pos, boolean isButton) {
super(app, node, () -> {}, label, size, pos);
super(app, node, () -> {
}, label, size, pos);
this.isButton = isButton;

View File

@@ -1,17 +1,13 @@
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.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Quad;
import com.jme3.texture.Texture;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import pp.mdga.client.Asset;
import pp.mdga.client.MdgaApp;

View File

@@ -2,8 +2,6 @@
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;

View File

@@ -1,7 +1,6 @@
package pp.mdga.client.dialog;
import com.jme3.scene.Node;
import com.simsilica.lemur.Container;
import pp.mdga.client.MdgaApp;
/**

View File

@@ -3,11 +3,9 @@
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.ButtonRight;
import pp.mdga.client.button.LabelButton;
import pp.mdga.client.button.MenuButton;
import pp.mdga.client.view.MdgaView;
import pp.mdga.game.Color;
/**

View File

@@ -4,7 +4,6 @@
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.NetworkSupport;
import pp.mdga.client.acoustic.AcousticHandler;
import pp.mdga.client.button.ButtonLeft;
import pp.mdga.client.button.ButtonRight;
import pp.mdga.client.button.InputButton;

View File

@@ -3,9 +3,7 @@
import com.jme3.math.Vector2f;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.button.InputButton;
import pp.mdga.client.button.MenuButton;
import pp.mdga.client.view.MainView;
import pp.mdga.client.view.MdgaView;
/**

View File

@@ -1,18 +1,13 @@
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.simsilica.lemur.Container;
import com.simsilica.lemur.component.QuadBackgroundComponent;
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;
/**
* The {@code StartDialog} class represents the initial dialog in the application,
@@ -75,8 +70,7 @@ protected void onShow() {
* Called when the dialog is hidden. Hides the name input field and all buttons.
*/
@Override
protected void onHide ()
{
protected void onHide() {
nameInput.hide();
hostButton.hide();

View File

@@ -3,7 +3,6 @@
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.ButtonLeft;
import pp.mdga.client.button.ButtonRight;
import pp.mdga.client.button.MenuButton;

View File

@@ -7,19 +7,12 @@
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;

View File

@@ -19,7 +19,8 @@
import com.jme3.texture.Image;
import com.jme3.texture.Texture2D;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
public class CardLayer extends AbstractAppState {

View File

@@ -13,8 +13,6 @@
import pp.mdga.client.Asset;
import pp.mdga.client.MdgaApp;
import java.util.Random;
import static com.jme3.material.Materials.LIGHTING;
import static com.jme3.material.Materials.UNSHADED;
@@ -55,8 +53,7 @@ protected void controlUpdate(float tpf) {
if (angularVelocity.lengthSquared() <= 3f || MdgaApp.DEBUG_MULTIPLIER == 0) {
slerp = true;
}
}
else {
} else {
timeElapsed += clampedTpf * rollDuration;
@@ -155,8 +152,7 @@ public void create(Vector3f pos, float scale, boolean shadow){
mat = new Material(assetManager, LIGHTING);
mat.setTexture("DiffuseMap", assetManager.loadTexture(Asset.dice.getDiffPath()));
spatial.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
}
else{
} else {
mat = new Material(assetManager, UNSHADED);
mat.setTexture("ColorMap", assetManager.loadTexture(Asset.dice.getDiffPath()));
}

View File

@@ -6,8 +6,8 @@
import com.jme3.texture.Image;
import com.jme3.texture.Texture2D;
import pp.mdga.client.MdgaApp;
import pp.mdga.game.Color;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
import java.util.List;
@@ -167,6 +167,4 @@ public void rollRankingResult(Color color, int eye){
}
}

View File

@@ -4,19 +4,16 @@
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.scene.Spatial;
import com.jme3.system.AppSettings;
import com.jme3.ui.Picture;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
public class PlayerNameHandler {
private final BitmapFont playerFont;
@@ -122,7 +119,6 @@ private Spatial createColor(Color color) {
}
private BitmapText createName(String name, boolean first, boolean own) {
BitmapText hudText = new BitmapText(playerFont);
//renderedSize = 45

View File

@@ -3,7 +3,6 @@
import com.jme3.asset.AssetManager;
import com.jme3.math.ColorRGBA;
import com.jme3.post.FilterPostProcessor;
import com.jme3.post.filters.FXAAFilter;
import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;

View File

@@ -286,8 +286,7 @@ public void send(int id, ServerMessage message) {
if (connection != null) {
System.out.println("server sends to: " + id + " " + message.getClass().getName());
connection.send(message);
}
else LOGGER.log(Level.ERROR, "there is no connection with id={0}", id); //NON-NLS
} else LOGGER.log(Level.ERROR, "there is no connection with id={0}", id); //NON-NLS
}
/**

View File

@@ -1,16 +1,14 @@
package pp.mdga.client.server;
import com.jme3.network.serializing.Serializer;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.UUID;
import com.jme3.network.serializing.Serializer;
public class UUIDSerializer extends Serializer
{
public class UUIDSerializer extends Serializer {
@Override
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException
{
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
byte[] uuid = new byte[36];
data.get(uuid);
@@ -22,8 +20,7 @@ public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException
}
@Override
public void writeObject(ByteBuffer buffer, Object object) throws IOException
{
public void writeObject(ByteBuffer buffer, Object object) throws IOException {
UUID uuid = (UUID) object;
if (uuid != null) {

View File

@@ -2,10 +2,10 @@
import com.jme3.post.FilterPostProcessor;
import com.jme3.scene.Node;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.acoustic.MdgaSound;
import pp.mdga.client.board.BoardHandler;
import pp.mdga.client.board.CameraHandler;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.button.ButtonLeft;
import pp.mdga.client.button.ButtonRight;
import pp.mdga.client.dialog.InterruptDialog;

View File

@@ -5,21 +5,15 @@
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.scene.Geometry;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Quad;
import com.jme3.texture.Texture;
import com.jme3.util.SkyFactory;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.acoustic.MdgaSound;
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 pp.mdga.message.client.StartGameMessage;
import pp.mdga.notification.GameNotification;
public class LobbyView extends MdgaView {
private Geometry background;
@@ -150,8 +144,7 @@ protected void onEnterOverlay(Overlay overlay) {
}
@Override
protected void onLeaveOverlay(Overlay overlay)
{
protected void onLeaveOverlay(Overlay overlay) {
}

View File

@@ -11,7 +11,9 @@
import com.jme3.texture.Texture;
import pp.mdga.client.MdgaApp;
import pp.mdga.client.acoustic.MdgaSound;
import pp.mdga.client.button.*;
import pp.mdga.client.button.AbstractButton;
import pp.mdga.client.button.LabelButton;
import pp.mdga.client.button.SettingsButton;
import pp.mdga.client.dialog.AudioSettingsDialog;
import pp.mdga.client.dialog.SettingsDialog;
import pp.mdga.client.dialog.VideoSettingsDialog;

View File

@@ -79,7 +79,6 @@ public CeremonyStates getState(){
/**
* this method is used to parse the selectNext from the clientGameLogic
*
*/
@Override
public void selectNext() {

View File

@@ -4,7 +4,6 @@
import pp.mdga.game.Color;
import pp.mdga.game.Piece;
import pp.mdga.message.server.*;
import pp.mdga.notification.CeremonyNotification;
import java.lang.System.Logger.Level;
@@ -161,7 +160,9 @@ public void received(ServerStartGameMessage msg) {
}
@Override
public void received(ShutdownMessage msg) {LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg.toString());}
public void received(ShutdownMessage msg) {
LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg.toString());
}
@Override
public void received(StartPieceMessage msg) {

View File

@@ -4,16 +4,9 @@
import pp.mdga.game.BonusCard;
import pp.mdga.game.Piece;
import pp.mdga.game.card.HiddenCard;
import pp.mdga.game.card.ShieldCard;
import pp.mdga.game.card.SwapCard;
import pp.mdga.game.card.TurboCard;
import pp.mdga.message.client.LeaveGameMessage;
import pp.mdga.message.server.*;
import pp.mdga.notification.AcquireCardNotification;
import pp.mdga.notification.CeremonyNotification;
import pp.mdga.notification.DrawCardNotification;
import pp.mdga.notification.InterruptNotification;
import pp.mdga.notification.StartDialogNotification;
import pp.mdga.notification.*;
public class GameState extends ClientState {
@@ -307,8 +300,7 @@ public void received(DrawCardMessage msg){
logic.getGame().getActivePlayer().addHandCard(msg.getCard());
if (msg.getCard() instanceof HiddenCard) {
logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), BonusCard.HIDDEN));
}
else{
} else {
logic.addNotification(new AcquireCardNotification(msg.getCard().getCard()));
}

View File

@@ -2,7 +2,6 @@
import pp.mdga.message.client.ForceContinueGameMessage;
import pp.mdga.message.server.ResumeGameMessage;
import pp.mdga.notification.ResumeNotification;
public class InterruptState extends ClientState {

View File

@@ -15,6 +15,7 @@ public class NetworkDialogState extends DialogStates {
/**
* Constructor for the NetworkDialogState
*
* @param parent the parent state
* @param logic the logic
*/

View File

@@ -10,6 +10,7 @@ public class StartDialogState extends DialogStates {
/**
* Constructor for the StartDialogState
*
* @param parent the parent state
* @param logic the logic
*/

View File

@@ -7,7 +7,6 @@
import pp.mdga.client.gamestate.determinestartplayerstate.Intro;
import pp.mdga.client.gamestate.determinestartplayerstate.RollRankingDiceState;
import pp.mdga.client.gamestate.determinestartplayerstate.WaitRankingState;
import pp.mdga.message.client.AnimationEndMessage;
import pp.mdga.message.server.*;
public class DetermineStartPlayerState extends GameStates {

View File

@@ -2,19 +2,12 @@
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.game.Board;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Node;
import pp.mdga.game.Piece;
import pp.mdga.game.PieceState;
import pp.mdga.game.ShieldState;
import pp.mdga.game.*;
import pp.mdga.message.server.PlayCardMessage;
import pp.mdga.notification.ShieldActiveNotification;
import pp.mdga.notification.ShieldSuppressedNotification;
import pp.mdga.notification.SwapPieceNotification;
import pp.mdga.notification.ThrowPieceNotification;
import java.util.List;
import java.util.UUID;
public abstract class GameStates extends ClientState {

View File

@@ -3,23 +3,12 @@
import pp.mdga.client.ClientGameLogic;
import pp.mdga.client.ClientState;
import pp.mdga.client.GameState;
import pp.mdga.client.gamestate.turnstate.ChoosePieceState;
import pp.mdga.client.gamestate.turnstate.MovePieceState;
import pp.mdga.client.gamestate.turnstate.PlayPowerCardState;
import pp.mdga.client.gamestate.turnstate.PowerCardState;
import pp.mdga.client.gamestate.turnstate.RollDiceState;
import pp.mdga.client.gamestate.turnstate.TurnStates;
import pp.mdga.client.gamestate.turnstate.*;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Piece;
import pp.mdga.game.ShieldState;
import pp.mdga.game.card.HiddenCard;
import pp.mdga.game.card.ShieldCard;
import pp.mdga.game.card.SwapCard;
import pp.mdga.game.card.TurboCard;
import pp.mdga.message.server.*;
import pp.mdga.notification.RemoveShieldNotification;
import pp.mdga.notification.AcquireCardNotification;
import pp.mdga.notification.DrawCardNotification;
public class TurnState extends GameStates {

View File

@@ -40,8 +40,7 @@ public void received(DieMessage msg) {
logic.getGame().setDiceEyes(msg.getDiceEye());
if (logic.getGame().getTurboFlag()) {
logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), msg.getDiceEye(), logic.getGame().getDiceModifier()));
}
else {
} else {
logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), msg.getDiceEye()));
}
@@ -93,16 +92,14 @@ public void received(MoveMessage msg) {
Node targetNode = logic.getGame().getActivePlayer().getHomeNodes()[msg.getTargetIndex()];
if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
piece.setState(PieceState.HOMEFINISHED);
}
else{
} else {
piece.setState(PieceState.HOME);
}
oldNode.clearOccupant();
targetNode.setOccupant(piece);
}
else{
} else {
logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
int oldNoteIdx = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
Node oldNode = logic.getGame().getBoard().getInfield()[oldNoteIdx];
@@ -112,16 +109,14 @@ public void received(MoveMessage msg) {
if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
piece.setState(PieceState.HOMEFINISHED);
}
else{
} else {
piece.setState(PieceState.HOME);
}
oldNode.clearOccupant();
targetNode.setOccupant(piece);
}
}
else {
} else {
int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
if (occ != null) {

View File

@@ -5,8 +5,9 @@
import pp.mdga.client.gamestate.DetermineStartPlayerState;
import pp.mdga.game.Color;
import pp.mdga.message.client.AnimationEndMessage;
import pp.mdga.message.server.*;
import pp.mdga.notification.ActivePlayerNotification;
import pp.mdga.message.server.ActivePlayerMessage;
import pp.mdga.message.server.DiceNowMessage;
import pp.mdga.message.server.RankingResponseMessage;
import pp.mdga.notification.RankingResponceNotification;
import java.util.HashMap;

View File

@@ -4,7 +4,10 @@
import pp.mdga.client.ClientState;
import pp.mdga.client.gamestate.TurnState;
import pp.mdga.message.client.AnimationEndMessage;
import pp.mdga.message.server.*;
import pp.mdga.message.server.CeremonyMessage;
import pp.mdga.message.server.DiceNowMessage;
import pp.mdga.message.server.EndOfTurnMessage;
import pp.mdga.message.server.SpectatorMessage;
public class MovePieceState extends TurnStates {

View File

@@ -4,8 +4,6 @@
import pp.mdga.client.ClientState;
import pp.mdga.client.gamestate.TurnState;
import pp.mdga.game.BonusCard;
import pp.mdga.game.card.ShieldCard;
import pp.mdga.game.card.SwapCard;
import pp.mdga.message.client.AnimationEndMessage;
import pp.mdga.message.server.PlayCardMessage;
import pp.mdga.notification.PlayCardNotification;

View File

@@ -52,8 +52,7 @@ public void received(DieMessage msg){
if (logic.getGame().getTurboFlag()) {
logic.addNotification(new RollDiceNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor(), msg.getDiceEye(), logic.getGame().getDiceModifier()));
}
else {
} else {
logic.addNotification(new RollDiceNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor(), msg.getDiceEye()));
}

View File

@@ -4,11 +4,11 @@
import pp.mdga.client.ClientState;
import pp.mdga.client.gamestate.turnstate.ChoosePieceState;
import pp.mdga.game.Piece;
import pp.mdga.message.server.*;
import pp.mdga.message.server.EndOfTurnMessage;
import pp.mdga.message.server.SelectPieceMessage;
import pp.mdga.message.server.StartPieceMessage;
import pp.mdga.notification.MovePieceNotification;
import pp.mdga.message.server.WaitPieceMessage;
import pp.mdga.notification.SelectableMoveNotification;
import pp.mdga.notification.WaitMoveNotification;
import java.util.ArrayList;
import java.util.List;

View File

@@ -4,17 +4,11 @@
import pp.mdga.client.ClientState;
import pp.mdga.client.gamestate.turnstate.ChoosePieceState;
import pp.mdga.game.Piece;
import pp.mdga.game.ShieldState;
import pp.mdga.game.PieceState;
import pp.mdga.game.ShieldState;
import pp.mdga.message.client.RequestMoveMessage;
import pp.mdga.message.client.SelectedPiecesMessage;
import pp.mdga.message.server.MoveMessage;
import pp.mdga.notification.HomeMoveNotification;
import pp.mdga.notification.MovePieceNotification;
import pp.mdga.notification.RemoveShieldNotification;
import pp.mdga.notification.ShieldActiveNotification;
import pp.mdga.notification.ShieldSuppressedNotification;
import pp.mdga.notification.ThrowPieceNotification;
import pp.mdga.notification.*;
import java.util.ArrayList;
@@ -63,29 +57,25 @@ public void received(MoveMessage msg) {
System.out.println("Client: SelectState: activePiece in Home: infieldIndex" + infieldIndex);
if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
piece.setState(PieceState.HOMEFINISHED);
}
else {
} else {
piece.setState(PieceState.HOME);
}
logic.getGame().getBoard().getInfield()[infieldIndex].clearOccupant();
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
}
else {
} else {
System.out.println("Client: SelectPieceState: receivedMoveMessage:reached else");
logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
System.out.println("Client: electPieceState: homeindex" + logic.getGame().getActivePlayer().getHomeIndexOfPiece(piece));
int pieceHomeIndex = logic.getGame().getActivePlayer().getHomeIndexOfPiece(piece);
if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
piece.setState(PieceState.HOMEFINISHED);
}
else {
} else {
piece.setState(PieceState.HOME);
}
logic.getGame().getActivePlayer().getHomeNodes()[pieceHomeIndex].clearOccupant();
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
}
}
else {
} else {
int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
@@ -111,8 +101,7 @@ public void received(MoveMessage msg) {
piece.setShield(ShieldState.SUPPRESSED);
logic.addNotification(new ShieldSuppressedNotification(piece.getUuid()));
}
}
else if (piece.isSuppressed()) {
} else if (piece.isSuppressed()) {
piece.setShield(ShieldState.ACTIVE);
logic.addNotification(new ShieldActiveNotification(piece.getUuid()));
}

View File

@@ -7,15 +7,8 @@
import pp.mdga.game.Piece;
import pp.mdga.game.ShieldState;
import pp.mdga.message.client.RequestMoveMessage;
import pp.mdga.message.client.SelectedPiecesMessage;
import pp.mdga.message.server.MoveMessage;
import pp.mdga.notification.MovePieceNotification;
import pp.mdga.notification.RemoveShieldNotification;
import pp.mdga.notification.ShieldActiveNotification;
import pp.mdga.notification.ShieldSuppressedNotification;
import pp.mdga.notification.ThrowPieceNotification;
import java.util.ArrayList;
import pp.mdga.notification.*;
public class StartPieceState extends ChoosePieceStates {

View File

@@ -7,15 +7,11 @@
import pp.mdga.game.PieceState;
import pp.mdga.game.ShieldState;
import pp.mdga.message.client.RequestMoveMessage;
import pp.mdga.message.client.SelectedPiecesMessage;
import pp.mdga.message.server.MoveMessage;
import pp.mdga.notification.MovePieceNotification;
import pp.mdga.notification.RemoveShieldNotification;
import pp.mdga.notification.ThrowPieceNotification;
import java.util.ArrayList;
import java.util.List;
public class WaitingPieceState extends ChoosePieceStates {
private final ChoosePieceState parent;

View File

@@ -4,9 +4,8 @@
import pp.mdga.client.ClientState;
import pp.mdga.client.gamestate.turnstate.PowerCardState;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Piece;
import pp.mdga.game.Player;
import pp.mdga.game.card.*;
import pp.mdga.game.card.PowerCard;
import pp.mdga.message.client.NoPowerCardMessage;
import pp.mdga.message.client.SelectCardMessage;
import pp.mdga.message.server.DiceNowMessage;
@@ -14,7 +13,6 @@
import pp.mdga.message.server.PossibleCardsMessage;
import pp.mdga.message.server.PossiblePieceMessage;
import pp.mdga.notification.SelectableCardsNotification;
import pp.mdga.notification.SelectableShieldNotification;
import java.util.ArrayList;
import java.util.stream.Collectors;
@@ -29,6 +27,7 @@ public class ChoosePowerCardState extends PowerCardStates {
/**
* Constructor
*
* @param parent parent state
* @param logic game logic
*/
@@ -54,6 +53,7 @@ public void exit() {
/**
* Set the possible cards
*
* @param msg possible cards message
*/
@Override
@@ -70,6 +70,7 @@ public void received(PossibleCardsMessage msg){
/**
* Select a card
*
* @param card card to select
*/
@Override
@@ -89,6 +90,7 @@ public void selectCard(BonusCard card){
/**
* Receive a card
*
* @param msg card message
*/
@Override
@@ -103,6 +105,7 @@ public void received(PlayCardMessage msg){
/**
* Receive a die now message
*
* @param msg dice now message
*/
@Override
@@ -112,6 +115,7 @@ public void received(DiceNowMessage msg){
/**
* Receive a possible piece message and decide if the player can swap or shield
*
* @param msg possible piece message
*/
@Override

View File

@@ -4,14 +4,12 @@
import pp.mdga.client.ClientState;
import pp.mdga.client.gamestate.turnstate.PowerCardState;
import pp.mdga.game.Piece;
import pp.mdga.message.client.RequestPlayCardMessage;
import pp.mdga.message.client.SelectedPiecesMessage;
import pp.mdga.message.server.PlayCardMessage;
import pp.mdga.notification.SelectableShieldNotification;
import java.lang.System.Logger.Level;
import java.util.ArrayList;
import java.util.List;
public class ShieldState extends PowerCardStates {

View File

@@ -4,14 +4,12 @@
import pp.mdga.client.ClientState;
import pp.mdga.client.gamestate.turnstate.PowerCardState;
import pp.mdga.game.Piece;
import pp.mdga.message.client.RequestPlayCardMessage;
import pp.mdga.message.client.SelectCardMessage;
import pp.mdga.message.client.SelectedPiecesMessage;
import pp.mdga.message.server.PlayCardMessage;
import pp.mdga.notification.SelectableSwapNotification;
import java.util.UUID;
import java.util.ArrayList;
import java.util.UUID;
public class SwapState extends PowerCardStates {

View File

@@ -2,7 +2,6 @@
import com.jme3.network.serializing.Serializable;
import java.util.Objects;
import java.util.UUID;
/**

View File

@@ -15,6 +15,7 @@ public class ShieldCard extends PowerCard {
public ShieldCard() {
this.card = BonusCard.SHIELD;
}
/**
* This method will be used to call the visit method of the given visitor parameter and pass a PowerCard object.
*

View File

@@ -19,6 +19,7 @@ public class CeremonyMessage extends ServerMessage {
private ArrayList<Integer> sixes;
private ArrayList<Integer> nodesMoved;
private ArrayList<Integer> bonusNodes;
/**
* Constructs a new Ceremony instance.
*/

View File

@@ -8,6 +8,7 @@ public class ChoosePieceStateMessage extends ServerMessage {
public ChoosePieceStateMessage() {
super();
}
/**
* Accepts a visitor to process this message.
*

View File

@@ -2,8 +2,6 @@
import com.jme3.network.serializing.Serializable;
import java.util.List;
/**
* A message sent by the server to the client to inform about the dice roll.
*/

View File

@@ -1,7 +1,6 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Color;
/**
* A message sent by the server to indicate that a player has left the lobby.

View File

@@ -3,8 +3,6 @@
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Piece;
import java.util.UUID;
/**
* A message sent by the server to the client to move a piece on the board.
*/

View File

@@ -3,10 +3,8 @@
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Piece;
import java.io.PipedOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* A message sent by the server to the active player to give all possible pieces to choose from.

View File

@@ -1,9 +1,9 @@
package pp.mdga.message.server;
import com.jme3.network.serializing.Serializable;
import pp.mdga.game.Piece;
import java.util.List;
import pp.mdga.game.Piece;
/**
* A message sent by the server to the active player to select a piece to move.

View File

@@ -2,8 +2,6 @@
import pp.mdga.game.BonusCard;
import java.util.UUID;
/**
* Notification that is sent when a card is acquired.
*/

View File

@@ -28,5 +28,7 @@ public String getMessage() {
return message;
}
public boolean isError() { return isError; }
public boolean isError() {
return isError;
}
}

View File

@@ -1,13 +1,12 @@
package pp.mdga.notification;
import pp.mdga.game.Color;
import pp.mdga.message.server.ServerMessage;
import java.util.HashMap;
import java.util.Map;
public class RankingResponceNotification extends Notification {
private final Map<Color, Integer> rankingResults;
/**
* Constructor.
*

View File

@@ -14,8 +14,10 @@ public class RollDiceNotification extends Notification{
private boolean isRanking;
//normal
/**
* Constructor.
*
* @param color the color of the player that rolled the die.
* @param eyes the number of eyes that were rolled.
*/
@@ -47,6 +49,7 @@ public RollDiceNotification(Color color, int eyes, int multiplier) {
/**
* Get the color of the player that rolled the die.
*
* @return the color of the player that rolled the die.
*/
public Color getColor() {
@@ -55,6 +58,7 @@ public Color getColor() {
/**
* Get the number of eyes that were rolled.
*
* @return the number of eyes that were rolled.
*/
public int getEyes() {
@@ -69,5 +73,7 @@ public boolean isTurbo() {
return turbo;
}
public boolean isRanking() { return isRanking; }
public boolean isRanking() {
return isRanking;
}
}

View File

@@ -1,6 +1,7 @@
package pp.mdga.notification;
import pp.mdga.game.BonusCard;
import java.util.List;
/**
@@ -14,6 +15,7 @@ public class SelectableCardsNotification extends Notification {
/**
* Constructor.
*
* @param cards The list of cards that the player can choose from.
*/
public SelectableCardsNotification(List<BonusCard> cards) {
@@ -22,6 +24,7 @@ public SelectableCardsNotification(List<BonusCard> cards) {
/**
* Get the list of cards that the player can choose from.
*
* @return The list of cards that the player can choose from.
*/
public List<BonusCard> getCards() {

View File

@@ -2,7 +2,6 @@
import pp.mdga.game.Color;
import pp.mdga.message.server.CeremonyMessage;
import pp.mdga.notification.CeremonyNotification;
import pp.mdga.server.ServerGameLogic;
/**

View File

@@ -3,9 +3,9 @@
import pp.mdga.message.client.*;
import pp.mdga.message.server.CeremonyMessage;
import pp.mdga.message.server.PauseGameMessage;
import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.automaton.game.AnimationState;
import pp.mdga.server.automaton.game.DetermineStartPlayerState;
import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.automaton.game.GameAutomatonState;
import pp.mdga.server.automaton.game.TurnState;

View File

@@ -4,10 +4,6 @@
import pp.mdga.game.Piece;
import pp.mdga.game.PieceState;
import pp.mdga.game.Player;
import pp.mdga.game.card.PowerCard;
import pp.mdga.game.card.ShieldCard;
import pp.mdga.game.card.SwapCard;
import pp.mdga.game.card.TurboCard;
import pp.mdga.message.client.*;
import pp.mdga.message.server.*;
import pp.mdga.server.ServerGameLogic;
@@ -98,8 +94,7 @@ public void received(SelectTSKMessage msg, int from) {
this.logic.getServerSender().broadcast(new UpdateTSKMessage(from, Color.NONE, false));
this.logic.getGame().getPlayerById(from).setColor(msg.getColor());
this.logic.getServerSender().broadcast(new UpdateTSKMessage(from, msg.getColor(), true));
}
else {
} else {
this.logic.getServerSender().send(from, new IncorrectRequestMessage(0));
}
}
@@ -132,8 +127,7 @@ public void received(LobbyReadyMessage msg, int from) {
if (color != Color.NONE) {
this.logic.getGame().getPlayerById(from).setColor(color);
this.logic.getServerSender().broadcast(new UpdateTSKMessage(from, color, true));
}
else {
} else {
this.logic.getServerSender().send(from, new IncorrectRequestMessage(1));
}
}
@@ -171,8 +165,7 @@ public void received(StartGameMessage msg, int from) {
} else {
this.logic.getServerSender().send(from, new IncorrectRequestMessage(6));
}
}
else {
} else {
this.logic.getServerSender().send(from, new IncorrectRequestMessage(5));
}
}

View File

@@ -41,7 +41,8 @@ public ServerState(ServerGameLogic logic) {
* @param msg as the message which was sent by the player as a AnimationEndMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(AnimationEndMessage msg, int from) {}
public void received(AnimationEndMessage msg, int from) {
}
/**
* This method will be called whenever the server received a DeselectTSKMessage message.
@@ -50,7 +51,8 @@ public void received(AnimationEndMessage msg, int from) {}
* @param msg as the message which was sent by the player as a DeselectTSKMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(DeselectTSKMessage msg, int from) {}
public void received(DeselectTSKMessage msg, int from) {
}
/**
* This method will be called whenever the server received a StartGame message.
@@ -59,7 +61,8 @@ public void received(DeselectTSKMessage msg, int from) {}
* @param msg as the message which was sent by the player as a StartGame object.
* @param from as the client id of the player as an Integer.
*/
public void received(StartGameMessage msg, int from) {}
public void received(StartGameMessage msg, int from) {
}
/**
* This method will be called whenever the server received a JoinedLobbyMessage message.
@@ -68,7 +71,8 @@ public void received(StartGameMessage msg, int from) {}
* @param msg as the message which was sent by the player as a JoinedLobbyMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(JoinedLobbyMessage msg, int from) {}
public void received(JoinedLobbyMessage msg, int from) {
}
/**
* This method will be called whenever the server received an LeaveGameMessage message.
@@ -94,7 +98,8 @@ public void received(LeaveGameMessage msg, int from) {
* @param msg as the message which was sent by the player as a LobbyReadyMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(LobbyReadyMessage msg, int from) {}
public void received(LobbyReadyMessage msg, int from) {
}
/**
* This method will be called whenever the server received a LobbyNotReadyMessage message.
@@ -103,7 +108,8 @@ public void received(LobbyReadyMessage msg, int from) {}
* @param msg as the message which was sent by the player as a LobbyNotReadyMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(LobbyNotReadyMessage msg, int from) {}
public void received(LobbyNotReadyMessage msg, int from) {
}
/**
* This method will be called whenever the server received a DisconnectedMessage message.
@@ -112,7 +118,8 @@ public void received(LobbyNotReadyMessage msg, int from) {}
* @param msg as the message which was sent by the player as a DisconnectedMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(DisconnectedMessage msg, int from) {}
public void received(DisconnectedMessage msg, int from) {
}
/**
* This method will be called whenever the server received a RequestBriefingMessage message.
@@ -121,7 +128,8 @@ public void received(DisconnectedMessage msg, int from) {}
* @param msg as the message which was sent by the player as a RequestBriefingMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(RequestBriefingMessage msg, int from) {}
public void received(RequestBriefingMessage msg, int from) {
}
/**
* This method will be called whenever the server received a RequestDieMessage message.
@@ -130,7 +138,8 @@ public void received(RequestBriefingMessage msg, int from) {}
* @param msg as the message which was sent by the player as a RequestDieMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(RequestDieMessage msg, int from) {}
public void received(RequestDieMessage msg, int from) {
}
/**
* This method will be called whenever the server received a RequestMoveMessage message.
@@ -139,7 +148,8 @@ public void received(RequestDieMessage msg, int from) {}
* @param msg as the message which was sent by the player as a RequestMoveMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(RequestMoveMessage msg, int from) {}
public void received(RequestMoveMessage msg, int from) {
}
/**
* This method will be called whenever the server received a RequestPlayCardMessage message.
@@ -148,7 +158,8 @@ public void received(RequestMoveMessage msg, int from) {}
* @param msg as the message which was sent by the player as a RequestPlayCardMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(RequestPlayCardMessage msg, int from) {}
public void received(RequestPlayCardMessage msg, int from) {
}
/**
* This method will be called whenever the server received a SelectCardMessage message.
@@ -157,7 +168,8 @@ public void received(RequestPlayCardMessage msg, int from) {}
* @param msg as the message which was sent by the player as a SelectCardMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(SelectCardMessage msg, int from) {}
public void received(SelectCardMessage msg, int from) {
}
/**
* This method will be called whenever the server received a SelectTSKMessage message.
@@ -166,7 +178,8 @@ public void received(SelectCardMessage msg, int from) {}
* @param msg as the message which was sent by the player as a SelectTSKMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(SelectTSKMessage msg, int from) {}
public void received(SelectTSKMessage msg, int from) {
}
/**
* This method will be called whenever the server received a ForceContinueGameMessage message.
@@ -175,7 +188,8 @@ public void received(SelectTSKMessage msg, int from) {}
* @param msg as the message which was sent by the player as a ForceContinueGameMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(ForceContinueGameMessage msg, int from) {}
public void received(ForceContinueGameMessage msg, int from) {
}
/**
* This method will be called whenever the server received a ClientStartGameMessage message.
@@ -184,7 +198,8 @@ public void received(ForceContinueGameMessage msg, int from) {}
* @param msg as the message which was sent by the player as a ClientStartGameMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(ClientStartGameMessage msg, int from) {}
public void received(ClientStartGameMessage msg, int from) {
}
/**
* This method will be called whenever the server received a NoPowerCardMessage message.
@@ -193,7 +208,8 @@ public void received(ClientStartGameMessage msg, int from) {}
* @param msg as the message which was sent by the player as a NoPowerCardMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(NoPowerCardMessage msg, int from) {}
public void received(NoPowerCardMessage msg, int from) {
}
/**
* This method will be called whenever the server received a SelectedPiecesMessage message.
@@ -202,5 +218,6 @@ public void received(NoPowerCardMessage msg, int from) {}
* @param msg as the message which was sent by the player as a SelectedPiecesMessage object.
* @param from as the client id of the player as an Integer.
*/
public void received(SelectedPiecesMessage msg, int from) {}
public void received(SelectedPiecesMessage msg, int from) {
}
}

View File

@@ -6,19 +6,12 @@
import pp.mdga.message.server.ActivePlayerMessage;
import pp.mdga.message.server.DiceNowMessage;
import pp.mdga.message.server.DieMessage;
import pp.mdga.message.server.EndOfTurnMessage;
import pp.mdga.message.server.RankingResponseMessage;
import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.automaton.GameState;
import java.lang.System.Logger.Level;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import java.util.*;
public class DetermineStartPlayerState extends GameAutomatonState {
/**
@@ -32,7 +25,7 @@ public class DetermineStartPlayerState extends GameAutomatonState {
private final Map<Integer, Integer> diceResults = new HashMap<>();
private final Map<Integer, Integer> finalDiceResults = new HashMap<>();
private final List<Integer> playersHaveToRoll = new ArrayList<>();
private final Set<Integer> messageReceived = new HashSet<>();;
private final Set<Integer> messageReceived = new HashSet<>();
private int playerToStart;
/**
@@ -77,8 +70,7 @@ public void received(RequestDieMessage msg, int from) {
if (maximumRoll == entry.getValue()) {
this.playersHaveToRoll.add(entry.getKey());
LOGGER.log(Level.INFO, "Players have to roll(RD same as maximum): {0}", this.playersHaveToRoll.size());
}
else if (maximumRoll < entry.getValue()) {
} else if (maximumRoll < entry.getValue()) {
maximumRoll = entry.getValue();
this.playersHaveToRoll.clear();
this.playersHaveToRoll.add(entry.getKey());
@@ -109,8 +101,7 @@ public void received(AnimationEndMessage msg, int from) {
}
finalDiceResults.putAll(this.diceResults);
diceResults.clear();
}
else {
} else {
finalDiceResults.putAll(this.diceResults);
LOGGER.log(Level.INFO, "Players have to roll: %s".formatted(this.logic.getGame().getPlayerById(this.playersHaveToRoll.get(0))));
Color color = this.logic.getGame().getPlayerById(this.playersHaveToRoll.get(0)).getColor();

View File

@@ -6,12 +6,7 @@
import pp.mdga.message.client.*;
import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.automaton.GameState;
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
import pp.mdga.server.automaton.game.turn.MovePieceState;
import pp.mdga.server.automaton.game.turn.PlayPowerCardState;
import pp.mdga.server.automaton.game.turn.PowerCardState;
import pp.mdga.server.automaton.game.turn.RollDiceState;
import pp.mdga.server.automaton.game.turn.TurnAutomatonState;
import pp.mdga.server.automaton.game.turn.*;
import java.lang.System.Logger.Level;

View File

@@ -4,7 +4,6 @@
import pp.mdga.game.Player;
import pp.mdga.message.client.AnimationEndMessage;
import pp.mdga.message.server.ActivePlayerMessage;
import pp.mdga.message.server.CeremonyMessage;
import pp.mdga.message.server.DiceNowMessage;
import pp.mdga.message.server.EndOfTurnMessage;
import pp.mdga.message.server.SpectatorMessage;

View File

@@ -3,7 +3,6 @@
import pp.mdga.message.client.AnimationEndMessage;
import pp.mdga.message.server.DiceNowMessage;
import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.automaton.game.AnimationState;
import pp.mdga.server.automaton.game.TurnState;
import java.util.HashSet;

View File

@@ -10,11 +10,7 @@
import pp.mdga.message.server.PossibleCardsMessage;
import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.automaton.game.TurnState;
import pp.mdga.server.automaton.game.turn.powercard.ChoosePowerCardState;
import pp.mdga.server.automaton.game.turn.powercard.PowerCardAutomatonState;
import pp.mdga.server.automaton.game.turn.powercard.ShieldCardState;
import pp.mdga.server.automaton.game.turn.powercard.SwapCardState;
import pp.mdga.server.automaton.game.turn.powercard.TurboCardState;
import pp.mdga.server.automaton.game.turn.powercard.*;
import pp.mdga.visitor.ServerCardVisitor;
import java.util.HashSet;
@@ -74,8 +70,7 @@ public void enter() {
if (this.visitor.getCards().isEmpty()) {
this.logic.getServerSender().send(this.logic.getGame().getActivePlayerId(), new DiceNowMessage());
this.turnAutomaton.setCurrentState(this.turnAutomaton.getRollDiceState());
}
else {
} else {
this.logic.getServerSender().send(this.logic.getGame().getActivePlayerId(), new PossibleCardsMessage(this.visitor.getCards()));
}
}

View File

@@ -1,7 +1,6 @@
package pp.mdga.server.automaton.game.turn.choosepiece;
import pp.mdga.game.*;
import pp.mdga.message.client.AnimationEndMessage;
import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.automaton.ServerState;
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
@@ -43,8 +42,7 @@ protected boolean canMove(Piece piece) {
if (canPieceMoveInHome(piece, steps)) {
return true;
}
}
else {
} else {
if (canPieceMoveInHome(piece, steps)) {
return true;
}
@@ -88,8 +86,7 @@ protected boolean canPieceMoveInHome(Piece piece, int steps) {
//tests if the steps are less than the possible movement
if ((3 - homeIdx) >= steps - 1) {
return !jumpOver(steps, homeIdx, false);
}
else {
} else {
return false;
}
}
@@ -107,8 +104,7 @@ else if (piece.getState() == PieceState.ACTIVE) {
if (restMovement >= 4) return false;
return !jumpOver(restMovement, 0, true);
}
}
else {
} else {
return false;
}
return false;

View File

@@ -1,8 +1,8 @@
package pp.mdga.server.automaton.game.turn.choosepiece;
import pp.mdga.Resources;
import pp.mdga.game.*;
import pp.mdga.message.client.AnimationEndMessage;
import pp.mdga.game.Piece;
import pp.mdga.game.PieceState;
import pp.mdga.game.Player;
import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
@@ -36,24 +36,19 @@ private void initialize() {
}
}
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
}
else if (activePlayer.hasPieceInWaitingArea()) {
} else if (activePlayer.hasPieceInWaitingArea()) {
if (!logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].isOccupied(activePlayer.getColor())) {
if (logic.getGame().getDiceEyes() == 6) {
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getWaitingPieceState());
}
else {
} else {
checkSelectPiece(activePlayer);
}
}
else if (canMove(logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].getOccupant())) {
} else if (canMove(logic.getGame().getBoard().getInfield()[activePlayer.getStartNodeIndex()].getOccupant())) {
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getStartPieceState());
}
else {
} else {
checkSelectPiece(activePlayer);
}
}
else {
} else {
checkSelectPiece(activePlayer);
}
}
@@ -68,8 +63,7 @@ private void checkSelectPiece(Player activePlayer) {
moveablePieces.removeIf(piece -> !canMove(piece));
if (moveablePieces.isEmpty()) {
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getNoTurnState());
}
else {
} else {
this.choosePieceAutomaton.getSelectPieceState().setMoveablePieces(moveablePieces);
this.choosePieceAutomaton.setCurrentState(this.choosePieceAutomaton.getSelectPieceState());
}

View File

@@ -48,8 +48,7 @@ public void enter() {
int target = getHomeTargetIdx(piece, steps);
targetIndex.add(target);
isHomeMove.add(true);
}
else {
} else {
int target = getInfieldTarget(piece, steps);
targetIndex.add(target);
isHomeMove.add(false);
@@ -78,15 +77,13 @@ public void received(RequestMoveMessage msg, int from) {
Node targetNode = logic.getGame().getActivePlayer().getHomeNodes()[targetHomeIdx];
if (targetHomeIdx == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
piece.setState(PieceState.HOMEFINISHED);
}
else {
} else {
piece.setState(PieceState.HOME);
}
oldNode.clearOccupant();
targetNode.setOccupant(piece);
}
else {
} else {
int oldNoteIdx = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
Node oldNode = logic.getGame().getBoard().getInfield()[oldNoteIdx];
@@ -96,8 +93,7 @@ public void received(RequestMoveMessage msg, int from) {
if (targetHomeIdx == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
piece.setState(PieceState.HOMEFINISHED);
}
else {
} else {
piece.setState(PieceState.HOME);
}
@@ -105,8 +101,7 @@ public void received(RequestMoveMessage msg, int from) {
targetNode.setOccupant(piece);
}
LOGGER.log(System.Logger.Level.INFO, "Server : SelectPieceState: PieceState:" + piece.getState());
}
else {
} else {
LOGGER.log(System.Logger.Level.INFO, "Server : SelectPieceState: PieceState:" + piece.getState());
int oldNoteIdx = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
Node oldNode = logic.getGame().getBoard().getInfield()[oldNoteIdx];
@@ -147,8 +142,7 @@ public void received(RequestMoveMessage msg, int from) {
PowerCard cardToDraw = logic.getGame().draw();
p.addHandCard(cardToDraw);
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(cardToDraw));
}
else {
} else {
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(new HiddenCard()));
}
}

View File

@@ -75,8 +75,7 @@ public void received(RequestMoveMessage msg, int from) {
PowerCard cardToDraw = logic.getGame().draw();
p.addHandCard(cardToDraw);
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(cardToDraw));
}
else {
} else {
logic.getServerSender().send(logic.getGame().getPlayerIdByColor(p.getColor()), new DrawCardMessage(new HiddenCard()));
}
}

View File

@@ -2,13 +2,11 @@
import pp.mdga.game.Piece;
import pp.mdga.game.PieceState;
import pp.mdga.game.ShieldState;
import pp.mdga.message.client.RequestMoveMessage;
import pp.mdga.message.server.MoveMessage;
import pp.mdga.message.server.WaitPieceMessage;
import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.automaton.game.turn.ChoosePieceState;
import pp.mdga.server.automaton.game.turn.rolldice.FirstRollState;
public class WaitingPieceState extends ChoosePieceAutomatonState {
/**

View File

@@ -1,11 +1,7 @@
package pp.mdga.server.automaton.game.turn.powercard;
import pp.mdga.game.BonusCard;
import pp.mdga.game.card.HiddenCard;
import pp.mdga.game.card.PowerCard;
import pp.mdga.game.card.ShieldCard;
import pp.mdga.game.card.SwapCard;
import pp.mdga.game.card.TurboCard;
import pp.mdga.game.card.*;
import pp.mdga.message.client.NoPowerCardMessage;
import pp.mdga.message.client.SelectCardMessage;
import pp.mdga.message.server.DiceNowMessage;

View File

@@ -1,9 +1,7 @@
package pp.mdga.server.automaton.game.turn.powercard;
import pp.mdga.game.Piece;
import pp.mdga.game.PieceState;
import pp.mdga.game.ShieldState;
import pp.mdga.game.card.PowerCard;
import pp.mdga.message.client.SelectedPiecesMessage;
import pp.mdga.message.server.IncorrectRequestMessage;
import pp.mdga.message.server.PlayCardMessage;
@@ -62,8 +60,7 @@ public void received(SelectedPiecesMessage msg, int from) {
this.logic.getGame().getPlayerByColor(this.logic.getGame().getActiveColor()).removeHandCard(this.powerCardAutomaton.getSelectedCard());
this.logic.getGame().getDiscardPile().add(this.powerCardAutomaton.getSelectedCard());
this.powerCardAutomaton.getTurnAutomaton().setCurrentState(this.powerCardAutomaton.getTurnAutomaton().getPlayPowerCardState());
}
else {
} else {
this.logic.getServerSender().send(from, new IncorrectRequestMessage(3));
}
}

View File

@@ -1,7 +1,6 @@
package pp.mdga.server.automaton.game.turn.powercard;
import pp.mdga.game.Board;
import pp.mdga.game.Color;
import pp.mdga.game.Node;
import pp.mdga.game.Piece;
import pp.mdga.game.card.SwapCard;
@@ -12,7 +11,6 @@
import pp.mdga.server.ServerGameLogic;
import pp.mdga.server.automaton.game.turn.PowerCardState;
import java.util.ArrayList;
import java.util.List;
public class SwapCardState extends PowerCardAutomatonState {
@@ -73,7 +71,8 @@ public void received(SelectedPiecesMessage msg, int from) {
this.powerCardAutomaton.addSelectedPiece(selOwn);
this.powerCardAutomaton.addSelectedPiece(selEnemy);
if(!(powerCardAutomaton.getSelectedCard() instanceof SwapCard)) throw new RuntimeException("getSelectedCard is not swapCard");
if (!(powerCardAutomaton.getSelectedCard() instanceof SwapCard))
throw new RuntimeException("getSelectedCard is not swapCard");
swapPieces(selOwn, selEnemy);

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