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"),
|
tankShootTop("Models/tank/tankShoot_top.j3o", "Models/tank/tank_diff.png"),
|
||||||
treesSmallBackground("Models/treeSmall/treesSmallBackground.j3o", "Models/treeSmall/treeSmall_diff.png", 1.2f),
|
treesSmallBackground("Models/treeSmall/treesSmallBackground.j3o", "Models/treeSmall/treeSmall_diff.png", 1.2f),
|
||||||
treesBigBackground("Models/treeBig/treesBigBackground.j3o", "Models/treeBig/treeBig_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 modelPath;
|
||||||
private final String diffPath;
|
private final String diffPath;
|
||||||
@@ -83,7 +82,8 @@ public enum Asset {
|
|||||||
Asset(String modelPath) {
|
Asset(String modelPath) {
|
||||||
String folderFileName = "./" + ROOT + name() + "/" + name();
|
String folderFileName = "./" + ROOT + name() + "/" + name();
|
||||||
this.modelPath = modelPath;
|
this.modelPath = modelPath;
|
||||||
this.diffPath = folderFileName + "_diff.png";;
|
this.diffPath = folderFileName + "_diff.png";
|
||||||
|
;
|
||||||
this.size = 1f;
|
this.size = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,19 +12,14 @@
|
|||||||
import com.jme3.renderer.Camera;
|
import com.jme3.renderer.Camera;
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import com.jme3.scene.control.AbstractControl;
|
import com.jme3.scene.control.AbstractControl;
|
||||||
import com.jme3.scene.control.Control;
|
|
||||||
import pp.mdga.client.board.NodeControl;
|
import pp.mdga.client.board.NodeControl;
|
||||||
import pp.mdga.client.board.OutlineControl;
|
import pp.mdga.client.board.OutlineControl;
|
||||||
|
import pp.mdga.client.board.OutlineOEControl;
|
||||||
import pp.mdga.client.board.PieceControl;
|
import pp.mdga.client.board.PieceControl;
|
||||||
import pp.mdga.client.gui.CardControl;
|
import pp.mdga.client.gui.CardControl;
|
||||||
import pp.mdga.client.gui.DiceControl;
|
import pp.mdga.client.gui.DiceControl;
|
||||||
import pp.mdga.client.view.GameView;
|
import pp.mdga.client.view.GameView;
|
||||||
import pp.mdga.game.BonusCard;
|
|
||||||
import pp.mdga.game.Color;
|
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.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -38,7 +33,7 @@ public class InputSynchronizer {
|
|||||||
private float rotationAngle = 180f;
|
private float rotationAngle = 180f;
|
||||||
private int scrollValue = 0;
|
private int scrollValue = 0;
|
||||||
private CardControl hoverCard;
|
private CardControl hoverCard;
|
||||||
private PieceControl hoverPiece;
|
private OutlineOEControl hoverPiece;
|
||||||
|
|
||||||
private boolean clickAllowed = true;
|
private boolean clickAllowed = true;
|
||||||
|
|
||||||
@@ -94,6 +89,7 @@ private void setupInput() {
|
|||||||
inputManager.addListener(actionListener, "Settings", "Forward", "RotateRightMouse", "Click", "Left", "Right", "Test");
|
inputManager.addListener(actionListener, "Settings", "Forward", "RotateRightMouse", "Click", "Left", "Right", "Test");
|
||||||
inputManager.addListener(analogListener, "MouseLeft", "MouseRight", "MouseScrollUp", "MouseScrollDown");
|
inputManager.addListener(analogListener, "MouseLeft", "MouseRight", "MouseScrollUp", "MouseScrollDown");
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID p = null;
|
UUID p = null;
|
||||||
/**
|
/**
|
||||||
* Handles action-based input events such as key presses and mouse clicks.
|
* Handles action-based input events such as key presses and mouse clicks.
|
||||||
@@ -118,25 +114,17 @@ public void onAction(String name, boolean isPressed, float tpf) {
|
|||||||
if (app.getView() instanceof GameView gameView) {
|
if (app.getView() instanceof GameView gameView) {
|
||||||
DiceControl diceSelect = checkHover(gameView.getGuiHandler().getCardLayerCamera(), gameView.getGuiHandler().getCardLayerRootNode(), DiceControl.class);
|
DiceControl diceSelect = checkHover(gameView.getGuiHandler().getCardLayerCamera(), gameView.getGuiHandler().getCardLayerRootNode(), DiceControl.class);
|
||||||
CardControl cardLayerSelect = checkHover(gameView.getGuiHandler().getCardLayerCamera(), gameView.getGuiHandler().getCardLayerRootNode(), CardControl.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();
|
app.getModelSynchronize().rolledDice();
|
||||||
}
|
} else if (cardLayerSelect != null) {
|
||||||
else if(cardLayerSelect != null) {
|
|
||||||
//cardSelect
|
//cardSelect
|
||||||
if (cardLayerSelect.isSelectable()) gameView.getGuiHandler().selectCard(cardLayerSelect);
|
if (cardLayerSelect.isSelectable()) gameView.getGuiHandler().selectCard(cardLayerSelect);
|
||||||
}
|
} else if (boardSelect != null) {
|
||||||
else if(boardSelect != null) {
|
|
||||||
//boardSelect
|
//boardSelect
|
||||||
if(boardSelect instanceof PieceControl pieceControl){
|
gameView.getBoardHandler().pieceSelect(boardSelect);
|
||||||
if(pieceControl.isSelectable()) gameView.getBoardHandler().pieceSelect(pieceControl);
|
} else {
|
||||||
}
|
|
||||||
if(boardSelect instanceof NodeControl nodeControl){
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//both null
|
//both null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,7 +165,6 @@ else if(boardSelect != null) {
|
|||||||
//gameView.getGuiHandler().playCardOwn(BonusCard.SHIELD);
|
//gameView.getGuiHandler().playCardOwn(BonusCard.SHIELD);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -191,17 +178,13 @@ else if(boardSelect != null) {
|
|||||||
public void onAnalog(String name, float value, float tpf) {
|
public void onAnalog(String name, float value, float tpf) {
|
||||||
if (name.equals("MouseLeft") && rightMousePressed) {
|
if (name.equals("MouseLeft") && rightMousePressed) {
|
||||||
rotationAngle -= value * 360f;
|
rotationAngle -= value * 360f;
|
||||||
}
|
} else if (name.equals("MouseRight") && rightMousePressed) {
|
||||||
else if (name.equals("MouseRight") && rightMousePressed) {
|
|
||||||
rotationAngle += value * 360f;
|
rotationAngle += value * 360f;
|
||||||
}
|
} else if (name.equals("MouseScrollUp")) {
|
||||||
else if (name.equals("MouseScrollUp")) {
|
|
||||||
scrollValue = Math.max(1, scrollValue - 5);
|
scrollValue = Math.max(1, scrollValue - 5);
|
||||||
}
|
} else if (name.equals("MouseScrollDown")) {
|
||||||
else if (name.equals("MouseScrollDown")) {
|
|
||||||
scrollValue = Math.min(100, scrollValue + 5);
|
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();
|
hoverPiece();
|
||||||
hoverCard();
|
hoverCard();
|
||||||
}
|
}
|
||||||
@@ -217,7 +200,8 @@ private <T extends AbstractControl> T checkHover(Camera cam, Node root, Class<T>
|
|||||||
Ray ray = new Ray(cam.getLocation(), getMousePos(cam).subtract(cam.getLocation()).normalize());
|
Ray ray = new Ray(cam.getLocation(), getMousePos(cam).subtract(cam.getLocation()).normalize());
|
||||||
root.collideWith(ray, results);
|
root.collideWith(ray, results);
|
||||||
for (CollisionResult collisionResult : results) {
|
for (CollisionResult collisionResult : results) {
|
||||||
if(collisionResult.getGeometry().getControl(controlType) != null) return collisionResult.getGeometry().getControl(controlType);
|
if (collisionResult.getGeometry().getControl(controlType) != null)
|
||||||
|
return collisionResult.getGeometry().getControl(controlType);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -247,13 +231,12 @@ private <T extends AbstractControl> T checkHoverOrtho(Camera cam, Node root, Cla
|
|||||||
*/
|
*/
|
||||||
private void hoverPiece() {
|
private void hoverPiece() {
|
||||||
if (app.getView() instanceof GameView gameView) {
|
if (app.getView() instanceof GameView gameView) {
|
||||||
PieceControl control = checkPiece();
|
OutlineOEControl control = checkPiece();
|
||||||
if (control != null) {
|
if (control != null) {
|
||||||
if (control != hoverPiece) {
|
if (control != hoverPiece) {
|
||||||
pieceOff(gameView);
|
pieceOff(gameView);
|
||||||
hoverPiece = control;
|
hoverPiece = control;
|
||||||
// hoverPiece.hover();
|
if(hoverPiece.isHoverable()) gameView.getBoardHandler().hoverOn(hoverPiece);
|
||||||
gameView.getBoardHandler().pieceHoverOn(hoverPiece);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pieceOff(gameView);
|
pieceOff(gameView);
|
||||||
@@ -272,7 +255,7 @@ private void hoverCard() {
|
|||||||
if (control != hoverCard) {
|
if (control != hoverCard) {
|
||||||
cardOff();
|
cardOff();
|
||||||
hoverCard = control;
|
hoverCard = control;
|
||||||
hoverCard.hover();
|
hoverCard.hoverOn();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cardOff();
|
cardOff();
|
||||||
@@ -285,8 +268,8 @@ private void hoverCard() {
|
|||||||
*
|
*
|
||||||
* @return The PieceControl of the hovered piece, or null if no piece is hovered.
|
* @return The PieceControl of the hovered piece, or null if no piece is hovered.
|
||||||
*/
|
*/
|
||||||
private PieceControl checkPiece() {
|
private OutlineOEControl checkPiece() {
|
||||||
return checkHover(app.getCamera(), app.getRootNode(), PieceControl.class);
|
return checkHover(app.getCamera(), app.getRootNode(), OutlineOEControl.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -308,8 +291,7 @@ private CardControl checkCard(GameView gameView) {
|
|||||||
*/
|
*/
|
||||||
private void pieceOff(GameView gameView) {
|
private void pieceOff(GameView gameView) {
|
||||||
if (hoverPiece != null) {
|
if (hoverPiece != null) {
|
||||||
gameView.getBoardHandler().pieceHoverOff(hoverPiece);
|
if(hoverPiece.isHoverable()) gameView.getBoardHandler().hoverOff(hoverPiece);
|
||||||
// hoverPiece.hoverOff();
|
|
||||||
}
|
}
|
||||||
hoverPiece = null;
|
hoverPiece = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,14 @@
|
|||||||
package pp.mdga.client;
|
package pp.mdga.client;
|
||||||
|
|
||||||
import com.jme3.app.SimpleApplication;
|
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.jme3.system.AppSettings;
|
||||||
|
import com.simsilica.lemur.GuiGlobals;
|
||||||
|
import pp.mdga.client.acoustic.AcousticHandler;
|
||||||
import pp.mdga.client.animation.TimerManager;
|
import pp.mdga.client.animation.TimerManager;
|
||||||
import pp.mdga.client.dialog.JoinDialog;
|
import pp.mdga.client.dialog.JoinDialog;
|
||||||
import pp.mdga.client.view.*;
|
import pp.mdga.client.view.*;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import java.awt.*;
|
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.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
@@ -27,40 +21,64 @@ public class MdgaApp extends SimpleApplication {
|
|||||||
|
|
||||||
private static Preferences prefs = Preferences.userNodeForPackage(JoinDialog.class);
|
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;
|
private AcousticHandler acousticHandler;
|
||||||
|
|
||||||
/** Synchronizes notifications throughout the application. */
|
/**
|
||||||
|
* Synchronizes notifications throughout the application.
|
||||||
|
*/
|
||||||
private NotificationSynchronizer notificationSynchronizer;
|
private NotificationSynchronizer notificationSynchronizer;
|
||||||
|
|
||||||
/** Manages input events and synchronization. */
|
/**
|
||||||
|
* Manages input events and synchronization.
|
||||||
|
*/
|
||||||
private InputSynchronizer inputSynchronizer;
|
private InputSynchronizer inputSynchronizer;
|
||||||
|
|
||||||
/** Synchronizes game models. */
|
/**
|
||||||
|
* Synchronizes game models.
|
||||||
|
*/
|
||||||
private ModelSynchronizer modelSynchronizer;
|
private ModelSynchronizer modelSynchronizer;
|
||||||
|
|
||||||
/** The currently active view in the application. */
|
/**
|
||||||
|
* The currently active view in the application.
|
||||||
|
*/
|
||||||
private MdgaView view = null;
|
private MdgaView view = null;
|
||||||
|
|
||||||
/** The current state of the application. */
|
/**
|
||||||
|
* The current state of the application.
|
||||||
|
*/
|
||||||
private MdgaState state = null;
|
private MdgaState state = null;
|
||||||
|
|
||||||
/** Scale for rendering images. */
|
/**
|
||||||
|
* Scale for rendering images.
|
||||||
|
*/
|
||||||
private final float imageScale = prefs.getInt("scale", 1);
|
private final float imageScale = prefs.getInt("scale", 1);
|
||||||
|
|
||||||
/** The main menu view. */
|
/**
|
||||||
|
* The main menu view.
|
||||||
|
*/
|
||||||
private MainView mainView;
|
private MainView mainView;
|
||||||
|
|
||||||
/** The lobby view. */
|
/**
|
||||||
|
* The lobby view.
|
||||||
|
*/
|
||||||
private LobbyView lobbyView;
|
private LobbyView lobbyView;
|
||||||
|
|
||||||
/** The game view. */
|
/**
|
||||||
|
* The game view.
|
||||||
|
*/
|
||||||
private GameView gameView;
|
private GameView gameView;
|
||||||
|
|
||||||
/** The ceremony view. */
|
/**
|
||||||
|
* The ceremony view.
|
||||||
|
*/
|
||||||
private CeremonyView ceremonyView;
|
private CeremonyView ceremonyView;
|
||||||
|
|
||||||
/** The client game logic. */
|
/**
|
||||||
|
* The client game logic.
|
||||||
|
*/
|
||||||
private final ClientGameLogic clientGameLogic;
|
private final ClientGameLogic clientGameLogic;
|
||||||
|
|
||||||
private ExecutorService executor;
|
private ExecutorService executor;
|
||||||
@@ -70,7 +88,7 @@ public class MdgaApp extends SimpleApplication {
|
|||||||
private final TimerManager timerManager = new TimerManager();
|
private final TimerManager timerManager = new TimerManager();
|
||||||
|
|
||||||
|
|
||||||
public static final int DEBUG_MULTIPLIER = 1;
|
public static final int DEBUG_MULTIPLIER = 0;
|
||||||
|
|
||||||
public MdgaApp() {
|
public MdgaApp() {
|
||||||
networkConnection = new NetworkSupport(this);
|
networkConnection = new NetworkSupport(this);
|
||||||
@@ -333,5 +351,9 @@ public GameView getGameView(){
|
|||||||
public TimerManager getTimerManager() {
|
public TimerManager getTimerManager() {
|
||||||
return timerManager;
|
return timerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CeremonyView getCeremonyView() {
|
||||||
|
return ceremonyView;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,6 +144,10 @@ public void enter(MdgaState state) {
|
|||||||
//app.enter(state);
|
//app.enter(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void next() {
|
||||||
|
app.getGameLogic().selectNext();
|
||||||
|
}
|
||||||
|
|
||||||
public void setSwap(boolean swap) {
|
public void setSwap(boolean swap) {
|
||||||
this.swap = swap;
|
this.swap = swap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,8 +133,7 @@ private void handleGame(Notification notification) {
|
|||||||
app.getAcousticHandler().playSound(MdgaSound.UI90);
|
app.getAcousticHandler().playSound(MdgaSound.UI90);
|
||||||
delay = STANDARD_DELAY;
|
delay = STANDARD_DELAY;
|
||||||
} else if (notification instanceof CeremonyNotification ceremonyNotification) {
|
} else if (notification instanceof CeremonyNotification ceremonyNotification) {
|
||||||
app.enter(MdgaState.CEREMONY);
|
CeremonyView ceremonyView = app.getCeremonyView();
|
||||||
CeremonyView ceremonyView = (CeremonyView) app.getView();
|
|
||||||
int size = ceremonyNotification.getNames().size();
|
int size = ceremonyNotification.getNames().size();
|
||||||
|
|
||||||
if (ceremonyNotification.getPiecesThrown().size() != size ||
|
if (ceremonyNotification.getPiecesThrown().size() != size ||
|
||||||
@@ -156,9 +155,13 @@ private void handleGame(Notification notification) {
|
|||||||
int v5 = ceremonyNotification.getNodesMoved().get(i);
|
int v5 = ceremonyNotification.getNodesMoved().get(i);
|
||||||
int v6 = ceremonyNotification.getBonusNodes().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);
|
ceremonyView.addStatisticsRow(name, v1, v2, v3, v4, v5, v6);
|
||||||
}
|
}
|
||||||
|
app.enter(MdgaState.CEREMONY);
|
||||||
} else if (notification instanceof DiceNowNotification) {
|
} else if (notification instanceof DiceNowNotification) {
|
||||||
guiHandler.hideText();
|
guiHandler.hideText();
|
||||||
guiHandler.showDice();
|
guiHandler.showDice();
|
||||||
@@ -177,8 +180,7 @@ private void handleGame(Notification notification) {
|
|||||||
//StartMove
|
//StartMove
|
||||||
boardHandler.movePieceStartAnim(n.getPiece(), n.getMoveIndex());
|
boardHandler.movePieceStartAnim(n.getPiece(), n.getMoveIndex());
|
||||||
waitForAnimation = true;
|
waitForAnimation = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
//InfieldMove
|
//InfieldMove
|
||||||
boardHandler.movePieceAnim(n.getPiece(), n.getStartIndex(), n.getMoveIndex());
|
boardHandler.movePieceAnim(n.getPiece(), n.getStartIndex(), n.getMoveIndex());
|
||||||
waitForAnimation = true;
|
waitForAnimation = true;
|
||||||
@@ -217,8 +219,7 @@ public void run() {
|
|||||||
if (n.getColor() == ownColor) {
|
if (n.getColor() == ownColor) {
|
||||||
guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
|
guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
|
||||||
waitForAnimation = true;
|
waitForAnimation = true;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (n.isTurbo()) guiHandler.showRolledDiceMult(n.getEyes(), n.getMultiplier(), n.getColor());
|
if (n.isTurbo()) guiHandler.showRolledDiceMult(n.getEyes(), n.getMultiplier(), n.getColor());
|
||||||
else guiHandler.showRolledDice(n.getEyes(), n.getColor());
|
else guiHandler.showRolledDice(n.getEyes(), n.getColor());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
|
|
||||||
public class Util {
|
public class Util {
|
||||||
private Util(){}
|
private Util() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs linear interpolation between two values.
|
* Performs linear interpolation between two values.
|
||||||
|
|||||||
@@ -4,7 +4,10 @@
|
|||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.MdgaState;
|
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;
|
import java.util.prefs.Preferences;
|
||||||
|
|
||||||
public class AcousticHandler {
|
public class AcousticHandler {
|
||||||
@@ -226,11 +229,11 @@ private float lerp(float start, float end, float t) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the state of audio playback, handling track transitions and volume adjustments.
|
* 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.
|
* 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.
|
* 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.
|
* The method prioritizes the latest scheduled track if multiple scheduling occurs quickly.
|
||||||
*
|
* <p>
|
||||||
* Behavior:
|
* Behavior:
|
||||||
* 1. If nothing is scheduled and no track is playing, it exits early.
|
* 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.
|
* 2. If a scheduled track exists and no track is playing, the scheduled track starts immediately at full volume.
|
||||||
@@ -239,7 +242,7 @@ private float lerp(float start, float end, float t) {
|
|||||||
* 4. If a track transition is in progress (fading), it processes the fade-out and fade-in states.
|
* 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.
|
* 5. If no fading is needed and a track is playing, it ensures the track's volume is updated.
|
||||||
*
|
* <p>
|
||||||
* Special cases:
|
* Special cases:
|
||||||
* - If no track is playing and a new track is scheduled, it starts the track immediately without fading.
|
* - 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.
|
* - 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.
|
* 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
|
* 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
|
* 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.
|
* tracks while maintaining the correct volume adjustments.
|
||||||
*
|
* <p>
|
||||||
* Behavior:
|
* Behavior:
|
||||||
* 1. **Outfade:** Gradually decreases the volume of the `old` track over the duration of `FADE_DURATION`.
|
* 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.
|
* 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
|
* 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:
|
* Key Details:
|
||||||
* - The outfade volume adjustment is interpolated linearly from full volume to zero using the `lerp` function.
|
* - 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.
|
* - 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.
|
* - If a new track is scheduled during the fade process, it is handled by external logic to prioritize transitions.
|
||||||
*
|
* <p>
|
||||||
* Preconditions:
|
* Preconditions:
|
||||||
* - `fading` is expected to be `true` when this method is called.
|
* - `fading` is expected to be `true` when this method is called.
|
||||||
* - The method is invoked as part of the `updateVolumeAndTrack` process.
|
* - The method is invoked as part of the `updateVolumeAndTrack` process.
|
||||||
@@ -343,10 +346,10 @@ private void handleFadeProcess() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages the fade-in process for the currently playing track.
|
* 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
|
* 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.
|
* over the duration of `CROSSFADE_DURATION`. It ensures a smooth transition into the new track.
|
||||||
*
|
* <p>
|
||||||
* Behavior:
|
* Behavior:
|
||||||
* 1. If no track is set as `playing`, the method exits early, as there is nothing to fade in.
|
* 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
|
* 2. Linearly interpolates the volume of the `playing` track from 0.0 to 1.0 based on the elapsed
|
||||||
@@ -354,12 +357,12 @@ private void handleFadeProcess() {
|
|||||||
* 3. Once the fade-in is complete (when `infadeTime` exceeds `CROSSFADE_DURATION`), the method:
|
* 3. Once the fade-in is complete (when `infadeTime` exceeds `CROSSFADE_DURATION`), the method:
|
||||||
* - Marks the fade process (`fading`) as complete.
|
* - Marks the fade process (`fading`) as complete.
|
||||||
* - Ensures the `playing` track is updated to its full volume.
|
* - Ensures the `playing` track is updated to its full volume.
|
||||||
*
|
* <p>
|
||||||
* Key Details:
|
* Key Details:
|
||||||
* - Uses the `lerp` function to calculate the volume level for the `playing` track during the fade-in.
|
* - 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.
|
* - 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.
|
* - The `infadeTime` parameter should be relative to the start of the fade-in process.
|
||||||
*
|
* <p>
|
||||||
* Preconditions:
|
* Preconditions:
|
||||||
* - The `playing` track must be initialized and actively fading in for this method to have an effect.
|
* - 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.
|
* - The method is invoked as part of the `updateVolumeAndTrack` process.
|
||||||
|
|||||||
@@ -4,4 +4,5 @@
|
|||||||
* A record that encapsulates a sound asset along with its playback settings:
|
* A record that encapsulates a sound asset along with its playback settings:
|
||||||
* the relative volume (subVolume) and a delay before it starts playing.
|
* 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) {
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ public ActionControl(Runnable runnable){
|
|||||||
this.runnable = runnable;
|
this.runnable = runnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void action() {
|
protected void action() {
|
||||||
if (null != runnable) {
|
if (null != runnable) {
|
||||||
runnable.run();
|
runnable.run();
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ protected void controlUpdate(float tpf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
rootNode.attachChild(smoke);
|
||||||
@@ -127,7 +128,8 @@ protected void controlUpdate(float tpf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
package pp.mdga.client.animation;
|
||||||
|
|
||||||
import com.jme3.renderer.queue.RenderQueue;
|
|
||||||
import com.jme3.scene.Geometry;
|
|
||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
import com.jme3.math.ColorRGBA;
|
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;
|
import static pp.mdga.client.Util.linInt;
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,6 @@
|
|||||||
import pp.mdga.client.Asset;
|
import pp.mdga.client.Asset;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.acoustic.MdgaSound;
|
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.
|
* The {@code JetAnimation} class handles the animation of a jet model in a 3D environment.
|
||||||
@@ -88,7 +84,8 @@ private void spawnJet() {
|
|||||||
rootNode.attachChild(jetModel);
|
rootNode.attachChild(jetModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**actionAfter
|
/**
|
||||||
|
* actionAfter
|
||||||
* Animates the jet along a Bezier curve path, triggers the explosion effect at the appropriate time,
|
* Animates the jet along a Bezier curve path, triggers the explosion effect at the appropriate time,
|
||||||
* and performs cleanup operations after the animation completes.
|
* and performs cleanup operations after the animation completes.
|
||||||
*/
|
*/
|
||||||
@@ -127,7 +124,8 @@ protected void controlUpdate(float tpf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void controlRender(RenderManager rm, ViewPort vp) {}
|
protected void controlRender(RenderManager rm, ViewPort vp) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
import com.jme3.material.RenderState;
|
import com.jme3.material.RenderState;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import pp.mdga.client.InitControl;
|
|
||||||
import pp.mdga.client.MdgaApp;
|
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 {
|
public class MatrixAnimation extends ActionControl {
|
||||||
private MdgaApp app;
|
private MdgaApp app;
|
||||||
@@ -53,7 +53,6 @@ protected void controlUpdate(float tpf) {
|
|||||||
timeElapsed += tpf;
|
timeElapsed += tpf;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case RADAR_ON -> {
|
case RADAR_ON -> {
|
||||||
if (timeElapsed >= 2f) {
|
if (timeElapsed >= 2f) {
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
import pp.mdga.client.acoustic.MdgaSound;
|
import pp.mdga.client.acoustic.MdgaSound;
|
||||||
import pp.mdga.client.board.BoardHandler;
|
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
|
* 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.
|
* towards a target point in a 3D environment. It also triggers an explosion at the target upon impact.
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
import com.jme3.math.Vector3f;
|
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
|
* A control that smoothly moves a spatial from an initial position to an end position
|
||||||
@@ -94,6 +95,4 @@ private void end(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,17 +3,12 @@
|
|||||||
import com.jme3.effect.ParticleEmitter;
|
import com.jme3.effect.ParticleEmitter;
|
||||||
import com.jme3.effect.ParticleMesh;
|
import com.jme3.effect.ParticleMesh;
|
||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
import com.jme3.material.RenderState;
|
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.FastMath;
|
import com.jme3.math.FastMath;
|
||||||
import com.jme3.math.Quaternion;
|
import com.jme3.math.Quaternion;
|
||||||
import com.jme3.math.Vector3f;
|
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.Spatial;
|
||||||
import com.jme3.scene.shape.Box;
|
|
||||||
import pp.mdga.client.Asset;
|
import pp.mdga.client.Asset;
|
||||||
import pp.mdga.client.InitControl;
|
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.acoustic.MdgaSound;
|
import pp.mdga.client.acoustic.MdgaSound;
|
||||||
import pp.mdga.client.board.TankTopControl;
|
import pp.mdga.client.board.TankTopControl;
|
||||||
@@ -22,7 +17,6 @@
|
|||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
|
||||||
import static com.jme3.material.Materials.LIGHTING;
|
import static com.jme3.material.Materials.LIGHTING;
|
||||||
import static com.jme3.material.Materials.UNSHADED;
|
|
||||||
|
|
||||||
public class ShellAnimation extends ActionControl {
|
public class ShellAnimation extends ActionControl {
|
||||||
private static final float FLYING_DURATION = 1.25f;
|
private static final float FLYING_DURATION = 1.25f;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.FastMath;
|
import com.jme3.math.FastMath;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import pp.mdga.client.InitControl;
|
|
||||||
|
|
||||||
public class ShellControl extends ActionControl {
|
public class ShellControl extends ActionControl {
|
||||||
private final Vector3f shootPos;
|
private final Vector3f shootPos;
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ protected void controlUpdate(float tpf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
rootNode.attachChild(smoke);
|
||||||
@@ -121,7 +122,8 @@ protected void controlUpdate(float tpf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,5 @@
|
|||||||
/**
|
/**
|
||||||
* Record for holding Asset information
|
* 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.Material;
|
||||||
import com.jme3.material.RenderState;
|
import com.jme3.material.RenderState;
|
||||||
import com.jme3.material.RenderState.BlendMode;
|
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.post.FilterPostProcessor;
|
import com.jme3.post.FilterPostProcessor;
|
||||||
@@ -16,6 +15,7 @@
|
|||||||
import pp.mdga.client.animation.*;
|
import pp.mdga.client.animation.*;
|
||||||
import pp.mdga.client.gui.DiceControl;
|
import pp.mdga.client.gui.DiceControl;
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
|
import pp.mdga.game.Piece;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -388,10 +388,12 @@ public void addPlayer(Color color, List<UUID> uuid) {
|
|||||||
|
|
||||||
List<AssetOnMap> playerAssets = colorAssetsMap.get(color);
|
List<AssetOnMap> playerAssets = colorAssetsMap.get(color);
|
||||||
if (playerAssets == null) throw new RuntimeException("Assets for Player color are not defined");
|
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);
|
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++) {
|
||||||
@@ -583,7 +585,8 @@ private void swapPieces(PieceControl p1, PieceControl p2, Vector3f loc1, float r
|
|||||||
* @throws RuntimeException if the sizes of the input lists do not match
|
* @throws RuntimeException if the sizes of the input lists do not match
|
||||||
*/
|
*/
|
||||||
public void outlineMove(List<UUID> pieces, List<Integer> moveIndexe, List<Boolean> homeMoves) {
|
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();
|
selectableEnemyPieces.clear();
|
||||||
selectableOwnPieces.clear();
|
selectableOwnPieces.clear();
|
||||||
@@ -598,14 +601,11 @@ public void outlineMove(List<UUID> pieces, List<Integer> moveIndexe, List<Boolea
|
|||||||
if (homeMoves.get(i)) {
|
if (homeMoves.get(i)) {
|
||||||
Color color = pieceColor.get(uuid);
|
Color color = pieceColor.get(uuid);
|
||||||
nodeControl = homeNodesMap.get(color).get(moveIndexe.get(i));
|
nodeControl = homeNodesMap.get(color).get(moveIndexe.get(i));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
nodeControl = infield.get(moveIndexe.get(i));
|
nodeControl = infield.get(moveIndexe.get(i));
|
||||||
}
|
}
|
||||||
nodeControl.highlight();
|
pieceControl.selectableOwn();
|
||||||
pieceControl.highlight(false);
|
nodeControl.selectableOwn();
|
||||||
pieceControl.setHoverable(true);
|
|
||||||
pieceControl.setSelectable(true);
|
|
||||||
outlineNodes.add(nodeControl);
|
outlineNodes.add(nodeControl);
|
||||||
selectableOwnPieces.add(pieceControl);
|
selectableOwnPieces.add(pieceControl);
|
||||||
selectedPieceNodeMap.put(pieceControl, nodeControl);
|
selectedPieceNodeMap.put(pieceControl, nodeControl);
|
||||||
@@ -627,16 +627,12 @@ public void outlineSwap(List<UUID> ownPieces, List<UUID> enemyPieces){
|
|||||||
|
|
||||||
for (UUID uuid : ownPieces) {
|
for (UUID uuid : ownPieces) {
|
||||||
PieceControl p = pieces.get(uuid);
|
PieceControl p = pieces.get(uuid);
|
||||||
p.highlight(false);
|
p.selectableOwn();
|
||||||
p.setHoverable(true);
|
|
||||||
p.setSelectable(true);
|
|
||||||
selectableOwnPieces.add(p);
|
selectableOwnPieces.add(p);
|
||||||
}
|
}
|
||||||
for (UUID uuid : enemyPieces) {
|
for (UUID uuid : enemyPieces) {
|
||||||
PieceControl p = pieces.get(uuid);
|
PieceControl p = pieces.get(uuid);
|
||||||
p.highlight(true);
|
p.selectableOff();
|
||||||
p.setHoverable(true);
|
|
||||||
p.setSelectable(true);
|
|
||||||
selectableEnemyPieces.add(p);
|
selectableEnemyPieces.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -654,9 +650,7 @@ public void outlineShield(List<UUID> pieces){
|
|||||||
|
|
||||||
for (UUID uuid : pieces) {
|
for (UUID uuid : pieces) {
|
||||||
PieceControl p = this.pieces.get(uuid);
|
PieceControl p = this.pieces.get(uuid);
|
||||||
p.highlight(false);
|
p.selectableOwn();
|
||||||
p.setHoverable(true);
|
|
||||||
p.setSelectable(true);
|
|
||||||
selectableOwnPieces.add(p);
|
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
|
* @param pieceSelected the PieceControl instance representing the piece selected by the user
|
||||||
*/
|
*/
|
||||||
public void pieceSelect(PieceControl pieceSelected) {
|
public void pieceSelect(OutlineOEControl selected) {
|
||||||
boolean isSelected = pieceSelected.isSelected();
|
PieceControl piece = getPieceByOE(selected);
|
||||||
if(selectableOwnPieces.contains(pieceSelected)){
|
NodeControl node = selectedPieceNodeMap.get(piece);
|
||||||
|
|
||||||
|
boolean isSelected = piece.isSelected();
|
||||||
|
if (selectableOwnPieces.contains(piece)) {
|
||||||
for (PieceControl p : selectableOwnPieces) {
|
for (PieceControl p : selectableOwnPieces) {
|
||||||
p.unSelect();
|
p.selectOff();
|
||||||
if(selectedPieceNodeMap.get(p) != null) selectedPieceNodeMap.get(p).unSelect();
|
NodeControl n = selectedPieceNodeMap.get(p);
|
||||||
|
if (n != null) n.selectOff();
|
||||||
}
|
}
|
||||||
if (!isSelected) {
|
if (!isSelected) {
|
||||||
pieceSelected.select();
|
piece.selectOn();
|
||||||
if(selectedPieceNodeMap.get(pieceSelected) != null) selectedPieceNodeMap.get(pieceSelected).select();
|
if (node != null) node.selectOn();
|
||||||
selectedOwnPiece = pieceSelected;
|
selectedOwnPiece = piece;
|
||||||
}
|
} else {
|
||||||
else {
|
piece.selectOff();
|
||||||
pieceSelected.unSelect();
|
if (node != null) node.selectOff();;
|
||||||
if(selectedPieceNodeMap.get(pieceSelected) != null) selectedPieceNodeMap.get(pieceSelected).unSelect();
|
|
||||||
selectedOwnPiece = null;
|
selectedOwnPiece = null;
|
||||||
}
|
}
|
||||||
}
|
} else if (selectableEnemyPieces.contains(piece)) {
|
||||||
else if(selectableEnemyPieces.contains(pieceSelected)) {
|
|
||||||
for (PieceControl p : selectableEnemyPieces) {
|
for (PieceControl p : selectableEnemyPieces) {
|
||||||
p.unSelect();
|
p.selectOff();
|
||||||
}
|
}
|
||||||
if (!isSelected) {
|
if (!isSelected) {
|
||||||
pieceSelected.select();
|
piece.selectOn();
|
||||||
selectedEnemyPiece = pieceSelected;
|
selectedEnemyPiece = piece;
|
||||||
}
|
} else {
|
||||||
else {
|
piece.selectOff();
|
||||||
pieceSelected.unSelect();
|
|
||||||
selectedEnemyPiece = null;
|
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));
|
app.getModelSynchronize().select(getKeyByValue(pieces, selectedOwnPiece), getKeyByValue(pieces, selectedEnemyPiece));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pieceHoverOn(PieceControl hoverPiece){
|
public void hoverOn(OutlineOEControl hover) {
|
||||||
hoverPiece.hover();
|
PieceControl piece = getPieceByOE(hover);
|
||||||
if(selectedPieceNodeMap.get(hoverPiece) != null) selectedPieceNodeMap.get(hoverPiece).hover();
|
NodeControl node = selectedPieceNodeMap.get(piece);
|
||||||
|
|
||||||
|
piece.hoverOn();
|
||||||
|
if(node != null) node.hoverOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pieceHoverOff(PieceControl hoverPiece){
|
public void hoverOff(OutlineOEControl hover) {
|
||||||
hoverPiece.hoverOff();
|
PieceControl piece = getPieceByOE(hover);
|
||||||
if(selectedPieceNodeMap.get(hoverPiece) != null) selectedPieceNodeMap.get(hoverPiece).hoverOff();
|
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.
|
* Clears all highlighted, selectable, and selected pieces and nodes.
|
||||||
*/
|
*/
|
||||||
public void clearSelectable() {
|
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();
|
|
||||||
}
|
|
||||||
for (PieceControl p : selectableOwnPieces) {
|
for (PieceControl p : selectableOwnPieces) {
|
||||||
p.unSelect();
|
p.selectableOff();
|
||||||
p.unHighlight();
|
NodeControl n = selectedPieceNodeMap.get(p);
|
||||||
p.setSelectable(false);
|
if(n != null) n.selectableOff();
|
||||||
p.setHoverable(false);
|
|
||||||
}
|
}
|
||||||
for(NodeControl n : outlineNodes){
|
for (PieceControl p : selectableEnemyPieces) {
|
||||||
n.deOutline();
|
p.selectableOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
outlineNodes.clear();
|
outlineNodes.clear();
|
||||||
selectableEnemyPieces.clear();
|
selectableEnemyPieces.clear();
|
||||||
selectableOwnPieces.clear();
|
selectableOwnPieces.clear();
|
||||||
@@ -881,7 +885,8 @@ public void swapPieceAnim(UUID piece1, UUID piece2){
|
|||||||
piece1Control.getSpatial().addControl(new MoveControl(
|
piece1Control.getSpatial().addControl(new MoveControl(
|
||||||
piece1Control.getLocation().clone(),
|
piece1Control.getLocation().clone(),
|
||||||
piece2Control.getLocation().clone(),
|
piece2Control.getLocation().clone(),
|
||||||
()->{}
|
() -> {
|
||||||
|
}
|
||||||
));
|
));
|
||||||
piece2Control.getSpatial().addControl(new MoveControl(
|
piece2Control.getSpatial().addControl(new MoveControl(
|
||||||
piece2Control.getLocation().clone(),
|
piece2Control.getLocation().clone(),
|
||||||
|
|||||||
@@ -65,11 +65,9 @@ public static List<AssetOnMap> loadMap(String mapName) {
|
|||||||
Asset asset = getLoadedAsset(assetName);
|
Asset asset = getLoadedAsset(assetName);
|
||||||
assetsOnMap.add(new AssetOnMap(asset, x, y, rot));
|
assetsOnMap.add(new AssetOnMap(asset, x, y, rot));
|
||||||
}
|
}
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
} catch (IllegalArgumentException e) {
|
||||||
catch (IllegalArgumentException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,25 +3,13 @@
|
|||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.post.FilterPostProcessor;
|
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;
|
import pp.mdga.client.MdgaApp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A control that adds highlighting functionality to a node in the game.
|
* 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.
|
* This class extends {@link OutlineControl} to add an outline effect when the node is highlighted.
|
||||||
*/
|
*/
|
||||||
public class NodeControl extends OutlineControl {
|
public class NodeControl extends OutlineOEControl {
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a {@link NodeControl} with the specified application and post processor.
|
* 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.
|
* @param fpp The {@link FilterPostProcessor} to apply post-processing effects.
|
||||||
*/
|
*/
|
||||||
public NodeControl(MdgaApp app, FilterPostProcessor fpp) {
|
public NodeControl(MdgaApp app, FilterPostProcessor fpp) {
|
||||||
super(app, fpp);
|
super(app, fpp, app.getCamera());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,35 +31,4 @@ public NodeControl(MdgaApp app, FilterPostProcessor fpp) {
|
|||||||
public Vector3f getLocation() {
|
public Vector3f getLocation() {
|
||||||
return this.getSpatial().getLocalTranslation();
|
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.math.ColorRGBA;
|
||||||
import com.jme3.post.FilterPostProcessor;
|
import com.jme3.post.FilterPostProcessor;
|
||||||
import com.jme3.renderer.Camera;
|
import com.jme3.renderer.Camera;
|
||||||
import pp.mdga.client.MdgaApp;
|
|
||||||
import pp.mdga.client.InitControl;
|
import pp.mdga.client.InitControl;
|
||||||
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.outline.SelectObjectOutliner;
|
import pp.mdga.client.outline.SelectObjectOutliner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,10 +13,21 @@
|
|||||||
* object, allowing it to be highlighted or deselected.
|
* object, allowing it to be highlighted or deselected.
|
||||||
*/
|
*/
|
||||||
public class OutlineControl extends InitControl {
|
public class OutlineControl extends InitControl {
|
||||||
/** The {@link SelectObjectOutliner} responsible for managing the outline effect. */
|
/**
|
||||||
private final SelectObjectOutliner outlineOwn;
|
* The {@link SelectObjectOutliner} responsible for managing the outline effect.
|
||||||
private static final int THICKNESS_DEFAULT = 6;
|
*/
|
||||||
private MdgaApp app;
|
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.
|
* 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 app The main application managing the outline control.
|
||||||
* @param fpp The {@code FilterPostProcessor} used for post-processing effects.
|
* @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;
|
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.
|
* Applies an outline to the spatial object with the given color.
|
||||||
*
|
*
|
||||||
* @param color The {@link ColorRGBA} representing the color of the outline.
|
* @param color The {@link ColorRGBA} representing the color of the outline.
|
||||||
*/
|
*/
|
||||||
public void outline(ColorRGBA color){
|
// public void outline(ColorRGBA color) {
|
||||||
outlineOwn.select(spatial, color);
|
// selectObjectOutliner.select(spatial, color);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies an outline to the spatial object with the given color and width.
|
* Applies an outline to the spatial object with the given color and width.
|
||||||
@@ -70,15 +67,15 @@ public void outline(ColorRGBA color){
|
|||||||
* @param width The width of the outline.
|
* @param width The width of the outline.
|
||||||
*/
|
*/
|
||||||
public void outline(ColorRGBA color, int width) {
|
public void outline(ColorRGBA color, int width) {
|
||||||
deOutline();
|
outlineOff();
|
||||||
outlineOwn.select(spatial, color, width);
|
selectObjectOutliner.select(spatial, color, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the outline effect from the spatial object.
|
* Removes the outline effect from the spatial object.
|
||||||
*/
|
*/
|
||||||
public void deOutline(){
|
public void outlineOff() {
|
||||||
outlineOwn.deselect(spatial);
|
selectObjectOutliner.deselect(spatial);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,4 +86,97 @@ public void deOutline(){
|
|||||||
public MdgaApp getApp() {
|
public MdgaApp getApp() {
|
||||||
return app;
|
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,
|
* to provide outline functionality and includes additional features like shield effects,
|
||||||
* hover states, and selection states.
|
* hover states, and selection states.
|
||||||
*/
|
*/
|
||||||
public class PieceControl extends OutlineControl {
|
public class PieceControl extends OutlineOEControl {
|
||||||
private final float initRotation;
|
private final float initRotation;
|
||||||
private final AssetManager assetManager;
|
private final AssetManager assetManager;
|
||||||
private Spatial shieldRing;
|
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 ColorRGBA SHIELD_SUPPRESSED_COLOR = new ColorRGBA(1f, 0.5f, 0, SHIELD_TRANSPARENCY);
|
||||||
private static final float SHIELD_Z = 0f;
|
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 final Node parentNode;
|
||||||
private boolean enemy;
|
private boolean enemy;
|
||||||
private boolean hoverable;
|
private boolean hoverable;
|
||||||
@@ -59,18 +49,13 @@ public class PieceControl extends OutlineControl {
|
|||||||
* @param fpp The {@link FilterPostProcessor} to apply post-processing effects.
|
* @param fpp The {@link FilterPostProcessor} to apply post-processing effects.
|
||||||
*/
|
*/
|
||||||
public PieceControl(float initRotation, AssetManager assetManager, MdgaApp app, FilterPostProcessor fpp) {
|
public PieceControl(float initRotation, AssetManager assetManager, MdgaApp app, FilterPostProcessor fpp) {
|
||||||
super(app, fpp);
|
super(app, fpp, app.getCamera());
|
||||||
this.parentNode = new Node();
|
this.parentNode = new Node();
|
||||||
this.initRotation = initRotation;
|
this.initRotation = initRotation;
|
||||||
this.assetManager = assetManager;
|
this.assetManager = assetManager;
|
||||||
this.shieldRing = null;
|
this.shieldRing = null;
|
||||||
this.shieldMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
this.shieldMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||||
this.shieldMat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
|
this.shieldMat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
|
||||||
enemy = false;
|
|
||||||
hoverable = false;
|
|
||||||
highlight = false;
|
|
||||||
selectable = false;
|
|
||||||
select = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,97 +175,4 @@ public void setMaterial(Material mat){
|
|||||||
public Material getMaterial() {
|
public Material getMaterial() {
|
||||||
return ((Geometry) getSpatial()).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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import com.jme3.ui.Picture;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a specific implementation of a clickable button positioned on the left side.
|
* Represents a specific implementation of a clickable button positioned on the left side.
|
||||||
|
|||||||
@@ -77,7 +77,8 @@ public enum Pos {
|
|||||||
* @param name the label or name displayed on the button
|
* @param name the label or name displayed on the button
|
||||||
*/
|
*/
|
||||||
public CeremonyButton(MdgaApp app, Node node, Node node3d, Color tsk, Pos pos, String name) {
|
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;
|
this.node3d = node3d;
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ public class LabelButton extends ClickButton {
|
|||||||
* @param isButton whether this component acts as a button or a simple label
|
* @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) {
|
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;
|
this.isButton = isButton;
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
package pp.mdga.client.button;
|
package pp.mdga.client.button;
|
||||||
|
|
||||||
import com.jme3.light.AmbientLight;
|
|
||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Quaternion;
|
import com.jme3.math.Quaternion;
|
||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.renderer.queue.RenderQueue;
|
import com.jme3.renderer.queue.RenderQueue;
|
||||||
import com.jme3.scene.Geometry;
|
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
import com.jme3.scene.shape.Quad;
|
|
||||||
import com.jme3.texture.Texture;
|
|
||||||
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
import com.simsilica.lemur.component.QuadBackgroundComponent;
|
||||||
import pp.mdga.client.Asset;
|
import pp.mdga.client.Asset;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import com.simsilica.lemur.HAlignment;
|
|
||||||
import com.simsilica.lemur.VAlignment;
|
|
||||||
import com.simsilica.lemur.component.IconComponent;
|
import com.simsilica.lemur.component.IconComponent;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package pp.mdga.client.dialog;
|
package pp.mdga.client.dialog;
|
||||||
|
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import com.simsilica.lemur.Container;
|
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,11 +3,9 @@
|
|||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.button.AbstractButton;
|
|
||||||
import pp.mdga.client.button.ButtonRight;
|
import pp.mdga.client.button.ButtonRight;
|
||||||
import pp.mdga.client.button.LabelButton;
|
import pp.mdga.client.button.LabelButton;
|
||||||
import pp.mdga.client.button.MenuButton;
|
import pp.mdga.client.button.MenuButton;
|
||||||
import pp.mdga.client.view.MdgaView;
|
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.NetworkSupport;
|
import pp.mdga.client.NetworkSupport;
|
||||||
import pp.mdga.client.acoustic.AcousticHandler;
|
|
||||||
import pp.mdga.client.button.ButtonLeft;
|
import pp.mdga.client.button.ButtonLeft;
|
||||||
import pp.mdga.client.button.ButtonRight;
|
import pp.mdga.client.button.ButtonRight;
|
||||||
import pp.mdga.client.button.InputButton;
|
import pp.mdga.client.button.InputButton;
|
||||||
|
|||||||
@@ -3,9 +3,7 @@
|
|||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.button.InputButton;
|
|
||||||
import pp.mdga.client.button.MenuButton;
|
import pp.mdga.client.button.MenuButton;
|
||||||
import pp.mdga.client.view.MainView;
|
|
||||||
import pp.mdga.client.view.MdgaView;
|
import pp.mdga.client.view.MdgaView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,18 +1,13 @@
|
|||||||
package pp.mdga.client.dialog;
|
package pp.mdga.client.dialog;
|
||||||
|
|
||||||
import com.jme3.math.ColorRGBA;
|
|
||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
import com.jme3.math.Vector3f;
|
|
||||||
import com.jme3.scene.Node;
|
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.MdgaApp;
|
||||||
import pp.mdga.client.button.InputButton;
|
import pp.mdga.client.button.InputButton;
|
||||||
import pp.mdga.client.button.MenuButton;
|
import pp.mdga.client.button.MenuButton;
|
||||||
import pp.mdga.client.view.MainView;
|
import pp.mdga.client.view.MainView;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.random.RandomGenerator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@code StartDialog} class represents the initial dialog in the application,
|
* 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.
|
* Called when the dialog is hidden. Hides the name input field and all buttons.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onHide ()
|
protected void onHide() {
|
||||||
{
|
|
||||||
nameInput.hide();
|
nameInput.hide();
|
||||||
|
|
||||||
hostButton.hide();
|
hostButton.hide();
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.button.AbstractButton;
|
|
||||||
import pp.mdga.client.button.ButtonLeft;
|
import pp.mdga.client.button.ButtonLeft;
|
||||||
import pp.mdga.client.button.ButtonRight;
|
import pp.mdga.client.button.ButtonRight;
|
||||||
import pp.mdga.client.button.MenuButton;
|
import pp.mdga.client.button.MenuButton;
|
||||||
|
|||||||
@@ -7,23 +7,14 @@
|
|||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.post.FilterPostProcessor;
|
import com.jme3.post.FilterPostProcessor;
|
||||||
import com.jme3.renderer.Camera;
|
import com.jme3.renderer.Camera;
|
||||||
import com.jme3.renderer.RenderManager;
|
|
||||||
import com.jme3.renderer.ViewPort;
|
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import com.jme3.scene.Node;
|
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 com.jme3.scene.shape.Sphere;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.board.OutlineControl;
|
import pp.mdga.client.board.OutlineControl;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class CardControl extends OutlineControl {
|
public class CardControl extends OutlineControl {
|
||||||
|
|
||||||
private static final ColorRGBA OUTLINE_COLOR = ColorRGBA.Yellow;
|
|
||||||
|
|
||||||
private static final ColorRGBA HIGHLIGHT_COLOR = ColorRGBA.Yellow;
|
private static final ColorRGBA HIGHLIGHT_COLOR = ColorRGBA.Yellow;
|
||||||
private static final int HIGHLIGHT_WIDTH = 9;
|
private static final int HIGHLIGHT_WIDTH = 9;
|
||||||
|
|
||||||
@@ -34,16 +25,16 @@ public class CardControl extends OutlineControl {
|
|||||||
private static final int SELECT_WIDTH = 13;
|
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 Node root;
|
||||||
private BitmapText num;
|
private BitmapText num;
|
||||||
|
|
||||||
public CardControl(MdgaApp app, FilterPostProcessor fpp, Camera cam, Node root) {
|
public CardControl(MdgaApp app, FilterPostProcessor fpp, Camera cam, Node root) {
|
||||||
super(app, fpp, cam, OUTLINE_THICKNESS);
|
super(app, fpp, cam,
|
||||||
|
HIGHLIGHT_COLOR, HIGHLIGHT_WIDTH,
|
||||||
|
HOVER_COLOR, HOVER_WIDTH,
|
||||||
|
SELECT_COLOR, SELECT_WIDTH
|
||||||
|
);
|
||||||
|
|
||||||
this.root = root;
|
this.root = root;
|
||||||
|
|
||||||
|
|
||||||
@@ -84,67 +75,6 @@ public Node getRoot() {
|
|||||||
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);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
import com.jme3.texture.Image;
|
import com.jme3.texture.Image;
|
||||||
import com.jme3.texture.Texture2D;
|
import com.jme3.texture.Texture2D;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CardLayer extends AbstractAppState {
|
public class CardLayer extends AbstractAppState {
|
||||||
|
|
||||||
|
|||||||
@@ -104,10 +104,7 @@ public void removeCard(BonusCard card){
|
|||||||
|
|
||||||
public void clearSelectableCards() {
|
public void clearSelectableCards() {
|
||||||
for (CardControl control : selectableCards) {
|
for (CardControl control : selectableCards) {
|
||||||
control.setSelectable(false);
|
control.selectableOff();
|
||||||
control.setHoverable(false);
|
|
||||||
control.unHighlight();
|
|
||||||
control.unSelect();
|
|
||||||
}
|
}
|
||||||
selectableCards.clear();
|
selectableCards.clear();
|
||||||
cardSelect = null;
|
cardSelect = null;
|
||||||
@@ -134,21 +131,19 @@ public void setSelectableCards(List<BonusCard> select) {
|
|||||||
selectableCards.add(bonusCardControlMap.get(card));
|
selectableCards.add(bonusCardControlMap.get(card));
|
||||||
}
|
}
|
||||||
for (CardControl control : selectableCards) {
|
for (CardControl control : selectableCards) {
|
||||||
control.setSelectable(true);
|
control.selectableOn();
|
||||||
control.setHoverable(true);
|
|
||||||
control.setHighlight();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectCard(CardControl cardControl) {
|
public void selectCard(CardControl cardControl) {
|
||||||
if (cardControl.isSelected()) {
|
if (cardControl.isSelected()) {
|
||||||
cardControl.unSelect();
|
cardControl.selectOff();
|
||||||
cardSelect = null;
|
cardSelect = null;
|
||||||
} else {
|
} else {
|
||||||
for (CardControl control : selectableCards) {
|
for (CardControl control : selectableCards) {
|
||||||
control.unSelect();
|
control.selectOff();
|
||||||
}
|
}
|
||||||
cardControl.select();
|
cardControl.selectOn();
|
||||||
cardSelect = getKeyByValue(bonusCardControlMap, cardControl);
|
cardSelect = getKeyByValue(bonusCardControlMap, cardControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,6 @@
|
|||||||
import pp.mdga.client.Asset;
|
import pp.mdga.client.Asset;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import static com.jme3.material.Materials.LIGHTING;
|
import static com.jme3.material.Materials.LIGHTING;
|
||||||
import static com.jme3.material.Materials.UNSHADED;
|
import static com.jme3.material.Materials.UNSHADED;
|
||||||
|
|
||||||
@@ -55,8 +53,7 @@ protected void controlUpdate(float tpf) {
|
|||||||
if (angularVelocity.lengthSquared() <= 3f || MdgaApp.DEBUG_MULTIPLIER == 0) {
|
if (angularVelocity.lengthSquared() <= 3f || MdgaApp.DEBUG_MULTIPLIER == 0) {
|
||||||
slerp = true;
|
slerp = true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
timeElapsed += clampedTpf * rollDuration;
|
timeElapsed += clampedTpf * rollDuration;
|
||||||
|
|
||||||
|
|
||||||
@@ -155,8 +152,7 @@ public void create(Vector3f pos, float scale, boolean shadow){
|
|||||||
mat = new Material(assetManager, LIGHTING);
|
mat = new Material(assetManager, LIGHTING);
|
||||||
mat.setTexture("DiffuseMap", assetManager.loadTexture(Asset.dice.getDiffPath()));
|
mat.setTexture("DiffuseMap", assetManager.loadTexture(Asset.dice.getDiffPath()));
|
||||||
spatial.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
|
spatial.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
mat = new Material(assetManager, UNSHADED);
|
mat = new Material(assetManager, UNSHADED);
|
||||||
mat.setTexture("ColorMap", assetManager.loadTexture(Asset.dice.getDiffPath()));
|
mat.setTexture("ColorMap", assetManager.loadTexture(Asset.dice.getDiffPath()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
import com.jme3.texture.Image;
|
import com.jme3.texture.Image;
|
||||||
import com.jme3.texture.Texture2D;
|
import com.jme3.texture.Texture2D;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.game.Color;
|
|
||||||
import pp.mdga.game.BonusCard;
|
import pp.mdga.game.BonusCard;
|
||||||
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -167,6 +167,4 @@ public void rollRankingResult(Color color, int eye){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,16 @@
|
|||||||
import com.jme3.font.BitmapFont;
|
import com.jme3.font.BitmapFont;
|
||||||
import com.jme3.font.BitmapText;
|
import com.jme3.font.BitmapText;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Vector3f;
|
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
import com.jme3.system.AppSettings;
|
import com.jme3.system.AppSettings;
|
||||||
import com.jme3.ui.Picture;
|
import com.jme3.ui.Picture;
|
||||||
import pp.mdga.game.BonusCard;
|
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
public class PlayerNameHandler {
|
public class PlayerNameHandler {
|
||||||
private final BitmapFont playerFont;
|
private final BitmapFont playerFont;
|
||||||
@@ -122,7 +119,6 @@ private Spatial createColor(Color color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private BitmapText createName(String name, boolean first, boolean own) {
|
private BitmapText createName(String name, boolean first, boolean own) {
|
||||||
BitmapText hudText = new BitmapText(playerFont);
|
BitmapText hudText = new BitmapText(playerFont);
|
||||||
//renderedSize = 45
|
//renderedSize = 45
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import com.jme3.asset.AssetManager;
|
import com.jme3.asset.AssetManager;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.post.FilterPostProcessor;
|
import com.jme3.post.FilterPostProcessor;
|
||||||
import com.jme3.post.filters.FXAAFilter;
|
|
||||||
import com.jme3.renderer.Camera;
|
import com.jme3.renderer.Camera;
|
||||||
import com.jme3.renderer.RenderManager;
|
import com.jme3.renderer.RenderManager;
|
||||||
import com.jme3.renderer.ViewPort;
|
import com.jme3.renderer.ViewPort;
|
||||||
@@ -16,20 +15,18 @@ public class SelectObjectOutliner {
|
|||||||
private final RenderManager renderManager;
|
private final RenderManager renderManager;
|
||||||
private final AssetManager assetManager;
|
private final AssetManager assetManager;
|
||||||
private final Camera cam;
|
private final Camera cam;
|
||||||
private final int width;
|
|
||||||
private boolean selected;
|
private boolean selected;
|
||||||
private ViewPort outlineViewport = null;
|
private ViewPort outlineViewport = null;
|
||||||
// private OutlineFilter outlineFilter = null;
|
// private OutlineFilter outlineFilter = null;
|
||||||
private OutlineProFilter outlineFilter = null;
|
private OutlineProFilter outlineFilter = null;
|
||||||
private final MdgaApp app;
|
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.selected = false;
|
||||||
this.fpp = fpp;
|
this.fpp = fpp;
|
||||||
this.renderManager = renderManager;
|
this.renderManager = renderManager;
|
||||||
this.assetManager = assetManager;
|
this.assetManager = assetManager;
|
||||||
this.cam = cam;
|
this.cam = cam;
|
||||||
this.width = width;
|
|
||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,12 +37,12 @@ public void deselect(Spatial model) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void select(Spatial model, ColorRGBA color) {
|
// public void select(Spatial model, ColorRGBA color) {
|
||||||
if(!selected){
|
// if (!selected) {
|
||||||
selected = true;
|
// selected = true;
|
||||||
showOutlineFilterEffect(model, width, color);
|
// showOutlineFilterEffect(model, width, color);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void select(Spatial model, ColorRGBA color, int width) {
|
public void select(Spatial model, ColorRGBA color, int width) {
|
||||||
if (!selected) {
|
if (!selected) {
|
||||||
|
|||||||
@@ -286,8 +286,7 @@ public void send(int id, ServerMessage message) {
|
|||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
System.out.println("server sends to: " + id + " " + message.getClass().getName());
|
System.out.println("server sends to: " + id + " " + message.getClass().getName());
|
||||||
connection.send(message);
|
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,16 +1,14 @@
|
|||||||
package pp.mdga.client.server;
|
package pp.mdga.client.server;
|
||||||
|
|
||||||
|
import com.jme3.network.serializing.Serializer;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.jme3.network.serializing.Serializer;
|
public class UUIDSerializer extends Serializer {
|
||||||
|
|
||||||
public class UUIDSerializer extends Serializer
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException
|
public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException {
|
||||||
{
|
|
||||||
byte[] uuid = new byte[36];
|
byte[] uuid = new byte[36];
|
||||||
data.get(uuid);
|
data.get(uuid);
|
||||||
|
|
||||||
@@ -22,8 +20,7 @@ public <T> T readObject(ByteBuffer data, Class<T> c) throws IOException
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeObject(ByteBuffer buffer, Object object) throws IOException
|
public void writeObject(ByteBuffer buffer, Object object) throws IOException {
|
||||||
{
|
|
||||||
UUID uuid = (UUID) object;
|
UUID uuid = (UUID) object;
|
||||||
|
|
||||||
if (uuid != null) {
|
if (uuid != null) {
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ public void forward() {
|
|||||||
enterSub(SubState.STATISTICS);
|
enterSub(SubState.STATISTICS);
|
||||||
break;
|
break;
|
||||||
case STATISTICS:
|
case STATISTICS:
|
||||||
app.getModelSynchronize().enter(MdgaState.MAIN);
|
app.getModelSynchronize().next();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ public void addCeremonyParticipant(Color color, int pos, String name) {
|
|||||||
|
|
||||||
ceremonyButtons.add(button);
|
ceremonyButtons.add(button);
|
||||||
|
|
||||||
if(state.equals(SubState.AWARD_CEREMONY)) {
|
if (state != null && state.equals(SubState.AWARD_CEREMONY)) {
|
||||||
button.hide();
|
button.hide();
|
||||||
button.show();
|
button.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
import com.jme3.post.FilterPostProcessor;
|
import com.jme3.post.FilterPostProcessor;
|
||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.acoustic.MdgaSound;
|
import pp.mdga.client.acoustic.MdgaSound;
|
||||||
import pp.mdga.client.board.BoardHandler;
|
import pp.mdga.client.board.BoardHandler;
|
||||||
import pp.mdga.client.board.CameraHandler;
|
import pp.mdga.client.board.CameraHandler;
|
||||||
import pp.mdga.client.MdgaApp;
|
|
||||||
import pp.mdga.client.button.ButtonLeft;
|
import pp.mdga.client.button.ButtonLeft;
|
||||||
import pp.mdga.client.button.ButtonRight;
|
import pp.mdga.client.button.ButtonRight;
|
||||||
import pp.mdga.client.dialog.InterruptDialog;
|
import pp.mdga.client.dialog.InterruptDialog;
|
||||||
|
|||||||
@@ -5,21 +5,15 @@
|
|||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.renderer.Camera;
|
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import com.jme3.scene.Spatial;
|
|
||||||
import com.jme3.scene.shape.Quad;
|
import com.jme3.scene.shape.Quad;
|
||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
import com.jme3.util.SkyFactory;
|
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.acoustic.MdgaSound;
|
import pp.mdga.client.acoustic.MdgaSound;
|
||||||
import pp.mdga.client.button.ButtonLeft;
|
import pp.mdga.client.button.ButtonLeft;
|
||||||
import pp.mdga.client.button.ButtonRight;
|
import pp.mdga.client.button.ButtonRight;
|
||||||
import pp.mdga.client.button.LobbyButton;
|
import pp.mdga.client.button.LobbyButton;
|
||||||
import pp.mdga.client.button.SettingsButton;
|
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
import pp.mdga.message.client.StartGameMessage;
|
|
||||||
import pp.mdga.notification.GameNotification;
|
|
||||||
|
|
||||||
public class LobbyView extends MdgaView {
|
public class LobbyView extends MdgaView {
|
||||||
private Geometry background;
|
private Geometry background;
|
||||||
@@ -150,8 +144,7 @@ protected void onEnterOverlay(Overlay overlay) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onLeaveOverlay(Overlay overlay)
|
protected void onLeaveOverlay(Overlay overlay) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,9 @@
|
|||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.acoustic.MdgaSound;
|
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.AudioSettingsDialog;
|
||||||
import pp.mdga.client.dialog.SettingsDialog;
|
import pp.mdga.client.dialog.SettingsDialog;
|
||||||
import pp.mdga.client.dialog.VideoSettingsDialog;
|
import pp.mdga.client.dialog.VideoSettingsDialog;
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ public CeremonyStates getState(){
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* this method is used to parse the selectNext from the clientGameLogic
|
* this method is used to parse the selectNext from the clientGameLogic
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectNext() {
|
public void selectNext() {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
import pp.mdga.message.server.*;
|
import pp.mdga.message.server.*;
|
||||||
import pp.mdga.notification.CeremonyNotification;
|
|
||||||
|
|
||||||
import java.lang.System.Logger.Level;
|
import java.lang.System.Logger.Level;
|
||||||
|
|
||||||
@@ -161,7 +160,9 @@ public void received(ServerStartGameMessage msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@Override
|
||||||
public void received(StartPieceMessage msg) {
|
public void received(StartPieceMessage msg) {
|
||||||
|
|||||||
@@ -4,16 +4,9 @@
|
|||||||
import pp.mdga.game.BonusCard;
|
import pp.mdga.game.BonusCard;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
import pp.mdga.game.card.HiddenCard;
|
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.client.LeaveGameMessage;
|
||||||
import pp.mdga.message.server.*;
|
import pp.mdga.message.server.*;
|
||||||
import pp.mdga.notification.AcquireCardNotification;
|
import pp.mdga.notification.*;
|
||||||
import pp.mdga.notification.CeremonyNotification;
|
|
||||||
import pp.mdga.notification.DrawCardNotification;
|
|
||||||
import pp.mdga.notification.InterruptNotification;
|
|
||||||
import pp.mdga.notification.StartDialogNotification;
|
|
||||||
|
|
||||||
public class GameState extends ClientState {
|
public class GameState extends ClientState {
|
||||||
|
|
||||||
@@ -307,8 +300,7 @@ public void received(DrawCardMessage msg){
|
|||||||
logic.getGame().getActivePlayer().addHandCard(msg.getCard());
|
logic.getGame().getActivePlayer().addHandCard(msg.getCard());
|
||||||
if (msg.getCard() instanceof HiddenCard) {
|
if (msg.getCard() instanceof HiddenCard) {
|
||||||
logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), BonusCard.HIDDEN));
|
logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), BonusCard.HIDDEN));
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
logic.addNotification(new AcquireCardNotification(msg.getCard().getCard()));
|
logic.addNotification(new AcquireCardNotification(msg.getCard().getCard()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import pp.mdga.message.client.ForceContinueGameMessage;
|
import pp.mdga.message.client.ForceContinueGameMessage;
|
||||||
import pp.mdga.message.server.ResumeGameMessage;
|
import pp.mdga.message.server.ResumeGameMessage;
|
||||||
import pp.mdga.notification.ResumeNotification;
|
|
||||||
|
|
||||||
public class InterruptState extends ClientState {
|
public class InterruptState extends ClientState {
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,13 @@
|
|||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
|
|
||||||
public abstract class CeremonyStates extends 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) {
|
protected CeremonyStates(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,21 +8,36 @@ public class PodiumState extends CeremonyStates {
|
|||||||
|
|
||||||
private final CeremonyState parent;
|
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) {
|
public PodiumState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (CeremonyState) parent;
|
this.parent = (CeremonyState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client enters the PodiumState.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client exits the PodiumState.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client selects the next button.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectNext() {
|
public void selectNext() {
|
||||||
parent.setState(parent.getStatisticsState());
|
parent.setState(parent.getStatisticsState());
|
||||||
|
|||||||
@@ -2,24 +2,42 @@
|
|||||||
|
|
||||||
import pp.mdga.client.ClientGameLogic;
|
import pp.mdga.client.ClientGameLogic;
|
||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
|
import pp.mdga.notification.StartDialogNotification;
|
||||||
|
|
||||||
public class StatisticsState extends CeremonyStates {
|
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) {
|
public StatisticsState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client enters the StatisticsState.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client exits the StatisticsState.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client selects the next button.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectNext() {
|
public void selectNext() {
|
||||||
|
logic.addNotification(new StartDialogNotification());
|
||||||
logic.setState(logic.getDialogs());
|
logic.setState(logic.getDialogs());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,12 @@
|
|||||||
|
|
||||||
public abstract class DialogStates extends ClientState {
|
public abstract class DialogStates extends ClientState {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {
|
public DialogStates(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,20 +19,35 @@ public class LobbyState extends DialogStates {
|
|||||||
|
|
||||||
private final DialogsState parent;
|
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) {
|
public LobbyState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (DialogsState) parent;
|
this.parent = (DialogsState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client enters the LobbyState.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
logic.send(new JoinedLobbyMessage(logic.getOwnPlayerName()));
|
logic.send(new JoinedLobbyMessage(logic.getOwnPlayerName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client exits the LobbyState.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client selects the leave button.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectLeave() {
|
public void selectLeave() {
|
||||||
parent.setState(parent.getStartDialog());
|
parent.setState(parent.getStartDialog());
|
||||||
@@ -40,26 +55,45 @@ public void selectLeave() {
|
|||||||
logic.send(new LeaveGameMessage());
|
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
|
@Override
|
||||||
public void selectTSK(Color color) {
|
public void selectTSK(Color color) {
|
||||||
logic.send(new SelectTSKMessage(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
|
@Override
|
||||||
public void deselectTSK(Color color) {
|
public void deselectTSK(Color color) {
|
||||||
logic.send(new DeselectTSKMessage(color));
|
logic.send(new DeselectTSKMessage(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client selects the ready button.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectReady() {
|
public void selectReady() {
|
||||||
logic.send(new LobbyReadyMessage());
|
logic.send(new LobbyReadyMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client selects the unready button.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectUnready() {
|
public void selectUnready() {
|
||||||
logic.send(new LobbyNotReadyMessage());
|
logic.send(new LobbyNotReadyMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client selects the start button.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectStart() {
|
public void selectStart() {
|
||||||
if (logic.isHost() && logic.getGame().areAllReady()) {
|
if (logic.isHost() && logic.getGame().areAllReady()) {
|
||||||
@@ -70,6 +104,11 @@ public void selectStart() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client receives a message.
|
||||||
|
*
|
||||||
|
* @param msg the message which was received
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(ServerStartGameMessage msg) {
|
public void received(ServerStartGameMessage msg) {
|
||||||
for (Player player : msg.getPlayers()) {
|
for (Player player : msg.getPlayers()) {
|
||||||
@@ -91,6 +130,11 @@ public void received(ServerStartGameMessage msg) {
|
|||||||
logic.setState(logic.getGameState());
|
logic.setState(logic.getGameState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be called whenever the client receives a message.
|
||||||
|
*
|
||||||
|
* @param msg the message which was received
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(LobbyPlayerJoinedMessage msg) {
|
public void received(LobbyPlayerJoinedMessage msg) {
|
||||||
if (msg.getPlayer().getName().equals(logic.getOwnPlayerName())) {
|
if (msg.getPlayer().getName().equals(logic.getOwnPlayerName())) {
|
||||||
@@ -105,6 +149,11 @@ public void received(LobbyPlayerJoinedMessage msg) {
|
|||||||
logic.getGame().getPlayers().put(msg.getId(), msg.getPlayer());
|
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
|
@Override
|
||||||
public void received(UpdateTSKMessage msg) {
|
public void received(UpdateTSKMessage msg) {
|
||||||
if (msg.isTaken()) {
|
if (msg.isTaken()) {
|
||||||
@@ -116,15 +165,24 @@ public void received(UpdateTSKMessage msg) {
|
|||||||
logic.getGame().getPlayers().get(msg.getId()).setColor(msg.getColor());
|
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
|
@Override
|
||||||
public void received(LobbyPlayerLeaveMessage msg) {
|
public void received(LobbyPlayerLeaveMessage msg) {
|
||||||
logic.addNotification(new TskUnselectNotification(logic.getGame().getPlayers().get(msg.getId()).getColor()));
|
logic.addNotification(new TskUnselectNotification(logic.getGame().getPlayers().get(msg.getId()).getColor()));
|
||||||
logic.getGame().getPlayers().remove(msg.getId());
|
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
|
@Override
|
||||||
public void received(UpdateReadyMessage msg) {
|
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.addNotification(new LobbyReadyNotification(logic.getGame().getPlayers().get(msg.getPlayerId()).getColor(), msg.isReady()));
|
||||||
logic.getGame().getPlayers().get(msg.getPlayerId()).setReady(msg.isReady());
|
logic.getGame().getPlayers().get(msg.getPlayerId()).setReady(msg.isReady());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class NetworkDialogState extends DialogStates {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the NetworkDialogState
|
* Constructor for the NetworkDialogState
|
||||||
|
*
|
||||||
* @param parent the parent state
|
* @param parent the parent state
|
||||||
* @param logic the logic
|
* @param logic the logic
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ public class StartDialogState extends DialogStates {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the StartDialogState
|
* Constructor for the StartDialogState
|
||||||
|
*
|
||||||
* @param parent the parent state
|
* @param parent the parent state
|
||||||
* @param logic the logic
|
* @param logic the logic
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,23 +11,53 @@ public class AnimationState extends GameStates {
|
|||||||
|
|
||||||
private final GameState parent;
|
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) {
|
public AnimationState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (GameState) parent;
|
this.parent = (GameState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
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
|
@Override
|
||||||
public void selectAnimationEnd() {
|
public void selectAnimationEnd() {
|
||||||
logic.send(new AnimationEndMessage());
|
logic.send(new AnimationEndMessage());
|
||||||
|
if (spectator){
|
||||||
|
parent.setState(parent.getSpectator());
|
||||||
|
} else {
|
||||||
parent.setState(parent.getWaiting());
|
parent.setState(parent.getWaiting());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
import pp.mdga.client.gamestate.determinestartplayerstate.Intro;
|
import pp.mdga.client.gamestate.determinestartplayerstate.Intro;
|
||||||
import pp.mdga.client.gamestate.determinestartplayerstate.RollRankingDiceState;
|
import pp.mdga.client.gamestate.determinestartplayerstate.RollRankingDiceState;
|
||||||
import pp.mdga.client.gamestate.determinestartplayerstate.WaitRankingState;
|
import pp.mdga.client.gamestate.determinestartplayerstate.WaitRankingState;
|
||||||
import pp.mdga.message.client.AnimationEndMessage;
|
|
||||||
import pp.mdga.message.server.*;
|
import pp.mdga.message.server.*;
|
||||||
|
|
||||||
public class DetermineStartPlayerState extends GameStates {
|
public class DetermineStartPlayerState extends GameStates {
|
||||||
@@ -19,41 +18,83 @@ public class DetermineStartPlayerState extends GameStates {
|
|||||||
private final WaitRankingState waitRankingState = new WaitRankingState(this, logic);
|
private final WaitRankingState waitRankingState = new WaitRankingState(this, logic);
|
||||||
private final Intro intro = new Intro(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) {
|
public DetermineStartPlayerState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (GameState) parent;
|
this.parent = (GameState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the roll ranking dice.
|
||||||
|
*
|
||||||
|
* @return the roll ranking dice
|
||||||
|
*/
|
||||||
public RollRankingDiceState getRollRankingDice() {
|
public RollRankingDiceState getRollRankingDice() {
|
||||||
return rollRankingDiceState;
|
return rollRankingDiceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the wait ranking.
|
||||||
|
*
|
||||||
|
* @return the wait ranking
|
||||||
|
*/
|
||||||
public WaitRankingState getWaitRanking() {
|
public WaitRankingState getWaitRanking() {
|
||||||
return waitRankingState;
|
return waitRankingState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the state.
|
||||||
|
*
|
||||||
|
* @return the state
|
||||||
|
*/
|
||||||
public DetermineStartPlayerStates getState() {
|
public DetermineStartPlayerStates getState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the intro.
|
||||||
|
*
|
||||||
|
* @return the intro
|
||||||
|
*/
|
||||||
public Intro getIntro() {
|
public Intro getIntro() {
|
||||||
return intro;
|
return intro;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the parent state.
|
||||||
|
*
|
||||||
|
* @return the parent state
|
||||||
|
*/
|
||||||
public GameState getParent() {
|
public GameState getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
this.setState(this.rollRankingDiceState);
|
this.setState(this.rollRankingDiceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
state = null;
|
state = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state.
|
||||||
|
*
|
||||||
|
* @param state the state
|
||||||
|
*/
|
||||||
public void setState(DetermineStartPlayerStates state) {
|
public void setState(DetermineStartPlayerStates state) {
|
||||||
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
||||||
if (this.state != null) {
|
if (this.state != null) {
|
||||||
@@ -63,36 +104,67 @@ public void setState(DetermineStartPlayerStates state) {
|
|||||||
this.state.enter();
|
this.state.enter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the dice.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectDice() {
|
public void selectDice() {
|
||||||
state.selectDice();
|
state.selectDice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the animation end.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectAnimationEnd() {
|
public void selectAnimationEnd() {
|
||||||
state.selectAnimationEnd();
|
state.selectAnimationEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the die message.
|
||||||
|
*
|
||||||
|
* @param msg the die message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DieMessage msg) {
|
public void received(DieMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the ceremony message.
|
||||||
|
*
|
||||||
|
* @param msg the ceremony message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DiceNowMessage msg) {
|
public void received(DiceNowMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the ranking roll again message.
|
||||||
|
*
|
||||||
|
* @param msg the ranking roll again message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(RankingRollAgainMessage msg) {
|
public void received(RankingRollAgainMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the ranking response message.
|
||||||
|
*
|
||||||
|
* @param msg the ranking response message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(RankingResponseMessage msg) {
|
public void received(RankingResponseMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the ranking result message.
|
||||||
|
*
|
||||||
|
* @param msg the ranking result message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(ActivePlayerMessage msg) {
|
public void received(ActivePlayerMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
|
|||||||
@@ -2,29 +2,33 @@
|
|||||||
|
|
||||||
import pp.mdga.client.ClientGameLogic;
|
import pp.mdga.client.ClientGameLogic;
|
||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
import pp.mdga.game.Board;
|
import pp.mdga.game.*;
|
||||||
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.message.server.PlayCardMessage;
|
import pp.mdga.message.server.PlayCardMessage;
|
||||||
import pp.mdga.notification.ShieldActiveNotification;
|
import pp.mdga.notification.ShieldActiveNotification;
|
||||||
import pp.mdga.notification.ShieldSuppressedNotification;
|
import pp.mdga.notification.ShieldSuppressedNotification;
|
||||||
import pp.mdga.notification.SwapPieceNotification;
|
import pp.mdga.notification.SwapPieceNotification;
|
||||||
import pp.mdga.notification.ThrowPieceNotification;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public abstract class GameStates extends ClientState {
|
public abstract class GameStates extends ClientState {
|
||||||
|
|
||||||
private final System.Logger LOGGER = System.getLogger(this.getClass().getName());
|
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) {
|
public GameStates(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the power card.
|
||||||
|
*
|
||||||
|
* @param msg the play card message
|
||||||
|
*/
|
||||||
protected void handlePowerCard(PlayCardMessage msg) {
|
protected void handlePowerCard(PlayCardMessage msg) {
|
||||||
if (msg.getCard().getCard().equals(BonusCard.TURBO)) {
|
if (msg.getCard().getCard().equals(BonusCard.TURBO)) {
|
||||||
logic.getGame().setTurboFlag(true);
|
logic.getGame().setTurboFlag(true);
|
||||||
@@ -37,6 +41,11 @@ protected void handlePowerCard(PlayCardMessage msg) {
|
|||||||
logic.getGame().getDiscardPile().add(msg.getCard());
|
logic.getGame().getDiscardPile().add(msg.getCard());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the shield.
|
||||||
|
*
|
||||||
|
* @param uuid the uuid
|
||||||
|
*/
|
||||||
private void handleShield(UUID uuid) {
|
private void handleShield(UUID uuid) {
|
||||||
Board board = logic.getGame().getBoard();
|
Board board = logic.getGame().getBoard();
|
||||||
Piece piece = logic.getGame().getPieceThroughUUID(uuid);
|
Piece piece = logic.getGame().getPieceThroughUUID(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) {
|
private void swapPieces(Piece messageOwn, Piece messageEnemy) {
|
||||||
//swap Pieces in Model
|
//swap Pieces in Model
|
||||||
Board board = logic.getGame().getBoard();
|
Board board = logic.getGame().getBoard();
|
||||||
@@ -68,6 +83,12 @@ private void swapPieces(Piece messageOwn, Piece messageEnemy) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the shield after the swap.
|
||||||
|
*
|
||||||
|
* @param node the node
|
||||||
|
* @param piece the piece
|
||||||
|
*/
|
||||||
private void checkShieldAfterSwap(Node node, Piece piece) {
|
private void checkShieldAfterSwap(Node node, Piece piece) {
|
||||||
if (node.isStart()) {
|
if (node.isStart()) {
|
||||||
if (piece.isShielded()) {
|
if (piece.isShielded()) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
import pp.mdga.client.GameState;
|
import pp.mdga.client.GameState;
|
||||||
import pp.mdga.game.BonusCard;
|
import pp.mdga.game.BonusCard;
|
||||||
|
import pp.mdga.game.Node;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
import pp.mdga.game.PieceState;
|
import pp.mdga.game.PieceState;
|
||||||
import pp.mdga.game.ShieldState;
|
import pp.mdga.game.ShieldState;
|
||||||
@@ -15,48 +16,69 @@ public class SpectatorState extends GameStates {
|
|||||||
|
|
||||||
private final GameState parent;
|
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) {
|
public SpectatorState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (GameState) parent;
|
this.parent = (GameState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
parent.getAnimation().setSpectator(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the reception of a CeremonyMessage.
|
||||||
|
*
|
||||||
|
* @param msg the ceremony message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(CeremonyMessage msg) {
|
public void received(CeremonyMessage msg) {
|
||||||
logic.setState(logic.getCeremony());
|
logic.setState(logic.getCeremony());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the reception of a DieMessage.
|
||||||
|
*
|
||||||
|
* @param msg the die message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DrawCardMessage msg){
|
public void received(DieMessage msg) {
|
||||||
logic.getGame().getActivePlayer().addHandCard(msg.getCard());
|
logic.getGame().setDiceEyes(msg.getDiceEye());
|
||||||
if (msg.getCard() instanceof HiddenCard) {
|
if (logic.getGame().getTurboFlag()) {
|
||||||
logic.addNotification(new DrawCardNotification(logic.getGame().getActiveColor(), BonusCard.HIDDEN));
|
logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), msg.getDiceEye(), logic.getGame().getDiceModifier()));
|
||||||
|
} else {
|
||||||
|
logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), msg.getDiceEye()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//stats
|
//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) {
|
if (msg.getDiceEye() == 6) {
|
||||||
logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPlayerStatistic().increaseDiced6();
|
logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPlayerStatistic().increaseDiced6();
|
||||||
logic.getGame().getGameStatistics().increaseDiced6();
|
logic.getGame().getGameStatistics().increaseDiced6();
|
||||||
}
|
}
|
||||||
parent.setState(parent.getAnimation());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the reception of a PlayCardMessage.
|
||||||
|
*
|
||||||
|
* @param msg the play card message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(PlayCardMessage msg) {
|
public void received(PlayCardMessage msg) {
|
||||||
logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor(), msg.getCard().getCard()));
|
logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor(), msg.getCard().getCard()));
|
||||||
@@ -66,23 +88,74 @@ public void received(PlayCardMessage msg) {
|
|||||||
parent.setState(parent.getAnimation());
|
parent.setState(parent.getAnimation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the reception of an ActivePlayerMessage.
|
||||||
|
*
|
||||||
|
* @param msg the active player message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(ActivePlayerMessage msg) {
|
public void received(ActivePlayerMessage msg) {
|
||||||
logic.addNotification(new ActivePlayerNotification(msg.getColor()));
|
logic.addNotification(new ActivePlayerNotification(msg.getColor()));
|
||||||
logic.getGame().setActiveColor(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
|
@Override
|
||||||
public void received(MoveMessage msg) {
|
public void received(MoveMessage msg) {
|
||||||
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
|
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
|
||||||
if (msg.isHomeMove()) {
|
if (msg.isHomeMove()) {
|
||||||
|
if (piece.getState().equals(PieceState.HOME)) {
|
||||||
logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
|
logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
|
||||||
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant();
|
int pieceHomeIndex = logic.getGame().getActivePlayer().getHomeIndexOfPiece(piece);
|
||||||
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), 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 {
|
} else {
|
||||||
int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
||||||
|
|
||||||
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
|
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
|
||||||
if (occ != null) {
|
if (occ != null) {
|
||||||
//TODO: MoveThrowNotification
|
//TODO: MoveThrowNotification
|
||||||
@@ -94,7 +167,7 @@ public void received(MoveMessage msg) {
|
|||||||
//set occ to waiting
|
//set occ to waiting
|
||||||
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
|
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.addNotification(new MovePieceNotification(piece.getUuid(), msg.getTargetIndex(), true));
|
||||||
logic.getGame().getPlayerByColor(piece.getColor()).removeWaitingPiece(piece);
|
logic.getGame().getPlayerByColor(piece.getColor()).removeWaitingPiece(piece);
|
||||||
piece.setState(PieceState.ACTIVE);
|
piece.setState(PieceState.ACTIVE);
|
||||||
@@ -105,7 +178,17 @@ public void received(MoveMessage msg) {
|
|||||||
}
|
}
|
||||||
//set new node
|
//set new node
|
||||||
logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].setOccupant(piece);
|
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);
|
logic.getGame().setTurboFlag(false);
|
||||||
parent.setState(parent.getAnimation());
|
parent.setState(parent.getAnimation());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,14 +12,22 @@
|
|||||||
import pp.mdga.game.BonusCard;
|
import pp.mdga.game.BonusCard;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
import pp.mdga.game.ShieldState;
|
import pp.mdga.game.ShieldState;
|
||||||
import pp.mdga.game.card.HiddenCard;
|
import pp.mdga.message.server.CeremonyMessage;
|
||||||
import pp.mdga.game.card.ShieldCard;
|
import pp.mdga.message.server.ChoosePieceStateMessage;
|
||||||
import pp.mdga.game.card.SwapCard;
|
import pp.mdga.message.server.DiceAgainMessage;
|
||||||
import pp.mdga.game.card.TurboCard;
|
import pp.mdga.message.server.DiceNowMessage;
|
||||||
import pp.mdga.message.server.*;
|
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.RemoveShieldNotification;
|
||||||
import pp.mdga.notification.AcquireCardNotification;
|
|
||||||
import pp.mdga.notification.DrawCardNotification;
|
|
||||||
|
|
||||||
public class TurnState extends GameStates {
|
public class TurnState extends GameStates {
|
||||||
|
|
||||||
@@ -33,11 +41,20 @@ public class TurnState extends GameStates {
|
|||||||
private final RollDiceState rollDiceState = new RollDiceState(this, logic);
|
private final RollDiceState rollDiceState = new RollDiceState(this, logic);
|
||||||
private boolean canChangeTurbo = false;
|
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) {
|
public TurnState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (GameState) parent;
|
this.parent = (GameState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
logic = logic;
|
logic = logic;
|
||||||
@@ -51,11 +68,19 @@ public void enter() {
|
|||||||
this.setState(this.powerCardState);
|
this.setState(this.powerCardState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
state = null;
|
state = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state.
|
||||||
|
*
|
||||||
|
* @param state the state
|
||||||
|
*/
|
||||||
public void setState(TurnStates state) {
|
public void setState(TurnStates state) {
|
||||||
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
||||||
if (this.state != null) {
|
if (this.state != null) {
|
||||||
@@ -65,133 +90,269 @@ public void setState(TurnStates state){
|
|||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the dice.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectDice() {
|
public void selectDice() {
|
||||||
state.selectDice();
|
state.selectDice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the piece.
|
||||||
|
*
|
||||||
|
* @param piece the piece
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectPiece(Piece piece) {
|
public void selectPiece(Piece piece) {
|
||||||
state.selectPiece(piece);
|
state.selectPiece(piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the card.
|
||||||
|
*
|
||||||
|
* @param card the card
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectCard(BonusCard card) {
|
public void selectCard(BonusCard card) {
|
||||||
state.selectCard(card);
|
state.selectCard(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the animation end.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectAnimationEnd() {
|
public void selectAnimationEnd() {
|
||||||
state.selectAnimationEnd();
|
state.selectAnimationEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the select piece message.
|
||||||
|
*
|
||||||
|
* @param msg the select piece message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(SelectPieceMessage msg) {
|
public void received(SelectPieceMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the wait piece message.
|
||||||
|
*
|
||||||
|
* @param msg the wait piece message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(WaitPieceMessage msg) {
|
public void received(WaitPieceMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the start piece message.
|
||||||
|
*
|
||||||
|
* @param msg the start piece message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(StartPieceMessage msg) {
|
public void received(StartPieceMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the NoTurnMessage message.
|
||||||
|
*
|
||||||
|
* @param msg the NoTurnMessage message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(NoTurnMessage msg) {
|
public void received(NoTurnMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the MoveMessage message.
|
||||||
|
*
|
||||||
|
* @param msg the MoveMessage message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(MoveMessage msg) {
|
public void received(MoveMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the CeremonyMessage message.
|
||||||
|
*
|
||||||
|
* @param msg the CeremonyMessage message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(CeremonyMessage msg) {
|
public void received(CeremonyMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the EndOfTurnMessage message.
|
||||||
|
*
|
||||||
|
* @param msg the EndOfTurnMessage message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(EndOfTurnMessage msg) {
|
public void received(EndOfTurnMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the SpectatorMessage message.
|
||||||
|
*
|
||||||
|
* @param msg the SpectatorMessage message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(SpectatorMessage msg) {
|
public void received(SpectatorMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the DiceAgainMessage message.
|
||||||
|
*
|
||||||
|
* @param msg the DiceAgainMessage message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DiceAgainMessage msg) {
|
public void received(DiceAgainMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the PossibleCardsMessage message.
|
||||||
|
*
|
||||||
|
* @param msg the PossibleCardsMessage message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(PossibleCardsMessage msg) {
|
public void received(PossibleCardsMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the PlayCardMessage message.
|
||||||
|
*
|
||||||
|
* @param msg the PlayCardMessage message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(PlayCardMessage msg) {
|
public void received(PlayCardMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the DiceNow message.
|
||||||
|
*
|
||||||
|
* @param msg the DiceNow message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DiceNowMessage msg) {
|
public void received(DiceNowMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the DieMessage message.
|
||||||
|
*
|
||||||
|
* @param msg the DieMessage message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DieMessage msg) {
|
public void received(DieMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the PossiblePieceMessage message.
|
||||||
|
*
|
||||||
|
* @param msg the PossiblePieceMessage message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(PossiblePieceMessage msg) {
|
public void received(PossiblePieceMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the ChoosePieceStateMessage message.
|
||||||
|
*
|
||||||
|
* @param msg the ChoosePieceStateMessage message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(ChoosePieceStateMessage msg) {
|
public void received(ChoosePieceStateMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ChoosePieceState.
|
||||||
|
*
|
||||||
|
* @return the ChoosePieceState
|
||||||
|
*/
|
||||||
public ChoosePieceState getChoosePiece() {
|
public ChoosePieceState getChoosePiece() {
|
||||||
return choosePieceState;
|
return choosePieceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the MovePieceState.
|
||||||
|
*
|
||||||
|
* @return the MovePieceState
|
||||||
|
*/
|
||||||
public MovePieceState getMovePiece() {
|
public MovePieceState getMovePiece() {
|
||||||
return movePieceState;
|
return movePieceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the PlayPowerCardState.
|
||||||
|
*
|
||||||
|
* @return the PlayPowerCardState
|
||||||
|
*/
|
||||||
public PlayPowerCardState getPlayPowerCard() {
|
public PlayPowerCardState getPlayPowerCard() {
|
||||||
return playPowerCardState;
|
return playPowerCardState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the PowerCardState.
|
||||||
|
*
|
||||||
|
* @return the PowerCardState
|
||||||
|
*/
|
||||||
public PowerCardState getPowerCard() {
|
public PowerCardState getPowerCard() {
|
||||||
return powerCardState;
|
return powerCardState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the RollDiceState.
|
||||||
|
*
|
||||||
|
* @return the RollDiceState
|
||||||
|
*/
|
||||||
public RollDiceState getRollDice() {
|
public RollDiceState getRollDice() {
|
||||||
return rollDiceState;
|
return rollDiceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the parent GameState.
|
||||||
|
*
|
||||||
|
* @return the parent GameState
|
||||||
|
*/
|
||||||
public GameState getParent() {
|
public GameState getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current TurnStates.
|
||||||
|
*
|
||||||
|
* @return the current TurnStates
|
||||||
|
*/
|
||||||
public TurnStates getState() {
|
public TurnStates getState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if turbo can be changed.
|
||||||
|
*
|
||||||
|
* @return true if turbo can be changed, false otherwise
|
||||||
|
*/
|
||||||
public boolean isCanChangeTurbo() {
|
public boolean isCanChangeTurbo() {
|
||||||
return canChangeTurbo;
|
return canChangeTurbo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the turbo change flag.
|
||||||
|
*
|
||||||
|
* @param canChangeTurbo the new value for the turbo change flag
|
||||||
|
*/
|
||||||
public void setCanChangeTurbo(boolean canChangeTurbo) {
|
public void setCanChangeTurbo(boolean canChangeTurbo) {
|
||||||
this.canChangeTurbo = canChangeTurbo;
|
this.canChangeTurbo = canChangeTurbo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,38 +10,62 @@
|
|||||||
import pp.mdga.message.server.*;
|
import pp.mdga.message.server.*;
|
||||||
import pp.mdga.notification.*;
|
import pp.mdga.notification.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the waiting state in the game.
|
||||||
|
*/
|
||||||
public class WaitingState extends GameStates {
|
public class WaitingState extends GameStates {
|
||||||
|
|
||||||
private final GameState parent;
|
private final GameState parent;
|
||||||
private final System.Logger LOGGER = System.getLogger(this.getClass().getName());
|
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) {
|
public WaitingState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (GameState) parent;
|
this.parent = (GameState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when entering the waiting state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when exiting the waiting state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the reception of a CeremonyMessage.
|
||||||
|
*
|
||||||
|
* @param msg the ceremony message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(CeremonyMessage msg) {
|
public void received(CeremonyMessage msg) {
|
||||||
logic.setState(logic.getCeremony());
|
logic.setState(logic.getCeremony());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the reception of a DieMessage.
|
||||||
|
*
|
||||||
|
* @param msg the die message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DieMessage msg) {
|
public void received(DieMessage msg) {
|
||||||
logic.getGame().setDiceEyes(msg.getDiceEye());
|
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()));
|
logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), msg.getDiceEye(), logic.getGame().getDiceModifier()));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
logic.addNotification(new RollDiceNotification(logic.getGame().getActiveColor(), msg.getDiceEye()));
|
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
|
@Override
|
||||||
public void received(PlayCardMessage msg) {
|
public void received(PlayCardMessage msg) {
|
||||||
logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor(), msg.getCard().getCard()));
|
logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor(), msg.getCard().getCard()));
|
||||||
@@ -61,6 +90,11 @@ public void received(PlayCardMessage msg) {
|
|||||||
parent.setState(parent.getAnimation());
|
parent.setState(parent.getAnimation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the reception of an ActivePlayerMessage.
|
||||||
|
*
|
||||||
|
* @param msg the active player message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(ActivePlayerMessage msg) {
|
public void received(ActivePlayerMessage msg) {
|
||||||
logic.addNotification(new ActivePlayerNotification(msg.getColor()));
|
logic.addNotification(new ActivePlayerNotification(msg.getColor()));
|
||||||
@@ -77,6 +111,11 @@ public void received(ActivePlayerMessage msg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the reception of a MoveMessage.
|
||||||
|
*
|
||||||
|
* @param msg the move message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(MoveMessage msg) {
|
public void received(MoveMessage msg) {
|
||||||
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
|
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
|
||||||
@@ -93,16 +132,14 @@ public void received(MoveMessage msg) {
|
|||||||
Node targetNode = logic.getGame().getActivePlayer().getHomeNodes()[msg.getTargetIndex()];
|
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);
|
piece.setState(PieceState.HOMEFINISHED);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
piece.setState(PieceState.HOME);
|
piece.setState(PieceState.HOME);
|
||||||
}
|
}
|
||||||
|
|
||||||
oldNode.clearOccupant();
|
oldNode.clearOccupant();
|
||||||
targetNode.setOccupant(piece);
|
targetNode.setOccupant(piece);
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
|
logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
|
||||||
int oldNoteIdx = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
int oldNoteIdx = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
||||||
Node oldNode = logic.getGame().getBoard().getInfield()[oldNoteIdx];
|
Node oldNode = logic.getGame().getBoard().getInfield()[oldNoteIdx];
|
||||||
@@ -112,16 +149,14 @@ public void received(MoveMessage msg) {
|
|||||||
|
|
||||||
if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
|
if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
|
||||||
piece.setState(PieceState.HOMEFINISHED);
|
piece.setState(PieceState.HOMEFINISHED);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
piece.setState(PieceState.HOME);
|
piece.setState(PieceState.HOME);
|
||||||
}
|
}
|
||||||
|
|
||||||
oldNode.clearOccupant();
|
oldNode.clearOccupant();
|
||||||
targetNode.setOccupant(piece);
|
targetNode.setOccupant(piece);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
||||||
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
|
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
|
||||||
if (occ != null) {
|
if (occ != null) {
|
||||||
|
|||||||
@@ -5,6 +5,13 @@
|
|||||||
import pp.mdga.client.gamestate.GameStates;
|
import pp.mdga.client.gamestate.GameStates;
|
||||||
|
|
||||||
public abstract class DetermineStartPlayerStates extends 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) {
|
public DetermineStartPlayerStates(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,23 +15,38 @@ public class RollRankingDiceState extends DetermineStartPlayerStates {
|
|||||||
private final DetermineStartPlayerState parent;
|
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) {
|
public RollRankingDiceState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (DetermineStartPlayerState) parent;
|
this.parent = (DetermineStartPlayerState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
LOGGER.log(System.Logger.Level.INFO, "Entering RollRankingDiceState");
|
LOGGER.log(System.Logger.Level.INFO, "Entering RollRankingDiceState");
|
||||||
logic.addNotification(new DiceNowNotification());
|
logic.addNotification(new DiceNowNotification());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
LOGGER.log(System.Logger.Level.INFO, "Exiting RollRankingDiceState");
|
LOGGER.log(System.Logger.Level.INFO, "Exiting RollRankingDiceState");
|
||||||
isRolled = false;
|
isRolled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the dice.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectDice() {
|
public void selectDice() {
|
||||||
if (!isRolled) {
|
if (!isRolled) {
|
||||||
@@ -40,6 +55,11 @@ public void selectDice(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the server sends a DieMessage.
|
||||||
|
*
|
||||||
|
* @param msg the DieMessage
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DieMessage msg) {
|
public void received(DieMessage msg) {
|
||||||
parent.setState(parent.getWaitRanking());
|
parent.setState(parent.getWaitRanking());
|
||||||
|
|||||||
@@ -5,8 +5,9 @@
|
|||||||
import pp.mdga.client.gamestate.DetermineStartPlayerState;
|
import pp.mdga.client.gamestate.DetermineStartPlayerState;
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
import pp.mdga.message.client.AnimationEndMessage;
|
import pp.mdga.message.client.AnimationEndMessage;
|
||||||
import pp.mdga.message.server.*;
|
import pp.mdga.message.server.ActivePlayerMessage;
|
||||||
import pp.mdga.notification.ActivePlayerNotification;
|
import pp.mdga.message.server.DiceNowMessage;
|
||||||
|
import pp.mdga.message.server.RankingResponseMessage;
|
||||||
import pp.mdga.notification.RankingResponceNotification;
|
import pp.mdga.notification.RankingResponceNotification;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -19,11 +20,20 @@ public class WaitRankingState extends DetermineStartPlayerStates {
|
|||||||
private final DetermineStartPlayerState parent;
|
private final DetermineStartPlayerState parent;
|
||||||
private boolean canChange = false;
|
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) {
|
public WaitRankingState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (DetermineStartPlayerState) parent;
|
this.parent = (DetermineStartPlayerState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the state to the intro state.
|
||||||
|
*/
|
||||||
private void changeToIntro() {
|
private void changeToIntro() {
|
||||||
if (!canChange) {
|
if (!canChange) {
|
||||||
canChange = true;
|
canChange = true;
|
||||||
@@ -32,22 +42,38 @@ private void changeToIntro(){
|
|||||||
parent.setState(parent.getIntro());
|
parent.setState(parent.getIntro());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
LOGGER.log(System.Logger.Level.INFO, "Entering WaitRankingState");
|
LOGGER.log(System.Logger.Level.INFO, "Entering WaitRankingState");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
canChange = false;
|
canChange = false;
|
||||||
LOGGER.log(System.Logger.Level.INFO, "Exiting WaitRankingState");
|
LOGGER.log(System.Logger.Level.INFO, "Exiting WaitRankingState");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the server sends a DiceNowMessage.
|
||||||
|
*
|
||||||
|
* @param msg the DiceNowMessage
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DiceNowMessage msg) {
|
public void received(DiceNowMessage msg) {
|
||||||
parent.setState(parent.getRollRankingDice());
|
parent.setState(parent.getRollRankingDice());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the server sends a RankingResponseMessage.
|
||||||
|
*
|
||||||
|
* @param msg the RankingResponseMessage
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(RankingResponseMessage msg) {
|
public void received(RankingResponseMessage msg) {
|
||||||
Map<Color, Integer> rankingResults = new HashMap<>();
|
Map<Color, Integer> rankingResults = new HashMap<>();
|
||||||
@@ -57,12 +83,20 @@ public void received(RankingResponseMessage msg){
|
|||||||
logic.addNotification(new RankingResponceNotification(rankingResults));
|
logic.addNotification(new RankingResponceNotification(rankingResults));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the view has completed the animation.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectAnimationEnd() {
|
public void selectAnimationEnd() {
|
||||||
changeToIntro();
|
changeToIntro();
|
||||||
logic.send(new AnimationEndMessage());
|
logic.send(new AnimationEndMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the server sends an ActivePlayerMessage.
|
||||||
|
*
|
||||||
|
* @param msg the ActivePlayerMessage
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(ActivePlayerMessage msg) {
|
public void received(ActivePlayerMessage msg) {
|
||||||
logic.getGame().setActiveColor(msg.getColor());
|
logic.getGame().setActiveColor(msg.getColor());
|
||||||
|
|||||||
@@ -17,22 +17,39 @@ public class ChoosePieceState extends TurnStates {
|
|||||||
private final StartPieceState startPieceState = new StartPieceState(this, logic);
|
private final StartPieceState startPieceState = new StartPieceState(this, logic);
|
||||||
private final WaitingPieceState waitingPieceState = new WaitingPieceState(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) {
|
public ChoosePieceState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (TurnState) parent;
|
this.parent = (TurnState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
this.setState(this.noPieceState);
|
this.setState(this.noPieceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
currentState.exit();
|
currentState.exit();
|
||||||
currentState = null;
|
currentState = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state.
|
||||||
|
*
|
||||||
|
* @param state the state
|
||||||
|
*/
|
||||||
public void setState(ChoosePieceStates state) {
|
public void setState(ChoosePieceStates state) {
|
||||||
System.out.println("CLIENT STATE old: " + this.currentState + " new: " + state);
|
System.out.println("CLIENT STATE old: " + this.currentState + " new: " + state);
|
||||||
if (currentState != null) {
|
if (currentState != null) {
|
||||||
@@ -42,56 +59,114 @@ public void setState(ChoosePieceStates state){
|
|||||||
currentState = state;
|
currentState = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the piece.
|
||||||
|
*
|
||||||
|
* @param piece the piece
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectPiece(Piece piece) {
|
public void selectPiece(Piece piece) {
|
||||||
currentState.selectPiece(piece);
|
currentState.selectPiece(piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the select piece message.
|
||||||
|
*
|
||||||
|
* @param msg the select piece message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(SelectPieceMessage msg) {
|
public void received(SelectPieceMessage msg) {
|
||||||
currentState.received(msg);
|
currentState.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the wait piece message.
|
||||||
|
*
|
||||||
|
* @param msg the wait piece message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(WaitPieceMessage msg) {
|
public void received(WaitPieceMessage msg) {
|
||||||
currentState.received(msg);
|
currentState.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the start piece message.
|
||||||
|
*
|
||||||
|
* @param msg the start piece message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(StartPieceMessage msg) {
|
public void received(StartPieceMessage msg) {
|
||||||
currentState.received(msg);
|
currentState.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the end of turn message.
|
||||||
|
*
|
||||||
|
* @param msg the end of turn message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(EndOfTurnMessage msg) {
|
public void received(EndOfTurnMessage msg) {
|
||||||
currentState.received(msg);
|
currentState.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the dice now message.
|
||||||
|
*
|
||||||
|
* @param msg the dice now message
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void received(DiceNowMessage msg) {
|
||||||
|
currentState.received(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the move message.
|
||||||
|
*
|
||||||
|
* @param msg the move message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(MoveMessage msg) {
|
public void received(MoveMessage msg) {
|
||||||
currentState.received(msg);
|
currentState.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the no piece state.
|
||||||
|
*/
|
||||||
public NoPieceState getNoPiece() {
|
public NoPieceState getNoPiece() {
|
||||||
return noPieceState;
|
return noPieceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the select piece state.
|
||||||
|
*/
|
||||||
public SelectPieceState getSelectPiece() {
|
public SelectPieceState getSelectPiece() {
|
||||||
return selectPieceState;
|
return selectPieceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the start piece state.
|
||||||
|
*/
|
||||||
public StartPieceState getStartPiece() {
|
public StartPieceState getStartPiece() {
|
||||||
return startPieceState;
|
return startPieceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the waiting piece state.
|
||||||
|
*/
|
||||||
public WaitingPieceState getWaitingPiece() {
|
public WaitingPieceState getWaitingPiece() {
|
||||||
return waitingPieceState;
|
return waitingPieceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current state.
|
||||||
|
*/
|
||||||
public ChoosePieceStates getState() {
|
public ChoosePieceStates getState() {
|
||||||
return currentState;
|
return currentState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the parent state.
|
||||||
|
*/
|
||||||
public TurnState getParent() {
|
public TurnState getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,52 +4,95 @@
|
|||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
import pp.mdga.client.gamestate.TurnState;
|
import pp.mdga.client.gamestate.TurnState;
|
||||||
import pp.mdga.message.client.AnimationEndMessage;
|
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 {
|
public class MovePieceState extends TurnStates {
|
||||||
|
|
||||||
private final TurnState parent;
|
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) {
|
public MovePieceState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (TurnState) parent;
|
this.parent = (TurnState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the animation end.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectAnimationEnd() {
|
public void selectAnimationEnd() {
|
||||||
logic.send(new AnimationEndMessage());
|
logic.send(new AnimationEndMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the ceremony message.
|
||||||
|
*
|
||||||
|
* @param msg the ceremony message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(CeremonyMessage msg) {
|
public void received(CeremonyMessage msg) {
|
||||||
logic.setState(logic.getCeremony());
|
logic.setState(logic.getCeremony());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the end of turn message.
|
||||||
|
*
|
||||||
|
* @param msg the end of turn message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(EndOfTurnMessage msg) {
|
public void received(EndOfTurnMessage msg) {
|
||||||
parent.getParent().setState(parent.getParent().getWaiting());
|
parent.getParent().setState(parent.getParent().getWaiting());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the spectator message.
|
||||||
|
*
|
||||||
|
* @param msg the spectator message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(SpectatorMessage msg) {
|
public void received(SpectatorMessage msg) {
|
||||||
parent.getParent().setState(parent.getParent().getSpectator());
|
parent.getParent().setState(parent.getParent().getSpectator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the dice now message.
|
||||||
|
*
|
||||||
|
* @param msg the dice now message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DiceNowMessage msg) {
|
public void received(DiceNowMessage msg) {
|
||||||
parent.setState(parent.getRollDice());
|
parent.setState(parent.getRollDice());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the parent state.
|
||||||
|
*
|
||||||
|
* @return the parent state
|
||||||
|
*/
|
||||||
public TurnState getParent() {
|
public TurnState getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
import pp.mdga.client.gamestate.TurnState;
|
import pp.mdga.client.gamestate.TurnState;
|
||||||
import pp.mdga.game.BonusCard;
|
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.client.AnimationEndMessage;
|
||||||
import pp.mdga.message.server.PlayCardMessage;
|
import pp.mdga.message.server.PlayCardMessage;
|
||||||
import pp.mdga.notification.PlayCardNotification;
|
import pp.mdga.notification.PlayCardNotification;
|
||||||
@@ -17,11 +15,20 @@ public class PlayPowerCardState extends TurnStates {
|
|||||||
private PlayCardMessage playCardMessage;
|
private PlayCardMessage playCardMessage;
|
||||||
private int extraAnimationCounter = 0;
|
private int extraAnimationCounter = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param parent parent state
|
||||||
|
* @param logic game logic
|
||||||
|
*/
|
||||||
public PlayPowerCardState(ClientState parent, ClientGameLogic logic) {
|
public PlayPowerCardState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (TurnState) parent;
|
this.parent = (TurnState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter the state
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
if (playCardMessage.getCard().getCard().equals(BonusCard.SWAP)) {
|
if (playCardMessage.getCard().getCard().equals(BonusCard.SWAP)) {
|
||||||
@@ -33,15 +40,26 @@ public void enter() {
|
|||||||
handlePowerCard(playCardMessage);
|
handlePowerCard(playCardMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
playCardMessage = null;
|
playCardMessage = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the power card
|
||||||
|
*
|
||||||
|
* @param playCardMessage the play card message
|
||||||
|
*/
|
||||||
public void setPlayCard(PlayCardMessage playCardMessage) {
|
public void setPlayCard(PlayCardMessage playCardMessage) {
|
||||||
this.playCardMessage = playCardMessage;
|
this.playCardMessage = playCardMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The view has finished its animation
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectAnimationEnd() {
|
public void selectAnimationEnd() {
|
||||||
if (extraAnimationCounter > 0) {
|
if (extraAnimationCounter > 0) {
|
||||||
|
|||||||
@@ -23,22 +23,38 @@ public class PowerCardState extends TurnStates {
|
|||||||
private final ShieldState shieldState = new ShieldState(this, logic);
|
private final ShieldState shieldState = new ShieldState(this, logic);
|
||||||
private final SwapState swapState = new SwapState(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) {
|
public PowerCardState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (TurnState) parent;
|
this.parent = (TurnState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
this.setState(this.choosePowerCardState);
|
this.setState(this.choosePowerCardState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
public void exit() {
|
public void exit() {
|
||||||
state.exit();
|
state.exit();
|
||||||
state = null;
|
state = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the state.
|
||||||
|
*
|
||||||
|
* @param state the state
|
||||||
|
*/
|
||||||
public void setState(PowerCardStates state) {
|
public void setState(PowerCardStates state) {
|
||||||
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
System.out.println("CLIENT STATE old: " + this.state + " new: " + state);
|
||||||
|
|
||||||
@@ -49,52 +65,97 @@ public void setState(PowerCardStates state) {
|
|||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the possible cards message.
|
||||||
|
*
|
||||||
|
* @param msg the possible cards message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(PossibleCardsMessage msg) {
|
public void received(PossibleCardsMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the play card message.
|
||||||
|
*
|
||||||
|
* @param msg the play card message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(PlayCardMessage msg) {
|
public void received(PlayCardMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the dice now message.
|
||||||
|
*
|
||||||
|
* @param msg the dice now message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DiceNowMessage msg) {
|
public void received(DiceNowMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the possible piece message.
|
||||||
|
*
|
||||||
|
* @param msg the possible piece message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(PossiblePieceMessage msg) {
|
public void received(PossiblePieceMessage msg) {
|
||||||
state.received(msg);
|
state.received(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the card.
|
||||||
|
*
|
||||||
|
* @param card the card
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectCard(BonusCard card) {
|
public void selectCard(BonusCard card) {
|
||||||
state.selectCard(card);
|
state.selectCard(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the piece.
|
||||||
|
*
|
||||||
|
* @param piece the piece
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectPiece(Piece piece) {
|
public void selectPiece(Piece piece) {
|
||||||
state.selectPiece(piece);
|
state.selectPiece(piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the choose power card state.
|
||||||
|
*/
|
||||||
public ChoosePowerCardState getChoosePowerCard() {
|
public ChoosePowerCardState getChoosePowerCard() {
|
||||||
return choosePowerCardState;
|
return choosePowerCardState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the shield state.
|
||||||
|
*/
|
||||||
public ShieldState getShield() {
|
public ShieldState getShield() {
|
||||||
return shieldState;
|
return shieldState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the swap state.
|
||||||
|
*/
|
||||||
public SwapState getSwap() {
|
public SwapState getSwap() {
|
||||||
return swapState;
|
return swapState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the parent state.
|
||||||
|
*/
|
||||||
public TurnState getParent() {
|
public TurnState getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the state.
|
||||||
|
*/
|
||||||
public PowerCardStates getState() {
|
public PowerCardStates getState() {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,27 +17,47 @@ public class RollDiceState extends TurnStates {
|
|||||||
private final TurnState parent;
|
private final TurnState 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 RollDiceState(ClientState parent, ClientGameLogic logic) {
|
public RollDiceState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (TurnState) parent;
|
this.parent = (TurnState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
isRolled = false;
|
isRolled = false;
|
||||||
logic.addNotification(new DiceNowNotification());
|
logic.addNotification(new DiceNowNotification());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
logic.getGame().setDiceModifier(1);
|
logic.getGame().setDiceModifier(1);
|
||||||
isRolled = false;
|
isRolled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the parent state.
|
||||||
|
*
|
||||||
|
* @return the parent state
|
||||||
|
*/
|
||||||
public TurnState getParent() {
|
public TurnState getParent() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the dice.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectDice() {
|
public void selectDice() {
|
||||||
if (!isRolled) {
|
if (!isRolled) {
|
||||||
@@ -46,34 +66,56 @@ public void selectDice(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the die message.
|
||||||
|
*
|
||||||
|
* @param msg the die message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DieMessage msg) {
|
public void received(DieMessage msg) {
|
||||||
logic.getGame().setDiceEyes(msg.getDiceEye());
|
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()));
|
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()));
|
logic.addNotification(new RollDiceNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor(), msg.getDiceEye()));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the animation end.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectAnimationEnd() {
|
public void selectAnimationEnd() {
|
||||||
logic.send(new AnimationEndMessage());
|
logic.send(new AnimationEndMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the choose piece state message.
|
||||||
|
*
|
||||||
|
* @param msg the choose piece state message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(ChoosePieceStateMessage msg) {
|
public void received(ChoosePieceStateMessage msg) {
|
||||||
parent.setState(parent.getChoosePiece());
|
parent.setState(parent.getChoosePiece());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the no turn message.
|
||||||
|
*
|
||||||
|
* @param msg the no turn message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(NoTurnMessage msg) {
|
public void received(NoTurnMessage msg) {
|
||||||
parent.getParent().setState(parent.getParent().getWaiting());
|
parent.getParent().setState(parent.getParent().getWaiting());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the dice now message.
|
||||||
|
*
|
||||||
|
* @param msg the dice now message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(DiceNowMessage msg) {
|
public void received(DiceNowMessage msg) {
|
||||||
isRolled = false;
|
isRolled = false;
|
||||||
|
|||||||
@@ -5,6 +5,13 @@
|
|||||||
import pp.mdga.client.gamestate.GameStates;
|
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) {
|
public TurnStates(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,13 @@
|
|||||||
import pp.mdga.client.gamestate.turnstate.TurnStates;
|
import pp.mdga.client.gamestate.turnstate.TurnStates;
|
||||||
|
|
||||||
public abstract class ChoosePieceStates extends 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) {
|
public ChoosePieceStates(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,13 @@
|
|||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
import pp.mdga.client.gamestate.turnstate.ChoosePieceState;
|
import pp.mdga.client.gamestate.turnstate.ChoosePieceState;
|
||||||
import pp.mdga.game.Piece;
|
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.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.SelectableMoveNotification;
|
||||||
import pp.mdga.notification.WaitMoveNotification;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -21,21 +23,36 @@ public class NoPieceState extends ChoosePieceStates {
|
|||||||
|
|
||||||
private final ChoosePieceState parent;
|
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) {
|
public NoPieceState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (ChoosePieceState) parent;
|
this.parent = (ChoosePieceState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
LOGGER.log(System.Logger.Level.INFO, "Entering NoPieceState");
|
LOGGER.log(System.Logger.Level.INFO, "Entering NoPieceState");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the piece.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(SelectPieceMessage msg) {
|
public void received(SelectPieceMessage msg) {
|
||||||
ArrayList<Piece> pieces = msg.getPieces().stream().map(piece -> logic.getGame().getPieceThroughUUID(piece.getUuid())).collect(Collectors.toCollection(ArrayList::new));
|
ArrayList<Piece> pieces = msg.getPieces().stream().map(piece -> logic.getGame().getPieceThroughUUID(piece.getUuid())).collect(Collectors.toCollection(ArrayList::new));
|
||||||
@@ -46,6 +63,9 @@ public void received(SelectPieceMessage msg) {
|
|||||||
parent.setState(parent.getSelectPiece());
|
parent.setState(parent.getSelectPiece());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the dice.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(WaitPieceMessage msg) {
|
public void received(WaitPieceMessage msg) {
|
||||||
LOGGER.log(System.Logger.Level.INFO, "Received WaitPieceMessage");
|
LOGGER.log(System.Logger.Level.INFO, "Received WaitPieceMessage");
|
||||||
@@ -54,6 +74,11 @@ public void received(WaitPieceMessage msg){
|
|||||||
parent.setState(parent.getWaitingPiece());
|
parent.setState(parent.getWaitingPiece());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the server sends a DiceNowMessage.
|
||||||
|
*
|
||||||
|
* @param msg the DiceNowMessage
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(StartPieceMessage msg) {
|
public void received(StartPieceMessage msg) {
|
||||||
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPieceIdentifier());
|
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPieceIdentifier());
|
||||||
@@ -69,9 +94,24 @@ public void received(StartPieceMessage msg){
|
|||||||
parent.setState(parent.getStartPiece());
|
parent.setState(parent.getStartPiece());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the server sends a DiceNowMessage.
|
||||||
|
*
|
||||||
|
* @param msg the DiceNowMessage
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(EndOfTurnMessage msg) {
|
public void received(EndOfTurnMessage msg) {
|
||||||
logic.getGame().setTurboFlag(false);
|
logic.getGame().setTurboFlag(false);
|
||||||
parent.getParent().getParent().setState(parent.getParent().getParent().getWaiting());
|
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.ClientState;
|
||||||
import pp.mdga.client.gamestate.turnstate.ChoosePieceState;
|
import pp.mdga.client.gamestate.turnstate.ChoosePieceState;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
import pp.mdga.game.ShieldState;
|
|
||||||
import pp.mdga.game.PieceState;
|
import pp.mdga.game.PieceState;
|
||||||
|
import pp.mdga.game.ShieldState;
|
||||||
import pp.mdga.message.client.RequestMoveMessage;
|
import pp.mdga.message.client.RequestMoveMessage;
|
||||||
import pp.mdga.message.client.SelectedPiecesMessage;
|
|
||||||
import pp.mdga.message.server.MoveMessage;
|
import pp.mdga.message.server.MoveMessage;
|
||||||
import pp.mdga.notification.HomeMoveNotification;
|
import pp.mdga.notification.*;
|
||||||
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 java.util.ArrayList;
|
||||||
|
|
||||||
@@ -24,25 +18,47 @@ public class SelectPieceState extends ChoosePieceStates {
|
|||||||
private ArrayList<Piece> possiblePieces;
|
private ArrayList<Piece> possiblePieces;
|
||||||
private final System.Logger LOGGER = System.getLogger(this.getClass().getName());
|
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) {
|
public SelectPieceState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (ChoosePieceState) parent;
|
this.parent = (ChoosePieceState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
possiblePieces = new ArrayList<>();
|
possiblePieces = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the possible pieces.
|
||||||
|
*
|
||||||
|
* @param possiblePieces the possible pieces
|
||||||
|
*/
|
||||||
public void setPossiblePieces(ArrayList<Piece> possiblePieces) {
|
public void setPossiblePieces(ArrayList<Piece> possiblePieces) {
|
||||||
this.possiblePieces = possiblePieces;
|
this.possiblePieces = possiblePieces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the piece.
|
||||||
|
*
|
||||||
|
* @param piece the piece
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectPiece(Piece piece) {
|
public void selectPiece(Piece piece) {
|
||||||
if (possiblePieces.contains(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
|
@Override
|
||||||
public void received(MoveMessage msg) {
|
public void received(MoveMessage msg) {
|
||||||
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
|
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);
|
System.out.println("Client: SelectState: activePiece in Home: infieldIndex" + infieldIndex);
|
||||||
if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
|
if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
|
||||||
piece.setState(PieceState.HOMEFINISHED);
|
piece.setState(PieceState.HOMEFINISHED);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
piece.setState(PieceState.HOME);
|
piece.setState(PieceState.HOME);
|
||||||
}
|
}
|
||||||
logic.getGame().getBoard().getInfield()[infieldIndex].clearOccupant();
|
logic.getGame().getBoard().getInfield()[infieldIndex].clearOccupant();
|
||||||
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
|
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
System.out.println("Client: SelectPieceState: receivedMoveMessage:reached else");
|
System.out.println("Client: SelectPieceState: receivedMoveMessage:reached else");
|
||||||
logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
|
logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
|
||||||
System.out.println("Client: electPieceState: homeindex" + logic.getGame().getActivePlayer().getHomeIndexOfPiece(piece));
|
System.out.println("Client: electPieceState: homeindex" + logic.getGame().getActivePlayer().getHomeIndexOfPiece(piece));
|
||||||
int pieceHomeIndex = logic.getGame().getActivePlayer().getHomeIndexOfPiece(piece);
|
int pieceHomeIndex = logic.getGame().getActivePlayer().getHomeIndexOfPiece(piece);
|
||||||
if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
|
if (msg.getTargetIndex() == logic.getGame().getActivePlayer().getHighestHomeIdx()) {
|
||||||
piece.setState(PieceState.HOMEFINISHED);
|
piece.setState(PieceState.HOMEFINISHED);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
piece.setState(PieceState.HOME);
|
piece.setState(PieceState.HOME);
|
||||||
}
|
}
|
||||||
logic.getGame().getActivePlayer().getHomeNodes()[pieceHomeIndex].clearOccupant();
|
logic.getGame().getActivePlayer().getHomeNodes()[pieceHomeIndex].clearOccupant();
|
||||||
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
|
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
|
||||||
|
|
||||||
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
|
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
|
||||||
@@ -111,8 +128,7 @@ public void received(MoveMessage msg) {
|
|||||||
piece.setShield(ShieldState.SUPPRESSED);
|
piece.setShield(ShieldState.SUPPRESSED);
|
||||||
logic.addNotification(new ShieldSuppressedNotification(piece.getUuid()));
|
logic.addNotification(new ShieldSuppressedNotification(piece.getUuid()));
|
||||||
}
|
}
|
||||||
}
|
} else if (piece.isSuppressed()) {
|
||||||
else if (piece.isSuppressed()) {
|
|
||||||
piece.setShield(ShieldState.ACTIVE);
|
piece.setShield(ShieldState.ACTIVE);
|
||||||
logic.addNotification(new ShieldActiveNotification(piece.getUuid()));
|
logic.addNotification(new ShieldActiveNotification(piece.getUuid()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,15 +7,8 @@
|
|||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
import pp.mdga.game.ShieldState;
|
import pp.mdga.game.ShieldState;
|
||||||
import pp.mdga.message.client.RequestMoveMessage;
|
import pp.mdga.message.client.RequestMoveMessage;
|
||||||
import pp.mdga.message.client.SelectedPiecesMessage;
|
|
||||||
import pp.mdga.message.server.MoveMessage;
|
import pp.mdga.message.server.MoveMessage;
|
||||||
import pp.mdga.notification.MovePieceNotification;
|
import pp.mdga.notification.*;
|
||||||
import pp.mdga.notification.RemoveShieldNotification;
|
|
||||||
import pp.mdga.notification.ShieldActiveNotification;
|
|
||||||
import pp.mdga.notification.ShieldSuppressedNotification;
|
|
||||||
import pp.mdga.notification.ThrowPieceNotification;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class StartPieceState extends ChoosePieceStates {
|
public class StartPieceState extends ChoosePieceStates {
|
||||||
|
|
||||||
@@ -24,26 +17,47 @@ public class StartPieceState extends ChoosePieceStates {
|
|||||||
private final ChoosePieceState parent;
|
private final ChoosePieceState parent;
|
||||||
private Piece moveablePiece;
|
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) {
|
public StartPieceState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (ChoosePieceState) parent;
|
this.parent = (ChoosePieceState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
moveablePiece = null;
|
moveablePiece = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the moveable piece.
|
||||||
|
*
|
||||||
|
* @param moveablePiece the moveable piece
|
||||||
|
*/
|
||||||
public void setMoveablePiece(Piece moveablePiece) {
|
public void setMoveablePiece(Piece moveablePiece) {
|
||||||
this.moveablePiece = moveablePiece;
|
this.moveablePiece = moveablePiece;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the piece.
|
||||||
|
*
|
||||||
|
* @param piece the piece
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectPiece(Piece piece) {
|
public void selectPiece(Piece piece) {
|
||||||
if (moveablePiece.equals(piece)) {
|
if (moveablePiece.equals(piece)) {
|
||||||
@@ -51,6 +65,11 @@ public void selectPiece(Piece piece){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the move message.
|
||||||
|
*
|
||||||
|
* @param msg the move message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(MoveMessage msg) {
|
public void received(MoveMessage msg) {
|
||||||
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
|
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
|
||||||
|
|||||||
@@ -7,39 +7,57 @@
|
|||||||
import pp.mdga.game.PieceState;
|
import pp.mdga.game.PieceState;
|
||||||
import pp.mdga.game.ShieldState;
|
import pp.mdga.game.ShieldState;
|
||||||
import pp.mdga.message.client.RequestMoveMessage;
|
import pp.mdga.message.client.RequestMoveMessage;
|
||||||
import pp.mdga.message.client.SelectedPiecesMessage;
|
|
||||||
import pp.mdga.message.server.MoveMessage;
|
import pp.mdga.message.server.MoveMessage;
|
||||||
import pp.mdga.notification.MovePieceNotification;
|
import pp.mdga.notification.MovePieceNotification;
|
||||||
import pp.mdga.notification.RemoveShieldNotification;
|
import pp.mdga.notification.RemoveShieldNotification;
|
||||||
import pp.mdga.notification.ThrowPieceNotification;
|
import pp.mdga.notification.ThrowPieceNotification;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class WaitingPieceState extends ChoosePieceStates {
|
public class WaitingPieceState extends ChoosePieceStates {
|
||||||
|
|
||||||
private final ChoosePieceState parent;
|
private final ChoosePieceState parent;
|
||||||
private Piece moveablePiece;
|
private Piece moveablePiece;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a client state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param parent the parent state
|
||||||
|
* @param logic the client game logic
|
||||||
|
*/
|
||||||
public WaitingPieceState(ClientState parent, ClientGameLogic logic) {
|
public WaitingPieceState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (ChoosePieceState) parent;
|
this.parent = (ChoosePieceState) parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
moveablePiece = null;
|
moveablePiece = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the moveable piece.
|
||||||
|
*
|
||||||
|
* @param piece the moveable piece
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectPiece(Piece piece) {
|
public void selectPiece(Piece piece) {
|
||||||
logic.send(new RequestMoveMessage(piece));
|
logic.send(new RequestMoveMessage(piece));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receives the move message.
|
||||||
|
*
|
||||||
|
* @param msg the move message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(MoveMessage msg) {
|
public void received(MoveMessage msg) {
|
||||||
Piece pieceToMove = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
|
Piece pieceToMove = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
|
||||||
|
|||||||
@@ -4,9 +4,8 @@
|
|||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
import pp.mdga.client.gamestate.turnstate.PowerCardState;
|
import pp.mdga.client.gamestate.turnstate.PowerCardState;
|
||||||
import pp.mdga.game.BonusCard;
|
import pp.mdga.game.BonusCard;
|
||||||
import pp.mdga.game.Piece;
|
|
||||||
import pp.mdga.game.Player;
|
import pp.mdga.game.Player;
|
||||||
import pp.mdga.game.card.*;
|
import pp.mdga.game.card.PowerCard;
|
||||||
import pp.mdga.message.client.NoPowerCardMessage;
|
import pp.mdga.message.client.NoPowerCardMessage;
|
||||||
import pp.mdga.message.client.SelectCardMessage;
|
import pp.mdga.message.client.SelectCardMessage;
|
||||||
import pp.mdga.message.server.DiceNowMessage;
|
import pp.mdga.message.server.DiceNowMessage;
|
||||||
@@ -14,7 +13,6 @@
|
|||||||
import pp.mdga.message.server.PossibleCardsMessage;
|
import pp.mdga.message.server.PossibleCardsMessage;
|
||||||
import pp.mdga.message.server.PossiblePieceMessage;
|
import pp.mdga.message.server.PossiblePieceMessage;
|
||||||
import pp.mdga.notification.SelectableCardsNotification;
|
import pp.mdga.notification.SelectableCardsNotification;
|
||||||
import pp.mdga.notification.SelectableShieldNotification;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -29,6 +27,7 @@ public class ChoosePowerCardState extends PowerCardStates {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
*
|
||||||
* @param parent parent state
|
* @param parent parent state
|
||||||
* @param logic game logic
|
* @param logic game logic
|
||||||
*/
|
*/
|
||||||
@@ -54,6 +53,7 @@ public void exit() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the possible cards
|
* Set the possible cards
|
||||||
|
*
|
||||||
* @param msg possible cards message
|
* @param msg possible cards message
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -70,6 +70,7 @@ public void received(PossibleCardsMessage msg){
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Select a card
|
* Select a card
|
||||||
|
*
|
||||||
* @param card card to select
|
* @param card card to select
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -89,6 +90,7 @@ public void selectCard(BonusCard card){
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive a card
|
* Receive a card
|
||||||
|
*
|
||||||
* @param msg card message
|
* @param msg card message
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -103,6 +105,7 @@ public void received(PlayCardMessage msg){
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive a die now message
|
* Receive a die now message
|
||||||
|
*
|
||||||
* @param msg dice now message
|
* @param msg dice now message
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -112,6 +115,7 @@ public void received(DiceNowMessage msg){
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive a possible piece message and decide if the player can swap or shield
|
* Receive a possible piece message and decide if the player can swap or shield
|
||||||
|
*
|
||||||
* @param msg possible piece message
|
* @param msg possible piece message
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,6 +5,13 @@
|
|||||||
import pp.mdga.client.gamestate.turnstate.TurnStates;
|
import pp.mdga.client.gamestate.turnstate.TurnStates;
|
||||||
|
|
||||||
public abstract class PowerCardStates extends TurnStates {
|
public abstract class PowerCardStates extends TurnStates {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a client state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param parent the parent state
|
||||||
|
* @param logic the client game logic
|
||||||
|
*/
|
||||||
public PowerCardStates(ClientState parent, ClientGameLogic logic) {
|
public PowerCardStates(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,12 @@
|
|||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
import pp.mdga.client.gamestate.turnstate.PowerCardState;
|
import pp.mdga.client.gamestate.turnstate.PowerCardState;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
import pp.mdga.message.client.RequestPlayCardMessage;
|
|
||||||
import pp.mdga.message.client.SelectedPiecesMessage;
|
import pp.mdga.message.client.SelectedPiecesMessage;
|
||||||
import pp.mdga.message.server.PlayCardMessage;
|
import pp.mdga.message.server.PlayCardMessage;
|
||||||
import pp.mdga.notification.SelectableShieldNotification;
|
import pp.mdga.notification.SelectableShieldNotification;
|
||||||
|
|
||||||
import java.lang.System.Logger.Level;
|
import java.lang.System.Logger.Level;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ShieldState extends PowerCardStates {
|
public class ShieldState extends PowerCardStates {
|
||||||
|
|
||||||
@@ -20,26 +18,48 @@ public class ShieldState extends PowerCardStates {
|
|||||||
|
|
||||||
private ArrayList<Piece> possiblePieces;
|
private ArrayList<Piece> possiblePieces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a client state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param parent the parent state
|
||||||
|
* @param logic the client game logic
|
||||||
|
*/
|
||||||
public ShieldState(ClientState parent, ClientGameLogic logic) {
|
public ShieldState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (PowerCardState) parent;
|
this.parent = (PowerCardState) parent;
|
||||||
possiblePieces = new ArrayList<>();
|
possiblePieces = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
logic.addNotification(new SelectableShieldNotification(possiblePieces.stream().map(Piece::getUuid).toList()));
|
logic.addNotification(new SelectableShieldNotification(possiblePieces.stream().map(Piece::getUuid).toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
possiblePieces = null;
|
possiblePieces = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the possible pieces.
|
||||||
|
*
|
||||||
|
* @param possiblePieces the possible pieces
|
||||||
|
*/
|
||||||
public void setPossiblePieces(ArrayList<Piece> possiblePieces) {
|
public void setPossiblePieces(ArrayList<Piece> possiblePieces) {
|
||||||
this.possiblePieces = possiblePieces;
|
this.possiblePieces = possiblePieces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the piece.
|
||||||
|
*
|
||||||
|
* @param piece the piece
|
||||||
|
*/
|
||||||
public void selectPiece(Piece piece) {
|
public void selectPiece(Piece piece) {
|
||||||
if (possiblePieces.contains(piece)) {
|
if (possiblePieces.contains(piece)) {
|
||||||
// logic.send(RequestPlayCardMessage.requestPlayShield(piece.getUuid()));
|
// logic.send(RequestPlayCardMessage.requestPlayShield(piece.getUuid()));
|
||||||
@@ -51,7 +71,11 @@ public void selectPiece(Piece piece) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when the server sends a PlayCardMessage.
|
||||||
|
*
|
||||||
|
* @param msg the PlayCardMessage
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(PlayCardMessage msg) {
|
public void received(PlayCardMessage msg) {
|
||||||
parent.getParent().getPlayPowerCard().setPlayCard(msg);
|
parent.getParent().getPlayPowerCard().setPlayCard(msg);
|
||||||
|
|||||||
@@ -4,14 +4,12 @@
|
|||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
import pp.mdga.client.gamestate.turnstate.PowerCardState;
|
import pp.mdga.client.gamestate.turnstate.PowerCardState;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
import pp.mdga.message.client.RequestPlayCardMessage;
|
|
||||||
import pp.mdga.message.client.SelectCardMessage;
|
|
||||||
import pp.mdga.message.client.SelectedPiecesMessage;
|
import pp.mdga.message.client.SelectedPiecesMessage;
|
||||||
import pp.mdga.message.server.PlayCardMessage;
|
import pp.mdga.message.server.PlayCardMessage;
|
||||||
import pp.mdga.notification.SelectableSwapNotification;
|
import pp.mdga.notification.SelectableSwapNotification;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class SwapState extends PowerCardStates {
|
public class SwapState extends PowerCardStates {
|
||||||
|
|
||||||
@@ -24,6 +22,12 @@ public class SwapState extends PowerCardStates {
|
|||||||
private Piece selectedOwnPiece;
|
private Piece selectedOwnPiece;
|
||||||
private Piece selectedEnemyPiece;
|
private Piece selectedEnemyPiece;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a client state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param parent the parent state
|
||||||
|
* @param logic the client game logic
|
||||||
|
*/
|
||||||
public SwapState(ClientState parent, ClientGameLogic logic) {
|
public SwapState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
this.parent = (PowerCardState) parent;
|
this.parent = (PowerCardState) parent;
|
||||||
@@ -33,6 +37,9 @@ public SwapState(ClientState parent, ClientGameLogic logic) {
|
|||||||
selectedEnemyPiece = null;
|
selectedEnemyPiece = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enters the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
LOGGER.log(System.Logger.Level.INFO, "Entering SwapState");
|
LOGGER.log(System.Logger.Level.INFO, "Entering SwapState");
|
||||||
@@ -43,6 +50,9 @@ public void enter() {
|
|||||||
selectedEnemyPiece = null;
|
selectedEnemyPiece = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exits the state.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void exit() {
|
public void exit() {
|
||||||
LOGGER.log(System.Logger.Level.INFO, "Exiting SwapState");
|
LOGGER.log(System.Logger.Level.INFO, "Exiting SwapState");
|
||||||
@@ -50,14 +60,29 @@ public void exit() {
|
|||||||
possibleEnemyPieces.clear();
|
possibleEnemyPieces.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the possible own pieces.
|
||||||
|
*
|
||||||
|
* @param possibleOwnPieces the possible own pieces
|
||||||
|
*/
|
||||||
public void setPossibleOwnPieces(ArrayList<Piece> possibleOwnPieces) {
|
public void setPossibleOwnPieces(ArrayList<Piece> possibleOwnPieces) {
|
||||||
this.possibleOwnPieces = possibleOwnPieces;
|
this.possibleOwnPieces = possibleOwnPieces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the possible enemy pieces.
|
||||||
|
*
|
||||||
|
* @param possibleEnemyPieces the possible enemy pieces
|
||||||
|
*/
|
||||||
public void setPossibleEnemyPieces(ArrayList<Piece> possibleEnemyPieces) {
|
public void setPossibleEnemyPieces(ArrayList<Piece> possibleEnemyPieces) {
|
||||||
this.possibleEnemyPieces = possibleEnemyPieces;
|
this.possibleEnemyPieces = possibleEnemyPieces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects the piece.
|
||||||
|
*
|
||||||
|
* @param piece the piece
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void selectPiece(Piece piece) {
|
public void selectPiece(Piece piece) {
|
||||||
if (possibleOwnPieces.contains(piece)) {
|
if (possibleOwnPieces.contains(piece)) {
|
||||||
@@ -76,6 +101,11 @@ public void selectPiece(Piece piece){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Receive a card
|
||||||
|
*
|
||||||
|
* @param msg card message
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void received(PlayCardMessage msg) {
|
public void received(PlayCardMessage msg) {
|
||||||
parent.getParent().getPlayPowerCard().setPlayCard(msg);
|
parent.getParent().getPlayPowerCard().setPlayCard(msg);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class ShieldCard extends PowerCard {
|
|||||||
public ShieldCard() {
|
public ShieldCard() {
|
||||||
this.card = BonusCard.SHIELD;
|
this.card = BonusCard.SHIELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be used to call the visit method of the given visitor parameter and pass a PowerCard object.
|
* This method will be used to call the visit method of the given visitor parameter and pass a PowerCard object.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class CeremonyMessage extends ServerMessage {
|
|||||||
private ArrayList<Integer> sixes;
|
private ArrayList<Integer> sixes;
|
||||||
private ArrayList<Integer> nodesMoved;
|
private ArrayList<Integer> nodesMoved;
|
||||||
private ArrayList<Integer> bonusNodes;
|
private ArrayList<Integer> bonusNodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new Ceremony instance.
|
* Constructs a new Ceremony instance.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ public class ChoosePieceStateMessage extends ServerMessage {
|
|||||||
public ChoosePieceStateMessage() {
|
public ChoosePieceStateMessage() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accepts a visitor to process this message.
|
* Accepts a visitor to process this message.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A message sent by the server to the client to inform about the dice roll.
|
* A message sent by the server to the client to inform about the dice roll.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
import pp.mdga.game.Color;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A message sent by the server to indicate that a player has left the lobby.
|
* A message sent by the server to indicate that a player has left the lobby.
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A message sent by the server to the client to move a piece on the board.
|
* A message sent by the server to the client to move a piece on the board.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,10 +3,8 @@
|
|||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
|
|
||||||
import java.io.PipedOutputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A message sent by the server to the active player to give all possible pieces to choose from.
|
* A message sent by the server to the active player to give all possible pieces to choose from.
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package pp.mdga.message.server;
|
package pp.mdga.message.server;
|
||||||
|
|
||||||
import com.jme3.network.serializing.Serializable;
|
import com.jme3.network.serializing.Serializable;
|
||||||
|
import pp.mdga.game.Piece;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import pp.mdga.game.Piece;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A message sent by the server to the active player to select a piece to move.
|
* A message sent by the server to the active player to select a piece to move.
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
import pp.mdga.game.BonusCard;
|
import pp.mdga.game.BonusCard;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notification that is sent when a card is acquired.
|
* Notification that is sent when a card is acquired.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -28,5 +28,7 @@ public String getMessage() {
|
|||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isError() { return isError; }
|
public boolean isError() {
|
||||||
|
return isError;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package pp.mdga.notification;
|
package pp.mdga.notification;
|
||||||
|
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
import pp.mdga.message.server.ServerMessage;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class RankingResponceNotification extends Notification {
|
public class RankingResponceNotification extends Notification {
|
||||||
private final Map<Color, Integer> rankingResults;
|
private final Map<Color, Integer> rankingResults;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ public class RollDiceNotification extends Notification{
|
|||||||
private boolean isRanking;
|
private boolean isRanking;
|
||||||
|
|
||||||
//normal
|
//normal
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
*
|
||||||
* @param color the color of the player that rolled the die.
|
* @param color the color of the player that rolled the die.
|
||||||
* @param eyes the number of eyes that were rolled.
|
* @param eyes the number of eyes that were rolled.
|
||||||
*/
|
*/
|
||||||
@@ -47,6 +49,7 @@ public RollDiceNotification(Color color, int eyes, int multiplier) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the color of the player that rolled the die.
|
* Get the color of the player that rolled the die.
|
||||||
|
*
|
||||||
* @return the color of the player that rolled the die.
|
* @return the color of the player that rolled the die.
|
||||||
*/
|
*/
|
||||||
public Color getColor() {
|
public Color getColor() {
|
||||||
@@ -55,6 +58,7 @@ public Color getColor() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of eyes that were rolled.
|
* Get the number of eyes that were rolled.
|
||||||
|
*
|
||||||
* @return the number of eyes that were rolled.
|
* @return the number of eyes that were rolled.
|
||||||
*/
|
*/
|
||||||
public int getEyes() {
|
public int getEyes() {
|
||||||
@@ -69,5 +73,7 @@ public boolean isTurbo() {
|
|||||||
return turbo;
|
return turbo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRanking() { return isRanking; }
|
public boolean isRanking() {
|
||||||
|
return isRanking;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user