Merge remote-tracking branch 'origin/development2' into development2
# Conflicts: # Projekte/mdga/model/src/main/java/pp/mdga/server/automaton/game/turn/rolldice/FirstRollState.java # Projekte/mdga/model/src/test/java/pp/mdga/client/clientState/ClientStateTest.java # Projekte/mdga/model/src/test/java/pp/mdga/game/PieceTest.java
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -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, 
 | 
			
		||||
@@ -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: 
 | 
			
		||||
@@ -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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -106,7 +106,7 @@ public enum Asset {
 | 
			
		||||
     * @param diffPath  Path to the diffuse texture file.
 | 
			
		||||
     * @param size      Scaling factor for the asset.
 | 
			
		||||
     */
 | 
			
		||||
    Asset(String modelPath, String diffPath, float size){
 | 
			
		||||
    Asset(String modelPath, String diffPath, float size) {
 | 
			
		||||
        this.modelPath = modelPath;
 | 
			
		||||
        this.diffPath = diffPath;
 | 
			
		||||
        this.size = size;
 | 
			
		||||
 
 | 
			
		||||
@@ -12,19 +12,14 @@
 | 
			
		||||
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.OutlineOEControl;
 | 
			
		||||
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;
 | 
			
		||||
@@ -38,7 +33,7 @@ public class InputSynchronizer {
 | 
			
		||||
    private float rotationAngle = 180f;
 | 
			
		||||
    private int scrollValue = 0;
 | 
			
		||||
    private CardControl hoverCard;
 | 
			
		||||
    private PieceControl hoverPiece;
 | 
			
		||||
    private OutlineOEControl hoverPiece;
 | 
			
		||||
 | 
			
		||||
    private boolean clickAllowed = true;
 | 
			
		||||
 | 
			
		||||
@@ -61,13 +56,13 @@ public class InputSynchronizer {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void update(float tpf) {
 | 
			
		||||
        if(isRotateLeft && isRotateRight) {
 | 
			
		||||
        if (isRotateLeft && isRotateRight) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if(isRotateLeft) {
 | 
			
		||||
        if (isRotateLeft) {
 | 
			
		||||
            rotationAngle += 180 * tpf;
 | 
			
		||||
        }
 | 
			
		||||
        if(isRotateRight) {
 | 
			
		||||
        if (isRotateRight) {
 | 
			
		||||
            rotationAngle -= 180 * tpf;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -94,6 +89,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.
 | 
			
		||||
@@ -110,33 +106,25 @@ public void onAction(String name, boolean isPressed, float tpf) {
 | 
			
		||||
            if (name.equals("RotateRightMouse")) {
 | 
			
		||||
                rightMousePressed = isPressed;
 | 
			
		||||
            }
 | 
			
		||||
            if(name.equals("Click") && isPressed) {
 | 
			
		||||
                if(!clickAllowed) {
 | 
			
		||||
            if (name.equals("Click") && isPressed) {
 | 
			
		||||
                if (!clickAllowed) {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (app.getView() instanceof GameView gameView) {
 | 
			
		||||
                    DiceControl diceSelect = checkHover(gameView.getGuiHandler().getCardLayerCamera(), gameView.getGuiHandler().getCardLayerRootNode(), DiceControl.class);
 | 
			
		||||
                    CardControl cardLayerSelect = checkHover(gameView.getGuiHandler().getCardLayerCamera(), gameView.getGuiHandler().getCardLayerRootNode(), CardControl.class);
 | 
			
		||||
                    OutlineControl boardSelect = checkHover(app.getCamera(), app.getRootNode(), OutlineControl.class);
 | 
			
		||||
                    OutlineOEControl boardSelect = checkHover(app.getCamera(), app.getRootNode(), OutlineOEControl.class);
 | 
			
		||||
 | 
			
		||||
                    if(diceSelect != null) {
 | 
			
		||||
                    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) {
 | 
			
		||||
                        if (cardLayerSelect.isSelectable()) gameView.getGuiHandler().selectCard(cardLayerSelect);
 | 
			
		||||
                    } else if (boardSelect != null) {
 | 
			
		||||
                        //boardSelect
 | 
			
		||||
                        if(boardSelect instanceof PieceControl pieceControl){
 | 
			
		||||
                            if(pieceControl.isSelectable()) gameView.getBoardHandler().pieceSelect(pieceControl);
 | 
			
		||||
                        }
 | 
			
		||||
                        if(boardSelect instanceof NodeControl nodeControl){
 | 
			
		||||
//
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    else {
 | 
			
		||||
                        gameView.getBoardHandler().pieceSelect(boardSelect);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        //both null
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
@@ -149,14 +137,14 @@ else if(boardSelect != null) {
 | 
			
		||||
            if (name.equals("Right")) {
 | 
			
		||||
                isRotateRight = !isRotateRight;
 | 
			
		||||
            }
 | 
			
		||||
            if(name.equals("Test2") &&isPressed){
 | 
			
		||||
                if(app.getView() instanceof GameView gameView){
 | 
			
		||||
            if (name.equals("Test2") && isPressed) {
 | 
			
		||||
                if (app.getView() instanceof GameView gameView) {
 | 
			
		||||
 | 
			
		||||
                    if(p == null) {
 | 
			
		||||
                    if (p == null) {
 | 
			
		||||
                        p = UUID.randomUUID();
 | 
			
		||||
                        gameView.getBoardHandler().addPlayer(Color.AIRFORCE,List.of(p,UUID.randomUUID(),UUID.randomUUID(),UUID.randomUUID()));
 | 
			
		||||
                        gameView.getBoardHandler().movePieceStartAnim(p,0);
 | 
			
		||||
                        gameView.getBoardHandler().outlineMove(List.of(p),List.of(2),List.of(false));
 | 
			
		||||
                        gameView.getBoardHandler().addPlayer(Color.AIRFORCE, List.of(p, UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID()));
 | 
			
		||||
                        gameView.getBoardHandler().movePieceStartAnim(p, 0);
 | 
			
		||||
                        gameView.getBoardHandler().outlineMove(List.of(p), List.of(2), List.of(false));
 | 
			
		||||
                        //gameView.getBoardHandler().movePieceAnim(p,0, 8);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        gameView.getBoardHandler().throwPiece(p, Color.ARMY);
 | 
			
		||||
@@ -177,7 +165,6 @@ else if(boardSelect != null) {
 | 
			
		||||
                    //gameView.getGuiHandler().playCardOwn(BonusCard.SHIELD);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -191,17 +178,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();
 | 
			
		||||
            }
 | 
			
		||||
@@ -212,12 +195,13 @@ else if (name.equals("MouseLeft") || name.equals("MouseRight") || name.equals("M
 | 
			
		||||
     * Detects the hovered piece and updates its hover state.
 | 
			
		||||
     */
 | 
			
		||||
    private <T extends AbstractControl> T checkHover(Camera cam, Node root, Class<T> controlType) {
 | 
			
		||||
        if(cam == null || root == null || controlType == null) return null;
 | 
			
		||||
        if (cam == null || root == null || controlType == null) return null;
 | 
			
		||||
        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);
 | 
			
		||||
        for (CollisionResult collisionResult : results) {
 | 
			
		||||
            if (collisionResult.getGeometry().getControl(controlType) != null)
 | 
			
		||||
                return collisionResult.getGeometry().getControl(controlType);
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
@@ -226,16 +210,16 @@ private <T extends AbstractControl> T checkHover(Camera cam, Node root, Class<T>
 | 
			
		||||
     * Detects the hovered card and updates its hover state.
 | 
			
		||||
     */
 | 
			
		||||
    private <T extends AbstractControl> T checkHoverOrtho(Camera cam, Node root, Class<T> controlType) {
 | 
			
		||||
        if(cam == null || root == null || controlType == null) return null;
 | 
			
		||||
        if (cam == null || root == null || controlType == null) return null;
 | 
			
		||||
        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) {
 | 
			
		||||
            for(CollisionResult res : results ){
 | 
			
		||||
            for (CollisionResult res : results) {
 | 
			
		||||
                T control = res.getGeometry().getControl(controlType);
 | 
			
		||||
                if(control != null) return control;
 | 
			
		||||
                if (control != null) return control;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
@@ -247,13 +231,12 @@ private <T extends AbstractControl> T checkHoverOrtho(Camera cam, Node root, Cla
 | 
			
		||||
     */
 | 
			
		||||
    private void hoverPiece() {
 | 
			
		||||
        if (app.getView() instanceof GameView gameView) {
 | 
			
		||||
            PieceControl control = checkPiece();
 | 
			
		||||
            OutlineOEControl control = checkPiece();
 | 
			
		||||
            if (control != null) {
 | 
			
		||||
                if (control != hoverPiece) {
 | 
			
		||||
                    pieceOff(gameView);
 | 
			
		||||
                    hoverPiece = control;
 | 
			
		||||
//                    hoverPiece.hover();
 | 
			
		||||
                    gameView.getBoardHandler().pieceHoverOn(hoverPiece);
 | 
			
		||||
                    if(hoverPiece.isHoverable()) gameView.getBoardHandler().hoverOn(hoverPiece);
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                pieceOff(gameView);
 | 
			
		||||
@@ -272,7 +255,7 @@ private void hoverCard() {
 | 
			
		||||
                if (control != hoverCard) {
 | 
			
		||||
                    cardOff();
 | 
			
		||||
                    hoverCard = control;
 | 
			
		||||
                    hoverCard.hover();
 | 
			
		||||
                    hoverCard.hoverOn();
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                cardOff();
 | 
			
		||||
@@ -285,8 +268,8 @@ private void hoverCard() {
 | 
			
		||||
     *
 | 
			
		||||
     * @return The PieceControl of the hovered piece, or null if no piece is hovered.
 | 
			
		||||
     */
 | 
			
		||||
    private PieceControl checkPiece() {
 | 
			
		||||
        return checkHover(app.getCamera(), app.getRootNode(), PieceControl.class);
 | 
			
		||||
    private OutlineOEControl checkPiece() {
 | 
			
		||||
        return checkHover(app.getCamera(), app.getRootNode(), OutlineOEControl.class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -297,9 +280,9 @@ private PieceControl checkPiece() {
 | 
			
		||||
     */
 | 
			
		||||
    private CardControl checkCard(GameView gameView) {
 | 
			
		||||
        return checkHoverOrtho(
 | 
			
		||||
            gameView.getGuiHandler().getCardLayerCamera(),
 | 
			
		||||
            gameView.getGuiHandler().getCardLayerRootNode(),
 | 
			
		||||
            CardControl.class
 | 
			
		||||
                gameView.getGuiHandler().getCardLayerCamera(),
 | 
			
		||||
                gameView.getGuiHandler().getCardLayerRootNode(),
 | 
			
		||||
                CardControl.class
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -308,8 +291,7 @@ private CardControl checkCard(GameView gameView) {
 | 
			
		||||
     */
 | 
			
		||||
    private void pieceOff(GameView gameView) {
 | 
			
		||||
        if (hoverPiece != null) {
 | 
			
		||||
            gameView.getBoardHandler().pieceHoverOff(hoverPiece);
 | 
			
		||||
//            hoverPiece.hoverOff();
 | 
			
		||||
            if(hoverPiece.isHoverable()) gameView.getBoardHandler().hoverOff(hoverPiece);
 | 
			
		||||
        }
 | 
			
		||||
        hoverPiece = null;
 | 
			
		||||
    }
 | 
			
		||||
@@ -344,7 +326,7 @@ public float getRotation() {
 | 
			
		||||
        return (rotationAngle / 2) % 360;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRotation(float rotationAngle){
 | 
			
		||||
    public void setRotation(float rotationAngle) {
 | 
			
		||||
        this.rotationAngle = rotationAngle;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -70,7 +88,7 @@ public class MdgaApp extends SimpleApplication {
 | 
			
		||||
    private final TimerManager timerManager = new TimerManager();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public static final int DEBUG_MULTIPLIER = 1;
 | 
			
		||||
    public static final int DEBUG_MULTIPLIER = 0;
 | 
			
		||||
 | 
			
		||||
    public MdgaApp() {
 | 
			
		||||
        networkConnection = new NetworkSupport(this);
 | 
			
		||||
@@ -87,7 +105,7 @@ public static void main(String[] args) {
 | 
			
		||||
        AppSettings settings = new AppSettings(true);
 | 
			
		||||
        settings.setSamples(128);
 | 
			
		||||
 | 
			
		||||
        if(prefs.getBoolean("fullscreen", false)) {
 | 
			
		||||
        if (prefs.getBoolean("fullscreen", false)) {
 | 
			
		||||
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
 | 
			
		||||
            int screenWidth = (int) screenSize.getWidth();
 | 
			
		||||
            int screenHeight = (int) screenSize.getHeight();
 | 
			
		||||
@@ -270,12 +288,12 @@ public ExecutorService getExecutor() {
 | 
			
		||||
        return this.executor;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ServerConnection getNetworkSupport(){
 | 
			
		||||
    public ServerConnection getNetworkSupport() {
 | 
			
		||||
        return networkConnection;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void updateResolution(int width, int height, float imageFactor, boolean isFullscreen) {
 | 
			
		||||
        if(isFullscreen) {
 | 
			
		||||
        if (isFullscreen) {
 | 
			
		||||
            int baseWidth = 1280;
 | 
			
		||||
            int baseHeight = 720;
 | 
			
		||||
            float baseAspectRatio = (float) baseWidth / baseHeight;
 | 
			
		||||
@@ -306,7 +324,7 @@ public static void restartApp() {
 | 
			
		||||
            String className = System.getProperty("sun.java.command");
 | 
			
		||||
 | 
			
		||||
            ProcessBuilder builder = new ProcessBuilder(
 | 
			
		||||
                javaBin, "-cp", classPath, className
 | 
			
		||||
                    javaBin, "-cp", classPath, className
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            builder.start();
 | 
			
		||||
@@ -326,12 +344,16 @@ public void afterGameCleanup() {
 | 
			
		||||
        ceremonyView.afterGameCleanup();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public GameView getGameView(){
 | 
			
		||||
    public GameView getGameView() {
 | 
			
		||||
        return gameView;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public TimerManager getTimerManager() {
 | 
			
		||||
        return timerManager;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public CeremonyView getCeremonyView() {
 | 
			
		||||
        return ceremonyView;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ public class ModelSynchronizer {
 | 
			
		||||
 | 
			
		||||
    private UUID a;
 | 
			
		||||
    private UUID b;
 | 
			
		||||
    private  BonusCard card;
 | 
			
		||||
    private BonusCard card;
 | 
			
		||||
    private boolean swap;
 | 
			
		||||
 | 
			
		||||
    ModelSynchronizer(MdgaApp app) {
 | 
			
		||||
@@ -23,15 +23,15 @@ public class ModelSynchronizer {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void animationEnd() {
 | 
			
		||||
        if(app.getNotificationSynchronizer().waitForAnimation) {
 | 
			
		||||
        if (app.getNotificationSynchronizer().waitForAnimation) {
 | 
			
		||||
            app.getNotificationSynchronizer().waitForAnimation = false;
 | 
			
		||||
        } else {
 | 
			
		||||
            app.getGameLogic().selectAnimationEnd();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void select(UUID a, UUID b){
 | 
			
		||||
        if(swap) selectSwap(a,b);
 | 
			
		||||
    public void select(UUID a, UUID b) {
 | 
			
		||||
        if (swap) selectSwap(a, b);
 | 
			
		||||
        else selectPiece(a);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -42,7 +42,7 @@ public void selectSwap(UUID a, UUID b) {
 | 
			
		||||
        this.b = b;
 | 
			
		||||
 | 
			
		||||
        GameView gameView = (GameView) app.getView();
 | 
			
		||||
        if(a != null && b != null) {
 | 
			
		||||
        if (a != null && b != null) {
 | 
			
		||||
            gameView.needConfirm();
 | 
			
		||||
        } else {
 | 
			
		||||
            gameView.noConfirm();
 | 
			
		||||
@@ -56,7 +56,7 @@ public void selectPiece(UUID piece) {
 | 
			
		||||
        this.a = piece;
 | 
			
		||||
 | 
			
		||||
        GameView gameView = (GameView) app.getView();
 | 
			
		||||
        if(piece != null) {
 | 
			
		||||
        if (piece != null) {
 | 
			
		||||
            gameView.needConfirm();
 | 
			
		||||
        } else {
 | 
			
		||||
            gameView.noConfirm();
 | 
			
		||||
@@ -71,7 +71,7 @@ public void selectCard(BonusCard card) {
 | 
			
		||||
 | 
			
		||||
        GameView gameView = (GameView) app.getView();
 | 
			
		||||
 | 
			
		||||
        if(card != null) {
 | 
			
		||||
        if (card != null) {
 | 
			
		||||
            gameView.needConfirm();
 | 
			
		||||
        } else {
 | 
			
		||||
            gameView.showNoPower();
 | 
			
		||||
@@ -85,7 +85,7 @@ public void confirm() {
 | 
			
		||||
 | 
			
		||||
        gameView.getGuiHandler().hideText();
 | 
			
		||||
 | 
			
		||||
        if(a != null && b != null) {
 | 
			
		||||
        if (a != null && b != null) {
 | 
			
		||||
            app.getGameLogic().selectPiece(a);
 | 
			
		||||
            app.getGameLogic().selectPiece(b);
 | 
			
		||||
            gameView.getBoardHandler().clearSelectable();
 | 
			
		||||
@@ -144,7 +144,11 @@ public void enter(MdgaState state) {
 | 
			
		||||
        //app.enter(state);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSwap(boolean swap){
 | 
			
		||||
    public void next() {
 | 
			
		||||
        app.getGameLogic().selectNext();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSwap(boolean swap) {
 | 
			
		||||
        this.swap = swap;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,13 +33,13 @@ public class NotificationSynchronizer {
 | 
			
		||||
 | 
			
		||||
    public void update() {
 | 
			
		||||
        while (timer.getTimeInSeconds() >= delay) {
 | 
			
		||||
            if(waitForAnimation) {
 | 
			
		||||
            if (waitForAnimation) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            Notification n = app.getGameLogic().getNotification();
 | 
			
		||||
 | 
			
		||||
            if(n == null) {
 | 
			
		||||
            if (n == null) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@@ -48,12 +48,12 @@ public void update() {
 | 
			
		||||
            timer.reset();
 | 
			
		||||
            delay = 0;
 | 
			
		||||
 | 
			
		||||
            if(n instanceof InfoNotification infoNotification) {
 | 
			
		||||
            if (n instanceof InfoNotification infoNotification) {
 | 
			
		||||
                app.getView().showInfo(infoNotification.getMessage(), infoNotification.isError());
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if(n != null) {
 | 
			
		||||
            if (n != null) {
 | 
			
		||||
                switch (app.getState()) {
 | 
			
		||||
                    case MAIN:
 | 
			
		||||
                        handleMain(n);
 | 
			
		||||
@@ -71,7 +71,7 @@ public void update() {
 | 
			
		||||
                        throw new RuntimeException("no notification expected: " + n.getClass().getName());
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if(0 == MdgaApp.DEBUG_MULTIPLIER) {
 | 
			
		||||
                if (0 == MdgaApp.DEBUG_MULTIPLIER) {
 | 
			
		||||
                    delay = 0;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
@@ -84,7 +84,7 @@ private void handleMain(Notification notification) {
 | 
			
		||||
        } else if (notification instanceof StartDialogNotification) {
 | 
			
		||||
            //nothing
 | 
			
		||||
        } else {
 | 
			
		||||
            throw new RuntimeException("notification not expected in main: "+ notification.getClass().getName());
 | 
			
		||||
            throw new RuntimeException("notification not expected in main: " + notification.getClass().getName());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -98,7 +98,7 @@ private void handleLobby(Notification notification) {
 | 
			
		||||
            app.enter(MdgaState.MAIN);
 | 
			
		||||
        } else if (notification instanceof TskUnselectNotification n) {
 | 
			
		||||
            lobbyView.setTaken(n.getColor(), false, false, null);
 | 
			
		||||
            } else if(notification instanceof LobbyReadyNotification lobbyReadyNotification) {
 | 
			
		||||
        } else if (notification instanceof LobbyReadyNotification lobbyReadyNotification) {
 | 
			
		||||
            lobbyView.setReady(lobbyReadyNotification.getColor(), lobbyReadyNotification.isReady());
 | 
			
		||||
        } else if (notification instanceof GameNotification n) {
 | 
			
		||||
            app.getGameView().setOwnColor(n.getOwnColor());
 | 
			
		||||
@@ -119,7 +119,7 @@ private void handleGame(Notification notification) {
 | 
			
		||||
            guiHandler.addCardOwn(n.getBonusCard());
 | 
			
		||||
            app.getAcousticHandler().playSound(MdgaSound.BONUS);
 | 
			
		||||
            delay = STANDARD_DELAY;
 | 
			
		||||
        } else if(notification instanceof RankingResponceNotification n) {
 | 
			
		||||
        } else if (notification instanceof RankingResponceNotification n) {
 | 
			
		||||
            guiHandler.hideText();
 | 
			
		||||
            n.getRankingResults().forEach((c, i) -> {
 | 
			
		||||
                guiHandler.rollRankingResult(c, i);
 | 
			
		||||
@@ -129,20 +129,19 @@ private void handleGame(Notification notification) {
 | 
			
		||||
            guiHandler.hideText();
 | 
			
		||||
            boardHandler.hideDice();
 | 
			
		||||
            gameView.getGuiHandler().setActivePlayer(n.getColor());
 | 
			
		||||
            if(n.getColor() != ownColor) boardHandler.showDice(n.getColor());
 | 
			
		||||
            if (n.getColor() != ownColor) boardHandler.showDice(n.getColor());
 | 
			
		||||
            app.getAcousticHandler().playSound(MdgaSound.UI90);
 | 
			
		||||
            delay = STANDARD_DELAY;
 | 
			
		||||
        } else if (notification instanceof CeremonyNotification ceremonyNotification) {
 | 
			
		||||
            app.enter(MdgaState.CEREMONY);
 | 
			
		||||
            CeremonyView ceremonyView = (CeremonyView) app.getView();
 | 
			
		||||
            CeremonyView ceremonyView = app.getCeremonyView();
 | 
			
		||||
            int size = ceremonyNotification.getNames().size();
 | 
			
		||||
 | 
			
		||||
            if (ceremonyNotification.getPiecesThrown().size() != size ||
 | 
			
		||||
                ceremonyNotification.getPiecesLost().size() != size ||
 | 
			
		||||
                ceremonyNotification.getBonusCardsPlayed().size() != size ||
 | 
			
		||||
                ceremonyNotification.getSixes().size() != size ||
 | 
			
		||||
                ceremonyNotification.getNodesMoved().size() != size ||
 | 
			
		||||
                ceremonyNotification.getBonusNodes().size() != size) {
 | 
			
		||||
                    ceremonyNotification.getPiecesLost().size() != size ||
 | 
			
		||||
                    ceremonyNotification.getBonusCardsPlayed().size() != size ||
 | 
			
		||||
                    ceremonyNotification.getSixes().size() != size ||
 | 
			
		||||
                    ceremonyNotification.getNodesMoved().size() != size ||
 | 
			
		||||
                    ceremonyNotification.getBonusNodes().size() != size) {
 | 
			
		||||
                throw new IllegalArgumentException("All data lists in CeremonyNotification must have the same size.");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@@ -156,9 +155,13 @@ private void handleGame(Notification notification) {
 | 
			
		||||
                int v5 = ceremonyNotification.getNodesMoved().get(i);
 | 
			
		||||
                int v6 = ceremonyNotification.getBonusNodes().get(i);
 | 
			
		||||
 | 
			
		||||
                ceremonyView.addCeremonyParticipant(color, i, name);
 | 
			
		||||
                if(i < size - 1) {
 | 
			
		||||
                    ceremonyView.addCeremonyParticipant(color, i + 1, name);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                ceremonyView.addStatisticsRow(name, v1, v2, v3, v4, v5, v6);
 | 
			
		||||
            }
 | 
			
		||||
            app.enter(MdgaState.CEREMONY);
 | 
			
		||||
        } else if (notification instanceof DiceNowNotification) {
 | 
			
		||||
            guiHandler.hideText();
 | 
			
		||||
            guiHandler.showDice();
 | 
			
		||||
@@ -173,12 +176,11 @@ private void handleGame(Notification notification) {
 | 
			
		||||
        } else if (notification instanceof InterruptNotification notification1) {
 | 
			
		||||
            gameView.enterInterrupt(notification1.getColor());
 | 
			
		||||
        } else if (notification instanceof MovePieceNotification n) {
 | 
			
		||||
            if(n.isMoveStart()) {
 | 
			
		||||
            if (n.isMoveStart()) {
 | 
			
		||||
                //StartMove
 | 
			
		||||
                boardHandler.movePieceStartAnim(n.getPiece(), n.getMoveIndex());
 | 
			
		||||
                waitForAnimation = true;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
            } else {
 | 
			
		||||
                //InfieldMove
 | 
			
		||||
                boardHandler.movePieceAnim(n.getPiece(), n.getStartIndex(), n.getMoveIndex());
 | 
			
		||||
                waitForAnimation = true;
 | 
			
		||||
@@ -190,15 +192,15 @@ private void handleGame(Notification notification) {
 | 
			
		||||
        } else if (notification instanceof RemoveShieldNotification n) {
 | 
			
		||||
            boardHandler.unshieldPiece(n.getPieceUuid());
 | 
			
		||||
        } else if (notification instanceof PlayCardNotification n) {
 | 
			
		||||
            if(n.getCard() == BonusCard.TURBO) {
 | 
			
		||||
            if (n.getCard() == BonusCard.TURBO) {
 | 
			
		||||
                app.getAcousticHandler().playSound(MdgaSound.TURBO);
 | 
			
		||||
                guiHandler.turbo();
 | 
			
		||||
            } else if(n.getCard() == BonusCard.SHIELD) {
 | 
			
		||||
            } else if (n.getCard() == BonusCard.SHIELD) {
 | 
			
		||||
                app.getAcousticHandler().playSound(MdgaSound.SHIELD);
 | 
			
		||||
            } else if(n.getCard() == BonusCard.SWAP) {
 | 
			
		||||
            } else if (n.getCard() == BonusCard.SWAP) {
 | 
			
		||||
                app.getAcousticHandler().playSound(MdgaSound.SWAP);
 | 
			
		||||
            }
 | 
			
		||||
            if(n.getColor() == ownColor) guiHandler.playCardOwn(n.getCard());
 | 
			
		||||
            if (n.getColor() == ownColor) guiHandler.playCardOwn(n.getCard());
 | 
			
		||||
            else guiHandler.playCardEnemy(n.getColor(), n.getCard());
 | 
			
		||||
 | 
			
		||||
            new Timer().schedule(new TimerTask() {
 | 
			
		||||
@@ -208,17 +210,16 @@ public void run() {
 | 
			
		||||
                }
 | 
			
		||||
            }, 2200 * MdgaApp.DEBUG_MULTIPLIER);
 | 
			
		||||
        } else if (notification instanceof PlayerInGameNotification n) {
 | 
			
		||||
            boardHandler.addPlayer(n.getColor(),n.getPiecesList());
 | 
			
		||||
            guiHandler.addPlayer(n.getColor(),n.getName());
 | 
			
		||||
            boardHandler.addPlayer(n.getColor(), n.getPiecesList());
 | 
			
		||||
            guiHandler.addPlayer(n.getColor(), n.getName());
 | 
			
		||||
        } else if (notification instanceof ResumeNotification) {
 | 
			
		||||
            gameView.leaveInterrupt();
 | 
			
		||||
        } else if (notification instanceof RollDiceNotification n) {
 | 
			
		||||
            gameView.getGuiHandler().hideText();
 | 
			
		||||
            if(n.getColor() == ownColor){
 | 
			
		||||
            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());
 | 
			
		||||
            }
 | 
			
		||||
@@ -243,12 +244,12 @@ public void run() {
 | 
			
		||||
        } else if (notification instanceof SelectableSwapNotification n) {
 | 
			
		||||
            boardHandler.outlineSwap(n.getOwnPieces(), n.getEnemyPieces());
 | 
			
		||||
            modelSynchronizer.setSwap(true);
 | 
			
		||||
       } else if (notification instanceof SelectableShieldNotification n) {
 | 
			
		||||
        } else if (notification instanceof SelectableShieldNotification n) {
 | 
			
		||||
            boardHandler.outlineShield(n.getPieces());
 | 
			
		||||
            modelSynchronizer.setSwap(false);
 | 
			
		||||
        } else if (notification instanceof TurboActiveNotification){
 | 
			
		||||
        } else if (notification instanceof TurboActiveNotification) {
 | 
			
		||||
            //nothing
 | 
			
		||||
        } else if (notification instanceof FinishNotification n){
 | 
			
		||||
        } else if (notification instanceof FinishNotification n) {
 | 
			
		||||
            guiHandler.finish(n.getColorFinished());
 | 
			
		||||
        } else {
 | 
			
		||||
            throw new RuntimeException("notification not expected in game: " + notification.getClass().getName());
 | 
			
		||||
 
 | 
			
		||||
@@ -3,14 +3,15 @@
 | 
			
		||||
import com.jme3.math.Vector3f;
 | 
			
		||||
 | 
			
		||||
public class Util {
 | 
			
		||||
    private Util(){}
 | 
			
		||||
    private Util() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Performs linear interpolation between two values.
 | 
			
		||||
     *
 | 
			
		||||
     * @param start The starting value.
 | 
			
		||||
     * @param end The ending value.
 | 
			
		||||
     * @param t A parameter between 0 and 1 representing the interpolation progress.
 | 
			
		||||
     * @param end   The ending value.
 | 
			
		||||
     * @param t     A parameter between 0 and 1 representing the interpolation progress.
 | 
			
		||||
     * @return The interpolated value.
 | 
			
		||||
     */
 | 
			
		||||
    public static float linInt(float start, float end, float t) {
 | 
			
		||||
@@ -23,7 +24,7 @@ public static float linInt(float start, float end, float t) {
 | 
			
		||||
     * @param p1 The initial point.
 | 
			
		||||
     * @param p2 The middle point.
 | 
			
		||||
     * @param p3 The final point.
 | 
			
		||||
     * @param t The interpolation parameter (0 <= t <= 1).
 | 
			
		||||
     * @param t  The interpolation parameter (0 <= t <= 1).
 | 
			
		||||
     * @return The interpolated point.
 | 
			
		||||
     */
 | 
			
		||||
    public static Vector3f quadInt(Vector3f p1, Vector3f p2, Vector3f p3, float t) {
 | 
			
		||||
@@ -41,7 +42,7 @@ public static Vector3f quadInt(Vector3f p1, Vector3f p2, Vector3f p3, float t) {
 | 
			
		||||
     * @param x The interpolation parameter (0 <= x <= 1).
 | 
			
		||||
     * @return The adjusted interpolation value.
 | 
			
		||||
     */
 | 
			
		||||
    public static float easeInOut(float x){
 | 
			
		||||
    public static float easeInOut(float x) {
 | 
			
		||||
        return x < 0.5 ? 4 * x * x * x : (float) (1 - Math.pow(-2 * x + 2, 3) / 2);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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,20 +229,20 @@ 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.
 | 
			
		||||
     * 3. If a scheduled track exists while a track is playing, it initiates a fade-out for the currently playing track
 | 
			
		||||
     *    and prepares for the new track to fade in.
 | 
			
		||||
     * and prepares for the new track to fade in.
 | 
			
		||||
     * 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.
 | 
			
		||||
     * 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.
 | 
			
		||||
     * 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.
 | 
			
		||||
     *
 | 
			
		||||
     * 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,23 +346,23 @@ 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
 | 
			
		||||
     *    `infadeTime` and the specified `CROSSFADE_DURATION`.
 | 
			
		||||
     * `infadeTime` and the specified `CROSSFADE_DURATION`.
 | 
			
		||||
     * 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.
 | 
			
		||||
     *
 | 
			
		||||
     * - 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.
 | 
			
		||||
@@ -402,7 +405,7 @@ private void addGameTracks() {
 | 
			
		||||
     * a new track will be scheduled to play. If the list of game tracks is empty, it will be refreshed.
 | 
			
		||||
     */
 | 
			
		||||
    private void updateGameTracks() {
 | 
			
		||||
        if(null == playing) {
 | 
			
		||||
        if (null == playing) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,14 +5,12 @@
 | 
			
		||||
public class ActionControl extends InitControl {
 | 
			
		||||
    private final Runnable runnable;
 | 
			
		||||
 | 
			
		||||
    public ActionControl(Runnable runnable){
 | 
			
		||||
    public ActionControl(Runnable runnable) {
 | 
			
		||||
        this.runnable = runnable;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    protected void action(){
 | 
			
		||||
        if(null != runnable) {
 | 
			
		||||
    protected void action() {
 | 
			
		||||
        if (null != runnable) {
 | 
			
		||||
            runnable.run();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -47,13 +47,13 @@ public Explosion(MdgaApp app, Node rootNode, Vector3f location) {
 | 
			
		||||
     * Configures the fire and smoke emitters with appearance, behavior, and lifespan.
 | 
			
		||||
     */
 | 
			
		||||
    private void initializeEmitter() {
 | 
			
		||||
        fire = new ParticleEmitter("Effect", Type.Triangle,50);
 | 
			
		||||
        fire = new ParticleEmitter("Effect", Type.Triangle, 50);
 | 
			
		||||
        fire.setMaterial(mat);
 | 
			
		||||
        fire.setImagesX(2);
 | 
			
		||||
        fire.setImagesY(2);
 | 
			
		||||
        fire.setStartColor(ColorRGBA.Yellow);
 | 
			
		||||
        fire.setEndColor(ColorRGBA.Red);
 | 
			
		||||
        fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f,0.2f,4f));
 | 
			
		||||
        fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f, 0.2f, 4f));
 | 
			
		||||
        fire.getParticleInfluencer().setVelocityVariation(0.4f);
 | 
			
		||||
        fire.setStartSize(0.7f);
 | 
			
		||||
        fire.setEndSize(1.8f);
 | 
			
		||||
@@ -64,13 +64,13 @@ private void initializeEmitter() {
 | 
			
		||||
 | 
			
		||||
        fire.setLocalTranslation(location);
 | 
			
		||||
 | 
			
		||||
        smoke = new ParticleEmitter("Effect2", Type.Triangle,40);
 | 
			
		||||
        smoke = new ParticleEmitter("Effect2", Type.Triangle, 40);
 | 
			
		||||
        smoke.setMaterial(mat);
 | 
			
		||||
        smoke.setImagesX(3);
 | 
			
		||||
        smoke.setImagesY(3);
 | 
			
		||||
        smoke.setStartColor(ColorRGBA.DarkGray);
 | 
			
		||||
        smoke.setEndColor(new ColorRGBA(0.05f, 0.05f, 0.05f, 1));
 | 
			
		||||
        smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f,0.0f,0.7f));
 | 
			
		||||
        smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f, 0.0f, 0.7f));
 | 
			
		||||
        smoke.getParticleInfluencer().setVelocityVariation(0.5f);
 | 
			
		||||
        smoke.setStartSize(0.8f);
 | 
			
		||||
        smoke.setEndSize(1.5f);
 | 
			
		||||
@@ -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) {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
@@ -38,10 +34,10 @@ public class JetAnimation {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor for the {@code JetAnimation} class.
 | 
			
		||||
     *
 | 
			
		||||
     * @param app              The main application managing the jet animation.
 | 
			
		||||
     * @param rootNode         The root node to which the jet model will be attached.
 | 
			
		||||
     * @param targetPoint      The target point where the explosion will occur.
 | 
			
		||||
     * @param curveHeight      The height of the curve for the jet's flight path.
 | 
			
		||||
     * @param app               The main application managing the jet animation.
 | 
			
		||||
     * @param rootNode          The root node to which the jet model will be attached.
 | 
			
		||||
     * @param targetPoint       The target point where the explosion will occur.
 | 
			
		||||
     * @param curveHeight       The height of the curve for the jet's flight path.
 | 
			
		||||
     * @param animationDuration The total duration of the jet animation.
 | 
			
		||||
     */
 | 
			
		||||
    public JetAnimation(MdgaApp app, Node rootNode, Vector3f targetPoint, float curveHeight, float animationDuration, Runnable actionAfter) {
 | 
			
		||||
@@ -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.
 | 
			
		||||
     */
 | 
			
		||||
@@ -106,7 +103,7 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
                elapsedTime += tpf;
 | 
			
		||||
                float progress = elapsedTime / animationDuration;
 | 
			
		||||
 | 
			
		||||
                if(elapsedTime > 4.2f) {
 | 
			
		||||
                if (elapsedTime > 4.2f) {
 | 
			
		||||
                    explosion.trigger();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@@ -127,11 +124,12 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            protected void controlRender(RenderManager rm, ViewPort vp) {}
 | 
			
		||||
            protected void controlRender(RenderManager rm, ViewPort vp) {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void endAnim(){
 | 
			
		||||
    private void endAnim() {
 | 
			
		||||
        actionAfter.run();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -23,7 +23,7 @@ public class MatrixAnimation extends ActionControl {
 | 
			
		||||
    private float timeElapsed = 0f;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private enum MatrixState{
 | 
			
		||||
    private enum MatrixState {
 | 
			
		||||
        RADAR_ON,
 | 
			
		||||
        RADAR_OFF,
 | 
			
		||||
        MATRIX_ON,
 | 
			
		||||
@@ -32,7 +32,7 @@ private enum MatrixState{
 | 
			
		||||
 | 
			
		||||
    private MatrixState state;
 | 
			
		||||
 | 
			
		||||
    public MatrixAnimation(MdgaApp app, Vector3f radarPos, Runnable runnable){
 | 
			
		||||
    public MatrixAnimation(MdgaApp app, Vector3f radarPos, Runnable runnable) {
 | 
			
		||||
        super(runnable);
 | 
			
		||||
        this.app = app;
 | 
			
		||||
        this.radarPos = radarPos;
 | 
			
		||||
@@ -48,15 +48,14 @@ protected void initSpatial() {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void controlUpdate(float tpf) {
 | 
			
		||||
        if(!init) return;
 | 
			
		||||
        if (!init) return;
 | 
			
		||||
 | 
			
		||||
        timeElapsed += tpf;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        switch(state){
 | 
			
		||||
        switch (state) {
 | 
			
		||||
            case RADAR_ON -> {
 | 
			
		||||
                if(timeElapsed >= 2f){
 | 
			
		||||
                if (timeElapsed >= 2f) {
 | 
			
		||||
                    state = MatrixState.RADAR_OFF;
 | 
			
		||||
                    timeElapsed = 0;
 | 
			
		||||
                    radarEmitter.setParticlesPerSec(0);
 | 
			
		||||
@@ -68,7 +67,7 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            case RADAR_OFF -> {
 | 
			
		||||
                if(timeElapsed >= 0.1f){
 | 
			
		||||
                if (timeElapsed >= 0.1f) {
 | 
			
		||||
                    state = MatrixState.MATRIX_ON;
 | 
			
		||||
                    timeElapsed = 0;
 | 
			
		||||
                    matrix();
 | 
			
		||||
@@ -76,12 +75,12 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            case MATRIX_ON -> {
 | 
			
		||||
                if(timeElapsed >= 3f){
 | 
			
		||||
                if (timeElapsed >= 3f) {
 | 
			
		||||
                    state = MatrixState.MATRIX_OFF;
 | 
			
		||||
                    timeElapsed = 0;
 | 
			
		||||
                    turnOff();
 | 
			
		||||
                    app.getTimerManager().addTask(3f, () -> app.enqueue(() -> {
 | 
			
		||||
                        for (ParticleEmitter particleEmitter : activeEmitter){
 | 
			
		||||
                        for (ParticleEmitter particleEmitter : activeEmitter) {
 | 
			
		||||
                            app.getRootNode().detachChild(particleEmitter);
 | 
			
		||||
                        }
 | 
			
		||||
                        System.out.println("delete particle");
 | 
			
		||||
@@ -90,7 +89,7 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            case MATRIX_OFF -> {
 | 
			
		||||
                if(timeElapsed >= 0.5f){
 | 
			
		||||
                if (timeElapsed >= 0.5f) {
 | 
			
		||||
                    init = false;
 | 
			
		||||
                    spatial.removeControl(this);
 | 
			
		||||
                    action();
 | 
			
		||||
@@ -99,13 +98,13 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void turnOff(){
 | 
			
		||||
        for (ParticleEmitter particleEmitter : activeEmitter){
 | 
			
		||||
    private void turnOff() {
 | 
			
		||||
        for (ParticleEmitter particleEmitter : activeEmitter) {
 | 
			
		||||
            particleEmitter.setParticlesPerSec(0f);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void radar(){
 | 
			
		||||
    private void radar() {
 | 
			
		||||
        Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
 | 
			
		||||
        mat.setTexture("Texture", app.getAssetManager().loadTexture("Images/particle/radar_beam.png"));
 | 
			
		||||
        ParticleEmitter emitter = new ParticleEmitter("Effect", Type.Triangle, 50);
 | 
			
		||||
@@ -123,26 +122,26 @@ private void radar(){
 | 
			
		||||
        float life = 2.6f;
 | 
			
		||||
        emitter.setLowLife(life);
 | 
			
		||||
        emitter.setHighLife(life);
 | 
			
		||||
        emitter.setLocalTranslation(radarPos.add(new Vector3f(0,0,5)));
 | 
			
		||||
        emitter.setLocalTranslation(radarPos.add(new Vector3f(0, 0, 5)));
 | 
			
		||||
        emitter.setParticlesPerSec(1.8f);
 | 
			
		||||
        app.getRootNode().attachChild(emitter);
 | 
			
		||||
        radarEmitter = emitter;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void matrix(){
 | 
			
		||||
       for(int i = 0; i < 5; i++){
 | 
			
		||||
           particleStream(
 | 
			
		||||
               generateMatrixColor(),
 | 
			
		||||
               generateMatrixColor(),
 | 
			
		||||
               getRandomFloat(0,1f),
 | 
			
		||||
               getRandomPosition(),
 | 
			
		||||
               getRandomFloat(1,2)
 | 
			
		||||
           );
 | 
			
		||||
       }
 | 
			
		||||
    private void matrix() {
 | 
			
		||||
        for (int i = 0; i < 5; i++) {
 | 
			
		||||
            particleStream(
 | 
			
		||||
                    generateMatrixColor(),
 | 
			
		||||
                    generateMatrixColor(),
 | 
			
		||||
                    getRandomFloat(0, 1f),
 | 
			
		||||
                    getRandomPosition(),
 | 
			
		||||
                    getRandomFloat(1, 2)
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private void particleStream(ColorRGBA start, ColorRGBA end, float speedVar, Vector3f pos, float spawnVar){
 | 
			
		||||
    private void particleStream(ColorRGBA start, ColorRGBA end, float speedVar, Vector3f pos, float spawnVar) {
 | 
			
		||||
        Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
 | 
			
		||||
        mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
 | 
			
		||||
        mat.setTexture("Texture", app.getAssetManager().loadTexture("Images/particle/particle_cir.png"));
 | 
			
		||||
@@ -160,7 +159,7 @@ private void particleStream(ColorRGBA start, ColorRGBA end, float speedVar, Vect
 | 
			
		||||
        matrix.setGravity(0, 0, 2f);
 | 
			
		||||
        matrix.setLowLife(3f);
 | 
			
		||||
        matrix.setHighLife(3f);
 | 
			
		||||
        matrix.setLocalTranslation(spatial.getLocalTranslation().add(pos).add(new Vector3f(0,0,15)));
 | 
			
		||||
        matrix.setLocalTranslation(spatial.getLocalTranslation().add(pos).add(new Vector3f(0, 0, 15)));
 | 
			
		||||
        matrix.setParticlesPerSec(spawnVar);
 | 
			
		||||
        app.getRootNode().attachChild(matrix);
 | 
			
		||||
        activeEmitter.add(matrix);
 | 
			
		||||
@@ -178,7 +177,7 @@ public static Vector3f getRandomPosition() {
 | 
			
		||||
        float x = radius * (float) Math.cos(angle);
 | 
			
		||||
        float y = radius * (float) Math.sin(angle);
 | 
			
		||||
 | 
			
		||||
        return new Vector3f(x,y,0);
 | 
			
		||||
        return new Vector3f(x, y, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static float getRandomFloat(float start, float end) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
@@ -42,9 +40,9 @@ public class MissileAnimation {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor for the {@code MissileAnimation} class.
 | 
			
		||||
     *
 | 
			
		||||
     * @param app       The main application managing the missile animation.
 | 
			
		||||
     * @param rootNode  The root node to which the missile model will be attached.
 | 
			
		||||
     * @param target    The target point where the missile will explode.
 | 
			
		||||
     * @param app        The main application managing the missile animation.
 | 
			
		||||
     * @param rootNode   The root node to which the missile model will be attached.
 | 
			
		||||
     * @param target     The target point where the missile will explode.
 | 
			
		||||
     * @param flightTime The total flight time of the missile.
 | 
			
		||||
     */
 | 
			
		||||
    public MissileAnimation(MdgaApp app, Node rootNode, Vector3f target, float flightTime, Runnable actionAfter) {
 | 
			
		||||
@@ -64,13 +62,13 @@ public MissileAnimation(MdgaApp app, Node rootNode, Vector3f target, float fligh
 | 
			
		||||
        this.mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
 | 
			
		||||
        mat.setTexture("Texture", app.getAssetManager().loadTexture("Images/particle/vapor_cloud.png"));
 | 
			
		||||
 | 
			
		||||
        smoke = new ParticleEmitter("Effect2", ParticleMesh.Type.Triangle,400);
 | 
			
		||||
        smoke = new ParticleEmitter("Effect2", ParticleMesh.Type.Triangle, 400);
 | 
			
		||||
        smoke.setMaterial(mat);
 | 
			
		||||
        smoke.setImagesX(3);
 | 
			
		||||
        smoke.setImagesY(3);
 | 
			
		||||
        smoke.setStartColor(ColorRGBA.DarkGray);
 | 
			
		||||
        smoke.setEndColor(new ColorRGBA(0.05f, 0.05f, 0.05f, 1));
 | 
			
		||||
        smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f,0.0f,0.0f));
 | 
			
		||||
        smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f, 0.0f, 0.0f));
 | 
			
		||||
        smoke.getParticleInfluencer().setVelocityVariation(0.1f);
 | 
			
		||||
        smoke.setStartSize(0.8f);
 | 
			
		||||
        smoke.setEndSize(1.5f);
 | 
			
		||||
@@ -120,7 +118,7 @@ private void animateMissile() {
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            protected void controlUpdate(float tpf) {
 | 
			
		||||
                if(elapsedTime > 6) {
 | 
			
		||||
                if (elapsedTime > 6) {
 | 
			
		||||
                    endAnim();
 | 
			
		||||
                    rootNode.detachChild(missileNode);
 | 
			
		||||
                    this.spatial.removeControl(this);
 | 
			
		||||
@@ -150,8 +148,8 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
                missileNode.setLocalTranslation(currentPosition);
 | 
			
		||||
 | 
			
		||||
                Vector3f direction = computeParabolicPath(start, target, progress + 0.01f)
 | 
			
		||||
                    .subtract(currentPosition)
 | 
			
		||||
                    .normalizeLocal();
 | 
			
		||||
                        .subtract(currentPosition)
 | 
			
		||||
                        .normalizeLocal();
 | 
			
		||||
                missileModel.lookAt(currentPosition.add(direction), Vector3f.UNIT_Y);
 | 
			
		||||
                missileModel.rotate(0, FastMath.HALF_PI, 0);
 | 
			
		||||
            }
 | 
			
		||||
@@ -162,16 +160,16 @@ protected void controlRender(RenderManager rm, ViewPort vp) {
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void endAnim(){
 | 
			
		||||
    private void endAnim() {
 | 
			
		||||
        actionAfter.run();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Computes a position along a parabolic path at a given progress value {@code t}.
 | 
			
		||||
     *
 | 
			
		||||
     * @param start The starting point of the missile's flight.
 | 
			
		||||
     * @param start  The starting point of the missile's flight.
 | 
			
		||||
     * @param target The target point of the missile's flight.
 | 
			
		||||
     * @param t The progress value (0.0 to 1.0) along the flight path.
 | 
			
		||||
     * @param t      The progress value (0.0 to 1.0) along the flight path.
 | 
			
		||||
     * @return The interpolated position along the parabolic path.
 | 
			
		||||
     */
 | 
			
		||||
    private Vector3f computeParabolicPath(Vector3f start, Vector3f target, float t) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -28,15 +29,15 @@ public class MoveControl extends ActionControl {
 | 
			
		||||
     * Creates a new MoveControl with specified initial and end positions, and an action to run after the movement.
 | 
			
		||||
     * The movement follows a path with a midpoint at a fixed height.
 | 
			
		||||
     *
 | 
			
		||||
     * @param initPos The starting position of the spatial.
 | 
			
		||||
     * @param endPos The target position of the spatial.
 | 
			
		||||
     * @param initPos     The starting position of the spatial.
 | 
			
		||||
     * @param endPos      The target position of the spatial.
 | 
			
		||||
     * @param actionAfter A Runnable that will be executed after the movement finishes.
 | 
			
		||||
     */
 | 
			
		||||
    public MoveControl(Vector3f initPos, Vector3f endPos, Runnable actionAfter){
 | 
			
		||||
    public MoveControl(Vector3f initPos, Vector3f endPos, Runnable actionAfter) {
 | 
			
		||||
        this(initPos, endPos, actionAfter, 2, 1, true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public MoveControl(Vector3f initPos, Vector3f endPos, Runnable actionAfter, float height, float duration, boolean easing){
 | 
			
		||||
    public MoveControl(Vector3f initPos, Vector3f endPos, Runnable actionAfter, float height, float duration, boolean easing) {
 | 
			
		||||
        super(actionAfter);
 | 
			
		||||
        moving = false;
 | 
			
		||||
        this.initPos = initPos;
 | 
			
		||||
@@ -70,7 +71,7 @@ protected void initSpatial() {
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void controlUpdate(float tpf) {
 | 
			
		||||
        if(!moving) return;
 | 
			
		||||
        if (!moving) return;
 | 
			
		||||
        timer += tpf;
 | 
			
		||||
 | 
			
		||||
        float t = timer / duration;
 | 
			
		||||
@@ -78,22 +79,20 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
 | 
			
		||||
        float interpolated = easing ? easeInOut(t) : t;
 | 
			
		||||
 | 
			
		||||
        spatial.setLocalTranslation(quadInt(initPos,middlePos,endPos, interpolated));
 | 
			
		||||
        spatial.setLocalTranslation(quadInt(initPos, middlePos, endPos, interpolated));
 | 
			
		||||
 | 
			
		||||
        if(t >= 1) end();
 | 
			
		||||
        if (t >= 1) end();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Ends the movement by stopping the interpolation, running the action after the movement,
 | 
			
		||||
     * and removing this control from the spatial.
 | 
			
		||||
     */
 | 
			
		||||
    private void end(){
 | 
			
		||||
    private void end() {
 | 
			
		||||
        moving = false;
 | 
			
		||||
        spatial.removeControl(this);
 | 
			
		||||
        action();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -30,7 +24,7 @@ public class ShellAnimation extends ActionControl {
 | 
			
		||||
    private TankTopControl tankTopControl;
 | 
			
		||||
    private MdgaApp app;
 | 
			
		||||
 | 
			
		||||
    public ShellAnimation(TankTopControl tankTopControl, MdgaApp app, Runnable actionAfter){
 | 
			
		||||
    public ShellAnimation(TankTopControl tankTopControl, MdgaApp app, Runnable actionAfter) {
 | 
			
		||||
        super(actionAfter);
 | 
			
		||||
        this.tankTopControl = tankTopControl;
 | 
			
		||||
        this.app = app;
 | 
			
		||||
@@ -44,14 +38,14 @@ protected void initSpatial() {
 | 
			
		||||
        app.getRootNode().attachChild(createShell());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Vector3f getShootPos(){
 | 
			
		||||
    private Vector3f getShootPos() {
 | 
			
		||||
        Vector3f localOffset = new Vector3f(0, -5.4f, 2.9f);
 | 
			
		||||
        Quaternion turretRotation = tankTopControl.getSpatial().getLocalRotation();
 | 
			
		||||
        Vector3f transformedOffset = turretRotation.mult(localOffset);
 | 
			
		||||
        return tankTopControl.getSpatial().getLocalTranslation().add(transformedOffset);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void shoot(){
 | 
			
		||||
    private void shoot() {
 | 
			
		||||
        app.getAcousticHandler().playSound(MdgaSound.TANK_SHOOT);
 | 
			
		||||
        Vector3f shootPos = getShootPos();
 | 
			
		||||
        createEffect(
 | 
			
		||||
@@ -71,7 +65,7 @@ private void shoot(){
 | 
			
		||||
                0.3f, 0.8f,
 | 
			
		||||
                10,
 | 
			
		||||
                0.1f, 0.35f,
 | 
			
		||||
                new ColorRGBA(0.5f,0.5f,0.5f,0.5f),
 | 
			
		||||
                new ColorRGBA(0.5f, 0.5f, 0.5f, 0.5f),
 | 
			
		||||
                ColorRGBA.Black
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
@@ -80,7 +74,7 @@ private void shoot(){
 | 
			
		||||
        shell.addControl(new ShellControl(this::hitExplosion, shootPos, spatial.getLocalTranslation(), FLYING_HEIGHT, FLYING_DURATION, app.getAssetManager()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Spatial createShell(){
 | 
			
		||||
    private Spatial createShell() {
 | 
			
		||||
        Spatial model = app.getAssetManager().loadModel(Asset.shell.getModelPath());
 | 
			
		||||
        model.scale(.16f);
 | 
			
		||||
        model.setLocalTranslation(tankTopControl.getSpatial().getLocalTranslation());
 | 
			
		||||
@@ -90,21 +84,21 @@ private Spatial createShell(){
 | 
			
		||||
        Vector3f direction = targetPos.subtract(shootPos).normalize();
 | 
			
		||||
 | 
			
		||||
        Quaternion rotation = new Quaternion();
 | 
			
		||||
        rotation.lookAt(direction, new Vector3f(1,0,0)); // Assuming UNIT_Y is the up vector
 | 
			
		||||
        rotation.lookAt(direction, new Vector3f(1, 0, 0)); // Assuming UNIT_Y is the up vector
 | 
			
		||||
 | 
			
		||||
        model.setLocalRotation(rotation);
 | 
			
		||||
        model.rotate(FastMath.HALF_PI,0,0);
 | 
			
		||||
        model.rotate(FastMath.HALF_PI, 0, 0);
 | 
			
		||||
 | 
			
		||||
        Material mat = new Material(app.getAssetManager(), LIGHTING);
 | 
			
		||||
        mat.setBoolean("UseMaterialColors", true);
 | 
			
		||||
        ColorRGBA color = ColorRGBA.fromRGBA255(143,117,0,255);
 | 
			
		||||
        ColorRGBA color = ColorRGBA.fromRGBA255(143, 117, 0, 255);
 | 
			
		||||
        mat.setColor("Diffuse", color);
 | 
			
		||||
        mat.setColor("Ambient", color);
 | 
			
		||||
        model.setMaterial(mat);
 | 
			
		||||
        return model;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void hitExplosion(){
 | 
			
		||||
    private void hitExplosion() {
 | 
			
		||||
        app.getAcousticHandler().playSound(MdgaSound.TANK_EXPLOSION);
 | 
			
		||||
        createEffect(
 | 
			
		||||
                spatial.getLocalTranslation().setZ(1),
 | 
			
		||||
@@ -130,7 +124,7 @@ private void createEffect(Vector3f shootPos,
 | 
			
		||||
                              float startSize, float endSize,
 | 
			
		||||
                              float velocity,
 | 
			
		||||
                              float lowLife, float highLife,
 | 
			
		||||
                              ColorRGBA start, ColorRGBA end){
 | 
			
		||||
                              ColorRGBA start, ColorRGBA end) {
 | 
			
		||||
        // Create a particle emitter for the explosion
 | 
			
		||||
        ParticleEmitter explosionEmitter = new ParticleEmitter("Explosion", ParticleMesh.Type.Triangle, 100);
 | 
			
		||||
        Material explosionMat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -18,7 +17,7 @@ public class ShellControl extends ActionControl {
 | 
			
		||||
    private ParticleEmitter emitter;
 | 
			
		||||
    private AssetManager assetManager;
 | 
			
		||||
 | 
			
		||||
    public ShellControl(Runnable runnable, Vector3f shootPos, Vector3f endPos, float height, float duration, AssetManager assetManager){
 | 
			
		||||
    public ShellControl(Runnable runnable, Vector3f shootPos, Vector3f endPos, float height, float duration, AssetManager assetManager) {
 | 
			
		||||
        super(runnable);
 | 
			
		||||
        this.shootPos = shootPos;
 | 
			
		||||
        this.endPos = endPos;
 | 
			
		||||
@@ -32,7 +31,7 @@ protected void initSpatial() {
 | 
			
		||||
        spatial.addControl(new MoveControl(
 | 
			
		||||
                shootPos,
 | 
			
		||||
                endPos,
 | 
			
		||||
                ()->{
 | 
			
		||||
                () -> {
 | 
			
		||||
                    emitter.killAllParticles();
 | 
			
		||||
                    emitter.setParticlesPerSec(0);
 | 
			
		||||
                    emitter.removeFromParent();
 | 
			
		||||
@@ -80,7 +79,7 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
        Vector3f direction = spatial.getLocalTranslation().subtract(oldPos).normalize();
 | 
			
		||||
        if (direction.lengthSquared() > 0) {
 | 
			
		||||
            spatial.getLocalRotation().lookAt(direction, Vector3f.UNIT_X);
 | 
			
		||||
            spatial.rotate(FastMath.HALF_PI,0,0);
 | 
			
		||||
            spatial.rotate(FastMath.HALF_PI, 0, 0);
 | 
			
		||||
        }
 | 
			
		||||
        oldPos = spatial.getLocalTranslation().clone();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -43,11 +43,11 @@ public Smoke(MdgaApp app, Node rootNode, Vector3f location) {
 | 
			
		||||
     * Configures the fire and smoke emitters with appearance, behavior, and lifespan.
 | 
			
		||||
     */
 | 
			
		||||
    private void initializeEmitter() {
 | 
			
		||||
        fire = new ParticleEmitter("Effect", ParticleMesh.Type.Triangle,50);
 | 
			
		||||
        fire = new ParticleEmitter("Effect", ParticleMesh.Type.Triangle, 50);
 | 
			
		||||
        fire.setMaterial(mat);
 | 
			
		||||
        fire.setStartColor(ColorRGBA.DarkGray);
 | 
			
		||||
        fire.setEndColor(ColorRGBA.DarkGray);
 | 
			
		||||
        fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f,0.2f,4f));
 | 
			
		||||
        fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f, 0.2f, 4f));
 | 
			
		||||
        fire.getParticleInfluencer().setVelocityVariation(0.4f);
 | 
			
		||||
        fire.setStartSize(0.7f);
 | 
			
		||||
        fire.setEndSize(3.8f);
 | 
			
		||||
@@ -58,13 +58,13 @@ private void initializeEmitter() {
 | 
			
		||||
 | 
			
		||||
        fire.setLocalTranslation(location);
 | 
			
		||||
 | 
			
		||||
        smoke = new ParticleEmitter("Effect2", ParticleMesh.Type.Triangle,40);
 | 
			
		||||
        smoke = new ParticleEmitter("Effect2", ParticleMesh.Type.Triangle, 40);
 | 
			
		||||
        smoke.setMaterial(mat);
 | 
			
		||||
        smoke.setImagesX(2);
 | 
			
		||||
        smoke.setImagesY(2);
 | 
			
		||||
        smoke.setStartColor(ColorRGBA.DarkGray);
 | 
			
		||||
        smoke.setEndColor(new ColorRGBA(0.05f, 0.05f, 0.05f, 1));
 | 
			
		||||
        smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f,0.0f,2f));
 | 
			
		||||
        smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f, 0.0f, 2f));
 | 
			
		||||
        smoke.getParticleInfluencer().setVelocityVariation(0.5f);
 | 
			
		||||
        smoke.setStartSize(0.5f);
 | 
			
		||||
        smoke.setEndSize(1.5f);
 | 
			
		||||
@@ -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) {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -172,8 +172,8 @@ public void turbo() {
 | 
			
		||||
     * Performs linear interpolation between two values.
 | 
			
		||||
     *
 | 
			
		||||
     * @param start The starting value.
 | 
			
		||||
     * @param end The target value.
 | 
			
		||||
     * @param t The interpolation parameter (0 <= t <= 1).
 | 
			
		||||
     * @param end   The target value.
 | 
			
		||||
     * @param t     The interpolation parameter (0 <= t <= 1).
 | 
			
		||||
     * @return The interpolated value.
 | 
			
		||||
     */
 | 
			
		||||
    private static float lerp(float start, float end, float t) {
 | 
			
		||||
 
 | 
			
		||||
@@ -17,8 +17,8 @@ public class ZoomControl extends InitControl {
 | 
			
		||||
    private float zoomFactor = 1f;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
      * Constructs a new ZoomControl with the default zoom speed.
 | 
			
		||||
      */
 | 
			
		||||
     * Constructs a new ZoomControl with the default zoom speed.
 | 
			
		||||
     */
 | 
			
		||||
    public ZoomControl() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -78,8 +78,8 @@ private void end() {
 | 
			
		||||
     * Performs linear interpolation between two values.
 | 
			
		||||
     *
 | 
			
		||||
     * @param start The starting value.
 | 
			
		||||
     * @param end The target value.
 | 
			
		||||
     * @param t The interpolation parameter (0 <= t <= 1).
 | 
			
		||||
     * @param end   The target value.
 | 
			
		||||
     * @param t     The interpolation parameter (0 <= t <= 1).
 | 
			
		||||
     * @return The interpolated value.
 | 
			
		||||
     */
 | 
			
		||||
    private static float lerp(float start, float end, float t) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -16,6 +15,7 @@
 | 
			
		||||
import pp.mdga.client.animation.*;
 | 
			
		||||
import pp.mdga.client.gui.DiceControl;
 | 
			
		||||
import pp.mdga.game.Color;
 | 
			
		||||
import pp.mdga.game.Piece;
 | 
			
		||||
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
@@ -66,13 +66,13 @@ public class BoardHandler {
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a new BoardHandler.
 | 
			
		||||
     *
 | 
			
		||||
     * @param app The main application instance
 | 
			
		||||
     * @param app      The main application instance
 | 
			
		||||
     * @param rootNode The root node where the board will be attached
 | 
			
		||||
     * @param fpp The post-processor for effects like shadows or filters
 | 
			
		||||
     * @param fpp      The post-processor for effects like shadows or filters
 | 
			
		||||
     * @throws RuntimeException if the app is null
 | 
			
		||||
     */
 | 
			
		||||
    public BoardHandler(MdgaApp app, Node rootNode, FilterPostProcessor fpp) {
 | 
			
		||||
        if(app == null) throw new RuntimeException("app is null");
 | 
			
		||||
        if (app == null) throw new RuntimeException("app is null");
 | 
			
		||||
 | 
			
		||||
        this.app = app;
 | 
			
		||||
        this.fpp = fpp;
 | 
			
		||||
@@ -99,7 +99,7 @@ public void init() {
 | 
			
		||||
    /**
 | 
			
		||||
     * Shuts down the board handler by detaching all board-related nodes and clearing selected pieces.
 | 
			
		||||
     */
 | 
			
		||||
    public void shutdown(){
 | 
			
		||||
    public void shutdown() {
 | 
			
		||||
        clearSelectable();
 | 
			
		||||
        isInitialised = false;
 | 
			
		||||
        rootNode.detachChild(rootNodeBoard);
 | 
			
		||||
@@ -108,7 +108,7 @@ public void shutdown(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Adds an asset to the map of player assets, ensuring that the player does not have too many assets.
 | 
			
		||||
     *
 | 
			
		||||
     * @param col The color of the player
 | 
			
		||||
     * @param col        The color of the player
 | 
			
		||||
     * @param assetOnMap The asset to be added
 | 
			
		||||
     * @throws RuntimeException if there are too many assets for the player
 | 
			
		||||
     */
 | 
			
		||||
@@ -129,7 +129,7 @@ private void initMap() {
 | 
			
		||||
        waitingPiecesMap = new HashMap<>();
 | 
			
		||||
        pieceColor = new HashMap<>();
 | 
			
		||||
        diceControl = new DiceControl(app.getAssetManager());
 | 
			
		||||
        diceControl.create(new Vector3f(0,0,0), 0.7f, true);
 | 
			
		||||
        diceControl.create(new Vector3f(0, 0, 0), 0.7f, true);
 | 
			
		||||
        waitingNodes = new HashMap<>();
 | 
			
		||||
        waitingNodes.put(Color.AIRFORCE, new HashMap<>());
 | 
			
		||||
        waitingNodes.put(Color.ARMY, new HashMap<>());
 | 
			
		||||
@@ -146,7 +146,7 @@ private void initMap() {
 | 
			
		||||
                case cir -> addFigureToPlayerMap(assetToColor(Asset.cir), assetOnMap);
 | 
			
		||||
                case marine -> addFigureToPlayerMap(assetToColor(Asset.marine), assetOnMap);
 | 
			
		||||
                case node_normal, node_bonus, node_start ->
 | 
			
		||||
                    infield.add(displayAndControl(assetOnMap, new NodeControl(app, fpp)));
 | 
			
		||||
                        infield.add(displayAndControl(assetOnMap, new NodeControl(app, fpp)));
 | 
			
		||||
                case node_home_black -> addHomeNode(homeNodesMap, Color.AIRFORCE, assetOnMap);
 | 
			
		||||
                case node_home_blue -> addHomeNode(homeNodesMap, Color.NAVY, assetOnMap);
 | 
			
		||||
                case node_home_green -> addHomeNode(homeNodesMap, Color.ARMY, assetOnMap);
 | 
			
		||||
@@ -194,8 +194,8 @@ private Color assetToColor(Asset asset) {
 | 
			
		||||
     * Creates a 3D model of an asset and adds it to the board.
 | 
			
		||||
     *
 | 
			
		||||
     * @param asset The asset to be displayed
 | 
			
		||||
     * @param pos The position of the asset on the board
 | 
			
		||||
     * @param rot The rotation of the asset
 | 
			
		||||
     * @param pos   The position of the asset on the board
 | 
			
		||||
     * @param rot   The rotation of the asset
 | 
			
		||||
     * @return The Spatial representation of the asset
 | 
			
		||||
     */
 | 
			
		||||
    private Spatial createModel(Asset asset, Vector3f pos, float rot) {
 | 
			
		||||
@@ -262,19 +262,19 @@ private <T extends AbstractControl> T displayAndControl(AssetOnMap assetOnMap, T
 | 
			
		||||
     * @param pieceControl The control managing the piece to be moved.
 | 
			
		||||
     * @param nodeControl  The control managing the target node to which the piece will move.
 | 
			
		||||
     */
 | 
			
		||||
    private void movePieceToNode(PieceControl pieceControl, NodeControl nodeControl){
 | 
			
		||||
    private void movePieceToNode(PieceControl pieceControl, NodeControl nodeControl) {
 | 
			
		||||
        pieceControl.setLocation(nodeControl.getLocation());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Adds a home node for a specific player color, attaching it to the map of home nodes.
 | 
			
		||||
     *
 | 
			
		||||
     * @param map          The map storing lists of home nodes by player color.
 | 
			
		||||
     * @param color        The color associated with the home nodes to be added.
 | 
			
		||||
     * @param assetOnMap   The asset representing the home node in the 3D environment.
 | 
			
		||||
     * @param map        The map storing lists of home nodes by player color.
 | 
			
		||||
     * @param color      The color associated with the home nodes to be added.
 | 
			
		||||
     * @param assetOnMap The asset representing the home node in the 3D environment.
 | 
			
		||||
     * @throws RuntimeException if more than 4 home nodes are added for a single color.
 | 
			
		||||
     */
 | 
			
		||||
    private void addHomeNode(Map<Color, List<NodeControl>> map, Color color, AssetOnMap assetOnMap){
 | 
			
		||||
    private void addHomeNode(Map<Color, List<NodeControl>> map, Color color, AssetOnMap assetOnMap) {
 | 
			
		||||
        List<NodeControl> homeNodes = addItemToMapList(map, color, displayAndControl(assetOnMap, new NodeControl(app, fpp)));
 | 
			
		||||
        if (homeNodes.size() > 4) throw new RuntimeException("too many homeNodes for " + color);
 | 
			
		||||
    }
 | 
			
		||||
@@ -290,19 +290,19 @@ private float getRotationMove(Vector3f prev, Vector3f next) {
 | 
			
		||||
        Vector3f direction = next.subtract(prev).normalizeLocal();
 | 
			
		||||
        //I had to reverse dir.y, because then it worked.
 | 
			
		||||
        float newRot = (float) Math.toDegrees(Math.atan2(direction.x, -direction.y));
 | 
			
		||||
        if(newRot < 0) newRot += 360;
 | 
			
		||||
        if (newRot < 0) newRot += 360;
 | 
			
		||||
        return newRot;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
        * Recursively moves a piece from its current index to the destination index,
 | 
			
		||||
        * to keep track of the piece rotation.
 | 
			
		||||
        *
 | 
			
		||||
        * @param uuid The UUID of the piece to move.
 | 
			
		||||
        * @param curIndex The current index of the piece.
 | 
			
		||||
        * @param moveIndex The target index to move the piece to.
 | 
			
		||||
     * Recursively moves a piece from its current index to the destination index,
 | 
			
		||||
     * to keep track of the piece rotation.
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid      The UUID of the piece to move.
 | 
			
		||||
     * @param curIndex  The current index of the piece.
 | 
			
		||||
     * @param moveIndex The target index to move the piece to.
 | 
			
		||||
     */
 | 
			
		||||
    private void movePieceRek(UUID uuid, int curIndex, int moveIndex){
 | 
			
		||||
    private void movePieceRek(UUID uuid, int curIndex, int moveIndex) {
 | 
			
		||||
        if (curIndex == moveIndex) return;
 | 
			
		||||
 | 
			
		||||
        int nextIndex = (curIndex + 1) % infield.size();
 | 
			
		||||
@@ -311,7 +311,7 @@ private void movePieceRek(UUID uuid, int curIndex, int moveIndex){
 | 
			
		||||
        NodeControl nodeCur = infield.get(curIndex);
 | 
			
		||||
        NodeControl nodeMove = infield.get(nextIndex);
 | 
			
		||||
 | 
			
		||||
        pieceControl.setRotation(getRotationMove(nodeCur.getLocation(),nodeMove.getLocation()));
 | 
			
		||||
        pieceControl.setRotation(getRotationMove(nodeCur.getLocation(), nodeMove.getLocation()));
 | 
			
		||||
 | 
			
		||||
        movePieceToNode(pieceControl, nodeMove);
 | 
			
		||||
 | 
			
		||||
@@ -329,7 +329,7 @@ private void movePieceRek(UUID uuid, int curIndex, int moveIndex){
 | 
			
		||||
     * @param <E>  The type of the key in the map.
 | 
			
		||||
     * @return The updated list associated with the specified key.
 | 
			
		||||
     */
 | 
			
		||||
    private <T, E> List<T> addItemToMapList(Map<E,List<T>> map, E key, T item){
 | 
			
		||||
    private <T, E> List<T> addItemToMapList(Map<E, List<T>> map, E key, T item) {
 | 
			
		||||
        List<T> list = map.getOrDefault(key, new ArrayList<>());
 | 
			
		||||
        list.add(item);
 | 
			
		||||
        map.put(key, list);
 | 
			
		||||
@@ -345,7 +345,7 @@ private <T, E> List<T> addItemToMapList(Map<E,List<T>> map, E key, T item){
 | 
			
		||||
     * @param <T>  The type of items in the list.
 | 
			
		||||
     * @param <E>  The type of the key in the map.
 | 
			
		||||
     */
 | 
			
		||||
    private <T, E> void 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);
 | 
			
		||||
@@ -357,7 +357,7 @@ private <T, E> void removeItemFromMapList(Map<E,List<T>> map, E key, T item){
 | 
			
		||||
     * @param color The color associated with the waiting nodes.
 | 
			
		||||
     * @return The mean position of the waiting nodes as a {@code Vector3f}.
 | 
			
		||||
     */
 | 
			
		||||
    private Vector3f getWaitingPos(Color color){
 | 
			
		||||
    private Vector3f getWaitingPos(Color color) {
 | 
			
		||||
        return getMeanPosition(waitingNodesMap.get(color).stream().map(NodeControl::getLocation).toList());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -381,20 +381,22 @@ public static Vector3f getMeanPosition(List<Vector3f> vectors) {
 | 
			
		||||
     * Adds a player to the game by associating a color and a list of UUIDs to corresponding assets and waiting nodes.
 | 
			
		||||
     *
 | 
			
		||||
     * @param color the color of the player
 | 
			
		||||
     * @param uuid the list of UUIDs representing the player's assets
 | 
			
		||||
     * @param uuid  the list of UUIDs representing the player's assets
 | 
			
		||||
     * @throws RuntimeException if the number of assets or waiting nodes does not match the provided UUIDs
 | 
			
		||||
     */
 | 
			
		||||
    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++){
 | 
			
		||||
        for (int i = 0; i < playerAssets.size(); i++) {
 | 
			
		||||
            AssetOnMap assetOnMap = playerAssets.get(i);
 | 
			
		||||
            UUID pieceUuid = uuid.get(i);
 | 
			
		||||
 | 
			
		||||
@@ -419,18 +421,18 @@ public void addPlayer(Color color, List<UUID> uuid) {
 | 
			
		||||
    /**
 | 
			
		||||
     * Moves a piece to its corresponding home node based on the given index.
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid the UUID of the piece to move
 | 
			
		||||
     * @param uuid  the UUID of the piece to move
 | 
			
		||||
     * @param index the index of the home node to move the piece to
 | 
			
		||||
     * @throws RuntimeException if the UUID is not mapped to a color or if the home nodes are not properly defined
 | 
			
		||||
     */
 | 
			
		||||
    private void moveHomePiece(UUID uuid, int index){
 | 
			
		||||
    private void moveHomePiece(UUID uuid, int index) {
 | 
			
		||||
 | 
			
		||||
        Color color = pieceColor.get(uuid);
 | 
			
		||||
        if(color == null) throw new RuntimeException("uuid is not mapped to a color");
 | 
			
		||||
        if (color == null) throw new RuntimeException("uuid is not mapped to a color");
 | 
			
		||||
 | 
			
		||||
        List<NodeControl> homeNodes = homeNodesMap.get(color);
 | 
			
		||||
 | 
			
		||||
        if(homeNodesMap.size() != 4) throw new RuntimeException("HomeNodes for" + color + " are not properly defined");
 | 
			
		||||
        if (homeNodesMap.size() != 4) throw new RuntimeException("HomeNodes for" + color + " are not properly defined");
 | 
			
		||||
 | 
			
		||||
        PieceControl pieceControl = pieces.get(uuid);
 | 
			
		||||
        NodeControl nodeControl = homeNodes.get(index);
 | 
			
		||||
@@ -438,7 +440,7 @@ private void moveHomePiece(UUID uuid, int index){
 | 
			
		||||
 | 
			
		||||
        //rotate piece in direction of homeNodes
 | 
			
		||||
        NodeControl firstHomeNode = homeNodes.get(0);
 | 
			
		||||
        NodeControl lastHomeNode = homeNodes.get(homeNodes.size()-1);
 | 
			
		||||
        NodeControl lastHomeNode = homeNodes.get(homeNodes.size() - 1);
 | 
			
		||||
 | 
			
		||||
        pieceControl.setRotation(getRotationMove(firstHomeNode.getLocation(), lastHomeNode.getLocation()));
 | 
			
		||||
        app.getModelSynchronize().animationEnd();
 | 
			
		||||
@@ -448,12 +450,12 @@ private void moveHomePiece(UUID uuid, int index){
 | 
			
		||||
    /**
 | 
			
		||||
     * Starts the movement of a piece to a target node based on the given index.
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid the UUID of the piece to move
 | 
			
		||||
     * @param uuid      the UUID of the piece to move
 | 
			
		||||
     * @param nodeIndex the index of the target node to move the piece to
 | 
			
		||||
     * @throws RuntimeException if the UUID is not mapped to a color or the piece control is not found
 | 
			
		||||
     * @throws RuntimeException         if the UUID is not mapped to a color or the piece control is not found
 | 
			
		||||
     * @throws IllegalArgumentException if the node index is invalid
 | 
			
		||||
     */
 | 
			
		||||
    private void movePieceStart(UUID uuid, int nodeIndex){
 | 
			
		||||
    private void movePieceStart(UUID uuid, int nodeIndex) {
 | 
			
		||||
 | 
			
		||||
        // Farbe des Pieces abrufen
 | 
			
		||||
        Color color = pieceColor.get(uuid);
 | 
			
		||||
@@ -480,11 +482,11 @@ private void movePieceStart(UUID uuid, int nodeIndex){
 | 
			
		||||
    /**
 | 
			
		||||
     * Moves a piece from its current position to the target position based on the given indexes.
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid the UUID of the piece to move
 | 
			
		||||
     * @param curIndex the current index of the piece
 | 
			
		||||
     * @param uuid      the UUID of the piece to move
 | 
			
		||||
     * @param curIndex  the current index of the piece
 | 
			
		||||
     * @param moveIndex the target index of the move
 | 
			
		||||
     */
 | 
			
		||||
    private void movePiece(UUID uuid, int curIndex, int moveIndex){
 | 
			
		||||
    private void movePiece(UUID uuid, int curIndex, int moveIndex) {
 | 
			
		||||
 | 
			
		||||
        movePieceRek(uuid, curIndex, moveIndex);
 | 
			
		||||
        app.getModelSynchronize().animationEnd();
 | 
			
		||||
@@ -497,7 +499,7 @@ private void movePiece(UUID uuid, int curIndex, int moveIndex){
 | 
			
		||||
     * @param uuid the UUID of the piece to throw
 | 
			
		||||
     * @throws RuntimeException if the UUID is not mapped to a color or if no available waiting nodes are found
 | 
			
		||||
     */
 | 
			
		||||
    private void throwPiece(UUID uuid){
 | 
			
		||||
    private void throwPiece(UUID uuid) {
 | 
			
		||||
 | 
			
		||||
        // Farbe des Pieces abrufen
 | 
			
		||||
        Color color = pieceColor.get(uuid);
 | 
			
		||||
@@ -531,7 +533,7 @@ private void throwPiece(UUID uuid){
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid the UUID of the piece to shield
 | 
			
		||||
     */
 | 
			
		||||
    public void shieldPiece(UUID uuid){
 | 
			
		||||
    public void shieldPiece(UUID uuid) {
 | 
			
		||||
        pieces.get(uuid).activateShield();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -540,7 +542,7 @@ public void shieldPiece(UUID uuid){
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid the UUID of the piece to unshield
 | 
			
		||||
     */
 | 
			
		||||
    public void unshieldPiece(UUID uuid){
 | 
			
		||||
    public void unshieldPiece(UUID uuid) {
 | 
			
		||||
        pieces.get(uuid).deactivateShield();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -549,7 +551,7 @@ public void unshieldPiece(UUID uuid){
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid the UUID of the piece to suppress the shield
 | 
			
		||||
     */
 | 
			
		||||
    public void suppressShield(UUID uuid){
 | 
			
		||||
    public void suppressShield(UUID uuid) {
 | 
			
		||||
 | 
			
		||||
        pieces.get(uuid).suppressShield();
 | 
			
		||||
    }
 | 
			
		||||
@@ -557,14 +559,14 @@ public void suppressShield(UUID uuid){
 | 
			
		||||
    /**
 | 
			
		||||
     * Swaps the positions and rotations of two pieces.
 | 
			
		||||
     *
 | 
			
		||||
     * @param p1 the first piece to swap
 | 
			
		||||
     * @param p2 the second piece to swap
 | 
			
		||||
     * @param p1   the first piece to swap
 | 
			
		||||
     * @param p2   the second piece to swap
 | 
			
		||||
     * @param loc1 the original location of the first piece
 | 
			
		||||
     * @param rot1 the original rotation of the first piece
 | 
			
		||||
     * @param loc2 the original location of the second piece
 | 
			
		||||
     * @param rot2 the original rotation of the second piece
 | 
			
		||||
     */
 | 
			
		||||
    private void swapPieces(PieceControl p1, PieceControl p2, Vector3f loc1, float rot1, Vector3f loc2, float rot2){
 | 
			
		||||
    private void swapPieces(PieceControl p1, PieceControl p2, Vector3f loc1, float rot1, Vector3f loc2, float rot2) {
 | 
			
		||||
        p1.setLocation(loc2);
 | 
			
		||||
        p2.setLocation(loc1);
 | 
			
		||||
 | 
			
		||||
@@ -577,13 +579,14 @@ private void swapPieces(PieceControl p1, PieceControl p2, Vector3f loc1, float r
 | 
			
		||||
    /**
 | 
			
		||||
     * Outlines the possible move nodes for a list of pieces based on the move indices and whether it's a home move.
 | 
			
		||||
     *
 | 
			
		||||
     * @param pieces the list of UUIDs representing the pieces to outline
 | 
			
		||||
     * @param pieces     the list of UUIDs representing the pieces to outline
 | 
			
		||||
     * @param moveIndexe the list of indices for the target move nodes
 | 
			
		||||
     * @param homeMoves the list indicating whether the move is a home move
 | 
			
		||||
     * @param homeMoves  the list indicating whether the move is a home move
 | 
			
		||||
     * @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,14 +601,11 @@ 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();
 | 
			
		||||
            pieceControl.highlight(false);
 | 
			
		||||
            pieceControl.setHoverable(true);
 | 
			
		||||
            pieceControl.setSelectable(true);
 | 
			
		||||
            pieceControl.selectableOwn();
 | 
			
		||||
            nodeControl.selectableOwn();
 | 
			
		||||
            outlineNodes.add(nodeControl);
 | 
			
		||||
            selectableOwnPieces.add(pieceControl);
 | 
			
		||||
            selectedPieceNodeMap.put(pieceControl, nodeControl);
 | 
			
		||||
@@ -615,28 +615,24 @@ public void outlineMove(List<UUID> pieces, List<Integer> moveIndexe, List<Boolea
 | 
			
		||||
    /**
 | 
			
		||||
     * Outlines the pieces that can be swapped based on the provided own and enemy pieces.
 | 
			
		||||
     *
 | 
			
		||||
     * @param ownPieces the list of UUIDs representing the player's pieces
 | 
			
		||||
     * @param ownPieces   the list of UUIDs representing the player's pieces
 | 
			
		||||
     * @param enemyPieces the list of UUIDs representing the enemy's pieces
 | 
			
		||||
     */
 | 
			
		||||
    public void outlineSwap(List<UUID> ownPieces, List<UUID> enemyPieces){
 | 
			
		||||
    public void outlineSwap(List<UUID> ownPieces, List<UUID> enemyPieces) {
 | 
			
		||||
 | 
			
		||||
        selectableEnemyPieces.clear();
 | 
			
		||||
        selectableOwnPieces.clear();
 | 
			
		||||
        selectedOwnPiece = null;
 | 
			
		||||
        selectedEnemyPiece = null;
 | 
			
		||||
 | 
			
		||||
        for(UUID uuid : ownPieces) {
 | 
			
		||||
        for (UUID uuid : ownPieces) {
 | 
			
		||||
            PieceControl p = pieces.get(uuid);
 | 
			
		||||
            p.highlight(false);
 | 
			
		||||
            p.setHoverable(true);
 | 
			
		||||
            p.setSelectable(true);
 | 
			
		||||
            p.selectableOwn();
 | 
			
		||||
            selectableOwnPieces.add(p);
 | 
			
		||||
        }
 | 
			
		||||
        for(UUID uuid : enemyPieces) {
 | 
			
		||||
        for (UUID uuid : enemyPieces) {
 | 
			
		||||
            PieceControl p = pieces.get(uuid);
 | 
			
		||||
            p.highlight(true);
 | 
			
		||||
            p.setHoverable(true);
 | 
			
		||||
            p.setSelectable(true);
 | 
			
		||||
            p.selectableOff();
 | 
			
		||||
            selectableEnemyPieces.add(p);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -646,17 +642,15 @@ public void outlineSwap(List<UUID> ownPieces, List<UUID> enemyPieces){
 | 
			
		||||
     *
 | 
			
		||||
     * @param pieces the list of UUIDs representing the pieces to be shielded
 | 
			
		||||
     */
 | 
			
		||||
    public void outlineShield(List<UUID> pieces){
 | 
			
		||||
    public void outlineShield(List<UUID> pieces) {
 | 
			
		||||
        selectableOwnPieces.clear();
 | 
			
		||||
        selectableEnemyPieces.clear();
 | 
			
		||||
        selectedOwnPiece = null;
 | 
			
		||||
        selectedEnemyPiece = null;
 | 
			
		||||
 | 
			
		||||
        for (UUID uuid : pieces){
 | 
			
		||||
        for (UUID uuid : pieces) {
 | 
			
		||||
            PieceControl p = this.pieces.get(uuid);
 | 
			
		||||
            p.highlight(false);
 | 
			
		||||
            p.setHoverable(true);
 | 
			
		||||
            p.setSelectable(true);
 | 
			
		||||
            p.selectableOwn();
 | 
			
		||||
            selectableOwnPieces.add(p);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -666,73 +660,83 @@ public void outlineShield(List<UUID> pieces){
 | 
			
		||||
     *
 | 
			
		||||
     * @param pieceSelected the PieceControl instance representing the piece selected by the user
 | 
			
		||||
     */
 | 
			
		||||
    public void pieceSelect(PieceControl pieceSelected) {
 | 
			
		||||
        boolean isSelected = pieceSelected.isSelected();
 | 
			
		||||
        if(selectableOwnPieces.contains(pieceSelected)){
 | 
			
		||||
            for(PieceControl p : selectableOwnPieces) {
 | 
			
		||||
                p.unSelect();
 | 
			
		||||
                if(selectedPieceNodeMap.get(p) != null) selectedPieceNodeMap.get(p).unSelect();
 | 
			
		||||
    public void pieceSelect(OutlineOEControl selected) {
 | 
			
		||||
        PieceControl piece = getPieceByOE(selected);
 | 
			
		||||
        NodeControl node = selectedPieceNodeMap.get(piece);
 | 
			
		||||
 | 
			
		||||
        boolean isSelected = piece.isSelected();
 | 
			
		||||
        if (selectableOwnPieces.contains(piece)) {
 | 
			
		||||
            for (PieceControl p : selectableOwnPieces) {
 | 
			
		||||
                p.selectOff();
 | 
			
		||||
                NodeControl n = selectedPieceNodeMap.get(p);
 | 
			
		||||
                if (n != null) n.selectOff();
 | 
			
		||||
            }
 | 
			
		||||
            if (!isSelected) {
 | 
			
		||||
                pieceSelected.select();
 | 
			
		||||
                if(selectedPieceNodeMap.get(pieceSelected) != null) selectedPieceNodeMap.get(pieceSelected).select();
 | 
			
		||||
                selectedOwnPiece = pieceSelected;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                pieceSelected.unSelect();
 | 
			
		||||
                if(selectedPieceNodeMap.get(pieceSelected) != null) selectedPieceNodeMap.get(pieceSelected).unSelect();
 | 
			
		||||
                piece.selectOn();
 | 
			
		||||
                if (node != null) node.selectOn();
 | 
			
		||||
                selectedOwnPiece = piece;
 | 
			
		||||
            } else {
 | 
			
		||||
                piece.selectOff();
 | 
			
		||||
                if (node != null) node.selectOff();;
 | 
			
		||||
                selectedOwnPiece = null;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else if(selectableEnemyPieces.contains(pieceSelected)) {
 | 
			
		||||
            for(PieceControl p : selectableEnemyPieces) {
 | 
			
		||||
                p.unSelect();
 | 
			
		||||
        } else if (selectableEnemyPieces.contains(piece)) {
 | 
			
		||||
            for (PieceControl p : selectableEnemyPieces) {
 | 
			
		||||
                p.selectOff();
 | 
			
		||||
            }
 | 
			
		||||
            if (!isSelected) {
 | 
			
		||||
                pieceSelected.select();
 | 
			
		||||
                selectedEnemyPiece = pieceSelected;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                pieceSelected.unSelect();
 | 
			
		||||
                piece.selectOn();
 | 
			
		||||
                selectedEnemyPiece = piece;
 | 
			
		||||
            } else {
 | 
			
		||||
                piece.selectOff();
 | 
			
		||||
                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));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void pieceHoverOn(PieceControl hoverPiece){
 | 
			
		||||
        hoverPiece.hover();
 | 
			
		||||
        if(selectedPieceNodeMap.get(hoverPiece) != null) selectedPieceNodeMap.get(hoverPiece).hover();
 | 
			
		||||
    public void hoverOn(OutlineOEControl hover) {
 | 
			
		||||
        PieceControl piece = getPieceByOE(hover);
 | 
			
		||||
        NodeControl node = selectedPieceNodeMap.get(piece);
 | 
			
		||||
 | 
			
		||||
        piece.hoverOn();
 | 
			
		||||
        if(node != null) node.hoverOn();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void pieceHoverOff(PieceControl hoverPiece){
 | 
			
		||||
        hoverPiece.hoverOff();
 | 
			
		||||
        if(selectedPieceNodeMap.get(hoverPiece) != null) selectedPieceNodeMap.get(hoverPiece).hoverOff();
 | 
			
		||||
    public void hoverOff(OutlineOEControl hover) {
 | 
			
		||||
        PieceControl piece = getPieceByOE(hover);
 | 
			
		||||
        NodeControl node = selectedPieceNodeMap.get(piece);
 | 
			
		||||
 | 
			
		||||
        piece.hoverOff();
 | 
			
		||||
        if(node != null) node.hoverOff();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private PieceControl getPieceByOE(OutlineOEControl control){
 | 
			
		||||
        PieceControl piece;
 | 
			
		||||
        if (control instanceof PieceControl p){
 | 
			
		||||
            piece = p;
 | 
			
		||||
        }
 | 
			
		||||
        else if (control instanceof NodeControl n){
 | 
			
		||||
            piece = getKeyByValue(selectedPieceNodeMap, n);
 | 
			
		||||
        }
 | 
			
		||||
        else throw new RuntimeException("selected is not instanceof piece or node");
 | 
			
		||||
        return piece;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Clears all highlighted, selectable, and selected pieces and nodes.
 | 
			
		||||
     */
 | 
			
		||||
    public void clearSelectable(){
 | 
			
		||||
        for(PieceControl p : selectableEnemyPieces) {
 | 
			
		||||
            p.unSelect();
 | 
			
		||||
            p.unHighlight();
 | 
			
		||||
            p.setSelectable(false);
 | 
			
		||||
            p.setHoverable(false);
 | 
			
		||||
            if(selectedPieceNodeMap.get(p) != null) selectedPieceNodeMap.get(p).unSelect();
 | 
			
		||||
            if(selectedPieceNodeMap.get(p) != null) selectedPieceNodeMap.get(p).unHighlight();
 | 
			
		||||
    public void clearSelectable() {
 | 
			
		||||
        for (PieceControl p : selectableOwnPieces) {
 | 
			
		||||
            p.selectableOff();
 | 
			
		||||
            NodeControl n = selectedPieceNodeMap.get(p);
 | 
			
		||||
            if(n != null) n.selectableOff();
 | 
			
		||||
        }
 | 
			
		||||
        for(PieceControl p : selectableOwnPieces) {
 | 
			
		||||
            p.unSelect();
 | 
			
		||||
            p.unHighlight();
 | 
			
		||||
            p.setSelectable(false);
 | 
			
		||||
            p.setHoverable(false);
 | 
			
		||||
        }
 | 
			
		||||
        for(NodeControl n : outlineNodes){
 | 
			
		||||
            n.deOutline();
 | 
			
		||||
        for (PieceControl p : selectableEnemyPieces) {
 | 
			
		||||
            p.selectableOff();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        outlineNodes.clear();
 | 
			
		||||
        selectableEnemyPieces.clear();
 | 
			
		||||
        selectableOwnPieces.clear();
 | 
			
		||||
@@ -746,16 +750,16 @@ public void clearSelectable(){
 | 
			
		||||
     *
 | 
			
		||||
     * @param color the color of the player whose dice should be displayed
 | 
			
		||||
     */
 | 
			
		||||
    public void showDice(Color color){
 | 
			
		||||
    public void showDice(Color color) {
 | 
			
		||||
        rootNodeBoard.attachChild(diceControl.getSpatial());
 | 
			
		||||
        diceControl.setPos(getWaitingPos(color).add(new Vector3f(0,0,4)));
 | 
			
		||||
        diceControl.setPos(getWaitingPos(color).add(new Vector3f(0, 0, 4)));
 | 
			
		||||
        diceControl.spin();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Hides the dice from the view.
 | 
			
		||||
     */
 | 
			
		||||
    public void hideDice(){
 | 
			
		||||
    public void hideDice() {
 | 
			
		||||
        diceControl.hide();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -771,42 +775,42 @@ private <K, V> K getKeyByValue(Map<K, V> map, V value) {
 | 
			
		||||
    /**
 | 
			
		||||
     * Animates the movement of a piece from its current index to a target index.
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid the UUID of the piece to animate
 | 
			
		||||
     * @param curIndex the current index of the piece
 | 
			
		||||
     * @param uuid      the UUID of the piece to animate
 | 
			
		||||
     * @param curIndex  the current index of the piece
 | 
			
		||||
     * @param moveIndex the target index to animate the piece to
 | 
			
		||||
     */
 | 
			
		||||
    public void movePieceAnim(UUID uuid, int curIndex, int moveIndex){
 | 
			
		||||
    public void movePieceAnim(UUID uuid, int curIndex, int moveIndex) {
 | 
			
		||||
 | 
			
		||||
        pieces.get(uuid).getSpatial().addControl(new MoveControl(
 | 
			
		||||
            infield.get(curIndex).getLocation(),
 | 
			
		||||
            infield.get(moveIndex).getLocation(),
 | 
			
		||||
            ()->movePiece(uuid,curIndex,moveIndex)));
 | 
			
		||||
                infield.get(curIndex).getLocation(),
 | 
			
		||||
                infield.get(moveIndex).getLocation(),
 | 
			
		||||
                () -> movePiece(uuid, curIndex, moveIndex)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Animates the movement of a piece to its home position based on the given home index.
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid the UUID of the piece to animate
 | 
			
		||||
     * @param uuid      the UUID of the piece to animate
 | 
			
		||||
     * @param homeIndex the index of the home node to move the piece to
 | 
			
		||||
     */
 | 
			
		||||
    public void movePieceHomeAnim(UUID uuid, int homeIndex){
 | 
			
		||||
    public void movePieceHomeAnim(UUID uuid, int homeIndex) {
 | 
			
		||||
        pieces.get(uuid).getSpatial().addControl(new MoveControl(
 | 
			
		||||
            pieces.get(uuid).getLocation(),
 | 
			
		||||
            homeNodesMap.get(pieceColor.get(uuid)).get(homeIndex).getLocation(),
 | 
			
		||||
            ()->moveHomePiece(uuid,homeIndex)));
 | 
			
		||||
                pieces.get(uuid).getLocation(),
 | 
			
		||||
                homeNodesMap.get(pieceColor.get(uuid)).get(homeIndex).getLocation(),
 | 
			
		||||
                () -> moveHomePiece(uuid, homeIndex)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Animates the start of the movement of a piece to a target index.
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid the UUID of the piece to animate
 | 
			
		||||
     * @param uuid      the UUID of the piece to animate
 | 
			
		||||
     * @param moveIndex the target index to animate the piece to
 | 
			
		||||
     */
 | 
			
		||||
    public void movePieceStartAnim(UUID uuid, int moveIndex){
 | 
			
		||||
    public void movePieceStartAnim(UUID uuid, int moveIndex) {
 | 
			
		||||
        pieces.get(uuid).getSpatial().addControl(new MoveControl(
 | 
			
		||||
            pieces.get(uuid).getLocation(),
 | 
			
		||||
            infield.get(moveIndex).getLocation(),
 | 
			
		||||
            ()->movePieceStart(uuid, moveIndex)
 | 
			
		||||
                pieces.get(uuid).getLocation(),
 | 
			
		||||
                infield.get(moveIndex).getLocation(),
 | 
			
		||||
                () -> movePieceStart(uuid, moveIndex)
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -815,15 +819,15 @@ public void movePieceStartAnim(UUID uuid, int moveIndex){
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid the UUID of the piece to animate
 | 
			
		||||
     */
 | 
			
		||||
    public void throwPieceAnim(UUID uuid){
 | 
			
		||||
    public void throwPieceAnim(UUID uuid) {
 | 
			
		||||
        pieces.get(uuid).getSpatial().addControl(new MoveControl(
 | 
			
		||||
            pieces.get(uuid).getLocation(), getNextWaitingNode(pieceColor.get(uuid)).getLocation(),
 | 
			
		||||
                ()->throwPiece(uuid))
 | 
			
		||||
                pieces.get(uuid).getLocation(), getNextWaitingNode(pieceColor.get(uuid)).getLocation(),
 | 
			
		||||
                () -> throwPiece(uuid))
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void throwPiece(UUID uuid, Color throwColor){
 | 
			
		||||
        switch(throwColor){
 | 
			
		||||
    public void throwPiece(UUID uuid, Color throwColor) {
 | 
			
		||||
        switch (throwColor) {
 | 
			
		||||
            case ARMY -> throwShell(uuid);
 | 
			
		||||
            case NAVY -> throwMissile(uuid);
 | 
			
		||||
            case CYBER -> throwMatrix(uuid);
 | 
			
		||||
@@ -840,14 +844,14 @@ public void throwPiece(UUID uuid, Color throwColor){
 | 
			
		||||
    private void throwBomb(UUID uuid) {
 | 
			
		||||
        Vector3f targetPoint = pieces.get(uuid).getLocation();
 | 
			
		||||
 | 
			
		||||
        JetAnimation anim = new JetAnimation(app, rootNode, targetPoint, 40, 6, ()->throwPieceAnim(uuid));
 | 
			
		||||
        JetAnimation anim = new JetAnimation(app, rootNode, targetPoint, 40, 6, () -> throwPieceAnim(uuid));
 | 
			
		||||
        anim.start();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void throwMatrix(UUID uuid) {
 | 
			
		||||
        app.getAcousticHandler().playSound(MdgaSound.MATRIX);
 | 
			
		||||
        Spatial piece = pieces.get(uuid).getSpatial();
 | 
			
		||||
        piece.addControl(new MatrixAnimation(app, radarPos,()-> {
 | 
			
		||||
        piece.addControl(new MatrixAnimation(app, radarPos, () -> {
 | 
			
		||||
            throwPieceAnim(uuid);
 | 
			
		||||
        }));
 | 
			
		||||
    }
 | 
			
		||||
@@ -855,12 +859,12 @@ private void throwMatrix(UUID uuid) {
 | 
			
		||||
    private void throwMissile(UUID uuid) {
 | 
			
		||||
        Vector3f targetPoint = pieces.get(uuid).getLocation();
 | 
			
		||||
 | 
			
		||||
        MissileAnimation anim = new MissileAnimation(app, rootNode, targetPoint, 2f, ()->throwPieceAnim(uuid));
 | 
			
		||||
        MissileAnimation anim = new MissileAnimation(app, rootNode, targetPoint, 2f, () -> throwPieceAnim(uuid));
 | 
			
		||||
        anim.start();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void throwShell(UUID uuid) {
 | 
			
		||||
        pieces.get(uuid).getSpatial().addControl(new ShellAnimation(tankTop, app, ()-> throwPieceAnim(uuid)));
 | 
			
		||||
        pieces.get(uuid).getSpatial().addControl(new ShellAnimation(tankTop, app, () -> throwPieceAnim(uuid)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -869,7 +873,7 @@ private void throwShell(UUID uuid) {
 | 
			
		||||
     * @param piece1 the UUID of the first piece
 | 
			
		||||
     * @param piece2 the UUID of the second piece
 | 
			
		||||
     */
 | 
			
		||||
    public void swapPieceAnim(UUID piece1, UUID piece2){
 | 
			
		||||
    public void swapPieceAnim(UUID piece1, UUID piece2) {
 | 
			
		||||
        PieceControl piece1Control = pieces.get(piece1);
 | 
			
		||||
        PieceControl piece2Control = pieces.get(piece2);
 | 
			
		||||
 | 
			
		||||
@@ -879,14 +883,15 @@ public void swapPieceAnim(UUID piece1, UUID piece2){
 | 
			
		||||
        float rot2 = piece2Control.getRotation();
 | 
			
		||||
 | 
			
		||||
        piece1Control.getSpatial().addControl(new MoveControl(
 | 
			
		||||
            piece1Control.getLocation().clone(),
 | 
			
		||||
            piece2Control.getLocation().clone(),
 | 
			
		||||
            ()->{}
 | 
			
		||||
                piece1Control.getLocation().clone(),
 | 
			
		||||
                piece2Control.getLocation().clone(),
 | 
			
		||||
                () -> {
 | 
			
		||||
                }
 | 
			
		||||
        ));
 | 
			
		||||
        piece2Control.getSpatial().addControl(new MoveControl(
 | 
			
		||||
            piece2Control.getLocation().clone(),
 | 
			
		||||
            piece1Control.getLocation().clone(),
 | 
			
		||||
            ()->swapPieces(piece1Control,piece2Control,loc1,rot1,loc2,rot2)
 | 
			
		||||
                piece2Control.getLocation().clone(),
 | 
			
		||||
                piece1Control.getLocation().clone(),
 | 
			
		||||
                () -> swapPieces(piece1Control, piece2Control, loc1, rot1, loc2, rot2)
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@ public CameraHandler(MdgaApp app, FilterPostProcessor fpp) {
 | 
			
		||||
//        ssaoFilter = new SSAOFilter();
 | 
			
		||||
        fxaaFilter = new FXAAFilter();
 | 
			
		||||
 | 
			
		||||
        sky = SkyFactory.createSky(app.getAssetManager(), "Images/sky/sky.dds", EnvMapType.EquirectMap).rotate(FastMath.HALF_PI*1,0,FastMath.HALF_PI*0.2f);
 | 
			
		||||
        sky = SkyFactory.createSky(app.getAssetManager(), "Images/sky/sky.dds", EnvMapType.EquirectMap).rotate(FastMath.HALF_PI * 1, 0, FastMath.HALF_PI * 0.2f);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
@@ -94,7 +94,7 @@ public void init(Color ownColor) {
 | 
			
		||||
        init = true;
 | 
			
		||||
        initRot = true;
 | 
			
		||||
        this.ownColor = ownColor;
 | 
			
		||||
        app.getInputSynchronize().setRotation(getInitAngleByColor(ownColor)*2);
 | 
			
		||||
        app.getInputSynchronize().setRotation(getInitAngleByColor(ownColor) * 2);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -120,11 +120,11 @@ public void shutdown() {
 | 
			
		||||
     * Updates the camera position and rotation based on user input (scroll and rotation).
 | 
			
		||||
     * Adjusts the vertical angle and radius based on zoom and rotation values.
 | 
			
		||||
     *
 | 
			
		||||
     * @param scroll The scroll input, determining zoom level.
 | 
			
		||||
     * @param scroll   The scroll input, determining zoom level.
 | 
			
		||||
     * @param rotation The rotation input, determining camera orientation.
 | 
			
		||||
     */
 | 
			
		||||
    public void update(float scroll, float rotation) {
 | 
			
		||||
        if(!init) return;
 | 
			
		||||
        if (!init) return;
 | 
			
		||||
        float scrollValue = Math.max(0, Math.min(scroll, 100));
 | 
			
		||||
 | 
			
		||||
        float rotationValue = rotation % 360;
 | 
			
		||||
@@ -162,8 +162,8 @@ public void update(float scroll, float rotation) {
 | 
			
		||||
     * @param color The color used to determine the camera angle.
 | 
			
		||||
     * @return The camera angle in degrees.
 | 
			
		||||
     */
 | 
			
		||||
    private float getAngleByColor(Color color){
 | 
			
		||||
        return switch (color){
 | 
			
		||||
    private float getAngleByColor(Color color) {
 | 
			
		||||
        return switch (color) {
 | 
			
		||||
            case ARMY -> 0;
 | 
			
		||||
            case AIRFORCE -> 90;
 | 
			
		||||
            case NAVY -> 270;
 | 
			
		||||
@@ -178,7 +178,7 @@ private float getAngleByColor(Color color){
 | 
			
		||||
     * @param color The color used to determine the camera angle.
 | 
			
		||||
     * @return The initial camera angle in degrees.
 | 
			
		||||
     */
 | 
			
		||||
    private float getInitAngleByColor(Color color){
 | 
			
		||||
    private float getInitAngleByColor(Color color) {
 | 
			
		||||
        return (getAngleByColor(color) + 180) % 360;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -28,15 +28,15 @@ private MapLoader() {
 | 
			
		||||
     *
 | 
			
		||||
     * @param mapName The name of the map file to load. The file is expected to be located in the resources directory.
 | 
			
		||||
     * @return A list of {@link AssetOnMap} objects representing the assets placed on the map.
 | 
			
		||||
     * @throws IOException If an error occurs while reading the map file.
 | 
			
		||||
     * @throws IOException              If an error occurs while reading the map file.
 | 
			
		||||
     * @throws IllegalArgumentException If the map file contains invalid data.
 | 
			
		||||
     */
 | 
			
		||||
    public static List<AssetOnMap> loadMap(String mapName) {
 | 
			
		||||
        List<AssetOnMap> assetsOnMap = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        try (
 | 
			
		||||
            InputStream inputStream = MapLoader.class.getClassLoader().getResourceAsStream(mapName);
 | 
			
		||||
            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))
 | 
			
		||||
                InputStream inputStream = MapLoader.class.getClassLoader().getResourceAsStream(mapName);
 | 
			
		||||
                BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))
 | 
			
		||||
        ) {
 | 
			
		||||
 | 
			
		||||
            while (true) {
 | 
			
		||||
@@ -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();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,25 +3,13 @@
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * A control that adds highlighting functionality to a node in the game.
 | 
			
		||||
 * This class extends {@link OutlineControl} to add an outline effect when the node is highlighted.
 | 
			
		||||
 */
 | 
			
		||||
public class NodeControl extends OutlineControl {
 | 
			
		||||
 | 
			
		||||
    private static final ColorRGBA OUTLINE_HIGHLIGHT_COLOR = ColorRGBA.White;
 | 
			
		||||
    private static final int OUTLINE_HIGHLIGHT_WIDTH = 6;
 | 
			
		||||
    private static final ColorRGBA OUTLINE_SELECT_COLOR = ColorRGBA.Cyan;
 | 
			
		||||
    private static final int OUTLINE_SELECT_WIDTH = 8;
 | 
			
		||||
    private static final ColorRGBA OUTLINE_HOVER_COLOR = ColorRGBA.Yellow;
 | 
			
		||||
    private static final int OUTLINE_HOVER_WIDTH = 6;
 | 
			
		||||
    private boolean select = false;
 | 
			
		||||
    private boolean highlight = false;
 | 
			
		||||
public class NodeControl extends OutlineOEControl {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a {@link NodeControl} with the specified application and post processor.
 | 
			
		||||
@@ -31,7 +19,7 @@ public class NodeControl extends OutlineControl {
 | 
			
		||||
     * @param fpp The {@link FilterPostProcessor} to apply post-processing effects.
 | 
			
		||||
     */
 | 
			
		||||
    public NodeControl(MdgaApp app, FilterPostProcessor fpp) {
 | 
			
		||||
        super(app, fpp);
 | 
			
		||||
        super(app, fpp, app.getCamera());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -40,38 +28,7 @@ public NodeControl(MdgaApp app, FilterPostProcessor fpp) {
 | 
			
		||||
     *
 | 
			
		||||
     * @return The {@link Vector3f} representing the node's location.
 | 
			
		||||
     */
 | 
			
		||||
    public Vector3f getLocation(){
 | 
			
		||||
    public Vector3f getLocation() {
 | 
			
		||||
        return this.getSpatial().getLocalTranslation();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void highlight(){
 | 
			
		||||
        highlight = true;
 | 
			
		||||
        super.outline(OUTLINE_HIGHLIGHT_COLOR, OUTLINE_HIGHLIGHT_WIDTH);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void unHighlight(){
 | 
			
		||||
        highlight = false;
 | 
			
		||||
        deOutline();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void select(){
 | 
			
		||||
        select = true;
 | 
			
		||||
        super.outline(OUTLINE_SELECT_COLOR, OUTLINE_SELECT_WIDTH);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void unSelect(){
 | 
			
		||||
        select = false;
 | 
			
		||||
        if(highlight) highlight();
 | 
			
		||||
        else deOutline();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void hover(){
 | 
			
		||||
        super.outline(OUTLINE_HOVER_COLOR, OUTLINE_HOVER_WIDTH);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void hoverOff(){
 | 
			
		||||
        if(select) select();
 | 
			
		||||
        else if(highlight) highlight();
 | 
			
		||||
        else deOutline();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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,10 +13,21 @@
 | 
			
		||||
 * object, allowing it to be highlighted or deselected.
 | 
			
		||||
 */
 | 
			
		||||
public class OutlineControl extends InitControl {
 | 
			
		||||
    /** The {@link SelectObjectOutliner} responsible for managing the outline effect. */
 | 
			
		||||
    private final SelectObjectOutliner outlineOwn;
 | 
			
		||||
    private static final int THICKNESS_DEFAULT = 6;
 | 
			
		||||
    private MdgaApp app;
 | 
			
		||||
    /**
 | 
			
		||||
     * The {@link SelectObjectOutliner} responsible for managing the outline effect.
 | 
			
		||||
     */
 | 
			
		||||
    private final SelectObjectOutliner selectObjectOutliner;
 | 
			
		||||
    private final MdgaApp app;
 | 
			
		||||
    private boolean hoverable = false;
 | 
			
		||||
    private boolean highlight = false;
 | 
			
		||||
    private boolean selectable = false;
 | 
			
		||||
    private boolean select = false;
 | 
			
		||||
    private ColorRGBA highlightColor;
 | 
			
		||||
    private int highlightWidth;
 | 
			
		||||
    private ColorRGBA hoverColor;
 | 
			
		||||
    private int hoverWidth;
 | 
			
		||||
    private ColorRGBA selectColor;
 | 
			
		||||
    private int selectWidth;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs an {@code OutlineControl} with default thickness for the object outline.
 | 
			
		||||
@@ -24,44 +35,30 @@ public class OutlineControl extends InitControl {
 | 
			
		||||
     * @param app The main application managing the outline control.
 | 
			
		||||
     * @param fpp The {@code FilterPostProcessor} used for post-processing effects.
 | 
			
		||||
     */
 | 
			
		||||
    public OutlineControl(MdgaApp app, FilterPostProcessor fpp){
 | 
			
		||||
    public OutlineControl(MdgaApp app, FilterPostProcessor fpp, Camera cam,
 | 
			
		||||
                          ColorRGBA highlightColor, int highlightWidth,
 | 
			
		||||
                          ColorRGBA hoverColor, int hoverWidth,
 | 
			
		||||
                          ColorRGBA selectColor, int selectWidth
 | 
			
		||||
    ) {
 | 
			
		||||
        this.app = app;
 | 
			
		||||
        outlineOwn = new SelectObjectOutliner(THICKNESS_DEFAULT, fpp, app.getRenderManager(), app.getAssetManager(), app.getCamera(), app);
 | 
			
		||||
        this.highlightColor = highlightColor;
 | 
			
		||||
        this.highlightWidth = highlightWidth;
 | 
			
		||||
        this.hoverColor = hoverColor;
 | 
			
		||||
        this.hoverWidth = hoverWidth;
 | 
			
		||||
        this.selectColor = selectColor;
 | 
			
		||||
        this.selectWidth = selectWidth;
 | 
			
		||||
        selectObjectOutliner = new SelectObjectOutliner(fpp, app.getRenderManager(), app.getAssetManager(), cam, app);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs an {@code OutlineControl} with default thickness, allowing a custom camera to be specified.
 | 
			
		||||
     *
 | 
			
		||||
     * @param app The main application managing the outline control.
 | 
			
		||||
     * @param fpp The {@code FilterPostProcessor} used for post-processing effects.
 | 
			
		||||
     * @param cam The camera used for rendering the outlined objects.
 | 
			
		||||
     */
 | 
			
		||||
    public OutlineControl(MdgaApp app, FilterPostProcessor fpp, Camera cam){
 | 
			
		||||
        this.app = app;
 | 
			
		||||
        outlineOwn = new SelectObjectOutliner(THICKNESS_DEFAULT, fpp, app.getRenderManager(), app.getAssetManager(), cam, app);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs an {@code OutlineControl} with a specified thickness and custom camera.
 | 
			
		||||
     *
 | 
			
		||||
     * @param app       The main application managing the outline control.
 | 
			
		||||
     * @param fpp       The {@code FilterPostProcessor} used for post-processing effects.
 | 
			
		||||
     * @param cam       The camera used for rendering the outlined objects.
 | 
			
		||||
     * @param thickness The thickness of the outline.
 | 
			
		||||
     */
 | 
			
		||||
    public OutlineControl(MdgaApp app, FilterPostProcessor fpp, Camera cam, int thickness){
 | 
			
		||||
        this.app = app;
 | 
			
		||||
        outlineOwn = new SelectObjectOutliner(thickness, fpp, app.getRenderManager(), app.getAssetManager(), cam, app);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Applies an outline to the spatial object with the given color.
 | 
			
		||||
     *
 | 
			
		||||
     * @param color The {@link ColorRGBA} representing the color of the outline.
 | 
			
		||||
     */
 | 
			
		||||
    public void outline(ColorRGBA color){
 | 
			
		||||
        outlineOwn.select(spatial, color);
 | 
			
		||||
    }
 | 
			
		||||
//    public void outline(ColorRGBA color) {
 | 
			
		||||
//        selectObjectOutliner.select(spatial, color);
 | 
			
		||||
//    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Applies an outline to the spatial object with the given color and width.
 | 
			
		||||
@@ -69,16 +66,16 @@ public void outline(ColorRGBA color){
 | 
			
		||||
     * @param color The {@link ColorRGBA} representing the color of the outline.
 | 
			
		||||
     * @param width The width of the outline.
 | 
			
		||||
     */
 | 
			
		||||
    public void outline(ColorRGBA color, int width){
 | 
			
		||||
        deOutline();
 | 
			
		||||
        outlineOwn.select(spatial, color, width);
 | 
			
		||||
    public void outline(ColorRGBA color, int width) {
 | 
			
		||||
        outlineOff();
 | 
			
		||||
        selectObjectOutliner.select(spatial, color, width);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Removes the outline effect from the spatial object.
 | 
			
		||||
     */
 | 
			
		||||
    public void deOutline(){
 | 
			
		||||
        outlineOwn.deselect(spatial);
 | 
			
		||||
    public void outlineOff() {
 | 
			
		||||
        selectObjectOutliner.deselect(spatial);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -89,4 +86,97 @@ public void deOutline(){
 | 
			
		||||
    public MdgaApp getApp() {
 | 
			
		||||
        return app;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void highlightOn() {
 | 
			
		||||
        highlight = true;
 | 
			
		||||
        outline(highlightColor, highlightWidth);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void highlightOff() {
 | 
			
		||||
        highlight = false;
 | 
			
		||||
        outlineOff();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void hoverOn() {
 | 
			
		||||
        if (!hoverable) return;
 | 
			
		||||
        outline(hoverColor, hoverWidth);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void hoverOff() {
 | 
			
		||||
        if (!hoverable) return;
 | 
			
		||||
 | 
			
		||||
        if (select) selectOn();
 | 
			
		||||
        else if (highlight) highlightOn();
 | 
			
		||||
        else outlineOff();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectOn() {
 | 
			
		||||
        if (!selectable) return;
 | 
			
		||||
        select = true;
 | 
			
		||||
        outline(selectColor, selectWidth);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectOff() {
 | 
			
		||||
        select = false;
 | 
			
		||||
        if (highlight) highlightOn();
 | 
			
		||||
        else outlineOff();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectableOn(){
 | 
			
		||||
        setSelectable(true);
 | 
			
		||||
        setHoverable(true);
 | 
			
		||||
        highlightOn();
 | 
			
		||||
        select = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectableOff(){
 | 
			
		||||
        setSelectable(false);
 | 
			
		||||
        setHoverable(false);
 | 
			
		||||
        highlightOff();
 | 
			
		||||
        select = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void setSelectable(boolean selectable) {
 | 
			
		||||
        this.selectable = selectable;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isSelected() {
 | 
			
		||||
        return select;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isSelectable() {
 | 
			
		||||
        return selectable;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isHoverable() {
 | 
			
		||||
        return hoverable;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void setHoverable(boolean hoverable) {
 | 
			
		||||
        this.hoverable = hoverable;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setHighlightColor(ColorRGBA color){
 | 
			
		||||
        highlightColor = color;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setHighlightWidth(int width){
 | 
			
		||||
        highlightWidth = width;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setHoverColor(ColorRGBA color){
 | 
			
		||||
        hoverColor = color;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setHoverWidth(int width){
 | 
			
		||||
        hoverWidth = width;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSelectColor(ColorRGBA color){
 | 
			
		||||
        selectColor = color;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setSelectWidth(int width){
 | 
			
		||||
        selectWidth = width;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,40 @@
 | 
			
		||||
package pp.mdga.client.board;
 | 
			
		||||
 | 
			
		||||
import com.jme3.math.ColorRGBA;
 | 
			
		||||
import com.jme3.post.FilterPostProcessor;
 | 
			
		||||
import com.jme3.renderer.Camera;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
 | 
			
		||||
public class OutlineOEControl extends OutlineControl{
 | 
			
		||||
    private static final ColorRGBA OUTLINE_OWN_COLOR = ColorRGBA.White;
 | 
			
		||||
    private static final ColorRGBA OUTLINE_ENEMY_COLOR = ColorRGBA.Red;
 | 
			
		||||
    private static final ColorRGBA OUTLINE_OWN_HOVER_COLOR = ColorRGBA.Yellow;
 | 
			
		||||
    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 = 8;
 | 
			
		||||
    private static final int OUTLINE_HOVER_WIDTH = 8;
 | 
			
		||||
    private static final int OUTLINE_SELECT_WIDTH = 10;
 | 
			
		||||
 | 
			
		||||
    public OutlineOEControl(MdgaApp app, FilterPostProcessor fpp, Camera cam){
 | 
			
		||||
        super(app, fpp, cam,
 | 
			
		||||
          OUTLINE_OWN_COLOR, OUTLINE_HIGHLIGHT_WIDTH,
 | 
			
		||||
          OUTLINE_OWN_HOVER_COLOR, OUTLINE_HOVER_WIDTH,
 | 
			
		||||
          OUTLINE_OWN_SELECT_COLOR, OUTLINE_SELECT_WIDTH
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectableOwn(){
 | 
			
		||||
        setHighlightColor(OUTLINE_OWN_COLOR);
 | 
			
		||||
        setHoverColor(OUTLINE_OWN_HOVER_COLOR);
 | 
			
		||||
        setSelectColor(OUTLINE_OWN_SELECT_COLOR);
 | 
			
		||||
        selectableOn();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectableEnemy(){
 | 
			
		||||
        setHighlightColor(OUTLINE_ENEMY_COLOR);
 | 
			
		||||
        setHoverColor(OUTLINE_ENEMY_HOVER_COLOR);
 | 
			
		||||
        setSelectColor(OUTLINE_ENEMY_SELECT_COLOR);
 | 
			
		||||
        selectableOn();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
 * to provide outline functionality and includes additional features like shield effects,
 | 
			
		||||
 * hover states, and selection states.
 | 
			
		||||
 */
 | 
			
		||||
public class PieceControl extends OutlineControl {
 | 
			
		||||
public class PieceControl extends OutlineOEControl {
 | 
			
		||||
    private final float initRotation;
 | 
			
		||||
    private final AssetManager assetManager;
 | 
			
		||||
    private Spatial shieldRing;
 | 
			
		||||
@@ -32,16 +32,6 @@ public class PieceControl extends OutlineControl {
 | 
			
		||||
    private static final ColorRGBA SHIELD_SUPPRESSED_COLOR = new ColorRGBA(1f, 0.5f, 0, SHIELD_TRANSPARENCY);
 | 
			
		||||
    private static final float SHIELD_Z = 0f;
 | 
			
		||||
 | 
			
		||||
    private static final ColorRGBA OUTLINE_OWN_COLOR = ColorRGBA.White;
 | 
			
		||||
    private static final ColorRGBA OUTLINE_ENEMY_COLOR = ColorRGBA.Red;
 | 
			
		||||
    private static final ColorRGBA OUTLINE_OWN_HOVER_COLOR = ColorRGBA.Yellow;
 | 
			
		||||
    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 = 8;
 | 
			
		||||
    private static final int OUTLINE_HOVER_WIDTH = 8;
 | 
			
		||||
    private static final int OUTLINE_SELECT_WIDTH = 10;
 | 
			
		||||
 | 
			
		||||
    private final Node parentNode;
 | 
			
		||||
    private boolean enemy;
 | 
			
		||||
    private boolean hoverable;
 | 
			
		||||
@@ -55,22 +45,17 @@ public class PieceControl extends OutlineControl {
 | 
			
		||||
     *
 | 
			
		||||
     * @param initRotation The initial rotation of the piece in degrees.
 | 
			
		||||
     * @param assetManager The {@link AssetManager} used for loading models and materials.
 | 
			
		||||
     * @param app The {@link MdgaApp} instance to use for the application context.
 | 
			
		||||
     * @param fpp The {@link FilterPostProcessor} to apply post-processing effects.
 | 
			
		||||
     * @param app          The {@link MdgaApp} instance to use for the application context.
 | 
			
		||||
     * @param fpp          The {@link FilterPostProcessor} to apply post-processing effects.
 | 
			
		||||
     */
 | 
			
		||||
    public PieceControl(float initRotation, AssetManager assetManager, MdgaApp app, FilterPostProcessor fpp){
 | 
			
		||||
        super(app, fpp);
 | 
			
		||||
    public PieceControl(float initRotation, AssetManager assetManager, MdgaApp app, FilterPostProcessor fpp) {
 | 
			
		||||
        super(app, fpp, app.getCamera());
 | 
			
		||||
        this.parentNode = new Node();
 | 
			
		||||
        this.initRotation = initRotation;
 | 
			
		||||
        this.assetManager = assetManager;
 | 
			
		||||
        this.shieldRing = null;
 | 
			
		||||
        this.shieldMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
 | 
			
		||||
        this.shieldMat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
 | 
			
		||||
        enemy = false;
 | 
			
		||||
        hoverable = false;
 | 
			
		||||
        highlight = false;
 | 
			
		||||
        selectable = false;
 | 
			
		||||
        select = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -79,7 +64,7 @@ public PieceControl(float initRotation, AssetManager assetManager, MdgaApp app,
 | 
			
		||||
     * @return The rotation of the piece in degrees.
 | 
			
		||||
     */
 | 
			
		||||
    public float getRotation() {
 | 
			
		||||
        return (float) Math.toDegrees(spatial.getLocalRotation().toAngleAxis(new Vector3f(0,0,1)));
 | 
			
		||||
        return (float) Math.toDegrees(spatial.getLocalRotation().toAngleAxis(new Vector3f(0, 0, 1)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -87,11 +72,11 @@ public float getRotation() {
 | 
			
		||||
     *
 | 
			
		||||
     * @param rot The rotation in degrees to set.
 | 
			
		||||
     */
 | 
			
		||||
    public void setRotation(float rot){
 | 
			
		||||
        if(rot < 0) rot =- 360;
 | 
			
		||||
    public void setRotation(float rot) {
 | 
			
		||||
        if (rot < 0) rot = -360;
 | 
			
		||||
 | 
			
		||||
        Quaternion quaternion = new Quaternion();
 | 
			
		||||
        quaternion.fromAngleAxis((float) Math.toRadians(rot), new Vector3f(0,0,1));
 | 
			
		||||
        quaternion.fromAngleAxis((float) Math.toRadians(rot), new Vector3f(0, 0, 1));
 | 
			
		||||
        spatial.setLocalRotation(quaternion);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -100,7 +85,7 @@ public void setRotation(float rot){
 | 
			
		||||
     *
 | 
			
		||||
     * @return The location of the piece as a {@link Vector3f}.
 | 
			
		||||
     */
 | 
			
		||||
    public Vector3f getLocation(){
 | 
			
		||||
    public Vector3f getLocation() {
 | 
			
		||||
        return spatial.getLocalTranslation();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -111,9 +96,9 @@ public Vector3f getLocation(){
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void controlUpdate(float delta) {
 | 
			
		||||
        if(shieldRing != null){
 | 
			
		||||
        if (shieldRing != null) {
 | 
			
		||||
            shieldRing.rotate(0, 0, delta * SHIELD_SPEED);
 | 
			
		||||
            shieldRing.setLocalTranslation(spatial.getLocalTranslation().add(new Vector3f(0,0,SHIELD_Z)));
 | 
			
		||||
            shieldRing.setLocalTranslation(spatial.getLocalTranslation().add(new Vector3f(0, 0, SHIELD_Z)));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -122,7 +107,7 @@ protected void controlUpdate(float delta) {
 | 
			
		||||
     *
 | 
			
		||||
     * @param loc The location to set as a {@link Vector3f}.
 | 
			
		||||
     */
 | 
			
		||||
    public void setLocation(Vector3f loc){
 | 
			
		||||
    public void setLocation(Vector3f loc) {
 | 
			
		||||
        this.spatial.setLocalTranslation(loc);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -131,7 +116,7 @@ public void setLocation(Vector3f loc){
 | 
			
		||||
     * This also moves the spatial to a new parent node for organizational purposes.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void initSpatial(){
 | 
			
		||||
    public void initSpatial() {
 | 
			
		||||
        setRotation(this.initRotation);
 | 
			
		||||
 | 
			
		||||
        Node oldParent = spatial.getParent();
 | 
			
		||||
@@ -149,14 +134,14 @@ public void rotateInit() {
 | 
			
		||||
     * Activates the shield around the piece.
 | 
			
		||||
     * This adds a visual shield effect in the form of a rotating ring.
 | 
			
		||||
     */
 | 
			
		||||
    public void activateShield(){
 | 
			
		||||
        if(shieldRing != null){
 | 
			
		||||
    public void activateShield() {
 | 
			
		||||
        if (shieldRing != null) {
 | 
			
		||||
            deactivateShield();
 | 
			
		||||
        }
 | 
			
		||||
        shieldRing = assetManager.loadModel(Asset.shieldRing.getModelPath());
 | 
			
		||||
        shieldRing.scale(1f);
 | 
			
		||||
        shieldRing.rotate((float) Math.toRadians(0), 0, (float) Math.toRadians(0));
 | 
			
		||||
        shieldRing.setLocalTranslation(spatial.getLocalTranslation().add(new Vector3f(0,0,SHIELD_Z)));
 | 
			
		||||
        shieldRing.setLocalTranslation(spatial.getLocalTranslation().add(new Vector3f(0, 0, SHIELD_Z)));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        shieldRing.setQueueBucket(RenderQueue.Bucket.Transparent); // Render in the transparent bucket
 | 
			
		||||
@@ -170,7 +155,7 @@ public void activateShield(){
 | 
			
		||||
     * Deactivates the shield by removing the shield ring from the scene.
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    public void deactivateShield(){
 | 
			
		||||
    public void deactivateShield() {
 | 
			
		||||
        parentNode.detachChild(shieldRing);
 | 
			
		||||
        shieldRing = null;
 | 
			
		||||
    }
 | 
			
		||||
@@ -178,109 +163,16 @@ public void deactivateShield(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Suppresses the shield, changing its color to a suppressed state.
 | 
			
		||||
     */
 | 
			
		||||
    public void suppressShield(){
 | 
			
		||||
        assert(shieldRing != null) : "PieceControl: shieldRing is not set";
 | 
			
		||||
    public void suppressShield() {
 | 
			
		||||
        assert (shieldRing != null) : "PieceControl: shieldRing is not set";
 | 
			
		||||
        shieldMat.setColor("Color", SHIELD_SUPPRESSED_COLOR);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setMaterial(Material mat){
 | 
			
		||||
    public void setMaterial(Material mat) {
 | 
			
		||||
        spatial.setMaterial(mat);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Material getMaterial(){
 | 
			
		||||
    public Material getMaterial() {
 | 
			
		||||
        return ((Geometry) getSpatial()).getMaterial();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Highlights the piece with the appropriate outline color based on whether it is an enemy or not.
 | 
			
		||||
     *
 | 
			
		||||
     * @param enemy True if the piece is an enemy, false if it is owned by the player.
 | 
			
		||||
     */
 | 
			
		||||
    public void highlight(boolean enemy) {
 | 
			
		||||
        this.enemy = enemy;
 | 
			
		||||
        highlight = true;
 | 
			
		||||
        super.outline(enemy ? OUTLINE_ENEMY_COLOR : OUTLINE_OWN_COLOR, OUTLINE_HIGHLIGHT_WIDTH);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Removes the highlight effect from the piece.
 | 
			
		||||
     */
 | 
			
		||||
    public void unHighlight(){
 | 
			
		||||
        highlight = false;
 | 
			
		||||
        deOutline();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Applies a hover effect on the piece if it is hoverable.
 | 
			
		||||
     */
 | 
			
		||||
    public void hover(){
 | 
			
		||||
        if(!hoverable) return;
 | 
			
		||||
        super.outline(enemy ? OUTLINE_ENEMY_HOVER_COLOR : OUTLINE_OWN_HOVER_COLOR, OUTLINE_HOVER_WIDTH);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Removes the hover effect from the piece.
 | 
			
		||||
     */
 | 
			
		||||
    public void hoverOff(){
 | 
			
		||||
        if(!hoverable) return;
 | 
			
		||||
 | 
			
		||||
        if(select) select();
 | 
			
		||||
        else if(highlight) highlight(enemy);
 | 
			
		||||
        else deOutline();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Deselects the piece and removes the selection outline. If the piece was highlighted,
 | 
			
		||||
     * it will be re-highlighted. Otherwise, the outline is removed.
 | 
			
		||||
     */
 | 
			
		||||
    public void unSelect(){
 | 
			
		||||
        select = false;
 | 
			
		||||
        if(highlight) highlight(enemy);
 | 
			
		||||
        else deOutline();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the piece and applies the selection outline. If the piece is an enemy, it will
 | 
			
		||||
     * be outlined with the enemy selection color; otherwise, the own selection color will be used.
 | 
			
		||||
     */
 | 
			
		||||
    public void select(){
 | 
			
		||||
        if(!selectable) return;
 | 
			
		||||
        select = true;
 | 
			
		||||
        super.outline(enemy ? OUTLINE_ENEMY_SELECT_COLOR : OUTLINE_OWN_SELECT_COLOR, OUTLINE_SELECT_WIDTH);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets whether the piece is selectable.
 | 
			
		||||
     *
 | 
			
		||||
     * @param selectable True if the piece can be selected, false otherwise.
 | 
			
		||||
     */
 | 
			
		||||
    public void setSelectable(boolean selectable){
 | 
			
		||||
        this.selectable = selectable;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Checks if the piece is selected.
 | 
			
		||||
     *
 | 
			
		||||
     * @return True if the piece is selected, false otherwise.
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isSelected() { return select; }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Checks if the piece is selectable.
 | 
			
		||||
     *
 | 
			
		||||
     * @return True if the piece is selectable, false otherwise.
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isSelectable() {
 | 
			
		||||
        return selectable;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets whether the piece is hoverable.
 | 
			
		||||
     *
 | 
			
		||||
     * @param hoverable True if the piece can be hovered over, false otherwise.
 | 
			
		||||
     */
 | 
			
		||||
    public void setHoverable(boolean hoverable) {
 | 
			
		||||
        this.hoverable = hoverable;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -37,9 +37,9 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
        // Apply the interpolated rotation to the spatial
 | 
			
		||||
        spatial.setLocalRotation(interpolatedRotation);
 | 
			
		||||
 | 
			
		||||
        if(t >= 1){
 | 
			
		||||
        if (t >= 1) {
 | 
			
		||||
            rotating = false;
 | 
			
		||||
            if(actionAfter != null) actionAfter.run();
 | 
			
		||||
            if (actionAfter != null) actionAfter.run();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -62,7 +62,7 @@ public void rotate(Vector3f enemyPos, Runnable actionAfter) {
 | 
			
		||||
        this.actionAfter = actionAfter; // Store the action to execute after rotation
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private float getEnemyAngle(Vector3f enemyPos){
 | 
			
		||||
    private float getEnemyAngle(Vector3f enemyPos) {
 | 
			
		||||
        // Direction to the enemy in the XY plane
 | 
			
		||||
        Vector3f direction = enemyPos.subtract(spatial.getLocalTranslation());
 | 
			
		||||
        direction.z = 0; // Project to XY plane
 | 
			
		||||
 
 | 
			
		||||
@@ -115,7 +115,7 @@ public abstract class AbstractButton {
 | 
			
		||||
     * Constructs an AbstractButton instance with the specified application context and scene node.
 | 
			
		||||
     * Initializes the button's visual elements and font.
 | 
			
		||||
     *
 | 
			
		||||
     * @param app the application instance for accessing resources
 | 
			
		||||
     * @param app  the application instance for accessing resources
 | 
			
		||||
     * @param node the node in the scene graph to which the button is attached
 | 
			
		||||
     */
 | 
			
		||||
    public AbstractButton(MdgaApp app, Node node) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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.
 | 
			
		||||
 
 | 
			
		||||
@@ -69,15 +69,16 @@ public enum Pos {
 | 
			
		||||
     * Constructs a CeremonyButton with specified attributes such as type, position, and label.
 | 
			
		||||
     * The button supports both 2D and 3D components for UI and visual effects.
 | 
			
		||||
     *
 | 
			
		||||
     * @param app   the application instance for accessing resources and settings
 | 
			
		||||
     * @param node  the node in the scene graph to which the button belongs
 | 
			
		||||
     * @param app    the application instance for accessing resources and settings
 | 
			
		||||
     * @param node   the node in the scene graph to which the button belongs
 | 
			
		||||
     * @param node3d the node for 3D scene components associated with this button
 | 
			
		||||
     * @param tsk   the type/color associated with the button
 | 
			
		||||
     * @param pos   the position of the button in the ceremony layout
 | 
			
		||||
     * @param name  the label or name displayed on the button
 | 
			
		||||
     * @param tsk    the type/color associated with the button
 | 
			
		||||
     * @param pos    the position of the button in the ceremony layout
 | 
			
		||||
     * @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;
 | 
			
		||||
 | 
			
		||||
@@ -217,9 +218,9 @@ public void update(float tpf) {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        model.setLocalRotation(new Quaternion().fromAngles(
 | 
			
		||||
            (float) Math.toRadians(90),
 | 
			
		||||
            (float) Math.toRadians(rot),
 | 
			
		||||
            (float) Math.toRadians(180)
 | 
			
		||||
                (float) Math.toRadians(90),
 | 
			
		||||
                (float) Math.toRadians(rot),
 | 
			
		||||
                (float) Math.toRadians(180)
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -236,9 +237,9 @@ private void createModel(Asset asset, Vector3f pos) {
 | 
			
		||||
        model = app.getAssetManager().loadModel(modelName);
 | 
			
		||||
        model.scale(asset.getSize() / 2);
 | 
			
		||||
        model.rotate(
 | 
			
		||||
            (float) Math.toRadians(90),
 | 
			
		||||
            (float) Math.toRadians(rot),
 | 
			
		||||
            (float) Math.toRadians(180)
 | 
			
		||||
                (float) Math.toRadians(90),
 | 
			
		||||
                (float) Math.toRadians(rot),
 | 
			
		||||
                (float) Math.toRadians(180)
 | 
			
		||||
        );
 | 
			
		||||
        model.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -41,12 +41,12 @@ public abstract class ClickButton extends AbstractButton {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a ClickButton with the specified properties.
 | 
			
		||||
     *
 | 
			
		||||
     * @param app   the application instance for accessing resources
 | 
			
		||||
     * @param node  the node in the scene graph to which the button belongs
 | 
			
		||||
     * @param app    the application instance for accessing resources
 | 
			
		||||
     * @param node   the node in the scene graph to which the button belongs
 | 
			
		||||
     * @param action the action to execute on button click
 | 
			
		||||
     * @param label the text label displayed on the button
 | 
			
		||||
     * @param size  the size of the button
 | 
			
		||||
     * @param pos   the position of the button in relative units
 | 
			
		||||
     * @param label  the text label displayed on the button
 | 
			
		||||
     * @param size   the size of the button
 | 
			
		||||
     * @param pos    the position of the button in relative units
 | 
			
		||||
     */
 | 
			
		||||
    ClickButton(MdgaApp app, Node node, Runnable action, String label, Vector2f size, Vector2f pos) {
 | 
			
		||||
        super(app, node);
 | 
			
		||||
@@ -203,9 +203,9 @@ protected void setImageRelative(Picture picture) {
 | 
			
		||||
        picture.setHeight(instance.getPreferredSize().y + larger);
 | 
			
		||||
 | 
			
		||||
        picture.setLocalTranslation(
 | 
			
		||||
            instance.getLocalTranslation().x - larger / 2,
 | 
			
		||||
            (instance.getLocalTranslation().y - picture.getHeight()) + larger / 2,
 | 
			
		||||
            instance.getLocalTranslation().z + 0.01f
 | 
			
		||||
                instance.getLocalTranslation().x - larger / 2,
 | 
			
		||||
                (instance.getLocalTranslation().y - picture.getHeight()) + larger / 2,
 | 
			
		||||
                instance.getLocalTranslation().z + 0.01f
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -101,11 +97,11 @@ public enum Taken {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a LobbyButton with specified properties, including a 3D model and label.
 | 
			
		||||
     *
 | 
			
		||||
     * @param app     the application instance for accessing resources
 | 
			
		||||
     * @param node    the node in the scene graph to which the button belongs
 | 
			
		||||
     * @param node3d  the node for 3D scene components associated with this button
 | 
			
		||||
     * @param action  the action to execute when the button is clicked
 | 
			
		||||
     * @param tsk     the type or category of the button (e.g., CYBER, AIRFORCE)
 | 
			
		||||
     * @param app    the application instance for accessing resources
 | 
			
		||||
     * @param node   the node in the scene graph to which the button belongs
 | 
			
		||||
     * @param node3d the node for 3D scene components associated with this button
 | 
			
		||||
     * @param action the action to execute when the button is clicked
 | 
			
		||||
     * @param tsk    the type or category of the button (e.g., CYBER, AIRFORCE)
 | 
			
		||||
     */
 | 
			
		||||
    public LobbyButton(MdgaApp app, Node node, Node node3d, Runnable action, Color tsk) {
 | 
			
		||||
        super(app, node, action, "", new Vector2f(WIDTH, 7), new Vector2f(0, 0));
 | 
			
		||||
@@ -261,9 +257,9 @@ public void update(float tpf) {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        model.setLocalRotation(new Quaternion().fromAngles(
 | 
			
		||||
            (float) Math.toRadians(90),
 | 
			
		||||
            (float) Math.toRadians(rot),
 | 
			
		||||
            (float) Math.toRadians(180)
 | 
			
		||||
                (float) Math.toRadians(90),
 | 
			
		||||
                (float) Math.toRadians(rot),
 | 
			
		||||
                (float) Math.toRadians(180)
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -280,9 +276,9 @@ private void createModel(Asset asset, Vector3f pos) {
 | 
			
		||||
        model = app.getAssetManager().loadModel(modelName);
 | 
			
		||||
        model.scale(asset.getSize() / 2);
 | 
			
		||||
        model.rotate(
 | 
			
		||||
            (float) Math.toRadians(90),
 | 
			
		||||
            (float) Math.toRadians(rot),
 | 
			
		||||
            (float) Math.toRadians(180)
 | 
			
		||||
                (float) Math.toRadians(90),
 | 
			
		||||
                (float) Math.toRadians(rot),
 | 
			
		||||
                (float) Math.toRadians(180)
 | 
			
		||||
        );
 | 
			
		||||
        model.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -13,10 +13,10 @@ public class MenuButton extends ClickButton {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a MenuButton with specified properties.
 | 
			
		||||
     *
 | 
			
		||||
     * @param app     the application instance for accessing resources
 | 
			
		||||
     * @param node    the node in the scene graph to which the button belongs
 | 
			
		||||
     * @param action  the action to execute when the button is clicked
 | 
			
		||||
     * @param label   the text label displayed on the button
 | 
			
		||||
     * @param app    the application instance for accessing resources
 | 
			
		||||
     * @param node   the node in the scene graph to which the button belongs
 | 
			
		||||
     * @param action the action to execute when the button is clicked
 | 
			
		||||
     * @param label  the text label displayed on the button
 | 
			
		||||
     */
 | 
			
		||||
    public MenuButton(MdgaApp app, Node node, Runnable action, String label) {
 | 
			
		||||
        super(app, node, action, label, new Vector2f(5.5f, 2), new Vector2f(0, 0));
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -91,7 +91,7 @@ protected void onHide() {
 | 
			
		||||
     * This method is called continuously while the dialog is active.
 | 
			
		||||
     */
 | 
			
		||||
    public void update() {
 | 
			
		||||
        if(!active) {
 | 
			
		||||
        if (!active) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,7 @@ public void addStatisticsRow(String name, int v1, int v2, int v3, int v4, int v5
 | 
			
		||||
 | 
			
		||||
        int j = 0;
 | 
			
		||||
        for (LabelButton b : row) {
 | 
			
		||||
            if(j > 0) {
 | 
			
		||||
            if (j > 0) {
 | 
			
		||||
                b.setColor(colorText, colorButton);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
package pp.mdga.client.dialog;
 | 
			
		||||
 | 
			
		||||
import com.jme3.scene.Node;
 | 
			
		||||
import com.simsilica.lemur.Container;
 | 
			
		||||
import pp.mdga.client.MdgaApp;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@
 | 
			
		||||
 * The {@code HostDialog} class represents a dialog for hosting a network game session.
 | 
			
		||||
 * It allows users to input a port number, start hosting a server, and navigate back to the previous view.
 | 
			
		||||
 */
 | 
			
		||||
public class HostDialog  extends NetworkDialog {
 | 
			
		||||
public class HostDialog extends NetworkDialog {
 | 
			
		||||
    private InputButton portInput;
 | 
			
		||||
 | 
			
		||||
    private ButtonRight hostButton;
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -39,7 +37,7 @@ public InterruptDialog(MdgaApp app, Node node) {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onShow() {
 | 
			
		||||
        if(app.getGameLogic().isHost()) {
 | 
			
		||||
        if (app.getGameLogic().isHost()) {
 | 
			
		||||
            forceButton.show();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -25,9 +25,9 @@ public abstract class NetworkDialog extends Dialog {
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a {@code NetworkDialog}.
 | 
			
		||||
     *
 | 
			
		||||
     * @param app      The main application managing the dialog.
 | 
			
		||||
     * @param node     The root node for attaching UI elements.
 | 
			
		||||
     * @param network  The network support instance for managing network interactions.
 | 
			
		||||
     * @param app     The main application managing the dialog.
 | 
			
		||||
     * @param node    The root node for attaching UI elements.
 | 
			
		||||
     * @param network The network support instance for managing network interactions.
 | 
			
		||||
     */
 | 
			
		||||
    public NetworkDialog(MdgaApp app, Node node, NetworkSupport network) {
 | 
			
		||||
        super(app, node);
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
@@ -101,210 +95,210 @@ public String getName() {
 | 
			
		||||
 | 
			
		||||
        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",
 | 
			
		||||
                "KartoffelKönig",
 | 
			
		||||
                "SaufenderWolf",
 | 
			
		||||
                "WurstGriller",
 | 
			
		||||
                "Flitzekacke",
 | 
			
		||||
                "BratwurstBub",
 | 
			
		||||
                "Hoppeldoppels",
 | 
			
		||||
                "BananenMensch",
 | 
			
		||||
                "KlopapierGuru",
 | 
			
		||||
                "SchnitzelKing",
 | 
			
		||||
                "NerdNomade",
 | 
			
		||||
                "Dönertänzer",
 | 
			
		||||
                "GlitzerGurke",
 | 
			
		||||
                "SchinkenShrek",
 | 
			
		||||
                "KäseKalle",
 | 
			
		||||
                "SchokoSchnecke",
 | 
			
		||||
                "KeksKämpfer",
 | 
			
		||||
                "QuarkPiraten",
 | 
			
		||||
                "Müslimonster",
 | 
			
		||||
                "KnuddelNase",
 | 
			
		||||
                "FantaFighter",
 | 
			
		||||
                "SchnapsSaurier",
 | 
			
		||||
                "Wackelpudding",
 | 
			
		||||
                "ZitronenZock",
 | 
			
		||||
                "FettWurst",
 | 
			
		||||
                "PlüschPanda",
 | 
			
		||||
                "Zuckerschnur",
 | 
			
		||||
                "FluffiKopf",
 | 
			
		||||
                "DonutDöner",
 | 
			
		||||
                "VollpfostenX",
 | 
			
		||||
                "Waschlappen",
 | 
			
		||||
                "Witzepumper",
 | 
			
		||||
                "ToastTraum",
 | 
			
		||||
                "FroschFighter",
 | 
			
		||||
                "KrümelTiger",
 | 
			
		||||
                "RegenWolke",
 | 
			
		||||
                "PuddingPower",
 | 
			
		||||
                "KoffeinKrieger",
 | 
			
		||||
                "SpeckSchlumpf",
 | 
			
		||||
                "SuperSuppe",
 | 
			
		||||
                "BierBärchen",
 | 
			
		||||
                "FischBär",
 | 
			
		||||
                "Flauschi",
 | 
			
		||||
                "Schokomonster",
 | 
			
		||||
                "ChaosKäse",
 | 
			
		||||
                "FlitzLappen",
 | 
			
		||||
                "WurstWombat",
 | 
			
		||||
                "KrümelMensch",
 | 
			
		||||
                "PuddingBär",
 | 
			
		||||
                "ZickZack",
 | 
			
		||||
                "Schwabel",
 | 
			
		||||
                "Fluffi",
 | 
			
		||||
                "RülpsFrosch",
 | 
			
		||||
                "PommesPapa",
 | 
			
		||||
                "QuarkBär",
 | 
			
		||||
                "KnusperKönig",
 | 
			
		||||
                "ToastBrot",
 | 
			
		||||
                "Ploppster",
 | 
			
		||||
                "Schleimschwein",
 | 
			
		||||
                "Äpfelchen",
 | 
			
		||||
                "Knallbonbon",
 | 
			
		||||
                "KaffeeKopf",
 | 
			
		||||
                "WackelWurst",
 | 
			
		||||
                "RennKeks",
 | 
			
		||||
                "BröselBub",
 | 
			
		||||
                "ZockerBrot",
 | 
			
		||||
                "BierWurm",
 | 
			
		||||
                "StinkFlummi",
 | 
			
		||||
                "SchlumpfKing",
 | 
			
		||||
                "PurzelBär",
 | 
			
		||||
                "FlinkFluff",
 | 
			
		||||
                "PloppPudel",
 | 
			
		||||
                "Schnorchel",
 | 
			
		||||
                "FliegenKopf",
 | 
			
		||||
                "PixelPommes",
 | 
			
		||||
                "SchwipsWürst",
 | 
			
		||||
                "WutzBär",
 | 
			
		||||
                "KnuddelKeks",
 | 
			
		||||
                "FantaFlumm",
 | 
			
		||||
                "ZockerKäse",
 | 
			
		||||
                "LachHäufchen",
 | 
			
		||||
                "GurkenGuru",
 | 
			
		||||
                "PonySchnitzel",
 | 
			
		||||
                "NudelNinja",
 | 
			
		||||
                "VulkanKeks",
 | 
			
		||||
                "WasserToast",
 | 
			
		||||
                "MenschSalat",
 | 
			
		||||
                "KampfKohl",
 | 
			
		||||
                "SockenZirkus",
 | 
			
		||||
                "SchwimmBärchen",
 | 
			
		||||
                "TanzenderPudel",
 | 
			
		||||
                "PizzamarktMensch",
 | 
			
		||||
                "ZahnarztZocker",
 | 
			
		||||
                "RollerRudi",
 | 
			
		||||
                "PupsPilot",
 | 
			
		||||
                "WitzigeZwiebel",
 | 
			
		||||
                "Pillenschlucker",
 | 
			
		||||
                "ZwiebelReiter",
 | 
			
		||||
                "HüpfenderKaktus",
 | 
			
		||||
                "AsteroidenAlf",
 | 
			
		||||
                "ChaosKarotte",
 | 
			
		||||
                "WolkenFurz",
 | 
			
		||||
                "Krümelmonster",
 | 
			
		||||
                "WackelBiene",
 | 
			
		||||
                    "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",
 | 
			
		||||
                    "KartoffelKönig",
 | 
			
		||||
                    "SaufenderWolf",
 | 
			
		||||
                    "WurstGriller",
 | 
			
		||||
                    "Flitzekacke",
 | 
			
		||||
                    "BratwurstBub",
 | 
			
		||||
                    "Hoppeldoppels",
 | 
			
		||||
                    "BananenMensch",
 | 
			
		||||
                    "KlopapierGuru",
 | 
			
		||||
                    "SchnitzelKing",
 | 
			
		||||
                    "NerdNomade",
 | 
			
		||||
                    "Dönertänzer",
 | 
			
		||||
                    "GlitzerGurke",
 | 
			
		||||
                    "SchinkenShrek",
 | 
			
		||||
                    "KäseKalle",
 | 
			
		||||
                    "SchokoSchnecke",
 | 
			
		||||
                    "KeksKämpfer",
 | 
			
		||||
                    "QuarkPiraten",
 | 
			
		||||
                    "Müslimonster",
 | 
			
		||||
                    "KnuddelNase",
 | 
			
		||||
                    "FantaFighter",
 | 
			
		||||
                    "SchnapsSaurier",
 | 
			
		||||
                    "Wackelpudding",
 | 
			
		||||
                    "ZitronenZock",
 | 
			
		||||
                    "FettWurst",
 | 
			
		||||
                    "PlüschPanda",
 | 
			
		||||
                    "Zuckerschnur",
 | 
			
		||||
                    "FluffiKopf",
 | 
			
		||||
                    "DonutDöner",
 | 
			
		||||
                    "VollpfostenX",
 | 
			
		||||
                    "Waschlappen",
 | 
			
		||||
                    "Witzepumper",
 | 
			
		||||
                    "ToastTraum",
 | 
			
		||||
                    "FroschFighter",
 | 
			
		||||
                    "KrümelTiger",
 | 
			
		||||
                    "RegenWolke",
 | 
			
		||||
                    "PuddingPower",
 | 
			
		||||
                    "KoffeinKrieger",
 | 
			
		||||
                    "SpeckSchlumpf",
 | 
			
		||||
                    "SuperSuppe",
 | 
			
		||||
                    "BierBärchen",
 | 
			
		||||
                    "FischBär",
 | 
			
		||||
                    "Flauschi",
 | 
			
		||||
                    "Schokomonster",
 | 
			
		||||
                    "ChaosKäse",
 | 
			
		||||
                    "FlitzLappen",
 | 
			
		||||
                    "WurstWombat",
 | 
			
		||||
                    "KrümelMensch",
 | 
			
		||||
                    "PuddingBär",
 | 
			
		||||
                    "ZickZack",
 | 
			
		||||
                    "Schwabel",
 | 
			
		||||
                    "Fluffi",
 | 
			
		||||
                    "RülpsFrosch",
 | 
			
		||||
                    "PommesPapa",
 | 
			
		||||
                    "QuarkBär",
 | 
			
		||||
                    "KnusperKönig",
 | 
			
		||||
                    "ToastBrot",
 | 
			
		||||
                    "Ploppster",
 | 
			
		||||
                    "Schleimschwein",
 | 
			
		||||
                    "Äpfelchen",
 | 
			
		||||
                    "Knallbonbon",
 | 
			
		||||
                    "KaffeeKopf",
 | 
			
		||||
                    "WackelWurst",
 | 
			
		||||
                    "RennKeks",
 | 
			
		||||
                    "BröselBub",
 | 
			
		||||
                    "ZockerBrot",
 | 
			
		||||
                    "BierWurm",
 | 
			
		||||
                    "StinkFlummi",
 | 
			
		||||
                    "SchlumpfKing",
 | 
			
		||||
                    "PurzelBär",
 | 
			
		||||
                    "FlinkFluff",
 | 
			
		||||
                    "PloppPudel",
 | 
			
		||||
                    "Schnorchel",
 | 
			
		||||
                    "FliegenKopf",
 | 
			
		||||
                    "PixelPommes",
 | 
			
		||||
                    "SchwipsWürst",
 | 
			
		||||
                    "WutzBär",
 | 
			
		||||
                    "KnuddelKeks",
 | 
			
		||||
                    "FantaFlumm",
 | 
			
		||||
                    "ZockerKäse",
 | 
			
		||||
                    "LachHäufchen",
 | 
			
		||||
                    "GurkenGuru",
 | 
			
		||||
                    "PonySchnitzel",
 | 
			
		||||
                    "NudelNinja",
 | 
			
		||||
                    "VulkanKeks",
 | 
			
		||||
                    "WasserToast",
 | 
			
		||||
                    "MenschSalat",
 | 
			
		||||
                    "KampfKohl",
 | 
			
		||||
                    "SockenZirkus",
 | 
			
		||||
                    "SchwimmBärchen",
 | 
			
		||||
                    "TanzenderPudel",
 | 
			
		||||
                    "PizzamarktMensch",
 | 
			
		||||
                    "ZahnarztZocker",
 | 
			
		||||
                    "RollerRudi",
 | 
			
		||||
                    "PupsPilot",
 | 
			
		||||
                    "WitzigeZwiebel",
 | 
			
		||||
                    "Pillenschlucker",
 | 
			
		||||
                    "ZwiebelReiter",
 | 
			
		||||
                    "HüpfenderKaktus",
 | 
			
		||||
                    "AsteroidenAlf",
 | 
			
		||||
                    "ChaosKarotte",
 | 
			
		||||
                    "WolkenFurz",
 | 
			
		||||
                    "Krümelmonster",
 | 
			
		||||
                    "WackelBiene",
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            Random random = new Random();
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -122,7 +121,7 @@ protected void onHide() {
 | 
			
		||||
     * Updates the dialog's state. This method can be used for periodic updates while the dialog is active.
 | 
			
		||||
     */
 | 
			
		||||
    public void update() {
 | 
			
		||||
        if(!active) {
 | 
			
		||||
        if (!active) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -130,13 +129,13 @@ public void update() {
 | 
			
		||||
    /**
 | 
			
		||||
     * Updates the resolution settings and optionally triggers the restart button if changes are detected.
 | 
			
		||||
     *
 | 
			
		||||
     * @param width         The width of the resolution.
 | 
			
		||||
     * @param height        The height of the resolution.
 | 
			
		||||
     * @param imageFactor   The scaling factor for the resolution.
 | 
			
		||||
     * @param isFullscreen  {@code true} if fullscreen mode is enabled, {@code false} otherwise.
 | 
			
		||||
     * @param width        The width of the resolution.
 | 
			
		||||
     * @param height       The height of the resolution.
 | 
			
		||||
     * @param imageFactor  The scaling factor for the resolution.
 | 
			
		||||
     * @param isFullscreen {@code true} if fullscreen mode is enabled, {@code false} otherwise.
 | 
			
		||||
     */
 | 
			
		||||
    public void updateResolution(int width, int height, float imageFactor, boolean isFullscreen) {
 | 
			
		||||
        if(width != prefs.getInt("width", 1280) || height != prefs.getInt("height", 720) || isFullscreen != prefs.getBoolean("fullscreen", false)) {
 | 
			
		||||
        if (width != prefs.getInt("width", 1280) || height != prefs.getInt("height", 720) || isFullscreen != prefs.getBoolean("fullscreen", false)) {
 | 
			
		||||
            restartButton.show();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
 * The {@code ActionTextHandler} class manages the display of animated and stylized text messages in the game's UI.
 | 
			
		||||
 * It supports dynamic text creation with spacing, color, and effects, such as dice rolls, player actions, and rankings.
 | 
			
		||||
 */
 | 
			
		||||
 class ActionTextHandler {
 | 
			
		||||
class ActionTextHandler {
 | 
			
		||||
    private Node root;
 | 
			
		||||
    private BitmapFont font;
 | 
			
		||||
    private AppSettings appSettings;
 | 
			
		||||
@@ -29,7 +29,7 @@ class ActionTextHandler {
 | 
			
		||||
     * @param assetManager The asset manager used to load fonts and other assets.
 | 
			
		||||
     * @param appSettings  The application settings for positioning and sizing.
 | 
			
		||||
     */
 | 
			
		||||
     ActionTextHandler(Node guiNode, AssetManager assetManager, AppSettings appSettings){
 | 
			
		||||
    ActionTextHandler(Node guiNode, AssetManager assetManager, AppSettings appSettings) {
 | 
			
		||||
        root = new Node("actionTextRoot");
 | 
			
		||||
        guiNode.attachChild(root);
 | 
			
		||||
 | 
			
		||||
@@ -50,12 +50,12 @@ class ActionTextHandler {
 | 
			
		||||
     * @throws RuntimeException if the lengths of {@code textArr} and {@code colorArr} do not match.
 | 
			
		||||
     */
 | 
			
		||||
    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");
 | 
			
		||||
        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++){
 | 
			
		||||
        for (int i = 0; i < textArr.length; i++) {
 | 
			
		||||
            String text = textArr[i];
 | 
			
		||||
            ColorRGBA color = colorArr[i];
 | 
			
		||||
            for (char c : text.toCharArray()) {
 | 
			
		||||
@@ -63,14 +63,14 @@ private Node createTextWithSpacing(String[] textArr, float spacing, float size,
 | 
			
		||||
                letter.setColor(color);
 | 
			
		||||
                letter.setSize(size);
 | 
			
		||||
                letter.setText(Character.toString(c));
 | 
			
		||||
                letter.setLocalTranslation(xOffset, letter.getHeight()/2, 0);
 | 
			
		||||
                letter.setLocalTranslation(xOffset, letter.getHeight() / 2, 0);
 | 
			
		||||
                center.attachChild(letter);
 | 
			
		||||
 | 
			
		||||
                xOffset += letter.getLineWidth() + spacing;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        center.setLocalTranslation(new Vector3f(-xOffset/2,0,0));
 | 
			
		||||
        center.setLocalTranslation(new Vector3f(-xOffset / 2, 0, 0));
 | 
			
		||||
        textNode.attachChild(center);
 | 
			
		||||
        return textNode;
 | 
			
		||||
    }
 | 
			
		||||
@@ -96,8 +96,8 @@ private Node createTextWithSpacing(String text, float spacing, float size, Color
 | 
			
		||||
     * @param pos    The origin position of the rectangle.
 | 
			
		||||
     * @return A {@code Vector3f} representing the center position.
 | 
			
		||||
     */
 | 
			
		||||
    private Vector3f center(float width, float height, Vector3f pos){
 | 
			
		||||
        return new Vector3f(pos.x+width/2, pos.y+height/2,0);
 | 
			
		||||
    private Vector3f center(float width, float height, Vector3f pos) {
 | 
			
		||||
        return new Vector3f(pos.x + width / 2, pos.y + height / 2, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -110,7 +110,7 @@ private Vector3f center(float width, float height, Vector3f pos){
 | 
			
		||||
     * @param top     The vertical offset from the top of the screen.
 | 
			
		||||
     * @return A {@code Node} containing the styled text positioned at the top.
 | 
			
		||||
     */
 | 
			
		||||
    private Node createTopText(String name, float spacing, float size, ColorRGBA color, float top){
 | 
			
		||||
    private Node createTopText(String name, float spacing, float size, ColorRGBA color, float top) {
 | 
			
		||||
        return createTopText(new String[]{name}, spacing, size, new ColorRGBA[]{color}, top);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -124,9 +124,9 @@ private Node createTopText(String name, float spacing, float size, ColorRGBA col
 | 
			
		||||
     * @param top     The vertical offset from the top of the screen.
 | 
			
		||||
     * @return A {@code Node} containing the styled text positioned at the top.
 | 
			
		||||
     */
 | 
			
		||||
    private Node createTopText(String[] name, float spacing, float size, ColorRGBA color[], float 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);
 | 
			
		||||
        text.setLocalTranslation(0, (appSettings.getHeight() / 2f) * 0.8f - top, 0);
 | 
			
		||||
        root.attachChild(text);
 | 
			
		||||
        return text;
 | 
			
		||||
    }
 | 
			
		||||
@@ -139,7 +139,7 @@ private Node createTopText(String[] name, float spacing, float size, ColorRGBA c
 | 
			
		||||
     * @param pos    The origin position of the rectangle.
 | 
			
		||||
     * @return A {@code Vector3f} representing the center position.
 | 
			
		||||
     */
 | 
			
		||||
    private Vector3f centerText(float width, float height, Vector3f pos){
 | 
			
		||||
    private Vector3f centerText(float width, float height, Vector3f pos) {
 | 
			
		||||
        return center(-width, height, pos);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -149,8 +149,8 @@ private Vector3f centerText(float width, float height, Vector3f pos){
 | 
			
		||||
     * @param name  The name of the active player.
 | 
			
		||||
     * @param color The color representing the player's team.
 | 
			
		||||
     */
 | 
			
		||||
     void activePlayer(String name, Color color){
 | 
			
		||||
        createTopText(new String[]{name," ist dran"}, 10,90,new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
 | 
			
		||||
    void activePlayer(String name, Color color) {
 | 
			
		||||
        createTopText(new String[]{name, " ist dran"}, 10, 90, new ColorRGBA[]{playerColorToColorRGBA(color), ColorRGBA.White}, 0).addControl(new ZoomControl());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -158,8 +158,8 @@ void activePlayer(String name, Color color){
 | 
			
		||||
     *
 | 
			
		||||
     * @param color The color representing the player's team.
 | 
			
		||||
     */
 | 
			
		||||
     void ownActive(Color color){
 | 
			
		||||
        createTopText(new String[]{"Du"," bist dran"}, 10,90,new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
 | 
			
		||||
    void ownActive(Color color) {
 | 
			
		||||
        createTopText(new String[]{"Du", " bist dran"}, 10, 90, new ColorRGBA[]{playerColorToColorRGBA(color), ColorRGBA.White}, 0).addControl(new ZoomControl());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -169,8 +169,8 @@ void ownActive(Color color){
 | 
			
		||||
     * @param name    The name of the player.
 | 
			
		||||
     * @param color   The color representing the player's team.
 | 
			
		||||
     */
 | 
			
		||||
     void diceNum(int diceNum, String name, Color color){
 | 
			
		||||
        createTopText(new String[]{name," würfelt:"}, 10,90,new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0);
 | 
			
		||||
    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);
 | 
			
		||||
 | 
			
		||||
@@ -184,10 +184,10 @@ void diceNum(int diceNum, String name, Color color){
 | 
			
		||||
     * @param name    The name of the player.
 | 
			
		||||
     * @param color   The color representing the player's team.
 | 
			
		||||
     */
 | 
			
		||||
     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);
 | 
			
		||||
    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);
 | 
			
		||||
        createTopText(new String[]{String.valueOf(diceNum), " x" + mult + " = " + (diceNum * mult)}, 20, 100, new ColorRGBA[]{ColorRGBA.White, ColorRGBA.Red}, 100);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -195,7 +195,7 @@ void diceNumMult(int diceNum,int mult, String name, Color color){
 | 
			
		||||
     *
 | 
			
		||||
     * @param diceNum The number rolled on the dice.
 | 
			
		||||
     */
 | 
			
		||||
     void ownDice(int diceNum){
 | 
			
		||||
    void ownDice(int diceNum) {
 | 
			
		||||
        createTopText(String.valueOf(diceNum), 10, 100, ColorRGBA.White, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -205,8 +205,8 @@ void ownDice(int diceNum){
 | 
			
		||||
     * @param diceNum The number rolled on the dice.
 | 
			
		||||
     * @param mult    The multiplier applied to the dice result.
 | 
			
		||||
     */
 | 
			
		||||
     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);
 | 
			
		||||
    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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -215,8 +215,8 @@ void ownDiceMult(int diceNum, int mult){
 | 
			
		||||
     * @param name  The name of the player who received the bonus card.
 | 
			
		||||
     * @param color The color representing the player's team.
 | 
			
		||||
     */
 | 
			
		||||
     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());
 | 
			
		||||
    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());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -224,8 +224,8 @@ void drawCard(String name, Color color){
 | 
			
		||||
     *
 | 
			
		||||
     * @param color The color representing the player's team.
 | 
			
		||||
     */
 | 
			
		||||
     void drawCardOwn(Color color){
 | 
			
		||||
        createTopText(new String[]{"Du","  erhälst eine Bonuskarte"}, 5,70, new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
 | 
			
		||||
    void drawCardOwn(Color color) {
 | 
			
		||||
        createTopText(new String[]{"Du", "  erhälst eine Bonuskarte"}, 5, 70, new ColorRGBA[]{playerColorToColorRGBA(color), ColorRGBA.White}, 0).addControl(new ZoomControl());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -234,8 +234,8 @@ void drawCardOwn(Color color){
 | 
			
		||||
     * @param name  The name of the player who finished.
 | 
			
		||||
     * @param color The color representing the player's team.
 | 
			
		||||
     */
 | 
			
		||||
     void finishText(String name, Color color){
 | 
			
		||||
        createTopText(new String[]{name," ist fertig!"}, 7,70, new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
 | 
			
		||||
    void finishText(String name, Color color) {
 | 
			
		||||
        createTopText(new String[]{name, " ist fertig!"}, 7, 70, new ColorRGBA[]{playerColorToColorRGBA(color), ColorRGBA.White}, 0).addControl(new ZoomControl());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -243,8 +243,8 @@ void finishText(String name, Color color){
 | 
			
		||||
     *
 | 
			
		||||
     * @param color The color representing the player's team.
 | 
			
		||||
     */
 | 
			
		||||
     void finishTextOwn(Color color){
 | 
			
		||||
        createTopText(new String[]{"Du", " bist fertig!"}, 7,70, new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, 0).addControl(new ZoomControl());
 | 
			
		||||
    void finishTextOwn(Color color) {
 | 
			
		||||
        createTopText(new String[]{"Du", " bist fertig!"}, 7, 70, new ColorRGBA[]{playerColorToColorRGBA(color), ColorRGBA.White}, 0).addControl(new ZoomControl());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -254,8 +254,8 @@ void finishTextOwn(Color color){
 | 
			
		||||
     * @return The corresponding {@code ColorRGBA}.
 | 
			
		||||
     * @throws RuntimeException if the color is invalid.
 | 
			
		||||
     */
 | 
			
		||||
    private ColorRGBA playerColorToColorRGBA(Color color){
 | 
			
		||||
        return switch (color){
 | 
			
		||||
    private ColorRGBA playerColorToColorRGBA(Color color) {
 | 
			
		||||
        return switch (color) {
 | 
			
		||||
            case ARMY -> ColorRGBA.Green;
 | 
			
		||||
            case NAVY -> ColorRGBA.Blue;
 | 
			
		||||
            case CYBER -> ColorRGBA.Orange;
 | 
			
		||||
@@ -267,9 +267,9 @@ private ColorRGBA playerColorToColorRGBA(Color color){
 | 
			
		||||
    /**
 | 
			
		||||
     * Hides all text messages displayed by the handler and resets the ranking counter.
 | 
			
		||||
     */
 | 
			
		||||
     void hide(){
 | 
			
		||||
         ranking = 0;
 | 
			
		||||
         root.detachAllChildren();
 | 
			
		||||
    void hide() {
 | 
			
		||||
        ranking = 0;
 | 
			
		||||
        root.detachAllChildren();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -279,8 +279,8 @@ void hide(){
 | 
			
		||||
     * @param color The color representing the player's team.
 | 
			
		||||
     * @param eye   The dice roll result.
 | 
			
		||||
     */
 | 
			
		||||
    void rollRankingResult(String name, Color color, int eye){
 | 
			
		||||
        createTopText(new String[]{name,":  "+eye}, 10,90,new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, paddingRanked*ranking);
 | 
			
		||||
    void rollRankingResult(String name, Color color, int eye) {
 | 
			
		||||
        createTopText(new String[]{name, ":  " + eye}, 10, 90, new ColorRGBA[]{playerColorToColorRGBA(color), ColorRGBA.White}, paddingRanked * ranking);
 | 
			
		||||
        ranking++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -290,15 +290,15 @@ void rollRankingResult(String name, Color color, int eye){
 | 
			
		||||
     * @param color The color representing the player's team.
 | 
			
		||||
     * @param eye   The dice roll result.
 | 
			
		||||
     */
 | 
			
		||||
     void rollRankingResultOwn(Color color, int eye){
 | 
			
		||||
         createTopText(new String[]{"Du",":  "+eye}, 10,90,new ColorRGBA[]{playerColorToColorRGBA(color),ColorRGBA.White}, paddingRanked*ranking);
 | 
			
		||||
         ranking++;
 | 
			
		||||
     }
 | 
			
		||||
    void rollRankingResultOwn(Color color, int eye) {
 | 
			
		||||
        createTopText(new String[]{"Du", ":  " + eye}, 10, 90, new ColorRGBA[]{playerColorToColorRGBA(color), ColorRGBA.White}, paddingRanked * ranking);
 | 
			
		||||
        ranking++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Displays a message prompting the player to roll the dice.
 | 
			
		||||
     */
 | 
			
		||||
     void diceNow(){
 | 
			
		||||
         createTopText("Klicke  zum  Würfeln", 5, 80, ColorRGBA.White, 0);
 | 
			
		||||
     }
 | 
			
		||||
    void diceNow() {
 | 
			
		||||
        createTopText("Klicke  zum  Würfeln", 5, 80, ColorRGBA.White, 0);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,23 +7,14 @@
 | 
			
		||||
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 ColorRGBA HIGHLIGHT_COLOR = ColorRGBA.Yellow;
 | 
			
		||||
    private static final int HIGHLIGHT_WIDTH = 9;
 | 
			
		||||
 | 
			
		||||
@@ -34,28 +25,28 @@ public class CardControl extends OutlineControl {
 | 
			
		||||
    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);
 | 
			
		||||
    public CardControl(MdgaApp app, FilterPostProcessor fpp, Camera cam, Node root) {
 | 
			
		||||
        super(app, fpp, cam,
 | 
			
		||||
            HIGHLIGHT_COLOR, HIGHLIGHT_WIDTH,
 | 
			
		||||
            HOVER_COLOR, HOVER_WIDTH,
 | 
			
		||||
            SELECT_COLOR, SELECT_WIDTH
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        this.root = root;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        Node rootNum = createNum();
 | 
			
		||||
        rootNum.setLocalTranslation(new Vector3f(0.35f,0.8f,0));
 | 
			
		||||
        rootNum.setLocalTranslation(new Vector3f(0.35f, 0.8f, 0));
 | 
			
		||||
        root.attachChild(rootNum);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Node createNum(){
 | 
			
		||||
    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));
 | 
			
		||||
        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);
 | 
			
		||||
@@ -72,7 +63,7 @@ private Node createNum(){
 | 
			
		||||
        return rootNum;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setNumCard(int num){
 | 
			
		||||
    public void setNumCard(int num) {
 | 
			
		||||
        this.num.setText(String.valueOf(num));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -81,70 +72,9 @@ public Node getRoot() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void initSpatial(){
 | 
			
		||||
    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;
 | 
			
		||||
    }
 | 
			
		||||
    private final static Vector3f HIGHLIGHT_Y = new Vector3f(0, 0.4f, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 | 
			
		||||
@@ -115,7 +116,7 @@ public void update(float tpf) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void addSpatial(Spatial card) {
 | 
			
		||||
        if(root == null) cardBuffer.add(card);
 | 
			
		||||
        if (root == null) cardBuffer.add(card);
 | 
			
		||||
        else root.attachChild(card);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,7 @@ public void rollDice(int rollNum, Runnable actionAfter) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void showDice() {
 | 
			
		||||
        if(show) return;
 | 
			
		||||
        if (show) return;
 | 
			
		||||
        show = true;
 | 
			
		||||
        cardLayer.addSpatial(diceControl.getSpatial());
 | 
			
		||||
        diceControl.spin();
 | 
			
		||||
@@ -90,11 +90,11 @@ public void addCard(BonusCard card) {
 | 
			
		||||
        updateCard();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void removeCard(BonusCard card){
 | 
			
		||||
        if(bonusCardControlMap.containsKey(card)){
 | 
			
		||||
    public void removeCard(BonusCard card) {
 | 
			
		||||
        if (bonusCardControlMap.containsKey(card)) {
 | 
			
		||||
            bonusCardIntegerMap.put(card, bonusCardIntegerMap.get(card) - 1);
 | 
			
		||||
 | 
			
		||||
            if(bonusCardIntegerMap.get(card) <= 0){
 | 
			
		||||
            if (bonusCardIntegerMap.get(card) <= 0) {
 | 
			
		||||
                bonusCardIntegerMap.remove(card);
 | 
			
		||||
                cardOrder.remove(card);
 | 
			
		||||
            }
 | 
			
		||||
@@ -104,23 +104,20 @@ public void removeCard(BonusCard card){
 | 
			
		||||
 | 
			
		||||
    public void clearSelectableCards() {
 | 
			
		||||
        for (CardControl control : selectableCards) {
 | 
			
		||||
            control.setSelectable(false);
 | 
			
		||||
            control.setHoverable(false);
 | 
			
		||||
            control.unHighlight();
 | 
			
		||||
            control.unSelect();
 | 
			
		||||
            control.selectableOff();
 | 
			
		||||
        }
 | 
			
		||||
        selectableCards.clear();
 | 
			
		||||
        cardSelect = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void updateCard(){
 | 
			
		||||
        for(BonusCard card : bonusCardControlMap.keySet()){
 | 
			
		||||
    private void updateCard() {
 | 
			
		||||
        for (BonusCard card : bonusCardControlMap.keySet()) {
 | 
			
		||||
            CardControl control = bonusCardControlMap.get(card);
 | 
			
		||||
            cardLayer.deleteSpatial(control.getRoot());
 | 
			
		||||
        }
 | 
			
		||||
        bonusCardControlMap.clear();
 | 
			
		||||
 | 
			
		||||
        for(int i = 0; i < cardOrder.size(); i++){
 | 
			
		||||
        for (int i = 0; i < cardOrder.size(); i++) {
 | 
			
		||||
            BonusCard card = cardOrder.get(i);
 | 
			
		||||
            CardControl control = createCard(bonusToAsset(card), nextPos(i));
 | 
			
		||||
            control.setNumCard(bonusCardIntegerMap.get(card));
 | 
			
		||||
@@ -134,21 +131,19 @@ public void setSelectableCards(List<BonusCard> select) {
 | 
			
		||||
            selectableCards.add(bonusCardControlMap.get(card));
 | 
			
		||||
        }
 | 
			
		||||
        for (CardControl control : selectableCards) {
 | 
			
		||||
            control.setSelectable(true);
 | 
			
		||||
            control.setHoverable(true);
 | 
			
		||||
            control.setHighlight();
 | 
			
		||||
            control.selectableOn();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectCard(CardControl cardControl) {
 | 
			
		||||
        if (cardControl.isSelected()) {
 | 
			
		||||
            cardControl.unSelect();
 | 
			
		||||
            cardControl.selectOff();
 | 
			
		||||
            cardSelect = null;
 | 
			
		||||
        } else {
 | 
			
		||||
            for (CardControl control : selectableCards) {
 | 
			
		||||
                control.unSelect();
 | 
			
		||||
                control.selectOff();
 | 
			
		||||
            }
 | 
			
		||||
            cardControl.select();
 | 
			
		||||
            cardControl.selectOn();
 | 
			
		||||
            cardSelect = getKeyByValue(bonusCardControlMap, cardControl);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -159,19 +154,19 @@ public Camera getCardLayerCamera() {
 | 
			
		||||
        return cardLayerCamera;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void shield(){
 | 
			
		||||
    public void shield() {
 | 
			
		||||
        SymbolControl control = createSymbol(Asset.shieldSymbol);
 | 
			
		||||
        cardLayer.addSpatial(control.getSpatial());
 | 
			
		||||
        control.shield();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void swap(){
 | 
			
		||||
    public void swap() {
 | 
			
		||||
        SymbolControl control = createSymbol(Asset.swapSymbol);
 | 
			
		||||
        cardLayer.addSpatial(control.getSpatial());
 | 
			
		||||
        control.swap();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void turbo(){
 | 
			
		||||
    public void turbo() {
 | 
			
		||||
        SymbolControl control = createSymbol(Asset.turboSymbol);
 | 
			
		||||
        cardLayer.addSpatial(control.getSpatial());
 | 
			
		||||
        control.turbo();
 | 
			
		||||
@@ -218,7 +213,7 @@ public void test() {
 | 
			
		||||
        addCard(BonusCard.SWAP);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private CardControl createCard(Asset card, Vector3f pos){
 | 
			
		||||
    private CardControl createCard(Asset card, Vector3f pos) {
 | 
			
		||||
        Node rootCard = new Node("Root Card");
 | 
			
		||||
        Spatial spatial = app.getAssetManager().loadModel(card.getModelPath());
 | 
			
		||||
        rootCard.attachChild(spatial);
 | 
			
		||||
@@ -227,26 +222,26 @@ private CardControl createCard(Asset card, Vector3f pos){
 | 
			
		||||
        spatial.setMaterial(mat);
 | 
			
		||||
        spatial.setLocalScale(1f);
 | 
			
		||||
        rootCard.setLocalTranslation(pos);
 | 
			
		||||
        spatial.rotate((float)Math.toRadians(90), (float)Math.toRadians(180), (float)Math.toRadians(180));
 | 
			
		||||
        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){
 | 
			
		||||
    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));
 | 
			
		||||
        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(){
 | 
			
		||||
    public CardLayer getCardLayer() {
 | 
			
		||||
        return cardLayer;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
@@ -33,7 +31,7 @@ public class DiceControl extends AbstractControl {
 | 
			
		||||
    private final AssetManager assetManager;
 | 
			
		||||
    private Runnable actionAfter;
 | 
			
		||||
 | 
			
		||||
    public DiceControl(AssetManager assetManager){
 | 
			
		||||
    public DiceControl(AssetManager assetManager) {
 | 
			
		||||
        this.assetManager = assetManager;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -42,7 +40,7 @@ public DiceControl(AssetManager assetManager){
 | 
			
		||||
    protected void controlUpdate(float tpf) {
 | 
			
		||||
        float clampedTpf = Math.min(tpf, 0.05f); // Max 50 ms per frame
 | 
			
		||||
        if (isRolling) {
 | 
			
		||||
            if(!slerp) {
 | 
			
		||||
            if (!slerp) {
 | 
			
		||||
                // Apply rotational velocity to the dice
 | 
			
		||||
                spinWithAngularVelocity(clampedTpf);
 | 
			
		||||
 | 
			
		||||
@@ -55,8 +53,7 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
                if (angularVelocity.lengthSquared() <= 3f || MdgaApp.DEBUG_MULTIPLIER == 0) {
 | 
			
		||||
                    slerp = true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
            } else {
 | 
			
		||||
                timeElapsed += clampedTpf * rollDuration;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -66,18 +63,18 @@ protected void controlUpdate(float tpf) {
 | 
			
		||||
                spatial.setLocalRotation(interpolated);
 | 
			
		||||
 | 
			
		||||
                // Stop rolling once duration is complete
 | 
			
		||||
              if (timeElapsed >= 1.0f * MdgaApp.DEBUG_MULTIPLIER) {
 | 
			
		||||
                if (timeElapsed >= 1.0f * MdgaApp.DEBUG_MULTIPLIER) {
 | 
			
		||||
                    isRolling = false;
 | 
			
		||||
                    slerp = false;
 | 
			
		||||
                    actionAfter.run();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } else if(spin){
 | 
			
		||||
        } else if (spin) {
 | 
			
		||||
            spinWithAngularVelocity(clampedTpf);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void spinWithAngularVelocity(float tpf){
 | 
			
		||||
    private void spinWithAngularVelocity(float tpf) {
 | 
			
		||||
        Quaternion currentRotation = spatial.getLocalRotation();
 | 
			
		||||
        Quaternion deltaRotation = new Quaternion();
 | 
			
		||||
        deltaRotation.fromAngles(
 | 
			
		||||
@@ -100,9 +97,9 @@ public void rollDice(int diceNum, Runnable actionAfter) {
 | 
			
		||||
        timeElapsed = 0;
 | 
			
		||||
        this.actionAfter = actionAfter;
 | 
			
		||||
        angularVelocity.set(
 | 
			
		||||
                FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX),
 | 
			
		||||
                FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX),
 | 
			
		||||
                FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX)
 | 
			
		||||
                FastMath.nextRandomInt(ANGULAR_MIN, ANGULAR_MAX),
 | 
			
		||||
                FastMath.nextRandomInt(ANGULAR_MIN, ANGULAR_MAX),
 | 
			
		||||
                FastMath.nextRandomInt(ANGULAR_MIN, ANGULAR_MAX)
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        targetRotation = getRotationForDiceNum(diceNum);
 | 
			
		||||
@@ -136,38 +133,37 @@ public void randomRotation() {
 | 
			
		||||
        spatial.setLocalRotation(randomRotation);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void spin(){
 | 
			
		||||
        angularVelocity.set(ANGULAR_SPIN,ANGULAR_SPIN,ANGULAR_SPIN);
 | 
			
		||||
    public void spin() {
 | 
			
		||||
        angularVelocity.set(ANGULAR_SPIN, ANGULAR_SPIN, ANGULAR_SPIN);
 | 
			
		||||
        spin = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void hide(){
 | 
			
		||||
    public void hide() {
 | 
			
		||||
        spatial.removeFromParent();
 | 
			
		||||
        spin = false;
 | 
			
		||||
        isRolling = false;
 | 
			
		||||
        slerp = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void create(Vector3f pos, float scale, boolean shadow){
 | 
			
		||||
    public void create(Vector3f pos, float scale, boolean shadow) {
 | 
			
		||||
        Spatial spatial = assetManager.loadModel(Asset.dice.getModelPath());
 | 
			
		||||
        Material mat;
 | 
			
		||||
        if(shadow){
 | 
			
		||||
        if (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()));
 | 
			
		||||
        }
 | 
			
		||||
        spatial.setMaterial(mat);
 | 
			
		||||
        spatial.setLocalScale(scale);
 | 
			
		||||
        spatial.setLocalTranslation(pos);
 | 
			
		||||
        spatial.rotate((float)Math.toRadians(90), (float)Math.toRadians(180), (float)Math.toRadians(180));
 | 
			
		||||
        spatial.rotate((float) Math.toRadians(90), (float) Math.toRadians(180), (float) Math.toRadians(180));
 | 
			
		||||
        spatial.addControl(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPos(Vector3f pos){
 | 
			
		||||
    public void setPos(Vector3f pos) {
 | 
			
		||||
        spatial.setLocalTranslation(pos);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
@@ -47,8 +47,8 @@ public void shutdown() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void rollDice(int rollNum, int mult) {
 | 
			
		||||
        cardLayerHandler.rollDice(rollNum, ()->{
 | 
			
		||||
            if(mult == -1) actionTextHandler.ownDice(rollNum);
 | 
			
		||||
        cardLayerHandler.rollDice(rollNum, () -> {
 | 
			
		||||
            if (mult == -1) actionTextHandler.ownDice(rollNum);
 | 
			
		||||
            else actionTextHandler.ownDiceMult(rollNum, mult);
 | 
			
		||||
            hideDice();
 | 
			
		||||
            app.getModelSynchronize().animationEnd();
 | 
			
		||||
@@ -58,7 +58,7 @@ public void rollDice(int rollNum, int mult) {
 | 
			
		||||
 | 
			
		||||
    public void showRolledDiceMult(int rollNum, int mult, Color color) {
 | 
			
		||||
        String name = playerNameHandler.getName(color);
 | 
			
		||||
        if(mult == -1) actionTextHandler.diceNum(rollNum, name, color);
 | 
			
		||||
        if (mult == -1) actionTextHandler.diceNum(rollNum, name, color);
 | 
			
		||||
        else actionTextHandler.diceNumMult(rollNum, mult, name, color);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -82,7 +82,7 @@ public void addCardOwn(BonusCard card) {
 | 
			
		||||
        actionTextHandler.drawCardOwn(ownColor);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void playCardOwn(BonusCard card){
 | 
			
		||||
    public void playCardOwn(BonusCard card) {
 | 
			
		||||
        getEffectByCard(card);
 | 
			
		||||
        cardLayerHandler.removeCard(card);
 | 
			
		||||
        playerNameHandler.removeCard(ownColor);
 | 
			
		||||
@@ -93,8 +93,8 @@ public void playCardEnemy(Color color, BonusCard card) {
 | 
			
		||||
        playerNameHandler.removeCard(color);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void getEffectByCard(BonusCard bonus){
 | 
			
		||||
        switch(bonus){
 | 
			
		||||
    private void getEffectByCard(BonusCard bonus) {
 | 
			
		||||
        switch (bonus) {
 | 
			
		||||
            case SWAP -> swap();
 | 
			
		||||
            case TURBO -> turbo();
 | 
			
		||||
            case SHIELD -> shield();
 | 
			
		||||
@@ -118,7 +118,7 @@ public Camera getCardLayerCamera() {
 | 
			
		||||
        return cardLayerHandler.getCardLayerCamera();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Node getCardLayerRootNode(){
 | 
			
		||||
    public Node getCardLayerRootNode() {
 | 
			
		||||
        return cardLayerHandler.getCardLayer().getRootNode();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -133,19 +133,19 @@ public void setActivePlayer(Color color) {
 | 
			
		||||
        else actionTextHandler.activePlayer(playerNameHandler.getName(color), color);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void shield(){
 | 
			
		||||
    public void shield() {
 | 
			
		||||
        cardLayerHandler.shield();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void swap(){
 | 
			
		||||
    public void swap() {
 | 
			
		||||
        cardLayerHandler.swap();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void turbo(){
 | 
			
		||||
    public void turbo() {
 | 
			
		||||
        cardLayerHandler.turbo();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void hideText(){
 | 
			
		||||
    public void hideText() {
 | 
			
		||||
        actionTextHandler.hide();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -156,17 +156,15 @@ public void drawCard(Color color) {
 | 
			
		||||
        playerNameHandler.addCard(color);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void finish(Color color){
 | 
			
		||||
        if(ownColor == color) actionTextHandler.finishTextOwn(color);
 | 
			
		||||
    public void finish(Color color) {
 | 
			
		||||
        if (ownColor == color) actionTextHandler.finishTextOwn(color);
 | 
			
		||||
        else actionTextHandler.finishText(playerNameHandler.getName(color), color);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void rollRankingResult(Color color, int eye){
 | 
			
		||||
        if(ownColor == color) actionTextHandler.rollRankingResultOwn(color, eye);
 | 
			
		||||
    public void rollRankingResult(Color color, int eye) {
 | 
			
		||||
        if (ownColor == color) actionTextHandler.rollRankingResultOwn(color, eye);
 | 
			
		||||
        else actionTextHandler.rollRankingResult(playerNameHandler.getName(color), color, eye);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -40,7 +37,7 @@ public class PlayerNameHandler {
 | 
			
		||||
 | 
			
		||||
    private final Node guiNode;
 | 
			
		||||
 | 
			
		||||
    public PlayerNameHandler(Node guiNode, AssetManager assetManager, AppSettings appSettings){
 | 
			
		||||
    public PlayerNameHandler(Node guiNode, AssetManager assetManager, AppSettings appSettings) {
 | 
			
		||||
        this.guiNode = guiNode;
 | 
			
		||||
 | 
			
		||||
        playerFont = assetManager.loadFont("Fonts/Gunplay.fnt");
 | 
			
		||||
@@ -60,35 +57,35 @@ public void hide() {
 | 
			
		||||
        guiNode.detachChild(playerNameNode);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void drawPlayers(){
 | 
			
		||||
    private void drawPlayers() {
 | 
			
		||||
        playerNameNode.detachAllChildren();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        for(int i = 0; i < playerOrder.size(); i++) {
 | 
			
		||||
        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");
 | 
			
		||||
            if (!colorNameMap.containsKey(color)) throw new RuntimeException(color + " isn't mapped to a name");
 | 
			
		||||
 | 
			
		||||
            Node nameParent = new Node("nameParent");
 | 
			
		||||
            nameParent.attachChild(createColor(color));
 | 
			
		||||
            BitmapText name = createName(colorNameMap.get(color), i == 0, color == ownColor);
 | 
			
		||||
            nameParent.attachChild(name);
 | 
			
		||||
            if(colorCardMap.getOrDefault(color, 0) > 0){
 | 
			
		||||
            if (colorCardMap.getOrDefault(color, 0) > 0) {
 | 
			
		||||
                Picture pic = createHandCard(name.getLineWidth());
 | 
			
		||||
                nameParent.attachChild(pic);
 | 
			
		||||
                nameParent.attachChild(createCardNum(colorCardMap.get(color), pic.getWidth(), pic.getLocalTranslation().getX()));
 | 
			
		||||
            }
 | 
			
		||||
            nameParent.setLocalTranslation(50,appSettings.getWindowHeight()-PADDING_TOP- MARGIN_NAMES *i,0);
 | 
			
		||||
            nameParent.setLocalTranslation(50, appSettings.getWindowHeight() - PADDING_TOP - MARGIN_NAMES * i, 0);
 | 
			
		||||
            playerNameNode.attachChild(nameParent);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Spatial createCardNum(int num, float lastWidth, float lastX ) {
 | 
			
		||||
    private Spatial createCardNum(int num, float lastWidth, float lastX) {
 | 
			
		||||
        BitmapText hudText = new BitmapText(playerFont);
 | 
			
		||||
        //renderedSize = 45
 | 
			
		||||
        hudText.setSize(TEXT_SIZE);
 | 
			
		||||
        hudText.setColor(NORMAL_COLOR);
 | 
			
		||||
        hudText.setText(String.valueOf(num));
 | 
			
		||||
        hudText.setLocalTranslation(lastX + lastWidth + 20,hudText.getHeight()/2, 0);
 | 
			
		||||
        hudText.setLocalTranslation(lastX + lastWidth + 20, hudText.getHeight() / 2, 0);
 | 
			
		||||
        return hudText;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -97,17 +94,17 @@ private Picture createHandCard(float width) {
 | 
			
		||||
        pic.setImage(assetManager, "./Images/handcard.png", true);
 | 
			
		||||
        pic.setWidth(IMAGE_SIZE);
 | 
			
		||||
        pic.setHeight(IMAGE_SIZE);
 | 
			
		||||
        pic.setPosition(-pic.getWidth()/2 + width + PADDING_LEFT * 2 ,-pic.getHeight()/2);
 | 
			
		||||
        pic.setPosition(-pic.getWidth() / 2 + width + PADDING_LEFT * 2, -pic.getHeight() / 2);
 | 
			
		||||
        return pic;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private String imagePath(Color color){
 | 
			
		||||
    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";
 | 
			
		||||
        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";
 | 
			
		||||
            default -> throw new RuntimeException("None is not valid");
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
@@ -117,31 +114,30 @@ private Spatial createColor(Color color) {
 | 
			
		||||
        pic.setImage(assetManager, imagePath(color), true);
 | 
			
		||||
        pic.setWidth(IMAGE_SIZE);
 | 
			
		||||
        pic.setHeight(IMAGE_SIZE);
 | 
			
		||||
        pic.setPosition(-pic.getWidth()/2,-pic.getHeight()/2);
 | 
			
		||||
        pic.setPosition(-pic.getWidth() / 2, -pic.getHeight() / 2);
 | 
			
		||||
        return pic;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private BitmapText createName(String name, boolean first, boolean own){
 | 
			
		||||
    private BitmapText 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(own ? name + " (Du)" : name);
 | 
			
		||||
        hudText.setLocalTranslation(PADDING_LEFT,hudText.getHeight()/2, 0);
 | 
			
		||||
        hudText.setLocalTranslation(PADDING_LEFT, hudText.getHeight() / 2, 0);
 | 
			
		||||
        return hudText;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void addPlayer(Color color, String name, boolean own){
 | 
			
		||||
        if(own) ownColor = color;
 | 
			
		||||
    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) {
 | 
			
		||||
        if(playerOrder.get(0) == color) return;
 | 
			
		||||
        if (playerOrder.get(0) == color) return;
 | 
			
		||||
        Color oldFirst = playerOrder.remove(0);
 | 
			
		||||
        playerOrder.remove(color);
 | 
			
		||||
        playerOrder.add(0, color);
 | 
			
		||||
@@ -150,20 +146,20 @@ public void setActivePlayer(Color color) {
 | 
			
		||||
        drawPlayers();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getName(Color color){
 | 
			
		||||
        if(!colorNameMap.containsKey(color)) throw new RuntimeException("color is not in colorNameMap");
 | 
			
		||||
    public String getName(Color color) {
 | 
			
		||||
        if (!colorNameMap.containsKey(color)) throw new RuntimeException("color is not in colorNameMap");
 | 
			
		||||
        return colorNameMap.get(color);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void addCard(Color color){
 | 
			
		||||
    public void addCard(Color color) {
 | 
			
		||||
        colorCardMap.put(color, colorCardMap.getOrDefault(color, 0) + 1);
 | 
			
		||||
        drawPlayers();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void removeCard(Color color){
 | 
			
		||||
        if(colorCardMap.containsKey(color)){
 | 
			
		||||
    public void removeCard(Color color) {
 | 
			
		||||
        if (colorCardMap.containsKey(color)) {
 | 
			
		||||
            colorCardMap.put(color, colorCardMap.getOrDefault(color, 0) - 1);
 | 
			
		||||
            if(colorCardMap.get(color) <= 0) colorCardMap.remove(color);
 | 
			
		||||
            if (colorCardMap.get(color) <= 0) colorCardMap.remove(color);
 | 
			
		||||
        }
 | 
			
		||||
        drawPlayers();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -13,67 +13,67 @@
 | 
			
		||||
 | 
			
		||||
public class OutlineFilter extends Filter {
 | 
			
		||||
 | 
			
		||||
	private OutlinePreFilter outlinePreFilter;
 | 
			
		||||
	private ColorRGBA outlineColor = new ColorRGBA(0, 1, 0, 1);
 | 
			
		||||
	private float outlineWidth = 1;
 | 
			
		||||
    private OutlinePreFilter outlinePreFilter;
 | 
			
		||||
    private ColorRGBA outlineColor = new ColorRGBA(0, 1, 0, 1);
 | 
			
		||||
    private float outlineWidth = 1;
 | 
			
		||||
 | 
			
		||||
	public OutlineFilter(OutlinePreFilter outlinePreFilter) {
 | 
			
		||||
		super("OutlineFilter");
 | 
			
		||||
		this.outlinePreFilter = outlinePreFilter;
 | 
			
		||||
	}
 | 
			
		||||
    public OutlineFilter(OutlinePreFilter outlinePreFilter) {
 | 
			
		||||
        super("OutlineFilter");
 | 
			
		||||
        this.outlinePreFilter = outlinePreFilter;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected void initFilter(AssetManager assetManager, RenderManager renderManager, ViewPort vp, int w, int h) {
 | 
			
		||||
		MaterialDef matDef = (MaterialDef) assetManager.loadAsset("MatDefs/SelectObjectOutliner/Outline.j3md");
 | 
			
		||||
		material = new Material(matDef);
 | 
			
		||||
		material.setVector2("Resolution", new Vector2f(w, h));
 | 
			
		||||
		material.setColor("OutlineColor", outlineColor);
 | 
			
		||||
		material.setFloat("OutlineWidth", outlineWidth);
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void initFilter(AssetManager assetManager, RenderManager renderManager, ViewPort vp, int w, int h) {
 | 
			
		||||
        MaterialDef matDef = (MaterialDef) assetManager.loadAsset("MatDefs/SelectObjectOutliner/Outline.j3md");
 | 
			
		||||
        material = new Material(matDef);
 | 
			
		||||
        material.setVector2("Resolution", new Vector2f(w, h));
 | 
			
		||||
        material.setColor("OutlineColor", outlineColor);
 | 
			
		||||
        material.setFloat("OutlineWidth", outlineWidth);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected void preFrame(float tpf) {
 | 
			
		||||
		super.preFrame(tpf);
 | 
			
		||||
		material.setTexture("OutlineDepthTexture", outlinePreFilter.getOutlineTexture());
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void preFrame(float tpf) {
 | 
			
		||||
        super.preFrame(tpf);
 | 
			
		||||
        material.setTexture("OutlineDepthTexture", outlinePreFilter.getOutlineTexture());
 | 
			
		||||
//		System.out.println("OutlineFilter.preFrame()");
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
 | 
			
		||||
		super.postFrame(renderManager, viewPort, prevFilterBuffer, sceneBuffer);
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
 | 
			
		||||
        super.postFrame(renderManager, viewPort, prevFilterBuffer, sceneBuffer);
 | 
			
		||||
//		material.setTexture("OutlineDepthTexture", outlinePreFilter.getDefaultPassDepthTexture());
 | 
			
		||||
//		System.out.println("OutlineFilter.postFrame()");
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected Material getMaterial() {
 | 
			
		||||
		return material;
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    protected Material getMaterial() {
 | 
			
		||||
        return material;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public ColorRGBA getOutlineColor() {
 | 
			
		||||
		return outlineColor;
 | 
			
		||||
	}
 | 
			
		||||
    public ColorRGBA getOutlineColor() {
 | 
			
		||||
        return outlineColor;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setOutlineColor(ColorRGBA outlineColor) {
 | 
			
		||||
		this.outlineColor = outlineColor;
 | 
			
		||||
		if (material != null) {
 | 
			
		||||
			material.setColor("OutlineColor", outlineColor);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
    public void setOutlineColor(ColorRGBA outlineColor) {
 | 
			
		||||
        this.outlineColor = outlineColor;
 | 
			
		||||
        if (material != null) {
 | 
			
		||||
            material.setColor("OutlineColor", outlineColor);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public float getOutlineWidth() {
 | 
			
		||||
		return outlineWidth;
 | 
			
		||||
	}
 | 
			
		||||
    public float getOutlineWidth() {
 | 
			
		||||
        return outlineWidth;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public void setOutlineWidth(float outlineWidth) {
 | 
			
		||||
		this.outlineWidth = outlineWidth;
 | 
			
		||||
		if (material != null) {
 | 
			
		||||
			material.setFloat("OutlineWidth", outlineWidth);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
    public void setOutlineWidth(float outlineWidth) {
 | 
			
		||||
        this.outlineWidth = outlineWidth;
 | 
			
		||||
        if (material != null) {
 | 
			
		||||
            material.setFloat("OutlineWidth", outlineWidth);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public OutlinePreFilter getOutlinePreFilter() {
 | 
			
		||||
		return outlinePreFilter;
 | 
			
		||||
	}
 | 
			
		||||
    public OutlinePreFilter getOutlinePreFilter() {
 | 
			
		||||
        return outlinePreFilter;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -14,54 +14,54 @@
 | 
			
		||||
 | 
			
		||||
public class OutlinePreFilter extends Filter {
 | 
			
		||||
 | 
			
		||||
	private Pass normalPass;
 | 
			
		||||
	private RenderManager renderManager;
 | 
			
		||||
    private Pass normalPass;
 | 
			
		||||
    private RenderManager renderManager;
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Creates a OutlinePreFilter
 | 
			
		||||
	 */
 | 
			
		||||
	public OutlinePreFilter() {
 | 
			
		||||
		super("OutlinePreFilter");
 | 
			
		||||
	}
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates a OutlinePreFilter
 | 
			
		||||
     */
 | 
			
		||||
    public OutlinePreFilter() {
 | 
			
		||||
        super("OutlinePreFilter");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected boolean isRequiresDepthTexture() {
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    protected boolean isRequiresDepthTexture() {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected void postQueue(RenderQueue queue) {
 | 
			
		||||
		Renderer r = renderManager.getRenderer();
 | 
			
		||||
		r.setFrameBuffer(normalPass.getRenderFrameBuffer());
 | 
			
		||||
		renderManager.getRenderer().clearBuffers(true, true, false);
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void postQueue(RenderQueue queue) {
 | 
			
		||||
        Renderer r = renderManager.getRenderer();
 | 
			
		||||
        r.setFrameBuffer(normalPass.getRenderFrameBuffer());
 | 
			
		||||
        renderManager.getRenderer().clearBuffers(true, true, false);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
 | 
			
		||||
		super.postFrame(renderManager, viewPort, prevFilterBuffer, sceneBuffer);
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
 | 
			
		||||
        super.postFrame(renderManager, viewPort, prevFilterBuffer, sceneBuffer);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected Material getMaterial() {
 | 
			
		||||
		return material;
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    protected Material getMaterial() {
 | 
			
		||||
        return material;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	public Texture getOutlineTexture() {
 | 
			
		||||
		return normalPass.getRenderedTexture();
 | 
			
		||||
	}
 | 
			
		||||
    public Texture getOutlineTexture() {
 | 
			
		||||
        return normalPass.getRenderedTexture();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
 | 
			
		||||
		this.renderManager = renderManager;
 | 
			
		||||
		normalPass = new Pass();
 | 
			
		||||
		normalPass.init(renderManager.getRenderer(), w, h, Format.RGBA8, Format.Depth);
 | 
			
		||||
		material = new Material(manager, "MatDefs/SelectObjectOutliner/OutlinePre.j3md");
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
 | 
			
		||||
        this.renderManager = renderManager;
 | 
			
		||||
        normalPass = new Pass();
 | 
			
		||||
        normalPass.init(renderManager.getRenderer(), w, h, Format.RGBA8, Format.Depth);
 | 
			
		||||
        material = new Material(manager, "MatDefs/SelectObjectOutliner/OutlinePre.j3md");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected void cleanUpFilter(Renderer r) {
 | 
			
		||||
		normalPass.cleanup(r);
 | 
			
		||||
	}
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void cleanUpFilter(Renderer r) {
 | 
			
		||||
        normalPass.cleanup(r);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -16,67 +15,65 @@ public class SelectObjectOutliner {
 | 
			
		||||
    private final RenderManager renderManager;
 | 
			
		||||
    private final AssetManager assetManager;
 | 
			
		||||
    private final Camera cam;
 | 
			
		||||
    private final int width;
 | 
			
		||||
    private boolean selected;
 | 
			
		||||
    private ViewPort outlineViewport = null;
 | 
			
		||||
//    private OutlineFilter outlineFilter = null;
 | 
			
		||||
    //    private OutlineFilter outlineFilter = null;
 | 
			
		||||
    private OutlineProFilter outlineFilter = null;
 | 
			
		||||
    private final MdgaApp app;
 | 
			
		||||
 | 
			
		||||
    public SelectObjectOutliner(int width, FilterPostProcessor fpp, RenderManager renderManager, AssetManager assetManager, Camera cam, MdgaApp app) {
 | 
			
		||||
    public SelectObjectOutliner(FilterPostProcessor fpp, RenderManager renderManager, AssetManager assetManager, Camera cam, MdgaApp app) {
 | 
			
		||||
        this.selected = false;
 | 
			
		||||
        this.fpp = fpp;
 | 
			
		||||
        this.renderManager = renderManager;
 | 
			
		||||
        this.assetManager = assetManager;
 | 
			
		||||
        this.cam = cam;
 | 
			
		||||
        this.width = width;
 | 
			
		||||
        this.app = app;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void deselect(Spatial model) {
 | 
			
		||||
        if(selected){
 | 
			
		||||
        if (selected) {
 | 
			
		||||
            selected = false;
 | 
			
		||||
            hideOutlineFilterEffect(model);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void select(Spatial model, ColorRGBA color) {
 | 
			
		||||
        if(!selected){
 | 
			
		||||
            selected = true;
 | 
			
		||||
            showOutlineFilterEffect(model, width, color);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
//    public void select(Spatial model, ColorRGBA color) {
 | 
			
		||||
//        if (!selected) {
 | 
			
		||||
//            selected = true;
 | 
			
		||||
//            showOutlineFilterEffect(model, width, color);
 | 
			
		||||
//        }
 | 
			
		||||
//    }
 | 
			
		||||
 | 
			
		||||
    public void select(Spatial model, ColorRGBA color, int width) {
 | 
			
		||||
        if(!selected){
 | 
			
		||||
        if (!selected) {
 | 
			
		||||
            selected = true;
 | 
			
		||||
            showOutlineFilterEffect(model, width, color);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void hideOutlineFilterEffect(Spatial model) {
 | 
			
		||||
            outlineFilter.setEnabled(false);
 | 
			
		||||
            outlineFilter.getOutlinePreFilter().setEnabled(false);
 | 
			
		||||
            fpp.removeFilter(outlineFilter);
 | 
			
		||||
            outlineViewport.detachScene(model);
 | 
			
		||||
            outlineViewport.clearProcessors();
 | 
			
		||||
            renderManager.removePreView(outlineViewport);
 | 
			
		||||
            outlineViewport = null;
 | 
			
		||||
        outlineFilter.setEnabled(false);
 | 
			
		||||
        outlineFilter.getOutlinePreFilter().setEnabled(false);
 | 
			
		||||
        fpp.removeFilter(outlineFilter);
 | 
			
		||||
        outlineViewport.detachScene(model);
 | 
			
		||||
        outlineViewport.clearProcessors();
 | 
			
		||||
        renderManager.removePreView(outlineViewport);
 | 
			
		||||
        outlineViewport = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void showOutlineFilterEffect(Spatial model, int width, ColorRGBA color) {
 | 
			
		||||
            outlineViewport = renderManager.createPreView("outlineViewport", cam);
 | 
			
		||||
            FilterPostProcessor outlineFpp = new FilterPostProcessor(assetManager);
 | 
			
		||||
        outlineViewport = renderManager.createPreView("outlineViewport", cam);
 | 
			
		||||
        FilterPostProcessor outlineFpp = new FilterPostProcessor(assetManager);
 | 
			
		||||
 | 
			
		||||
            OutlinePreFilter outlinePreFilter = new OutlinePreFilter();
 | 
			
		||||
            outlineFpp.addFilter(outlinePreFilter);
 | 
			
		||||
            outlineViewport.attachScene(model);
 | 
			
		||||
            outlineViewport.addProcessor(outlineFpp);
 | 
			
		||||
        OutlinePreFilter outlinePreFilter = new OutlinePreFilter();
 | 
			
		||||
        outlineFpp.addFilter(outlinePreFilter);
 | 
			
		||||
        outlineViewport.attachScene(model);
 | 
			
		||||
        outlineViewport.addProcessor(outlineFpp);
 | 
			
		||||
 | 
			
		||||
            outlineFilter = new OutlineProFilter(outlinePreFilter);
 | 
			
		||||
            outlineFilter.setOutlineColor(color);
 | 
			
		||||
            outlineFilter.setOutlineWidth(width);
 | 
			
		||||
        outlineFilter = new OutlineProFilter(outlinePreFilter);
 | 
			
		||||
        outlineFilter.setOutlineColor(color);
 | 
			
		||||
        outlineFilter.setOutlineWidth(width);
 | 
			
		||||
 | 
			
		||||
            fpp.addFilter(outlineFilter);
 | 
			
		||||
        fpp.addFilter(outlineFilter);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -283,11 +283,10 @@ public void send(int id, ServerMessage message) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        final HostedConnection connection = myServer.getConnection(id);
 | 
			
		||||
        if (connection != null){
 | 
			
		||||
        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
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -1,32 +1,29 @@
 | 
			
		||||
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
 | 
			
		||||
{
 | 
			
		||||
    byte[] uuid = new byte[36];
 | 
			
		||||
    data.get(uuid);
 | 
			
		||||
    public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
 | 
			
		||||
        byte[] uuid = new byte[36];
 | 
			
		||||
        data.get(uuid);
 | 
			
		||||
 | 
			
		||||
    if(uuid.equals(new UUID(1, 1))) {
 | 
			
		||||
        return null;
 | 
			
		||||
    } else {
 | 
			
		||||
        return (T) UUID.fromString(new String(uuid));
 | 
			
		||||
        if (uuid.equals(new UUID(1, 1))) {
 | 
			
		||||
            return null;
 | 
			
		||||
        } else {
 | 
			
		||||
            return (T) UUID.fromString(new String(uuid));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
    @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) {
 | 
			
		||||
        if (uuid != null) {
 | 
			
		||||
            buffer.put(uuid.toString().getBytes());
 | 
			
		||||
        } else {
 | 
			
		||||
            buffer.put(new UUID(1, 1).toString().getBytes());
 | 
			
		||||
 
 | 
			
		||||
@@ -103,7 +103,7 @@ public void onLeave() {
 | 
			
		||||
        backButton.hide();
 | 
			
		||||
        continueButton.hide();
 | 
			
		||||
 | 
			
		||||
        if(null != background) {
 | 
			
		||||
        if (null != background) {
 | 
			
		||||
            guiNode.detachChild(background);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -118,7 +118,7 @@ public void onLeave() {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onEnterOverlay(Overlay overlay) {
 | 
			
		||||
        if(rootNode.hasChild(podest)) {
 | 
			
		||||
        if (rootNode.hasChild(podest)) {
 | 
			
		||||
            rootNode.detachChild(podest);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -157,7 +157,7 @@ private void statistics() {
 | 
			
		||||
    private void enterSub(SubState state) {
 | 
			
		||||
        this.state = state;
 | 
			
		||||
 | 
			
		||||
        if(rootNode.hasChild(podest)) {
 | 
			
		||||
        if (rootNode.hasChild(podest)) {
 | 
			
		||||
            rootNode.detachChild(podest);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -184,7 +184,7 @@ public void forward() {
 | 
			
		||||
                enterSub(SubState.STATISTICS);
 | 
			
		||||
                break;
 | 
			
		||||
            case STATISTICS:
 | 
			
		||||
                app.getModelSynchronize().enter(MdgaState.MAIN);
 | 
			
		||||
                app.getModelSynchronize().next();
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -205,7 +205,7 @@ public void addCeremonyParticipant(Color color, int pos, String name) {
 | 
			
		||||
 | 
			
		||||
        ceremonyButtons.add(button);
 | 
			
		||||
 | 
			
		||||
        if(state.equals(SubState.AWARD_CEREMONY)) {
 | 
			
		||||
        if (state != null && state.equals(SubState.AWARD_CEREMONY)) {
 | 
			
		||||
            button.hide();
 | 
			
		||||
            button.show();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -84,14 +84,14 @@ public void onUpdate(float tpf) {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onEnterOverlay(Overlay overlay) {
 | 
			
		||||
        if(overlay == Overlay.SETTINGS) {
 | 
			
		||||
        if (overlay == Overlay.SETTINGS) {
 | 
			
		||||
            leaveButton.show();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onLeaveOverlay(Overlay overlay) {
 | 
			
		||||
        if(overlay == Overlay.SETTINGS) {
 | 
			
		||||
        if (overlay == Overlay.SETTINGS) {
 | 
			
		||||
            leaveButton.hide();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -101,7 +101,7 @@ private void leaveGame() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public BoardHandler getBoardHandler() {
 | 
			
		||||
        return  boardHandler;
 | 
			
		||||
        return boardHandler;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public GuiHandler getGuiHandler() {
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -64,7 +58,7 @@ public void onEnter() {
 | 
			
		||||
        leaveButton.show();
 | 
			
		||||
        readyButton.show();
 | 
			
		||||
 | 
			
		||||
        if(app.getGameLogic().isHost()) {
 | 
			
		||||
        if (app.getGameLogic().isHost()) {
 | 
			
		||||
            startButton.show();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -114,10 +108,10 @@ public void onLeave() {
 | 
			
		||||
        app.getCamera().setParallelProjection(false);
 | 
			
		||||
 | 
			
		||||
        app.getCamera().setFrustumPerspective(
 | 
			
		||||
            45.0f,
 | 
			
		||||
            (float) app.getCamera().getWidth() / app.getCamera().getHeight(),
 | 
			
		||||
            0.1f,
 | 
			
		||||
            1000.0f
 | 
			
		||||
                45.0f,
 | 
			
		||||
                (float) app.getCamera().getWidth() / app.getCamera().getHeight(),
 | 
			
		||||
                0.1f,
 | 
			
		||||
                1000.0f
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        app.getCamera().setLocation(new Vector3f(0, 0, 10));
 | 
			
		||||
@@ -150,23 +144,22 @@ protected void onEnterOverlay(Overlay overlay) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onLeaveOverlay(Overlay overlay)
 | 
			
		||||
    {
 | 
			
		||||
    protected void onLeaveOverlay(Overlay overlay) {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTaken(Color color, boolean isTaken, boolean isSelf, String name) {
 | 
			
		||||
        LobbyButton.Taken taken;
 | 
			
		||||
 | 
			
		||||
        if(isTaken) {
 | 
			
		||||
            if(isSelf) {
 | 
			
		||||
        if (isTaken) {
 | 
			
		||||
            if (isSelf) {
 | 
			
		||||
                own = color;
 | 
			
		||||
                taken = LobbyButton.Taken.SELF;
 | 
			
		||||
            } else {
 | 
			
		||||
                taken = LobbyButton.Taken.OTHER;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            if(isSelf) {
 | 
			
		||||
            if (isSelf) {
 | 
			
		||||
                own = null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@@ -204,10 +197,10 @@ public void setReady(Color color, boolean isReady) {
 | 
			
		||||
            this.isReady = isReady;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if(!isReady) {
 | 
			
		||||
        if (!isReady) {
 | 
			
		||||
            app.getAcousticHandler().playSound(MdgaSound.NOT_READY);
 | 
			
		||||
        } else {
 | 
			
		||||
            if(button.getTaken() != LobbyButton.Taken.SELF) {
 | 
			
		||||
            if (button.getTaken() != LobbyButton.Taken.SELF) {
 | 
			
		||||
                app.getAcousticHandler().playSound(MdgaSound.OTHER_READY);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -231,7 +224,7 @@ private void toggleTsk(Color color) {
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if(isReady) {
 | 
			
		||||
        if (isReady) {
 | 
			
		||||
            setReady(own, false);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -249,12 +242,12 @@ private void toggleTsk(Color color) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void ready() {
 | 
			
		||||
        if(own == null) {
 | 
			
		||||
        if (own == null) {
 | 
			
		||||
            app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if(!isReady) {
 | 
			
		||||
        if (!isReady) {
 | 
			
		||||
            app.getAcousticHandler().playSound(MdgaSound.SELF_READY);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -98,7 +98,7 @@ private void tryHost() {
 | 
			
		||||
        try {
 | 
			
		||||
            port = Integer.parseInt(text);
 | 
			
		||||
 | 
			
		||||
            if(port >= 1 && port <= 65535) {
 | 
			
		||||
            if (port >= 1 && port <= 65535) {
 | 
			
		||||
                app.getModelSynchronize().setName(startDialog.getName());
 | 
			
		||||
                hostDialog.hostServer();
 | 
			
		||||
                try {
 | 
			
		||||
@@ -148,10 +148,10 @@ private void tryJoin() {
 | 
			
		||||
 | 
			
		||||
    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]?)$";
 | 
			
		||||
                "^(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);
 | 
			
		||||
    }
 | 
			
		||||
@@ -159,7 +159,7 @@ private boolean isValidIpAddress(String ip) {
 | 
			
		||||
    private void enterSub(SubState state) {
 | 
			
		||||
        this.state = state;
 | 
			
		||||
 | 
			
		||||
        if(null != background) {
 | 
			
		||||
        if (null != background) {
 | 
			
		||||
            rootNode.detachChild(background);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -198,7 +198,7 @@ public void forward(boolean host) {
 | 
			
		||||
                tryJoin();
 | 
			
		||||
                break;
 | 
			
		||||
            case MAIN:
 | 
			
		||||
                if(host) {
 | 
			
		||||
                if (host) {
 | 
			
		||||
                    enterSub(SubState.HOST);
 | 
			
		||||
                    //TODO playSound
 | 
			
		||||
                } else {
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -196,9 +198,9 @@ public void pressForward() {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (this instanceof GameView gameView) {
 | 
			
		||||
            if(gameView.needConfirm) {
 | 
			
		||||
            if (gameView.needConfirm) {
 | 
			
		||||
                app.getModelSynchronize().confirm();
 | 
			
		||||
            } else if(gameView.needNoPower) {
 | 
			
		||||
            } else if (gameView.needNoPower) {
 | 
			
		||||
                app.getModelSynchronize().confirm();
 | 
			
		||||
            } else {
 | 
			
		||||
                app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
 | 
			
		||||
@@ -213,7 +215,7 @@ public void pressForward() {
 | 
			
		||||
    public void showInfo(String error, boolean isError) {
 | 
			
		||||
        infoTimer.reset();
 | 
			
		||||
 | 
			
		||||
        if(null != infoLabel) {
 | 
			
		||||
        if (null != infoLabel) {
 | 
			
		||||
            infoLabel.hide();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -221,7 +223,7 @@ public void showInfo(String error, boolean isError) {
 | 
			
		||||
 | 
			
		||||
        ColorRGBA color;
 | 
			
		||||
 | 
			
		||||
        if(isError) {
 | 
			
		||||
        if (isError) {
 | 
			
		||||
            color = ColorRGBA.Red.clone();
 | 
			
		||||
        } else {
 | 
			
		||||
            color = ColorRGBA.Green.clone();
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ public class CeremonyState extends ClientState {
 | 
			
		||||
     * Creates a new CeremonyState
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the game logic
 | 
			
		||||
     * @param logic  the game logic
 | 
			
		||||
     */
 | 
			
		||||
    public CeremonyState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
@@ -42,8 +42,8 @@ public void exit() {
 | 
			
		||||
     *
 | 
			
		||||
     * @param state the state to be set
 | 
			
		||||
     */
 | 
			
		||||
    public void setState(CeremonyStates state){
 | 
			
		||||
        if(this.currentState != null){
 | 
			
		||||
    public void setState(CeremonyStates state) {
 | 
			
		||||
        if (this.currentState != null) {
 | 
			
		||||
            this.currentState.exit();
 | 
			
		||||
        }
 | 
			
		||||
        state.enter();
 | 
			
		||||
@@ -55,7 +55,7 @@ public void setState(CeremonyStates state){
 | 
			
		||||
     *
 | 
			
		||||
     * @return the PodiumState
 | 
			
		||||
     */
 | 
			
		||||
    public PodiumState getPodiumState(){
 | 
			
		||||
    public PodiumState getPodiumState() {
 | 
			
		||||
        return podiumState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -64,7 +64,7 @@ public PodiumState getPodiumState(){
 | 
			
		||||
     *
 | 
			
		||||
     * @return the StatisticsState
 | 
			
		||||
     */
 | 
			
		||||
    public StatisticsState getStatisticsState(){
 | 
			
		||||
    public StatisticsState getStatisticsState() {
 | 
			
		||||
        return statisticsState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -73,16 +73,15 @@ public StatisticsState getStatisticsState(){
 | 
			
		||||
     *
 | 
			
		||||
     * @return the current State
 | 
			
		||||
     */
 | 
			
		||||
    public CeremonyStates getState(){
 | 
			
		||||
    public CeremonyStates getState() {
 | 
			
		||||
        return currentState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * this method is used to parse the selectNext from the clientGameLogic
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectNext(){
 | 
			
		||||
    public void selectNext() {
 | 
			
		||||
        currentState.selectNext();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
@@ -15,7 +14,7 @@ public abstract class ClientState implements Observer, ServerInterpreter {
 | 
			
		||||
 | 
			
		||||
    protected ClientGameLogic logic;
 | 
			
		||||
 | 
			
		||||
    protected ClientState(ClientState parent, ClientGameLogic logic){
 | 
			
		||||
    protected ClientState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        this.parent = parent;
 | 
			
		||||
        this.logic = logic;
 | 
			
		||||
    }
 | 
			
		||||
@@ -24,14 +23,14 @@ protected ClientState(ClientState parent, ClientGameLogic logic){
 | 
			
		||||
 | 
			
		||||
    public abstract void exit();
 | 
			
		||||
 | 
			
		||||
    public ClientState getParent(){
 | 
			
		||||
    public ClientState getParent() {
 | 
			
		||||
        return parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void update() {/* do nothing */}
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public String toString(){
 | 
			
		||||
    public String toString() {
 | 
			
		||||
        return getClass().getSimpleName();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -101,7 +100,7 @@ public void received(ChoosePieceStateMessage msg) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DrawCardMessage msg){
 | 
			
		||||
    public void received(DrawCardMessage msg) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg.toString());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -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) {
 | 
			
		||||
@@ -195,7 +196,7 @@ public void received(WaitPieceMessage msg) {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(IncorrectRequestMessage msg) {
 | 
			
		||||
       LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg.toString());
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Received {0} not allowed.", msg.toString());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectPiece(Piece piece) {
 | 
			
		||||
@@ -238,23 +239,23 @@ public void deselectTSK(Color color) {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Deselecting TSK not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectUnready(){
 | 
			
		||||
    public void selectUnready() {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Selecting unready not allowed.");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectStart(){
 | 
			
		||||
    public void selectStart() {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Starting not allowed");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
    public void selectAnimationEnd() {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Animation end not allowed");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectNext(){
 | 
			
		||||
    public void selectNext() {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Next not allowed");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void selectResume(){
 | 
			
		||||
    public void selectResume() {
 | 
			
		||||
        LOGGER.log(Level.DEBUG, "Resume not allowed");
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ public class DialogsState extends ClientState {
 | 
			
		||||
     * Creates a new DialogsState
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the game logic
 | 
			
		||||
     * @param logic  the game logic
 | 
			
		||||
     */
 | 
			
		||||
    public DialogsState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
@@ -29,7 +29,7 @@ public DialogsState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
     * exits this state
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit(){
 | 
			
		||||
    public void exit() {
 | 
			
		||||
        currentState.exit();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -37,7 +37,7 @@ public void exit(){
 | 
			
		||||
     * Enters the new state machine
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter(){
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        setState(startDialogState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -46,8 +46,8 @@ public void enter(){
 | 
			
		||||
     *
 | 
			
		||||
     * @param newState the state to be set
 | 
			
		||||
     */
 | 
			
		||||
    public void setState(DialogStates newState){
 | 
			
		||||
        if(currentState != null){
 | 
			
		||||
    public void setState(DialogStates newState) {
 | 
			
		||||
        if (currentState != null) {
 | 
			
		||||
            currentState.exit();
 | 
			
		||||
        }
 | 
			
		||||
        newState.enter();
 | 
			
		||||
@@ -85,7 +85,7 @@ public StartDialogState getStartDialog() {
 | 
			
		||||
     * This method is used to call the selectLeave method of the current state
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectLeave(){
 | 
			
		||||
    public void selectLeave() {
 | 
			
		||||
        currentState.selectLeave();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -95,7 +95,7 @@ public void selectLeave(){
 | 
			
		||||
     * @param name the name to be set
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void setName(String name){
 | 
			
		||||
    public void setName(String name) {
 | 
			
		||||
        currentState.setName(name);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -105,7 +105,7 @@ public void setName(String name){
 | 
			
		||||
     * @param color the color to be set
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectTSK(Color color){
 | 
			
		||||
    public void selectTSK(Color color) {
 | 
			
		||||
        currentState.selectTSK(color);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -115,7 +115,7 @@ public void selectTSK(Color color){
 | 
			
		||||
     * @param color the color to be deselected
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void deselectTSK(Color color){
 | 
			
		||||
    public void deselectTSK(Color color) {
 | 
			
		||||
        currentState.deselectTSK(color);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -123,7 +123,7 @@ public void deselectTSK(Color color){
 | 
			
		||||
     * This method is used to call the selectReady method of the current state
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectReady(){
 | 
			
		||||
    public void selectReady() {
 | 
			
		||||
        currentState.selectReady();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -131,7 +131,7 @@ public void selectReady(){
 | 
			
		||||
     * This method is used to call the selectUnready method of the current state
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectUnready(){
 | 
			
		||||
    public void selectUnready() {
 | 
			
		||||
        currentState.selectUnready();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -139,7 +139,7 @@ public void selectUnready(){
 | 
			
		||||
     * This method is used to call the selectStart method of the current state
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectStart(){
 | 
			
		||||
    public void selectStart() {
 | 
			
		||||
        currentState.selectStart();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -149,7 +149,7 @@ public void selectStart(){
 | 
			
		||||
     * @param string the string to be set
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectJoin(String string){
 | 
			
		||||
    public void selectJoin(String string) {
 | 
			
		||||
        currentState.selectJoin(string);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -159,7 +159,7 @@ public void selectJoin(String string){
 | 
			
		||||
     * @param name the name to be set
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectHost(String name){
 | 
			
		||||
    public void selectHost(String name) {
 | 
			
		||||
        currentState.selectHost(name);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -169,7 +169,7 @@ public void selectHost(String name){
 | 
			
		||||
     * @param msg the LobbyPlayerJoin message received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyPlayerJoinedMessage msg){
 | 
			
		||||
    public void received(LobbyPlayerJoinedMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -179,7 +179,7 @@ public void received(LobbyPlayerJoinedMessage msg){
 | 
			
		||||
     * @param msg the LobbyPlayerLeave message received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyPlayerLeaveMessage msg){
 | 
			
		||||
    public void received(LobbyPlayerLeaveMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -189,7 +189,7 @@ public void received(LobbyPlayerLeaveMessage msg){
 | 
			
		||||
     * @param msg the UpdateTSKMessage message received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(UpdateTSKMessage msg){
 | 
			
		||||
    public void received(UpdateTSKMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -199,7 +199,7 @@ public void received(UpdateTSKMessage msg){
 | 
			
		||||
     * @param msg the UpdateReady message received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(UpdateReadyMessage msg){
 | 
			
		||||
    public void received(UpdateReadyMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -209,7 +209,7 @@ public void received(UpdateReadyMessage msg){
 | 
			
		||||
     * @param msg the ServerStartGame message received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ServerStartGameMessage msg){
 | 
			
		||||
    public void received(ServerStartGameMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -219,7 +219,7 @@ public void received(ServerStartGameMessage msg){
 | 
			
		||||
     * @param msg the LobbyAccept message received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyAcceptMessage msg){
 | 
			
		||||
    public void received(LobbyAcceptMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -229,7 +229,7 @@ public void received(LobbyAcceptMessage msg){
 | 
			
		||||
     * @param msg the LobbyDeny message received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyDenyMessage msg){
 | 
			
		||||
    public void received(LobbyDenyMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 | 
			
		||||
@@ -32,7 +25,7 @@ public class GameState extends ClientState {
 | 
			
		||||
     * Constructor for GameState
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent of this state
 | 
			
		||||
     * @param logic the ClientGameLogic
 | 
			
		||||
     * @param logic  the ClientGameLogic
 | 
			
		||||
     */
 | 
			
		||||
    public GameState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
@@ -59,8 +52,8 @@ public void exit() {
 | 
			
		||||
     *
 | 
			
		||||
     * @param newState the state to be set
 | 
			
		||||
     */
 | 
			
		||||
    public void setState(GameStates newState){
 | 
			
		||||
        if(this.state != null){
 | 
			
		||||
    public void setState(GameStates newState) {
 | 
			
		||||
        if (this.state != null) {
 | 
			
		||||
            this.state.exit();
 | 
			
		||||
        }
 | 
			
		||||
        System.out.println("CLIENT STATE old: " + this.state + " new: " + newState);
 | 
			
		||||
@@ -72,7 +65,7 @@ public void setState(GameStates newState){
 | 
			
		||||
     * This method is used to call the selectAnimationEnd method of the current state
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
    public void selectAnimationEnd() {
 | 
			
		||||
        state.selectAnimationEnd();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -80,7 +73,7 @@ public void selectAnimationEnd(){
 | 
			
		||||
     * This method is used to call the selectDice method of the current state
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectDice(){
 | 
			
		||||
    public void selectDice() {
 | 
			
		||||
        state.selectDice();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -90,7 +83,7 @@ public void selectDice(){
 | 
			
		||||
     * @param piece the piece to be selected
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectPiece(Piece piece){
 | 
			
		||||
    public void selectPiece(Piece piece) {
 | 
			
		||||
        state.selectPiece(piece);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -100,7 +93,7 @@ public void selectPiece(Piece piece){
 | 
			
		||||
     * @param card the card to be selected
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectCard(BonusCard card){
 | 
			
		||||
    public void selectCard(BonusCard card) {
 | 
			
		||||
        state.selectCard(card);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -110,13 +103,13 @@ public void selectCard(BonusCard card){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PauseGameMessage msg){
 | 
			
		||||
    public void received(PauseGameMessage msg) {
 | 
			
		||||
        logic.enterInterrupt();
 | 
			
		||||
        logic.addNotification(new InterruptNotification(logic.getGame().getPlayers().get(msg.getPlayerId()).getColor()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectLeave(){
 | 
			
		||||
    public void selectLeave() {
 | 
			
		||||
        logic.send(new LeaveGameMessage());
 | 
			
		||||
        logic.addNotification(new StartDialogNotification());
 | 
			
		||||
        logic.setState(logic.getDialogs());
 | 
			
		||||
@@ -128,7 +121,7 @@ public void selectLeave(){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DieMessage msg){
 | 
			
		||||
    public void received(DieMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -138,7 +131,7 @@ public void received(DieMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(RankingRollAgainMessage msg){
 | 
			
		||||
    public void received(RankingRollAgainMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -148,7 +141,7 @@ public void received(RankingRollAgainMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(RankingResponseMessage msg){
 | 
			
		||||
    public void received(RankingResponseMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -158,7 +151,7 @@ public void received(RankingResponseMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(SelectPieceMessage msg){
 | 
			
		||||
    public void received(SelectPieceMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -168,7 +161,7 @@ public void received(SelectPieceMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(WaitPieceMessage msg){
 | 
			
		||||
    public void received(WaitPieceMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -178,7 +171,7 @@ public void received(WaitPieceMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(StartPieceMessage msg){
 | 
			
		||||
    public void received(StartPieceMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -188,7 +181,7 @@ public void received(StartPieceMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(NoTurnMessage msg){
 | 
			
		||||
    public void received(NoTurnMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -198,7 +191,7 @@ public void received(NoTurnMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(MoveMessage msg){
 | 
			
		||||
    public void received(MoveMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -208,7 +201,7 @@ public void received(MoveMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(CeremonyMessage msg){
 | 
			
		||||
    public void received(CeremonyMessage msg) {
 | 
			
		||||
        CeremonyNotification notification = new CeremonyNotification();
 | 
			
		||||
        notification.setColors(msg.getColors());
 | 
			
		||||
        notification.setNames(msg.getNames());
 | 
			
		||||
@@ -228,7 +221,7 @@ public void received(CeremonyMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(EndOfTurnMessage msg){
 | 
			
		||||
    public void received(EndOfTurnMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -238,7 +231,7 @@ public void received(EndOfTurnMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(SpectatorMessage msg){
 | 
			
		||||
    public void received(SpectatorMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -248,7 +241,7 @@ public void received(SpectatorMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceAgainMessage msg){
 | 
			
		||||
    public void received(DiceAgainMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -258,7 +251,7 @@ public void received(DiceAgainMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PossibleCardsMessage msg){
 | 
			
		||||
    public void received(PossibleCardsMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -268,7 +261,7 @@ public void received(PossibleCardsMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PlayCardMessage msg){
 | 
			
		||||
    public void received(PlayCardMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -278,7 +271,7 @@ public void received(PlayCardMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceNowMessage msg){
 | 
			
		||||
    public void received(DiceNowMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -288,27 +281,26 @@ public void received(DiceNowMessage msg){
 | 
			
		||||
     * @param msg the message to be received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ActivePlayerMessage msg){
 | 
			
		||||
    public void received(ActivePlayerMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PossiblePieceMessage msg){
 | 
			
		||||
    public void received(PossiblePieceMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ChoosePieceStateMessage msg){
 | 
			
		||||
    public void received(ChoosePieceStateMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DrawCardMessage msg){
 | 
			
		||||
    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()));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -319,7 +311,7 @@ public void received(DrawCardMessage msg){
 | 
			
		||||
     *
 | 
			
		||||
     * @return the current state
 | 
			
		||||
     */
 | 
			
		||||
    public GameStates getState(){
 | 
			
		||||
    public GameStates getState() {
 | 
			
		||||
        return state;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 | 
			
		||||
@@ -12,7 +11,7 @@ public class InterruptState extends ClientState {
 | 
			
		||||
     * Creates a new InterruptState
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the game logic
 | 
			
		||||
     * @param logic  the game logic
 | 
			
		||||
     */
 | 
			
		||||
    public InterruptState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
@@ -56,8 +55,8 @@ public ClientState getPreviousState() {
 | 
			
		||||
     * The host resumes the game
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectResume(){
 | 
			
		||||
        if(logic.isHost()){
 | 
			
		||||
    public void selectResume() {
 | 
			
		||||
        if (logic.isHost()) {
 | 
			
		||||
            logic.send(new ForceContinueGameMessage());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@ public class SettingsState extends ClientState {
 | 
			
		||||
     * Creates a new SettingsState
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the game logic
 | 
			
		||||
     * @param logic  the game logic
 | 
			
		||||
     */
 | 
			
		||||
    public SettingsState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
@@ -45,28 +45,28 @@ public void exit() {
 | 
			
		||||
    /**
 | 
			
		||||
     * Changes the current state
 | 
			
		||||
     */
 | 
			
		||||
    public SettingStates getState(){
 | 
			
		||||
    public SettingStates getState() {
 | 
			
		||||
        return currentState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the main settings state
 | 
			
		||||
     */
 | 
			
		||||
    public MainSettingsState getMainSettingsState(){
 | 
			
		||||
    public MainSettingsState getMainSettingsState() {
 | 
			
		||||
        return mainSettingsState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the audio settings state
 | 
			
		||||
     */
 | 
			
		||||
    public AudioSettingsState getAudioSettingsState(){
 | 
			
		||||
    public AudioSettingsState getAudioSettingsState() {
 | 
			
		||||
        return audioSettingsState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the video settings state
 | 
			
		||||
     */
 | 
			
		||||
    public VideoSettingsState getVideoSettingsState(){
 | 
			
		||||
    public VideoSettingsState getVideoSettingsState() {
 | 
			
		||||
        return videoSettingsState;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,13 @@
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
 | 
			
		||||
public abstract class CeremonyStates extends ClientState {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    protected CeremonyStates(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -8,23 +8,38 @@ public class PodiumState extends CeremonyStates {
 | 
			
		||||
 | 
			
		||||
    private final CeremonyState parent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This constructs a new PodiumState.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public PodiumState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (CeremonyState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client enters the PodiumState.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client exits the PodiumState.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client selects the next button.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectNext(){
 | 
			
		||||
    public void selectNext() {
 | 
			
		||||
        parent.setState(parent.getStatisticsState());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,24 +2,42 @@
 | 
			
		||||
 | 
			
		||||
import pp.mdga.client.ClientGameLogic;
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.notification.StartDialogNotification;
 | 
			
		||||
 | 
			
		||||
public class StatisticsState extends CeremonyStates {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This constructs a new StatisticsState.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public StatisticsState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client enters the StatisticsState.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client exits the StatisticsState.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client selects the next button.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectNext(){
 | 
			
		||||
    public void selectNext() {
 | 
			
		||||
        logic.addNotification(new StartDialogNotification());
 | 
			
		||||
        logic.setState(logic.getDialogs());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,13 @@
 | 
			
		||||
 | 
			
		||||
public abstract class DialogStates extends ClientState {
 | 
			
		||||
 | 
			
		||||
    public DialogStates(ClientState parent, ClientGameLogic logic){
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public DialogStates(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,20 +19,35 @@ public class LobbyState extends DialogStates {
 | 
			
		||||
 | 
			
		||||
    private final DialogsState parent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The constructor of the LobbyState.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public LobbyState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (DialogsState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client enters the LobbyState.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        logic.send(new JoinedLobbyMessage(logic.getOwnPlayerName()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client exits the LobbyState.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client selects the leave button.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectLeave() {
 | 
			
		||||
        parent.setState(parent.getStartDialog());
 | 
			
		||||
@@ -40,26 +55,45 @@ public void selectLeave() {
 | 
			
		||||
        logic.send(new LeaveGameMessage());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client selects the color of the player.
 | 
			
		||||
     *
 | 
			
		||||
     * @param color the color of the player
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectTSK(Color color) {
 | 
			
		||||
        logic.send(new SelectTSKMessage(color));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client deselects the color of the player.
 | 
			
		||||
     *
 | 
			
		||||
     * @param color the color of the player
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void deselectTSK(Color color) {
 | 
			
		||||
        logic.send(new DeselectTSKMessage(color));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client selects the ready button.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectReady() {
 | 
			
		||||
        logic.send(new LobbyReadyMessage());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client selects the unready button.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectUnready() {
 | 
			
		||||
        logic.send(new LobbyNotReadyMessage());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client selects the start button.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectStart() {
 | 
			
		||||
        if (logic.isHost() && logic.getGame().areAllReady()) {
 | 
			
		||||
@@ -70,10 +104,15 @@ public void selectStart() {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client receives a message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the message which was received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ServerStartGameMessage msg) {
 | 
			
		||||
        for (Player player: msg.getPlayers()) {
 | 
			
		||||
            for (Map.Entry<Integer, Player> entry: this.logic.getGame().getPlayers().entrySet()) {
 | 
			
		||||
        for (Player player : msg.getPlayers()) {
 | 
			
		||||
            for (Map.Entry<Integer, Player> entry : this.logic.getGame().getPlayers().entrySet()) {
 | 
			
		||||
                if (entry.getValue().getColor() == player.getColor()) {
 | 
			
		||||
                    this.logic.getGame().getPlayers().put(entry.getKey(), player);
 | 
			
		||||
                }
 | 
			
		||||
@@ -91,6 +130,11 @@ public void received(ServerStartGameMessage msg) {
 | 
			
		||||
        logic.setState(logic.getGameState());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client receives a message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the message which was received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyPlayerJoinedMessage msg) {
 | 
			
		||||
        if (msg.getPlayer().getName().equals(logic.getOwnPlayerName())) {
 | 
			
		||||
@@ -105,6 +149,11 @@ public void received(LobbyPlayerJoinedMessage msg) {
 | 
			
		||||
        logic.getGame().getPlayers().put(msg.getId(), msg.getPlayer());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client receives a message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the message which was received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(UpdateTSKMessage msg) {
 | 
			
		||||
        if (msg.isTaken()) {
 | 
			
		||||
@@ -116,15 +165,24 @@ public void received(UpdateTSKMessage msg) {
 | 
			
		||||
        logic.getGame().getPlayers().get(msg.getId()).setColor(msg.getColor());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client receives a message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the message which was received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(LobbyPlayerLeaveMessage msg) {
 | 
			
		||||
        logic.addNotification(new TskUnselectNotification(logic.getGame().getPlayers().get(msg.getId()).getColor()));
 | 
			
		||||
        logic.getGame().getPlayers().remove(msg.getId());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method will be called whenever the client receives a message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the message which was received
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(UpdateReadyMessage msg) {
 | 
			
		||||
        //TODO server sendet kein update on UNready
 | 
			
		||||
        logic.addNotification(new LobbyReadyNotification(logic.getGame().getPlayers().get(msg.getPlayerId()).getColor(), msg.isReady()));
 | 
			
		||||
        logic.getGame().getPlayers().get(msg.getPlayerId()).setReady(msg.isReady());
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -15,8 +15,9 @@ public class NetworkDialogState extends DialogStates {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor for the NetworkDialogState
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the logic
 | 
			
		||||
     * @param logic  the logic
 | 
			
		||||
     */
 | 
			
		||||
    public NetworkDialogState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
 
 | 
			
		||||
@@ -10,8 +10,9 @@ public class StartDialogState extends DialogStates {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor for the StartDialogState
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the logic
 | 
			
		||||
     * @param logic  the logic
 | 
			
		||||
     */
 | 
			
		||||
    public StartDialogState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
 
 | 
			
		||||
@@ -11,23 +11,53 @@ public class AnimationState extends GameStates {
 | 
			
		||||
 | 
			
		||||
    private final GameState parent;
 | 
			
		||||
 | 
			
		||||
    private boolean spectator = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public AnimationState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (GameState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
        spectator = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets the spectator.
 | 
			
		||||
     *
 | 
			
		||||
     * @param spectator the spectator
 | 
			
		||||
     */
 | 
			
		||||
    public void setSpectator(boolean spectator) {
 | 
			
		||||
        this.spectator = spectator;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the animation end.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
    public void selectAnimationEnd() {
 | 
			
		||||
        logic.send(new AnimationEndMessage());
 | 
			
		||||
        parent.setState(parent.getWaiting());
 | 
			
		||||
        if (spectator){
 | 
			
		||||
            parent.setState(parent.getSpectator());
 | 
			
		||||
        } else {
 | 
			
		||||
            parent.setState(parent.getWaiting());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
@@ -19,82 +18,155 @@ public class DetermineStartPlayerState extends GameStates {
 | 
			
		||||
    private final WaitRankingState waitRankingState = new WaitRankingState(this, logic);
 | 
			
		||||
    private final Intro intro = new Intro(this, logic);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public DetermineStartPlayerState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (GameState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the roll ranking dice.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the roll ranking dice
 | 
			
		||||
     */
 | 
			
		||||
    public RollRankingDiceState getRollRankingDice() {
 | 
			
		||||
        return rollRankingDiceState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the wait ranking.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the wait ranking
 | 
			
		||||
     */
 | 
			
		||||
    public WaitRankingState getWaitRanking() {
 | 
			
		||||
        return waitRankingState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public DetermineStartPlayerStates getState(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the state.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the state
 | 
			
		||||
     */
 | 
			
		||||
    public DetermineStartPlayerStates getState() {
 | 
			
		||||
        return state;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Intro getIntro(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the intro.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the intro
 | 
			
		||||
     */
 | 
			
		||||
    public Intro getIntro() {
 | 
			
		||||
        return intro;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the parent state.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the parent state
 | 
			
		||||
     */
 | 
			
		||||
    public GameState getParent() {
 | 
			
		||||
        return parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        this.setState(this.rollRankingDiceState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
        state = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets the state.
 | 
			
		||||
     *
 | 
			
		||||
     * @param state the state
 | 
			
		||||
     */
 | 
			
		||||
    public void setState(DetermineStartPlayerStates state) {
 | 
			
		||||
        System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
 | 
			
		||||
        if(this.state != null){
 | 
			
		||||
        if (this.state != null) {
 | 
			
		||||
            this.state.exit();
 | 
			
		||||
        }
 | 
			
		||||
        this.state = state;
 | 
			
		||||
        this.state.enter();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the dice.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectDice() {
 | 
			
		||||
        state.selectDice();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the animation end.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
    public void selectAnimationEnd() {
 | 
			
		||||
        state.selectAnimationEnd();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the die message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the die message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DieMessage msg){
 | 
			
		||||
    public void received(DieMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the ceremony message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the ceremony message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceNowMessage msg){
 | 
			
		||||
    public void received(DiceNowMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the ranking roll again message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the ranking roll again message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(RankingRollAgainMessage msg){
 | 
			
		||||
    public void received(RankingRollAgainMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the ranking response message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the ranking response message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(RankingResponseMessage msg){
 | 
			
		||||
    public void received(RankingResponseMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the ranking result message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the ranking result message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ActivePlayerMessage msg){
 | 
			
		||||
    public void received(ActivePlayerMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,29 +2,33 @@
 | 
			
		||||
 | 
			
		||||
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 {
 | 
			
		||||
 | 
			
		||||
    private final System.Logger LOGGER = System.getLogger(this.getClass().getName());
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public GameStates(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the power card.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the play card message
 | 
			
		||||
     */
 | 
			
		||||
    protected void handlePowerCard(PlayCardMessage msg) {
 | 
			
		||||
        if (msg.getCard().getCard().equals(BonusCard.TURBO)) {
 | 
			
		||||
            logic.getGame().setTurboFlag(true);
 | 
			
		||||
@@ -37,10 +41,15 @@ protected void handlePowerCard(PlayCardMessage msg) {
 | 
			
		||||
        logic.getGame().getDiscardPile().add(msg.getCard());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the shield.
 | 
			
		||||
     *
 | 
			
		||||
     * @param uuid the uuid
 | 
			
		||||
     */
 | 
			
		||||
    private void handleShield(UUID uuid) {
 | 
			
		||||
        Board board = logic.getGame().getBoard();
 | 
			
		||||
        Piece piece = logic.getGame().getPieceThroughUUID(uuid);
 | 
			
		||||
        Node node =  board.getInfield()[board.getInfieldIndexOfPiece(piece)];
 | 
			
		||||
        Node node = board.getInfield()[board.getInfieldIndexOfPiece(piece)];
 | 
			
		||||
        if (node.isStart()) {
 | 
			
		||||
            logic.getGame().getPieceThroughUUID(uuid).setShield(ShieldState.SUPPRESSED);
 | 
			
		||||
            logic.addNotification(new ShieldActiveNotification(uuid));
 | 
			
		||||
@@ -51,6 +60,12 @@ private void handleShield(UUID uuid) {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Swaps the pieces.
 | 
			
		||||
     *
 | 
			
		||||
     * @param messageOwn the own piece
 | 
			
		||||
     * @param messageEnemy the enemy piece
 | 
			
		||||
     */
 | 
			
		||||
    private void swapPieces(Piece messageOwn, Piece messageEnemy) {
 | 
			
		||||
        //swap Pieces in Model
 | 
			
		||||
        Board board = logic.getGame().getBoard();
 | 
			
		||||
@@ -68,13 +83,19 @@ private void swapPieces(Piece messageOwn, Piece messageEnemy) {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void checkShieldAfterSwap(Node node, Piece piece){
 | 
			
		||||
        if (node.isStart()){
 | 
			
		||||
            if (piece.isShielded()){
 | 
			
		||||
    /**
 | 
			
		||||
     * Checks the shield after the swap.
 | 
			
		||||
     *
 | 
			
		||||
     * @param node the node
 | 
			
		||||
     * @param piece the piece
 | 
			
		||||
     */
 | 
			
		||||
    private void checkShieldAfterSwap(Node node, Piece piece) {
 | 
			
		||||
        if (node.isStart()) {
 | 
			
		||||
            if (piece.isShielded()) {
 | 
			
		||||
                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()));
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.GameState;
 | 
			
		||||
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;
 | 
			
		||||
@@ -15,48 +16,69 @@ public class SpectatorState extends GameStates {
 | 
			
		||||
 | 
			
		||||
    private final GameState parent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public SpectatorState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (GameState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        parent.getAnimation().setSpectator(true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the reception of a CeremonyMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the ceremony message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(CeremonyMessage msg) {
 | 
			
		||||
        logic.setState(logic.getCeremony());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the reception of a DieMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the die message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    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));
 | 
			
		||||
    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 {
 | 
			
		||||
            logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), msg.getDiceEye()));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //stats
 | 
			
		||||
        logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPlayerStatistic().increaseActivatedBonusNodes();
 | 
			
		||||
        logic.getGame().getGameStatistics().increaseActivatedBonusNodes();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DieMessage msg) {
 | 
			
		||||
        //logic.getGame().setDiceEyes(msg.getDiceEye());
 | 
			
		||||
//        logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), logic.getGame().getDiceEyes(), logic.getGame().getDiceEyes() * logic.getGame().getDiceModifier()));
 | 
			
		||||
        if (msg.getDiceEye() == 6) {
 | 
			
		||||
            logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPlayerStatistic().increaseDiced6();
 | 
			
		||||
            logic.getGame().getGameStatistics().increaseDiced6();
 | 
			
		||||
        }
 | 
			
		||||
        parent.setState(parent.getAnimation());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the reception of a PlayCardMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the play card message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PlayCardMessage msg) {
 | 
			
		||||
        logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor(), msg.getCard().getCard()));
 | 
			
		||||
@@ -66,35 +88,86 @@ public void received(PlayCardMessage msg) {
 | 
			
		||||
        parent.setState(parent.getAnimation());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the reception of an ActivePlayerMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the active player message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ActivePlayerMessage msg) {
 | 
			
		||||
        logic.addNotification(new ActivePlayerNotification(msg.getColor()));
 | 
			
		||||
        logic.getGame().setActiveColor(msg.getColor());
 | 
			
		||||
        parent.setState(parent.getAnimation());
 | 
			
		||||
        if (msg.getColor() == logic.getGame().getPlayers().get(logic.getOwnPlayerId()).getColor()) {
 | 
			
		||||
            parent.setState(parent.getTurn());
 | 
			
		||||
        } else {
 | 
			
		||||
            for (Piece piece : logic.getGame().getActivePlayer().getPieces()) {
 | 
			
		||||
                if (piece.isShielded() || piece.isSuppressed()) {
 | 
			
		||||
                    logic.addNotification(new RemoveShieldNotification(piece.getUuid()));
 | 
			
		||||
                    piece.setShield(ShieldState.NONE);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the reception of a MoveMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the move message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(MoveMessage msg) {
 | 
			
		||||
        Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
 | 
			
		||||
        if (msg.isHomeMove()) {
 | 
			
		||||
            logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
 | 
			
		||||
            logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant();
 | 
			
		||||
            logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
 | 
			
		||||
            if (piece.getState().equals(PieceState.HOME)) {
 | 
			
		||||
                logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
 | 
			
		||||
                int pieceHomeIndex = logic.getGame().getActivePlayer().getHomeIndexOfPiece(piece);
 | 
			
		||||
                Node pieceNode = logic.getGame().getActivePlayer().getHomeNodes()[pieceHomeIndex];
 | 
			
		||||
 | 
			
		||||
                //gets the oldNode
 | 
			
		||||
                int homeIndex = logic.getGame().getActivePlayer().getHomeIndexOfPiece(piece);
 | 
			
		||||
                Node oldNode = logic.getGame().getActivePlayer().getHomeNodes()[homeIndex];
 | 
			
		||||
                //gets the targetNode
 | 
			
		||||
                Node targetNode = logic.getGame().getActivePlayer().getHomeNodes()[msg.getTargetIndex()];
 | 
			
		||||
                if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
 | 
			
		||||
                    piece.setState(PieceState.HOMEFINISHED);
 | 
			
		||||
                } else {
 | 
			
		||||
                    piece.setState(PieceState.HOME);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                oldNode.clearOccupant();
 | 
			
		||||
                targetNode.setOccupant(piece);
 | 
			
		||||
 | 
			
		||||
            } else {
 | 
			
		||||
                logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
 | 
			
		||||
                int oldNoteIdx = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
 | 
			
		||||
                Node oldNode = logic.getGame().getBoard().getInfield()[oldNoteIdx];
 | 
			
		||||
 | 
			
		||||
                //gets the targetNode
 | 
			
		||||
                Node targetNode = logic.getGame().getActivePlayer().getHomeNodes()[msg.getTargetIndex()];
 | 
			
		||||
 | 
			
		||||
                if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
 | 
			
		||||
                    piece.setState(PieceState.HOMEFINISHED);
 | 
			
		||||
                } else {
 | 
			
		||||
                    piece.setState(PieceState.HOME);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                oldNode.clearOccupant();
 | 
			
		||||
                targetNode.setOccupant(piece);
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
 | 
			
		||||
 | 
			
		||||
            Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
 | 
			
		||||
            if (occ != null) {
 | 
			
		||||
                //TODO: MoveThrowNotification
 | 
			
		||||
                logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor()));
 | 
			
		||||
                if (occ.isSuppressed()){
 | 
			
		||||
                if (occ.isSuppressed()) {
 | 
			
		||||
                    logic.addNotification(new RemoveShieldNotification(occ.getUuid()));
 | 
			
		||||
                    occ.setShield(ShieldState.NONE);
 | 
			
		||||
                }
 | 
			
		||||
                //set occ to waiting
 | 
			
		||||
                logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
 | 
			
		||||
            }
 | 
			
		||||
            if(msg.getPiece().getState().equals(PieceState.WAITING)){
 | 
			
		||||
            if (oldIndex == -1) {
 | 
			
		||||
                logic.addNotification(new MovePieceNotification(piece.getUuid(), msg.getTargetIndex(), true));
 | 
			
		||||
                logic.getGame().getPlayerByColor(piece.getColor()).removeWaitingPiece(piece);
 | 
			
		||||
                piece.setState(PieceState.ACTIVE);
 | 
			
		||||
@@ -105,7 +178,17 @@ public void received(MoveMessage msg) {
 | 
			
		||||
            }
 | 
			
		||||
            //set new node
 | 
			
		||||
            logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].setOccupant(piece);
 | 
			
		||||
            if (logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].isStart()) {
 | 
			
		||||
                if (piece.isShielded()) {
 | 
			
		||||
                    piece.setShield(ShieldState.SUPPRESSED);
 | 
			
		||||
                    logic.addNotification(new ShieldSuppressedNotification(piece.getUuid()));
 | 
			
		||||
                }
 | 
			
		||||
            } else if (piece.isSuppressed()) {
 | 
			
		||||
                piece.setShield(ShieldState.ACTIVE);
 | 
			
		||||
                logic.addNotification(new ShieldActiveNotification(piece.getUuid()));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        System.out.println("send AnimationEndMessage");
 | 
			
		||||
        logic.getGame().setTurboFlag(false);
 | 
			
		||||
        parent.setState(parent.getAnimation());
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -12,14 +12,22 @@
 | 
			
		||||
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.message.server.CeremonyMessage;
 | 
			
		||||
import pp.mdga.message.server.ChoosePieceStateMessage;
 | 
			
		||||
import pp.mdga.message.server.DiceAgainMessage;
 | 
			
		||||
import pp.mdga.message.server.DiceNowMessage;
 | 
			
		||||
import pp.mdga.message.server.DieMessage;
 | 
			
		||||
import pp.mdga.message.server.EndOfTurnMessage;
 | 
			
		||||
import pp.mdga.message.server.MoveMessage;
 | 
			
		||||
import pp.mdga.message.server.NoTurnMessage;
 | 
			
		||||
import pp.mdga.message.server.PlayCardMessage;
 | 
			
		||||
import pp.mdga.message.server.PossibleCardsMessage;
 | 
			
		||||
import pp.mdga.message.server.PossiblePieceMessage;
 | 
			
		||||
import pp.mdga.message.server.SelectPieceMessage;
 | 
			
		||||
import pp.mdga.message.server.SpectatorMessage;
 | 
			
		||||
import pp.mdga.message.server.StartPieceMessage;
 | 
			
		||||
import pp.mdga.message.server.WaitPieceMessage;
 | 
			
		||||
import pp.mdga.notification.RemoveShieldNotification;
 | 
			
		||||
import pp.mdga.notification.AcquireCardNotification;
 | 
			
		||||
import pp.mdga.notification.DrawCardNotification;
 | 
			
		||||
 | 
			
		||||
public class TurnState extends GameStates {
 | 
			
		||||
 | 
			
		||||
@@ -33,16 +41,25 @@ public class TurnState extends GameStates {
 | 
			
		||||
    private final RollDiceState rollDiceState = new RollDiceState(this, logic);
 | 
			
		||||
    private boolean canChangeTurbo = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic  the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public TurnState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (GameState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        logic = logic;
 | 
			
		||||
        for (Piece piece : logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPieces()) {
 | 
			
		||||
            if (piece.isShielded() || piece.isSuppressed()){
 | 
			
		||||
            if (piece.isShielded() || piece.isSuppressed()) {
 | 
			
		||||
                piece.setShield(ShieldState.NONE);
 | 
			
		||||
                logic.addNotification(new RemoveShieldNotification(piece.getUuid()));
 | 
			
		||||
            }
 | 
			
		||||
@@ -51,147 +68,291 @@ public void enter() {
 | 
			
		||||
        this.setState(this.powerCardState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
        state = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setState(TurnStates state){
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets the state.
 | 
			
		||||
     *
 | 
			
		||||
     * @param state the state
 | 
			
		||||
     */
 | 
			
		||||
    public void setState(TurnStates state) {
 | 
			
		||||
        System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
 | 
			
		||||
        if(this.state != null){
 | 
			
		||||
        if (this.state != null) {
 | 
			
		||||
            this.state.exit();
 | 
			
		||||
        }
 | 
			
		||||
        state.enter();
 | 
			
		||||
        this.state = state;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the dice.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectDice(){
 | 
			
		||||
    public void selectDice() {
 | 
			
		||||
        state.selectDice();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the piece.
 | 
			
		||||
     *
 | 
			
		||||
     * @param piece the piece
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectPiece(Piece piece){
 | 
			
		||||
    public void selectPiece(Piece piece) {
 | 
			
		||||
        state.selectPiece(piece);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the card.
 | 
			
		||||
     *
 | 
			
		||||
     * @param card the card
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectCard(BonusCard card){
 | 
			
		||||
    public void selectCard(BonusCard card) {
 | 
			
		||||
        state.selectCard(card);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the animation end.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
    public void selectAnimationEnd() {
 | 
			
		||||
        state.selectAnimationEnd();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the select piece message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the select piece message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(SelectPieceMessage msg){
 | 
			
		||||
    public void received(SelectPieceMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the wait piece message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the wait piece message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(WaitPieceMessage msg){
 | 
			
		||||
    public void received(WaitPieceMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the start piece message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the start piece message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(StartPieceMessage msg){
 | 
			
		||||
    public void received(StartPieceMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the NoTurnMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the NoTurnMessage message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(NoTurnMessage msg){
 | 
			
		||||
    public void received(NoTurnMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the MoveMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the MoveMessage message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(MoveMessage msg){
 | 
			
		||||
    public void received(MoveMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the CeremonyMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the CeremonyMessage message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(CeremonyMessage msg){
 | 
			
		||||
    public void received(CeremonyMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the EndOfTurnMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the EndOfTurnMessage message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(EndOfTurnMessage msg){
 | 
			
		||||
    public void received(EndOfTurnMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the SpectatorMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the SpectatorMessage message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(SpectatorMessage msg){
 | 
			
		||||
    public void received(SpectatorMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the DiceAgainMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the DiceAgainMessage message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceAgainMessage msg){
 | 
			
		||||
    public void received(DiceAgainMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the PossibleCardsMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the PossibleCardsMessage message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PossibleCardsMessage msg){
 | 
			
		||||
    public void received(PossibleCardsMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the PlayCardMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the PlayCardMessage message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PlayCardMessage msg){
 | 
			
		||||
    public void received(PlayCardMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the DiceNow message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the DiceNow message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceNowMessage msg){
 | 
			
		||||
    public void received(DiceNowMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the DieMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the DieMessage message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DieMessage msg){
 | 
			
		||||
    public void received(DieMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the PossiblePieceMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the PossiblePieceMessage message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PossiblePieceMessage msg){
 | 
			
		||||
    public void received(PossiblePieceMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the ChoosePieceStateMessage message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the ChoosePieceStateMessage message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ChoosePieceStateMessage msg){
 | 
			
		||||
    public void received(ChoosePieceStateMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the ChoosePieceState.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the ChoosePieceState
 | 
			
		||||
     */
 | 
			
		||||
    public ChoosePieceState getChoosePiece() {
 | 
			
		||||
        return choosePieceState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the MovePieceState.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the MovePieceState
 | 
			
		||||
     */
 | 
			
		||||
    public MovePieceState getMovePiece() {
 | 
			
		||||
        return movePieceState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the PlayPowerCardState.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the PlayPowerCardState
 | 
			
		||||
     */
 | 
			
		||||
    public PlayPowerCardState getPlayPowerCard() {
 | 
			
		||||
        return playPowerCardState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the PowerCardState.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the PowerCardState
 | 
			
		||||
     */
 | 
			
		||||
    public PowerCardState getPowerCard() {
 | 
			
		||||
        return powerCardState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the RollDiceState.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the RollDiceState
 | 
			
		||||
     */
 | 
			
		||||
    public RollDiceState getRollDice() {
 | 
			
		||||
        return rollDiceState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public GameState getParent(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the parent GameState.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the parent GameState
 | 
			
		||||
     */
 | 
			
		||||
    public GameState getParent() {
 | 
			
		||||
        return parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public TurnStates getState(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the current TurnStates.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the current TurnStates
 | 
			
		||||
     */
 | 
			
		||||
    public TurnStates getState() {
 | 
			
		||||
        return state;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Checks if turbo can be changed.
 | 
			
		||||
     *
 | 
			
		||||
     * @return true if turbo can be changed, false otherwise
 | 
			
		||||
     */
 | 
			
		||||
    public boolean isCanChangeTurbo() {
 | 
			
		||||
        return canChangeTurbo;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets the turbo change flag.
 | 
			
		||||
     *
 | 
			
		||||
     * @param canChangeTurbo the new value for the turbo change flag
 | 
			
		||||
     */
 | 
			
		||||
    public void setCanChangeTurbo(boolean canChangeTurbo) {
 | 
			
		||||
        this.canChangeTurbo = canChangeTurbo;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -10,38 +10,62 @@
 | 
			
		||||
import pp.mdga.message.server.*;
 | 
			
		||||
import pp.mdga.notification.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Represents the waiting state in the game.
 | 
			
		||||
 */
 | 
			
		||||
public class WaitingState extends GameStates {
 | 
			
		||||
 | 
			
		||||
    private final GameState parent;
 | 
			
		||||
    private final System.Logger LOGGER = System.getLogger(this.getClass().getName());
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a new WaitingState.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the game logic
 | 
			
		||||
     */
 | 
			
		||||
    public WaitingState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (GameState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Called when entering the waiting state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Called when exiting the waiting state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the reception of a CeremonyMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the ceremony message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(CeremonyMessage msg) {
 | 
			
		||||
        logic.setState(logic.getCeremony());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the reception of a DieMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the die message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DieMessage msg) {
 | 
			
		||||
        logic.getGame().setDiceEyes(msg.getDiceEye());
 | 
			
		||||
        if(logic.getGame().getTurboFlag()){
 | 
			
		||||
        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()));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -52,6 +76,11 @@ public void received(DieMessage msg) {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the reception of a PlayCardMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the play card message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PlayCardMessage msg) {
 | 
			
		||||
        logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor(), msg.getCard().getCard()));
 | 
			
		||||
@@ -61,15 +90,20 @@ public void received(PlayCardMessage msg) {
 | 
			
		||||
        parent.setState(parent.getAnimation());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the reception of an ActivePlayerMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the active player message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ActivePlayerMessage msg) {
 | 
			
		||||
        logic.addNotification(new ActivePlayerNotification(msg.getColor()));
 | 
			
		||||
        logic.getGame().setActiveColor(msg.getColor());
 | 
			
		||||
        if(msg.getColor() == logic.getGame().getPlayers().get(logic.getOwnPlayerId()).getColor()) {
 | 
			
		||||
        if (msg.getColor() == logic.getGame().getPlayers().get(logic.getOwnPlayerId()).getColor()) {
 | 
			
		||||
            parent.setState(parent.getTurn());
 | 
			
		||||
        } else {
 | 
			
		||||
            for (Piece piece : logic.getGame().getActivePlayer().getPieces()){
 | 
			
		||||
                if (piece.isShielded() || piece.isSuppressed()){
 | 
			
		||||
            for (Piece piece : logic.getGame().getActivePlayer().getPieces()) {
 | 
			
		||||
                if (piece.isShielded() || piece.isSuppressed()) {
 | 
			
		||||
                    logic.addNotification(new RemoveShieldNotification(piece.getUuid()));
 | 
			
		||||
                    piece.setShield(ShieldState.NONE);
 | 
			
		||||
                }
 | 
			
		||||
@@ -77,11 +111,16 @@ public void received(ActivePlayerMessage msg) {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handles the reception of a MoveMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the move message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(MoveMessage msg) {
 | 
			
		||||
        Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
 | 
			
		||||
        if (msg.isHomeMove()) {
 | 
			
		||||
            if(piece.getState().equals(PieceState.HOME)){
 | 
			
		||||
            if (piece.getState().equals(PieceState.HOME)) {
 | 
			
		||||
                logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
 | 
			
		||||
                int pieceHomeIndex = logic.getGame().getActivePlayer().getHomeIndexOfPiece(piece);
 | 
			
		||||
                Node pieceNode = logic.getGame().getActivePlayer().getHomeNodes()[pieceHomeIndex];
 | 
			
		||||
@@ -91,18 +130,16 @@ public void received(MoveMessage msg) {
 | 
			
		||||
                Node oldNode = logic.getGame().getActivePlayer().getHomeNodes()[homeIndex];
 | 
			
		||||
                //gets the targetNode
 | 
			
		||||
                Node targetNode = logic.getGame().getActivePlayer().getHomeNodes()[msg.getTargetIndex()];
 | 
			
		||||
                if (msg.getTargetIndex() ==logic.getGame().getActivePlayer().getHighestHomeIdx()) {
 | 
			
		||||
                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];
 | 
			
		||||
@@ -110,31 +147,29 @@ public void received(MoveMessage msg) {
 | 
			
		||||
                //gets the targetNode
 | 
			
		||||
                Node targetNode = logic.getGame().getActivePlayer().getHomeNodes()[msg.getTargetIndex()];
 | 
			
		||||
 | 
			
		||||
                if (msg.getTargetIndex() ==logic.getGame().getActivePlayer().getHighestHomeIdx()) {
 | 
			
		||||
                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) {
 | 
			
		||||
                //TODO: MoveThrowNotification
 | 
			
		||||
                logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor()));
 | 
			
		||||
                if (occ.isSuppressed()){
 | 
			
		||||
                if (occ.isSuppressed()) {
 | 
			
		||||
                    logic.addNotification(new RemoveShieldNotification(occ.getUuid()));
 | 
			
		||||
                    occ.setShield(ShieldState.NONE);
 | 
			
		||||
                }
 | 
			
		||||
                //set occ to waiting
 | 
			
		||||
                logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
 | 
			
		||||
            }
 | 
			
		||||
            if(oldIndex == -1){
 | 
			
		||||
            if (oldIndex == -1) {
 | 
			
		||||
                logic.addNotification(new MovePieceNotification(piece.getUuid(), msg.getTargetIndex(), true));
 | 
			
		||||
                logic.getGame().getPlayerByColor(piece.getColor()).removeWaitingPiece(piece);
 | 
			
		||||
                piece.setState(PieceState.ACTIVE);
 | 
			
		||||
@@ -145,12 +180,12 @@ public void received(MoveMessage msg) {
 | 
			
		||||
            }
 | 
			
		||||
            //set new node
 | 
			
		||||
            logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].setOccupant(piece);
 | 
			
		||||
            if (logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].isStart()){
 | 
			
		||||
                if (piece.isShielded()){
 | 
			
		||||
            if (logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].isStart()) {
 | 
			
		||||
                if (piece.isShielded()) {
 | 
			
		||||
                    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()));
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,13 @@
 | 
			
		||||
import pp.mdga.client.gamestate.GameStates;
 | 
			
		||||
 | 
			
		||||
public abstract class DetermineStartPlayerStates extends GameStates {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public DetermineStartPlayerStates(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@
 | 
			
		||||
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
public class Intro extends DetermineStartPlayerStates{
 | 
			
		||||
public class Intro extends DetermineStartPlayerStates {
 | 
			
		||||
 | 
			
		||||
    private final DetermineStartPlayerState parent;
 | 
			
		||||
 | 
			
		||||
@@ -23,7 +23,7 @@ public class Intro extends DetermineStartPlayerStates{
 | 
			
		||||
     * Constructor for Intro
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     * @param logic  the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public Intro(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
@@ -35,7 +35,7 @@ public Intro(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
     *
 | 
			
		||||
     * @return the parent state
 | 
			
		||||
     */
 | 
			
		||||
    public DetermineStartPlayerState getParent(){
 | 
			
		||||
    public DetermineStartPlayerState getParent() {
 | 
			
		||||
        return parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -44,13 +44,13 @@ public DetermineStartPlayerState getParent(){
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        for(Map.Entry<Integer, Player> entry : logic.getGame().getPlayers().entrySet()){
 | 
			
		||||
        for (Map.Entry<Integer, Player> entry : logic.getGame().getPlayers().entrySet()) {
 | 
			
		||||
            logic.addNotification(new MovePieceNotification(entry.getValue().getPieces()[0].getUuid(), entry.getValue().getStartNodeIndex(), true));
 | 
			
		||||
            logic.getGame().getBoard().getInfield()[entry.getValue().getStartNodeIndex()].setOccupant(entry.getValue().getPieces()[0]);
 | 
			
		||||
            entry.getValue().getWaitingArea()[0] = null;
 | 
			
		||||
            animationCounter++;
 | 
			
		||||
            for (PowerCard card : entry.getValue().getHandCards()){
 | 
			
		||||
                if(entry.getKey() == logic.getOwnPlayerId()){
 | 
			
		||||
            for (PowerCard card : entry.getValue().getHandCards()) {
 | 
			
		||||
                if (entry.getKey() == logic.getOwnPlayerId()) {
 | 
			
		||||
                    logic.addNotification(new AcquireCardNotification(card.getCard()));
 | 
			
		||||
                } else {
 | 
			
		||||
                    logic.addNotification(new DrawCardNotification(entry.getValue().getColor(), card.getCard()));
 | 
			
		||||
@@ -71,13 +71,13 @@ public void exit() {
 | 
			
		||||
     * This method is used when the view has completed the animation.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
    public void selectAnimationEnd() {
 | 
			
		||||
        animationCounter--;
 | 
			
		||||
        if(animationCounter != 0){
 | 
			
		||||
        if (animationCounter != 0) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        logic.send(new AnimationEndMessage());
 | 
			
		||||
        if (logic.getGame().getActivePlayerId() == logic.getOwnPlayerId()){
 | 
			
		||||
        if (logic.getGame().getActivePlayerId() == logic.getOwnPlayerId()) {
 | 
			
		||||
            parent.getParent().setState(parent.getParent().getTurn());
 | 
			
		||||
            logic.addNotification(new ActivePlayerNotification(logic.getGame().getActiveColor()));
 | 
			
		||||
        } else {
 | 
			
		||||
 
 | 
			
		||||
@@ -13,36 +13,56 @@ public class RollRankingDiceState extends DetermineStartPlayerStates {
 | 
			
		||||
    private final System.Logger LOGGER = System.getLogger(this.getClass().getName());
 | 
			
		||||
 | 
			
		||||
    private final DetermineStartPlayerState parent;
 | 
			
		||||
    private boolean isRolled =false;
 | 
			
		||||
    private boolean isRolled = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public RollRankingDiceState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (DetermineStartPlayerState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        LOGGER.log(System.Logger.Level.INFO, "Entering RollRankingDiceState");
 | 
			
		||||
        logic.addNotification(new DiceNowNotification());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
        LOGGER.log(System.Logger.Level.INFO, "Exiting RollRankingDiceState");
 | 
			
		||||
        isRolled=false;
 | 
			
		||||
        isRolled = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the dice.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectDice(){
 | 
			
		||||
        if(!isRolled){
 | 
			
		||||
    public void selectDice() {
 | 
			
		||||
        if (!isRolled) {
 | 
			
		||||
            isRolled = true;
 | 
			
		||||
            logic.send(new RequestDieMessage());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method is called when the server sends a DieMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the DieMessage
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DieMessage msg){
 | 
			
		||||
    public void received(DieMessage msg) {
 | 
			
		||||
        parent.setState(parent.getWaitRanking());
 | 
			
		||||
        logic.addNotification(new RollDiceNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor(), msg.getDiceEye(),true));
 | 
			
		||||
        logic.addNotification(new RollDiceNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor(), msg.getDiceEye(), true));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -19,37 +20,62 @@ public class WaitRankingState extends DetermineStartPlayerStates {
 | 
			
		||||
    private final DetermineStartPlayerState parent;
 | 
			
		||||
    private boolean canChange = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public WaitRankingState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (DetermineStartPlayerState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void changeToIntro(){
 | 
			
		||||
        if(!canChange){
 | 
			
		||||
    /**
 | 
			
		||||
     * Changes the state to the intro state.
 | 
			
		||||
     */
 | 
			
		||||
    private void changeToIntro() {
 | 
			
		||||
        if (!canChange) {
 | 
			
		||||
            canChange = true;
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        parent.setState(parent.getIntro());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        LOGGER.log(System.Logger.Level.INFO, "Entering WaitRankingState");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
        canChange = false;
 | 
			
		||||
        LOGGER.log(System.Logger.Level.INFO, "Exiting WaitRankingState");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method is called when the server sends a DiceNowMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the DiceNowMessage
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceNowMessage msg){
 | 
			
		||||
    public void received(DiceNowMessage msg) {
 | 
			
		||||
        parent.setState(parent.getRollRankingDice());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method is called when the server sends a RankingResponseMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the RankingResponseMessage
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(RankingResponseMessage msg){
 | 
			
		||||
    public void received(RankingResponseMessage msg) {
 | 
			
		||||
        Map<Color, Integer> rankingResults = new HashMap<>();
 | 
			
		||||
        for (var entry : msg.getRankingResults().entrySet()) {
 | 
			
		||||
            rankingResults.put(logic.getGame().getPlayerById(entry.getKey()).getColor(), entry.getValue());
 | 
			
		||||
@@ -57,14 +83,22 @@ public void received(RankingResponseMessage msg){
 | 
			
		||||
        logic.addNotification(new RankingResponceNotification(rankingResults));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method is called when the view has completed the animation.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
    public void selectAnimationEnd() {
 | 
			
		||||
        changeToIntro();
 | 
			
		||||
        logic.send(new AnimationEndMessage());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method is called when the server sends an ActivePlayerMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the ActivePlayerMessage
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ActivePlayerMessage msg){
 | 
			
		||||
    public void received(ActivePlayerMessage msg) {
 | 
			
		||||
        logic.getGame().setActiveColor(msg.getColor());
 | 
			
		||||
        changeToIntro();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -17,82 +17,157 @@ public class ChoosePieceState extends TurnStates {
 | 
			
		||||
    private final StartPieceState startPieceState = new StartPieceState(this, logic);
 | 
			
		||||
    private final WaitingPieceState waitingPieceState = new WaitingPieceState(this, logic);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public ChoosePieceState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (TurnState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        this.setState(this.noPieceState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
        currentState.exit();
 | 
			
		||||
        currentState= null;
 | 
			
		||||
        currentState = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setState(ChoosePieceStates state){
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets the state.
 | 
			
		||||
     *
 | 
			
		||||
     * @param state the state
 | 
			
		||||
     */
 | 
			
		||||
    public void setState(ChoosePieceStates state) {
 | 
			
		||||
        System.out.println("CLIENT STATE old: " + this.currentState + " new: " + state);
 | 
			
		||||
        if(currentState != null){
 | 
			
		||||
        if (currentState != null) {
 | 
			
		||||
            currentState.exit();
 | 
			
		||||
        }
 | 
			
		||||
        state.enter();
 | 
			
		||||
        currentState = state;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the piece.
 | 
			
		||||
     *
 | 
			
		||||
     * @param piece the piece
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectPiece(Piece piece){
 | 
			
		||||
    public void selectPiece(Piece piece) {
 | 
			
		||||
        currentState.selectPiece(piece);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the select piece message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the select piece message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(SelectPieceMessage msg){
 | 
			
		||||
    public void received(SelectPieceMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the wait piece message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the wait piece message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(WaitPieceMessage msg){
 | 
			
		||||
    public void received(WaitPieceMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the start piece message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the start piece message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(StartPieceMessage msg){
 | 
			
		||||
    public void received(StartPieceMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the end of turn message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the end of turn message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(EndOfTurnMessage msg){
 | 
			
		||||
    public void received(EndOfTurnMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the dice now message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the dice now message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(MoveMessage msg){
 | 
			
		||||
    public void received(DiceNowMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public NoPieceState getNoPiece(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the move message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the move message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(MoveMessage msg) {
 | 
			
		||||
        currentState.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the no piece state.
 | 
			
		||||
     */
 | 
			
		||||
    public NoPieceState getNoPiece() {
 | 
			
		||||
        return noPieceState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public SelectPieceState getSelectPiece(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the select piece state.
 | 
			
		||||
     */
 | 
			
		||||
    public SelectPieceState getSelectPiece() {
 | 
			
		||||
        return selectPieceState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public StartPieceState getStartPiece(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the start piece state.
 | 
			
		||||
     */
 | 
			
		||||
    public StartPieceState getStartPiece() {
 | 
			
		||||
        return startPieceState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public WaitingPieceState getWaitingPiece(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the waiting piece state.
 | 
			
		||||
     */
 | 
			
		||||
    public WaitingPieceState getWaitingPiece() {
 | 
			
		||||
        return waitingPieceState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ChoosePieceStates getState(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the current state.
 | 
			
		||||
     */
 | 
			
		||||
    public ChoosePieceStates getState() {
 | 
			
		||||
        return currentState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public TurnState getParent(){
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the parent state.
 | 
			
		||||
     */
 | 
			
		||||
    public TurnState getParent() {
 | 
			
		||||
        return parent;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,52 +4,95 @@
 | 
			
		||||
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 {
 | 
			
		||||
 | 
			
		||||
    private final TurnState parent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public MovePieceState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (TurnState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the animation end.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
    public void selectAnimationEnd() {
 | 
			
		||||
        logic.send(new AnimationEndMessage());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the ceremony message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the ceremony message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(CeremonyMessage msg){
 | 
			
		||||
    public void received(CeremonyMessage msg) {
 | 
			
		||||
        logic.setState(logic.getCeremony());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the end of turn message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the end of turn message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(EndOfTurnMessage msg){
 | 
			
		||||
    public void received(EndOfTurnMessage msg) {
 | 
			
		||||
        parent.getParent().setState(parent.getParent().getWaiting());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the spectator message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the spectator message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(SpectatorMessage msg){
 | 
			
		||||
    public void received(SpectatorMessage msg) {
 | 
			
		||||
        parent.getParent().setState(parent.getParent().getSpectator());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the dice now message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the dice now message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceNowMessage msg){
 | 
			
		||||
    public void received(DiceNowMessage msg) {
 | 
			
		||||
        parent.setState(parent.getRollDice());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the parent state.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the parent state
 | 
			
		||||
     */
 | 
			
		||||
    public TurnState getParent() {
 | 
			
		||||
        return parent;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
@@ -17,14 +15,23 @@ public class PlayPowerCardState extends TurnStates {
 | 
			
		||||
    private PlayCardMessage playCardMessage;
 | 
			
		||||
    private int extraAnimationCounter = 0;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent parent state
 | 
			
		||||
     * @param logic  game logic
 | 
			
		||||
     */
 | 
			
		||||
    public PlayPowerCardState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (TurnState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enter the state
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        if(playCardMessage.getCard().getCard().equals(BonusCard.SWAP)) {
 | 
			
		||||
        if (playCardMessage.getCard().getCard().equals(BonusCard.SWAP)) {
 | 
			
		||||
            extraAnimationCounter++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -33,18 +40,29 @@ public void enter() {
 | 
			
		||||
        handlePowerCard(playCardMessage);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
        playCardMessage = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Handle the power card
 | 
			
		||||
     *
 | 
			
		||||
     * @param playCardMessage the play card message
 | 
			
		||||
     */
 | 
			
		||||
    public void setPlayCard(PlayCardMessage playCardMessage) {
 | 
			
		||||
        this.playCardMessage = playCardMessage;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The view has finished its animation
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
        if(extraAnimationCounter > 0) {
 | 
			
		||||
    public void selectAnimationEnd() {
 | 
			
		||||
        if (extraAnimationCounter > 0) {
 | 
			
		||||
            extraAnimationCounter--;
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -23,78 +23,139 @@ public class PowerCardState extends TurnStates {
 | 
			
		||||
    private final ShieldState shieldState = new ShieldState(this, logic);
 | 
			
		||||
    private final SwapState swapState = new SwapState(this, logic);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public PowerCardState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (TurnState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        this.setState(this.choosePowerCardState);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    public void exit() {
 | 
			
		||||
        state.exit();
 | 
			
		||||
        state = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets the state.
 | 
			
		||||
     *
 | 
			
		||||
     * @param state the state
 | 
			
		||||
     */
 | 
			
		||||
    public void setState(PowerCardStates state) {
 | 
			
		||||
        System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
 | 
			
		||||
 | 
			
		||||
        if(this.state != null){
 | 
			
		||||
        if (this.state != null) {
 | 
			
		||||
            this.state.exit();
 | 
			
		||||
        }
 | 
			
		||||
        state.enter();
 | 
			
		||||
        this.state = state;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the possible cards message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the possible cards message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PossibleCardsMessage msg){
 | 
			
		||||
    public void received(PossibleCardsMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the play card message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the play card message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PlayCardMessage msg){
 | 
			
		||||
    public void received(PlayCardMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the dice now message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the dice now message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceNowMessage msg){
 | 
			
		||||
    public void received(DiceNowMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the possible piece message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the possible piece message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(PossiblePieceMessage msg){
 | 
			
		||||
    public void received(PossiblePieceMessage msg) {
 | 
			
		||||
        state.received(msg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the card.
 | 
			
		||||
     *
 | 
			
		||||
     * @param card the card
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectCard(BonusCard card) {
 | 
			
		||||
        state.selectCard(card);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the piece.
 | 
			
		||||
     *
 | 
			
		||||
     * @param piece the piece
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectPiece(Piece piece) {
 | 
			
		||||
        state.selectPiece(piece);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the choose power card state.
 | 
			
		||||
     */
 | 
			
		||||
    public ChoosePowerCardState getChoosePowerCard() {
 | 
			
		||||
        return choosePowerCardState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the shield state.
 | 
			
		||||
     */
 | 
			
		||||
    public ShieldState getShield() {
 | 
			
		||||
        return shieldState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the swap state.
 | 
			
		||||
     */
 | 
			
		||||
    public SwapState getSwap() {
 | 
			
		||||
        return swapState;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the parent state.
 | 
			
		||||
     */
 | 
			
		||||
    public TurnState getParent() {
 | 
			
		||||
        return parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the state.
 | 
			
		||||
     */
 | 
			
		||||
    public PowerCardStates getState() {
 | 
			
		||||
        return state;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -17,65 +17,107 @@ public class RollDiceState extends TurnStates {
 | 
			
		||||
    private final TurnState parent;
 | 
			
		||||
    private boolean isRolled = false;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public RollDiceState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (TurnState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        isRolled = false;
 | 
			
		||||
        logic.addNotification(new DiceNowNotification());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
        logic.getGame().setDiceModifier(1);
 | 
			
		||||
        isRolled = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the parent state.
 | 
			
		||||
     *
 | 
			
		||||
     * @return the parent state
 | 
			
		||||
     */
 | 
			
		||||
    public TurnState getParent() {
 | 
			
		||||
        return parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the dice.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectDice(){
 | 
			
		||||
        if (!isRolled){
 | 
			
		||||
    public void selectDice() {
 | 
			
		||||
        if (!isRolled) {
 | 
			
		||||
            isRolled = true;
 | 
			
		||||
            logic.send(new RequestDieMessage());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the die message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the die message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DieMessage msg){
 | 
			
		||||
    public void received(DieMessage msg) {
 | 
			
		||||
        logic.getGame().setDiceEyes(msg.getDiceEye());
 | 
			
		||||
 | 
			
		||||
        if(logic.getGame().getTurboFlag()){
 | 
			
		||||
        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()));
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the animation end.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectAnimationEnd(){
 | 
			
		||||
    public void selectAnimationEnd() {
 | 
			
		||||
        logic.send(new AnimationEndMessage());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the choose piece state message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the choose piece state message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(ChoosePieceStateMessage msg){
 | 
			
		||||
    public void received(ChoosePieceStateMessage msg) {
 | 
			
		||||
        parent.setState(parent.getChoosePiece());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the no turn message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the no turn message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(NoTurnMessage msg){
 | 
			
		||||
    public void received(NoTurnMessage msg) {
 | 
			
		||||
        parent.getParent().setState(parent.getParent().getWaiting());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the dice now message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the dice now message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceNowMessage msg){
 | 
			
		||||
    public void received(DiceNowMessage msg) {
 | 
			
		||||
        isRolled = false;
 | 
			
		||||
        logic.addNotification(new DiceNowNotification());
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,14 @@
 | 
			
		||||
import pp.mdga.client.ClientState;
 | 
			
		||||
import pp.mdga.client.gamestate.GameStates;
 | 
			
		||||
 | 
			
		||||
public  abstract class TurnStates extends GameStates {
 | 
			
		||||
public abstract class TurnStates extends GameStates {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public TurnStates(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,13 @@
 | 
			
		||||
import pp.mdga.client.gamestate.turnstate.TurnStates;
 | 
			
		||||
 | 
			
		||||
public abstract class ChoosePieceStates extends TurnStates {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public ChoosePieceStates(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -4,11 +4,13 @@
 | 
			
		||||
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.DiceNowMessage;
 | 
			
		||||
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.DiceNowNotification;
 | 
			
		||||
import pp.mdga.notification.SelectableMoveNotification;
 | 
			
		||||
import pp.mdga.notification.WaitMoveNotification;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
@@ -21,21 +23,36 @@ public class NoPieceState extends ChoosePieceStates {
 | 
			
		||||
 | 
			
		||||
    private final ChoosePieceState parent;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public NoPieceState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (ChoosePieceState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
        LOGGER.log(System.Logger.Level.INFO, "Entering NoPieceState");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the piece.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(SelectPieceMessage msg) {
 | 
			
		||||
        ArrayList<Piece> pieces = msg.getPieces().stream().map(piece -> logic.getGame().getPieceThroughUUID(piece.getUuid())).collect(Collectors.toCollection(ArrayList::new));
 | 
			
		||||
@@ -46,16 +63,24 @@ public void received(SelectPieceMessage msg) {
 | 
			
		||||
        parent.setState(parent.getSelectPiece());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the dice.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(WaitPieceMessage msg){
 | 
			
		||||
    public void received(WaitPieceMessage msg) {
 | 
			
		||||
        LOGGER.log(System.Logger.Level.INFO, "Received WaitPieceMessage");
 | 
			
		||||
        Piece piece = logic.getGame().getPieceThroughUUID(msg.getPieceID());
 | 
			
		||||
        logic.addNotification(new SelectableMoveNotification(new ArrayList<>(List.of(msg.getPieceID())), new ArrayList<>(List.of(logic.getGame().getPlayerByColor(piece.getColor()).getStartNodeIndex())), new ArrayList<>(List.of(false))));
 | 
			
		||||
        parent.setState(parent.getWaitingPiece());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method is called when the server sends a DiceNowMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the DiceNowMessage
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(StartPieceMessage msg){
 | 
			
		||||
    public void received(StartPieceMessage msg) {
 | 
			
		||||
        Piece piece = logic.getGame().getPieceThroughUUID(msg.getPieceIdentifier());
 | 
			
		||||
        List<UUID> listPiece = new ArrayList<>();
 | 
			
		||||
        List<Integer> listIndex = new ArrayList<>();
 | 
			
		||||
@@ -69,9 +94,24 @@ public void received(StartPieceMessage msg){
 | 
			
		||||
        parent.setState(parent.getStartPiece());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method is called when the server sends a DiceNowMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the DiceNowMessage
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(EndOfTurnMessage msg){
 | 
			
		||||
    public void received(EndOfTurnMessage msg) {
 | 
			
		||||
        logic.getGame().setTurboFlag(false);
 | 
			
		||||
        parent.getParent().getParent().setState(parent.getParent().getParent().getWaiting());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method is called when the server sends a DiceNowMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the DiceNowMessage
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(DiceNowMessage msg){
 | 
			
		||||
        parent.getParent().setState(parent.getParent().getRollDice());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
@@ -24,25 +18,47 @@ public class SelectPieceState extends ChoosePieceStates {
 | 
			
		||||
    private ArrayList<Piece> possiblePieces;
 | 
			
		||||
    private final System.Logger LOGGER = System.getLogger(this.getClass().getName());
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public SelectPieceState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (ChoosePieceState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
        possiblePieces = new ArrayList<>();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets the possible pieces.
 | 
			
		||||
     *
 | 
			
		||||
     * @param possiblePieces the possible pieces
 | 
			
		||||
     */
 | 
			
		||||
    public void setPossiblePieces(ArrayList<Piece> possiblePieces) {
 | 
			
		||||
        this.possiblePieces = possiblePieces;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the piece.
 | 
			
		||||
     *
 | 
			
		||||
     * @param piece the piece
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectPiece(Piece piece) {
 | 
			
		||||
        if (possiblePieces.contains(piece)) {
 | 
			
		||||
@@ -50,6 +66,11 @@ public void selectPiece(Piece piece) {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This method is called when the server sends a MoveMessage.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the MoveMessage
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(MoveMessage msg) {
 | 
			
		||||
        Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
 | 
			
		||||
@@ -63,29 +84,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();
 | 
			
		||||
@@ -93,7 +110,7 @@ public void received(MoveMessage msg) {
 | 
			
		||||
            if (occ != null) {
 | 
			
		||||
                //TODO: MoveThrowNotification
 | 
			
		||||
                logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor()));
 | 
			
		||||
                if (occ.isSuppressed()){
 | 
			
		||||
                if (occ.isSuppressed()) {
 | 
			
		||||
                    logic.addNotification(new RemoveShieldNotification(occ.getUuid()));
 | 
			
		||||
                    occ.setShield(ShieldState.NONE);
 | 
			
		||||
                }
 | 
			
		||||
@@ -111,8 +128,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()));
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 | 
			
		||||
@@ -24,35 +17,61 @@ public class StartPieceState extends ChoosePieceStates {
 | 
			
		||||
    private final ChoosePieceState parent;
 | 
			
		||||
    private Piece moveablePiece;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructs a client state of the specified game logic.
 | 
			
		||||
     *
 | 
			
		||||
     * @param parent the parent state
 | 
			
		||||
     * @param logic the client game logic
 | 
			
		||||
     */
 | 
			
		||||
    public StartPieceState(ClientState parent, ClientGameLogic logic) {
 | 
			
		||||
        super(parent, logic);
 | 
			
		||||
        this.parent = (ChoosePieceState) parent;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Enters the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void enter() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Exits the state.
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void exit() {
 | 
			
		||||
        moveablePiece = null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sets the moveable piece.
 | 
			
		||||
     *
 | 
			
		||||
     * @param moveablePiece the moveable piece
 | 
			
		||||
     */
 | 
			
		||||
    public void setMoveablePiece(Piece moveablePiece) {
 | 
			
		||||
        this.moveablePiece = moveablePiece;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Selects the piece.
 | 
			
		||||
     *
 | 
			
		||||
     * @param piece the piece
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void selectPiece(Piece piece){
 | 
			
		||||
        if(moveablePiece.equals(piece)){
 | 
			
		||||
    public void selectPiece(Piece piece) {
 | 
			
		||||
        if (moveablePiece.equals(piece)) {
 | 
			
		||||
            logic.send(new RequestMoveMessage(piece));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Receives the move message.
 | 
			
		||||
     *
 | 
			
		||||
     * @param msg the move message
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void received(MoveMessage msg){
 | 
			
		||||
    public void received(MoveMessage msg) {
 | 
			
		||||
        Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
 | 
			
		||||
        int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
 | 
			
		||||
        int targetIndex = msg.getTargetIndex();
 | 
			
		||||
@@ -62,21 +81,21 @@ public void received(MoveMessage msg){
 | 
			
		||||
 | 
			
		||||
        //get Occupant
 | 
			
		||||
        Piece occ = targetNode.getOccupant();
 | 
			
		||||
        if (occ != null){
 | 
			
		||||
        if (occ != null) {
 | 
			
		||||
            logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
 | 
			
		||||
            if (occ.isSuppressed()){
 | 
			
		||||
            if (occ.isSuppressed()) {
 | 
			
		||||
                logic.addNotification(new RemoveShieldNotification(occ.getUuid()));
 | 
			
		||||
                occ.setShield(ShieldState.NONE);
 | 
			
		||||
            }
 | 
			
		||||
            logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor()));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (targetNode.isStart()){
 | 
			
		||||
            if (piece.isShielded()){
 | 
			
		||||
        if (targetNode.isStart()) {
 | 
			
		||||
            if (piece.isShielded()) {
 | 
			
		||||
                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 RemoveShieldNotification(piece.getUuid()));
 | 
			
		||||
            logic.addNotification(new ShieldActiveNotification(piece.getUuid()));
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user