Compare commits
	
		
			200 Commits
		
	
	
		
			b_wilkenin
			...
			acc797f2ff
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | acc797f2ff | ||
|  | 853c32a5b8 | ||
|  | 72bef7143a | ||
|  | b1ed571950 | ||
|  | 1a75d6d6a8 | ||
|  | c990e7b562 | ||
|  | c87406f60e | ||
|  | 21914a1294 | ||
|  | a344145732 | ||
|  | a27ac31086 | ||
|  | 9a7f75b76b | ||
|  | 3e487c00d5 | ||
|  | 4820b8cf46 | ||
|  | caa4cb5262 | ||
|  | 1b2a7d73b5 | ||
|  | 55778dbcea | ||
|  | 422faec281 | ||
|  | dcf10e0819 | ||
|  | 6b78733a5d | ||
|  | c124a99901 | ||
|  | d7df4002da | ||
|  | 8b0ef97a82 | ||
|  | 75d3bef5c8 | ||
|  | c2d5611ab9 | ||
|  | fb28f3fefc | ||
|  | 6a34dab00c | ||
|  | c7bd7d18b7 | ||
|  | 437114704a | ||
|  | 9b4cac4e56 | ||
|  | e780513b35 | ||
|  | d582c59a7d | ||
|  | 7d2c85f617 | ||
|  | 4a882bc4ac | ||
|  | 3c4eac1fcd | ||
|  | 75d5a15bdb | ||
|  | 17f121f7d1 | ||
|  | a66c570b51 | ||
|  | e1e7f2eaf6 | ||
|  | 46d2dce372 | ||
|  | c39f1f6d4c | ||
|  | 738b04f2d9 | ||
|  | ecba1c3135 | ||
|  | 748226f4ed | ||
|  | f658f53ba9 | ||
|  | 4a8304ee4f | ||
|  | 7fe9604338 | ||
|  | 7f09a6dae8 | ||
|  | 270129bc97 | ||
|  | 62ec6f6bef | ||
|  | b24c14900c | ||
|  | 44c55ce3a6 | ||
|  | 895bea048c | ||
|  | 885ab5bdc9 | ||
|  | c6355b2c09 | ||
|  | ada6bf3f24 | ||
|  | db471ac679 | ||
|  | 84059c4085 | ||
|  | 09b363f943 | ||
|  | fd347c7780 | ||
|  | b38a34efa5 | ||
|  | 10e24cf30e | ||
|  | 3369057afb | ||
|  | 7ada56e215 | ||
|  | 373b9e6d53 | ||
|  | 3de31de9f7 | ||
|  | 7252259ab3 | ||
|  | f33c673a05 | ||
|  | 65a7958b66 | ||
|  | 91e4df7478 | ||
|  | 399606d9a0 | ||
|  | 559afcaffd | ||
|  | 15f5f91ddb | ||
|  | 067a8063a5 | ||
|  | 35e367ba24 | ||
|  | fe68d991fc | ||
|  | 88dc633e8e | ||
|  | 0b9cbb0f5f | ||
|  | c3a33b4402 | ||
|  | e12f00aad6 | ||
|  | 47bac0185f | ||
|  | dafe1dab2a | ||
|  | 8ba4ea2819 | ||
|  | f6f708fd5b | ||
|  | 1203077aed | ||
|  | ddbf79c928 | ||
|  | aa47dd579f | ||
|  | cdce478d77 | ||
|  | f11f4a59f1 | ||
|  | d631e8df1e | ||
|  | af80d40700 | ||
|  | 3a6f8a945a | ||
|  | bb9727d54a | ||
|  | 7da8b3e545 | ||
|  | b6968df451 | ||
|  | b85bbdd0ad | ||
|  | aa986fb948 | ||
|  | 6e63de6e99 | ||
|  | 962ecd08fa | ||
|  | 580a26b3ea | ||
|  | 0cda6b5fa0 | ||
|  | cc8c3795b8 | ||
|  | 3c21165efb | ||
|  | 818fdf4670 | ||
|  | b7d679b492 | ||
|  | a42093df23 | ||
|  | 6157db51da | ||
|  | 843052989b | ||
|  | 8e01fa3192 | ||
|  | e2126a7ea7 | ||
|  | 0b46d14650 | ||
|  | 9e28deedf7 | ||
|  | 9c0172b413 | ||
|  | 2933d022aa | ||
|  | bdefb7193e | ||
|  | 7246133363 | ||
|  | 69b68a6975 | ||
|  | e38a7e8cdd | ||
|  | dbd9dd0001 | ||
|  | ccb1743a01 | ||
|  | 4ac897693c | ||
|  | dfb962e9fe | ||
|  | f97cbd778d | ||
|  | e889a61d43 | ||
|  | a33d422547 | ||
|  | c4b4001b96 | ||
|  | 20949b641e | ||
|  | 56e2174b6d | ||
|  | acfeebca14 | ||
|  | cc47acbd3f | ||
|  | 869e16406d | ||
|  | 1c99da4fc5 | ||
|  | b74ca4e702 | ||
|  | 5fde7451c8 | ||
|  | 6fd9209336 | ||
|  | 0213dc3560 | ||
|  | e73c434c1b | ||
|  | b135f3fa50 | ||
|  | 0e580a3180 | ||
|  | 8e3cb43244 | ||
|  | 6dcfb92dba | ||
|  | a7ea5773da | ||
|  | 5b66131d30 | ||
|  | cac06dda7d | ||
|  | 12c1c97a99 | ||
|  | af4b4243ea | ||
|  | 5189c74058 | ||
|  | fffd32e13c | ||
|  | b37a5095f0 | ||
|  | 951b4c198c | ||
|  | 8698eed273 | ||
|  | 1af8614b35 | ||
|  | 11faeeaf45 | ||
|  | 9d0fcc3370 | ||
|  | 2f6d6037de | ||
|  | 1d69bcc814 | ||
|  | 62c363068b | ||
|  | d2e0b8187b | ||
|  | 628b98af9b | ||
|  | 627e3dbd7f | ||
|  | 61b88f6bf8 | ||
|  | 8ab37e73c1 | ||
|  | afdf43ebf1 | ||
|  | 2e0d1c059d | ||
|  | 2b772199b0 | ||
|  | c37b850798 | ||
|  | c31f924d77 | ||
|  | ed87a6167d | ||
|  | 0d86ba0ca9 | ||
|  | f2fd283d06 | ||
|  | 10b978debf | ||
|  | 85756713df | ||
|  | 3bdfd6a78a | ||
|  | e59ab4a320 | ||
|  | 15b3902bd3 | ||
|  | b622d66942 | ||
|  | 12ef219064 | ||
|  | 853b52b52d | ||
|  | 7a2ad1d31a | ||
|  | c5ad476eaf | ||
|  | 12978ff410 | ||
|  | caa45097c3 | ||
|  | 232e3a117c | ||
|  | 3668382911 | ||
|  | fafa53ffb7 | ||
|  | 44673fd57e | ||
|  | f7149f225c | ||
|  | 6773e18d34 | ||
|  | 19a9b06f3c | ||
|  | 7ee2273761 | ||
|  | 86b8297c9d | ||
|  | 17533112a1 | ||
|  | 2cc1a338ec | ||
|  | 81731247c7 | ||
|  | 65c85aacf0 | ||
|  | dca23151a8 | ||
|  | 25305760c5 | ||
|  | 3ef2459ad0 | ||
|  | 29a56f42a8 | ||
|  | 3784348f91 | ||
|  | 188ec03abd | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						| @@ -4,6 +4,7 @@ build | |||||||
|  |  | ||||||
| # VSC | # VSC | ||||||
| bin | bin | ||||||
|  | .vscode | ||||||
|  |  | ||||||
| # IntelliJ | # IntelliJ | ||||||
| *.iml | *.iml | ||||||
|   | |||||||
							
								
								
									
										18
									
								
								Projekte/.run/MonopolyApp.run.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,18 @@ | |||||||
|  | <component name="ProjectRunConfigurationManager"> | ||||||
|  |   <configuration default="false" name="MonopolyApp" type="Application" factoryName="Application" singleton="false" | ||||||
|  |                  nameIsGenerated="true"> | ||||||
|  |     <option name="MAIN_CLASS_NAME" value="pp.monopoly.client.MonopolyApp"/> | ||||||
|  |     <module name="Projekte.monopoly.client.main"/> | ||||||
|  |     <option name="VM_PARAMETERS" value="-Djava.util.logging.config.file=logging.properties"/> | ||||||
|  |     <option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$"/> | ||||||
|  |     <extension name="coverage"> | ||||||
|  |       <pattern> | ||||||
|  |         <option name="PATTERN" value="pp.monopoly.client.*"/> | ||||||
|  |         <option name="ENABLED" value="true"/> | ||||||
|  |       </pattern> | ||||||
|  |     </extension> | ||||||
|  |     <method v="2"> | ||||||
|  |       <option name="Make" enabled="true"/> | ||||||
|  |     </method> | ||||||
|  |   </configuration> | ||||||
|  | </component> | ||||||
							
								
								
									
										17
									
								
								Projekte/.run/MonopolyServer.run.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,17 @@ | |||||||
|  | <component name="ProjectRunConfigurationManager"> | ||||||
|  |   <configuration default="false" name="MonopolyServer" type="Application" factoryName="Application" | ||||||
|  |                  nameIsGenerated="true"> | ||||||
|  |     <option name="MAIN_CLASS_NAME" value="pp.monopoly.server.MonopolyServer"/> | ||||||
|  |     <module name="Projekte.monopoly.server.main"/> | ||||||
|  |     <option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$"/> | ||||||
|  |     <extension name="coverage"> | ||||||
|  |       <pattern> | ||||||
|  |         <option name="PATTERN" value="pp.monopoly.server.*"/> | ||||||
|  |         <option name="ENABLED" value="true"/> | ||||||
|  |       </pattern> | ||||||
|  |     </extension> | ||||||
|  |     <method v="2"> | ||||||
|  |       <option name="Make" enabled="true"/> | ||||||
|  |     </method> | ||||||
|  |   </configuration> | ||||||
|  | </component> | ||||||
| @@ -9,6 +9,7 @@ dependencies { | |||||||
|     implementation project(":battleship:model") |     implementation project(":battleship:model") | ||||||
|  |  | ||||||
|     implementation libs.jme3.desktop |     implementation libs.jme3.desktop | ||||||
|  |     implementation libs.jme3.effects | ||||||
|  |  | ||||||
|     runtimeOnly libs.jme3.awt.dialogs |     runtimeOnly libs.jme3.awt.dialogs | ||||||
|     runtimeOnly libs.jme3.plugins |     runtimeOnly libs.jme3.plugins | ||||||
|   | |||||||
| @@ -9,7 +9,7 @@ | |||||||
| # | # | ||||||
| # Specifies the map used by the opponent in single mode. | # Specifies the map used by the opponent in single mode. | ||||||
| # Single mode is activated if this property is set. | # Single mode is activated if this property is set. | ||||||
| map.opponent=maps/map2.json | #map.opponent=maps/map2.json | ||||||
| # | # | ||||||
| # Specifies the map used by the player in single mode. | # Specifies the map used by the player in single mode. | ||||||
| # The player must define their own map if this property is not set. | # The player must define their own map if this property is not set. | ||||||
|   | |||||||
| @@ -1,66 +0,0 @@ | |||||||
| { |  | ||||||
|   "width": 10, |  | ||||||
|   "height": 10, |  | ||||||
|   "ships": [ |  | ||||||
|     { |  | ||||||
|       "length": 4, |  | ||||||
|       "x": 15, |  | ||||||
|       "y": 5, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 9, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 6, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 4, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 4, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 1, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 6, |  | ||||||
|       "y": 2, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 8, |  | ||||||
|       "y": 2, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 6, |  | ||||||
|       "y": 0, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 8, |  | ||||||
|       "y": 0, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     } |  | ||||||
|   ] |  | ||||||
| } |  | ||||||
| @@ -1,66 +0,0 @@ | |||||||
| { |  | ||||||
|   "width": 10, |  | ||||||
|   "height": 10, |  | ||||||
|   "ships": [ |  | ||||||
|     { |  | ||||||
|       "length": 4, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 5, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 9, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 6, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 4, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 1, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 6, |  | ||||||
|       "y": 2, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 8, |  | ||||||
|       "y": 2, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 6, |  | ||||||
|       "y": 0, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 8, |  | ||||||
|       "y": 0, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     } |  | ||||||
|   ] |  | ||||||
| } |  | ||||||
| @@ -1,66 +0,0 @@ | |||||||
| { |  | ||||||
|   "width": 10, |  | ||||||
|   "height": 10, |  | ||||||
|   "ships": [ |  | ||||||
|     { |  | ||||||
|       "length": 4, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 5, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 9, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 6, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 4, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 4, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 1, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 6, |  | ||||||
|       "y": 2, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 8, |  | ||||||
|       "y": 2, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 6, |  | ||||||
|       "y": 0, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 8, |  | ||||||
|       "y": 0, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     } |  | ||||||
|   ] |  | ||||||
| } |  | ||||||
| @@ -1,60 +0,0 @@ | |||||||
| { |  | ||||||
|   "width": 10, |  | ||||||
|   "height": 10, |  | ||||||
|   "ships": [ |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 9, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 6, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 4, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 4, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 1, |  | ||||||
|       "rot": "DOWN" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 6, |  | ||||||
|       "y": 2, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 8, |  | ||||||
|       "y": 2, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 6, |  | ||||||
|       "y": 0, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 8, |  | ||||||
|       "y": 0, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     } |  | ||||||
|   ] |  | ||||||
| } |  | ||||||
| @@ -1,66 +0,0 @@ | |||||||
| { |  | ||||||
|   "width": 10, |  | ||||||
|   "height": 10, |  | ||||||
|   "ships": [ |  | ||||||
|     { |  | ||||||
|       "length": 4, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 9, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 4, |  | ||||||
|       "y": 9, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 7, |  | ||||||
|       "y": 9, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 2, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 4, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 6, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 7, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 8, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 9, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     } |  | ||||||
|   ] |  | ||||||
| } |  | ||||||
| @@ -1,66 +0,0 @@ | |||||||
| { |  | ||||||
|   "width": 10, |  | ||||||
|   "height": 10, |  | ||||||
|   "ships": [ |  | ||||||
|     { |  | ||||||
|       "length": 4, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 9, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 8, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 3, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 7, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 6, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 5, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 2, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 4, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 3, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 2, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 1, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     }, |  | ||||||
|     { |  | ||||||
|       "length": 1, |  | ||||||
|       "x": 0, |  | ||||||
|       "y": 0, |  | ||||||
|       "rot": "RIGHT" |  | ||||||
|     } |  | ||||||
|   ] |  | ||||||
| } |  | ||||||
| @@ -22,6 +22,7 @@ import com.simsilica.lemur.GuiGlobals; | |||||||
| import com.simsilica.lemur.style.BaseStyles; | import com.simsilica.lemur.style.BaseStyles; | ||||||
| import pp.battleship.client.gui.BattleAppState; | import pp.battleship.client.gui.BattleAppState; | ||||||
| import pp.battleship.client.gui.EditorAppState; | import pp.battleship.client.gui.EditorAppState; | ||||||
|  | import pp.battleship.client.gui.GameMusic; | ||||||
| import pp.battleship.client.gui.SeaAppState; | import pp.battleship.client.gui.SeaAppState; | ||||||
| import pp.battleship.game.client.BattleshipClient; | import pp.battleship.game.client.BattleshipClient; | ||||||
| import pp.battleship.game.client.ClientGameLogic; | import pp.battleship.game.client.ClientGameLogic; | ||||||
| @@ -282,15 +283,14 @@ public class BattleshipApp extends SimpleApplication implements BattleshipClient | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Attaches the music state and sets its initial enabled state. |      * Attaches the background music state and sets its initial enabled state. | ||||||
|      */ |      */ | ||||||
|     private void attachGameMusic() { |     private void attachGameMusic() { | ||||||
|         final GameMusic gameMusic = new GameMusic(); |         final GameMusic gameSound = new GameMusic(); | ||||||
|         gameMusic.setEnabled(GameMusic.enabledInPreferences()); |         gameSound.setEnabled(GameMusic.enabledInPreferences()); | ||||||
|         stateManager.attach(gameMusic); |         stateManager.attach(gameSound); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Updates the application state every frame. |      * Updates the application state every frame. | ||||||
|      * This method is called once per frame during the game loop. |      * This method is called once per frame during the game loop. | ||||||
|   | |||||||
| @@ -80,7 +80,6 @@ public class GameSound extends AbstractAppState implements GameEventListener { | |||||||
|         splashSound = loadSound(app, "Sound/Effects/splash.wav"); //NON-NLS |         splashSound = loadSound(app, "Sound/Effects/splash.wav"); //NON-NLS | ||||||
|         explosionSound = loadSound(app, "Sound/Effects/explosion.wav"); //NON-NLS |         explosionSound = loadSound(app, "Sound/Effects/explosion.wav"); //NON-NLS | ||||||
|         shellFlyingSound = loadSound(app, "Sound/Effects/shell_flying.wav"); |         shellFlyingSound = loadSound(app, "Sound/Effects/shell_flying.wav"); | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -138,7 +137,7 @@ public class GameSound extends AbstractAppState implements GameEventListener { | |||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Handles a recieved {@code SoundEvent} and plays the according sound. |      * Handles a recieved {@code SoundEvent} and plays the according sound. | ||||||
|      * |      *  | ||||||
|      * @param event the Sound event to be processed |      * @param event the Sound event to be processed | ||||||
|      */ |      */ | ||||||
|     @Override |     @Override | ||||||
| @@ -148,7 +147,6 @@ public class GameSound extends AbstractAppState implements GameEventListener { | |||||||
|             case SPLASH -> splash(); |             case SPLASH -> splash(); | ||||||
|             case DESTROYED_SHIP -> shipDestroyed(); |             case DESTROYED_SHIP -> shipDestroyed(); | ||||||
|             case SHELL_FLYING -> shellFly(); |             case SHELL_FLYING -> shellFly(); | ||||||
|  |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -7,22 +7,22 @@ | |||||||
|  |  | ||||||
| package pp.battleship.client; | package pp.battleship.client; | ||||||
|  |  | ||||||
| import com.simsilica.lemur.Button; |  | ||||||
| import com.simsilica.lemur.Checkbox; |  | ||||||
| import com.simsilica.lemur.Label; |  | ||||||
| import com.simsilica.lemur.style.ElementId; |  | ||||||
| import pp.dialog.Dialog; |  | ||||||
| import pp.dialog.StateCheckboxModel; |  | ||||||
| import pp.dialog.TextInputDialog; |  | ||||||
|  |  | ||||||
| import pp.battleship.client.GameMusic; |  | ||||||
| import pp.battleship.client.VolumeSlider; |  | ||||||
|  |  | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.util.prefs.Preferences; | import java.util.prefs.Preferences; | ||||||
|  |  | ||||||
|  | import com.simsilica.lemur.Button; | ||||||
|  | import com.simsilica.lemur.Checkbox; | ||||||
|  | import com.simsilica.lemur.Label; | ||||||
|  | import com.simsilica.lemur.style.ElementId; | ||||||
|  |  | ||||||
| import static pp.battleship.Resources.lookup; | import static pp.battleship.Resources.lookup; | ||||||
|  | import pp.battleship.client.gui.GameMusic; | ||||||
|  | import pp.dialog.Dialog; | ||||||
|  | import pp.dialog.StateCheckboxModel; | ||||||
|  | import pp.dialog.TextInputDialog; | ||||||
|  | import pp.battleship.client.gui.VolumeSlider; | ||||||
|  |  | ||||||
| import static pp.util.PreferencesUtils.getPreferences; | import static pp.util.PreferencesUtils.getPreferences; | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -39,7 +39,7 @@ class Menu extends Dialog { | |||||||
|     private final VolumeSlider slider; |     private final VolumeSlider slider; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Constructs the Menu dialog for the Battleship application. |      * Constructs the Menu dialog for the Battleship application.+ | ||||||
|      * |      * | ||||||
|      * @param app the BattleshipApp instance |      * @param app the BattleshipApp instance | ||||||
|      */ |      */ | ||||||
| @@ -51,17 +51,14 @@ class Menu extends Dialog { | |||||||
|         addChild(new Checkbox(lookup("menu.sound-enabled"), new StateCheckboxModel(app, GameSound.class))); |         addChild(new Checkbox(lookup("menu.sound-enabled"), new StateCheckboxModel(app, GameSound.class))); | ||||||
|  |  | ||||||
|         addChild(new Checkbox(lookup("menu.background-sound-enabled"), new StateCheckboxModel(app, GameMusic.class))); |         addChild(new Checkbox(lookup("menu.background-sound-enabled"), new StateCheckboxModel(app, GameMusic.class))); | ||||||
|  |          | ||||||
|         addChild(slider); |         addChild(slider); | ||||||
|  |  | ||||||
|         addChild(loadButton) |         addChild(loadButton).addClickCommands(s -> ifTopDialog(this::loadDialog)); | ||||||
|                 .addClickCommands(s -> ifTopDialog(this::loadDialog)); |         addChild(saveButton).addClickCommands(s -> ifTopDialog(this::saveDialog)); | ||||||
|         addChild(saveButton) |         addChild(new Button(lookup("menu.return-to-game"))).addClickCommands(s -> ifTopDialog(this::close)); | ||||||
|                 .addClickCommands(s -> ifTopDialog(this::saveDialog)); |         addChild(new Button(lookup("menu.quit"))).addClickCommands(s -> ifTopDialog(app::closeApp)); | ||||||
|         addChild(new Button(lookup("menu.return-to-game"))) |          | ||||||
|                 .addClickCommands(s -> ifTopDialog(this::close)); |  | ||||||
|         addChild(new Button(lookup("menu.quit"))) |  | ||||||
|                 .addClickCommands(s -> ifTopDialog(app::closeApp)); |  | ||||||
|         update(); |         update(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -74,6 +71,11 @@ class Menu extends Dialog { | |||||||
|         saveButton.setEnabled(app.getGameLogic().maySaveMap()); |         saveButton.setEnabled(app.getGameLogic().maySaveMap()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public void update(float delta) { | ||||||
|  |         slider.update(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * As an escape action, this method closes the menu if it is the top dialog. |      * As an escape action, this method closes the menu if it is the top dialog. | ||||||
|      */ |      */ | ||||||
| @@ -149,13 +151,4 @@ class Menu extends Dialog { | |||||||
|     private void saveDialog() { |     private void saveDialog() { | ||||||
|         fileDialog(app.getGameLogic()::saveMap, lookup("menu.map.save")); |         fileDialog(app.getGameLogic()::saveMap, lookup("menu.map.save")); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * Updates the position of the volume control slider. |  | ||||||
|      */ |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public void update(float delta) { |  | ||||||
|         slider.update(); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -7,22 +7,22 @@ | |||||||
|  |  | ||||||
| package pp.battleship.client; | package pp.battleship.client; | ||||||
|  |  | ||||||
| import com.simsilica.lemur.Button; |  | ||||||
| import com.simsilica.lemur.Container; |  | ||||||
| import com.simsilica.lemur.Label; |  | ||||||
| import com.simsilica.lemur.TextField; |  | ||||||
| import com.simsilica.lemur.component.SpringGridLayout; |  | ||||||
| import pp.battleship.server.BattleshipServer; |  | ||||||
| import pp.dialog.Dialog; |  | ||||||
| import pp.dialog.DialogBuilder; |  | ||||||
| import pp.dialog.SimpleDialog; |  | ||||||
|  |  | ||||||
| import java.lang.System.Logger; | import java.lang.System.Logger; | ||||||
| import java.lang.System.Logger.Level; | import java.lang.System.Logger.Level; | ||||||
| import java.util.concurrent.ExecutionException; | import java.util.concurrent.ExecutionException; | ||||||
| import java.util.concurrent.Future; | import java.util.concurrent.Future; | ||||||
|  |  | ||||||
|  | import com.simsilica.lemur.Button; | ||||||
|  | import com.simsilica.lemur.Container; | ||||||
|  | import com.simsilica.lemur.Label; | ||||||
|  | import com.simsilica.lemur.TextField; | ||||||
|  | import com.simsilica.lemur.component.SpringGridLayout; | ||||||
|  |  | ||||||
| import static pp.battleship.Resources.lookup; | import static pp.battleship.Resources.lookup; | ||||||
|  | import pp.battleship.server.BattleshipServer; | ||||||
|  | import pp.dialog.Dialog; | ||||||
|  | import pp.dialog.DialogBuilder; | ||||||
|  | import pp.dialog.SimpleDialog; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * Represents a dialog for setting up a network connection in the Battleship game. |  * Represents a dialog for setting up a network connection in the Battleship game. | ||||||
| @@ -31,7 +31,7 @@ import static pp.battleship.Resources.lookup; | |||||||
| class NetworkDialog extends SimpleDialog { | class NetworkDialog extends SimpleDialog { | ||||||
|     private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName()); |     private static final Logger LOGGER = System.getLogger(NetworkDialog.class.getName()); | ||||||
|     private static final String LOCALHOST = "localhost"; //NON-NLS |     private static final String LOCALHOST = "localhost"; //NON-NLS | ||||||
|     private static final String DEFAULT_PORT = "1234"; //NON-NLS |     private static final String DEFAULT_PORT = "42069"; //NON-NLS | ||||||
|     private final NetworkSupport network; |     private final NetworkSupport network; | ||||||
|     private final TextField host = new TextField(LOCALHOST); |     private final TextField host = new TextField(LOCALHOST); | ||||||
|     private final TextField port = new TextField(DEFAULT_PORT); |     private final TextField port = new TextField(DEFAULT_PORT); | ||||||
| @@ -69,7 +69,7 @@ class NetworkDialog extends SimpleDialog { | |||||||
|                      .setOkClose(false) |                      .setOkClose(false) | ||||||
|                      .setNoClose(false) |                      .setNoClose(false) | ||||||
|                      .build(this); |                      .build(this); | ||||||
|  |          | ||||||
|         //Add the button to start the sever |         //Add the button to start the sever | ||||||
|         addChild(serverButton).addClickCommands(s -> ifTopDialog(this::startServerInThread)); |         addChild(serverButton).addClickCommands(s -> ifTopDialog(this::startServerInThread)); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -0,0 +1,122 @@ | |||||||
|  | package pp.battleship.client.gui; | ||||||
|  |  | ||||||
|  | import static pp.util.PreferencesUtils.getPreferences; | ||||||
|  |  | ||||||
|  | import java.lang.System.Logger; | ||||||
|  | import java.lang.System.Logger.Level; | ||||||
|  | import java.util.prefs.Preferences; | ||||||
|  |  | ||||||
|  | import com.jme3.app.Application; | ||||||
|  | import com.jme3.app.state.AbstractAppState; | ||||||
|  | import com.jme3.app.state.AppStateManager; | ||||||
|  | import com.jme3.asset.AssetLoadException; | ||||||
|  | import com.jme3.asset.AssetNotFoundException; | ||||||
|  | import com.jme3.audio.AudioData; | ||||||
|  | import com.jme3.audio.AudioNode; | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Handles the background music beeing played. Is able to start and stop the music. Set the Volume of the Audio. | ||||||
|  |  */ | ||||||
|  | public class GameMusic extends AbstractAppState{ | ||||||
|  |     private static final Logger LOGGER = System.getLogger(GameMusic.class.getName()); | ||||||
|  |     private static final Preferences PREFERENCES = getPreferences(GameMusic.class); | ||||||
|  |     private static final String ENABLED_PREF = "enabled"; //NON-NLS | ||||||
|  |     private static final String VOLUME_PREF = "volume"; //NON-NLS | ||||||
|  |  | ||||||
|  |     private AudioNode music; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Checks if sound is enabled in the preferences. | ||||||
|  |      * | ||||||
|  |      * @return {@code true} if sound is enabled, {@code false} otherwise. | ||||||
|  |      */ | ||||||
|  |     public static boolean enabledInPreferences() { | ||||||
|  |         return PREFERENCES.getBoolean(ENABLED_PREF, true); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |         /** | ||||||
|  |      * Checks if sound is enabled in the preferences. | ||||||
|  |      * | ||||||
|  |      * @return float to which the volume is set | ||||||
|  |      */ | ||||||
|  |     public static float volumeInPreferences() { | ||||||
|  |         return PREFERENCES.getFloat(VOLUME_PREF, 0.5f); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Initializes the sound effects for the game. | ||||||
|  |      * Overrides {@link AbstractAppState#initialize(AppStateManager, Application)} | ||||||
|  |      * | ||||||
|  |      * @param stateManager The state manager | ||||||
|  |      * @param app          The application | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public void initialize(AppStateManager stateManager, Application app) { | ||||||
|  |         super.initialize(stateManager, app); | ||||||
|  |         music = loadSound(app, "Sound/background.ogg"); | ||||||
|  |         setVolume(volumeInPreferences()); | ||||||
|  |         music.setLooping(true); | ||||||
|  |         if (isEnabled() && music != null) { | ||||||
|  |             music.play(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Loads a sound from the specified file. | ||||||
|  |      * | ||||||
|  |      * @param app  The application | ||||||
|  |      * @param name The name of the sound file. | ||||||
|  |      * @return The loaded AudioNode. | ||||||
|  |      */ | ||||||
|  |     private AudioNode loadSound(Application app, String name) { | ||||||
|  |         try { | ||||||
|  |             final AudioNode sound = new AudioNode(app.getAssetManager(), name, AudioData.DataType.Buffer); | ||||||
|  |             sound.setLooping(false); | ||||||
|  |             sound.setPositional(false); | ||||||
|  |             return sound; | ||||||
|  |         } | ||||||
|  |         catch (AssetLoadException | AssetNotFoundException ex) { | ||||||
|  |             LOGGER.log(Level.ERROR, ex.getMessage(), ex); | ||||||
|  |         } | ||||||
|  |         return null; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Sets the enabled state of this AppState. | ||||||
|  |      * Overrides {@link com.jme3.app.state.AbstractAppState#setEnabled(boolean)} | ||||||
|  |      * | ||||||
|  |      * @param enabled {@code true} to enable the AppState, {@code false} to disable it. | ||||||
|  |      */ | ||||||
|  |     @Override | ||||||
|  |     public void setEnabled(boolean enabled) { | ||||||
|  |         if (isEnabled() == enabled) return; | ||||||
|  |  | ||||||
|  |         if (music != null) { | ||||||
|  |             if (enabled) { | ||||||
|  |                 music.play(); | ||||||
|  |             } else { | ||||||
|  |                 music.stop(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |      | ||||||
|  |         super.setEnabled(enabled); | ||||||
|  |         LOGGER.log(Level.INFO, "Sound enabled: {0}", enabled); //NON-NLS | ||||||
|  |         PREFERENCES.putBoolean(ENABLED_PREF, enabled); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Toggles the game sound on or off. | ||||||
|  |      */ | ||||||
|  |     public void toggleSound() { | ||||||
|  |         setEnabled(!isEnabled()); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Sets the volume of music | ||||||
|  |      * @param vol the volume to which the music should be set | ||||||
|  |      */ | ||||||
|  |     public void setVolume(float vol){ | ||||||
|  |         music.setVolume(vol); | ||||||
|  |         PREFERENCES.putFloat(VOLUME_PREF, vol); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -15,10 +15,12 @@ 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.Sphere; | import com.jme3.scene.shape.Sphere; | ||||||
|  |  | ||||||
| import pp.battleship.model.Battleship; | import pp.battleship.model.Battleship; | ||||||
| import pp.battleship.model.Shell; | import pp.battleship.model.Shell; | ||||||
| import pp.battleship.model.Shot; | import pp.battleship.model.Shot; | ||||||
| import pp.util.Position; | import pp.util.Position; | ||||||
|  |  | ||||||
| import static com.jme3.material.Materials.UNSHADED; | import static com.jme3.material.Materials.UNSHADED; | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -130,7 +132,7 @@ class MapViewSynchronizer extends ShipMapSynchronizer { | |||||||
|         return view.getApp().getDraw().makeFatLine(x1, y1, x2, y2, SHIP_DEPTH, color, SHIP_LINE_WIDTH); |         return view.getApp().getDraw().makeFatLine(x1, y1, x2, y2, SHIP_DEPTH, color, SHIP_LINE_WIDTH); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |         /** | ||||||
|      * Creates and returns a Spatial representation of the given {@code Shell} object |      * Creates and returns a Spatial representation of the given {@code Shell} object | ||||||
|      * for 2D visualization in the game. The shell is represented as a circle. |      * for 2D visualization in the game. The shell is represented as a circle. | ||||||
|      * |      * | ||||||
| @@ -148,6 +150,5 @@ class MapViewSynchronizer extends ShipMapSynchronizer { | |||||||
|         ellipse.setMaterial(mat); |         ellipse.setMaterial(mat); | ||||||
|         ellipse.addControl(new Shell2DControl(view, shell)); |         ellipse.addControl(new Shell2DControl(view, shell)); | ||||||
|         return ellipse; |         return ellipse; | ||||||
|     } |     }       | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -7,28 +7,30 @@ import com.jme3.material.Material; | |||||||
| 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.battleship.client.BattleshipApp; | import pp.battleship.client.BattleshipApp; | ||||||
| 
 | 
 | ||||||
| public class ParticleCreator { | /** | ||||||
|  |  * Factory class responsible for creating particle effects used in the game. | ||||||
|  |  * This centralizes the creation of various types of particle emitters. | ||||||
|  |  */ | ||||||
|  | public class ParticleEffectFactory { | ||||||
|     private static final int COUNT_FACTOR = 1; |     private static final int COUNT_FACTOR = 1; | ||||||
|     private static final float COUNT_FACTOR_F = 1f; |     private static final float COUNT_FACTOR_F = 1f; | ||||||
|     private static final boolean POINT_SPRITE = true; |     private static final boolean POINT_SPRITE = true; | ||||||
|     private static final Type EMITTER_TYPE = POINT_SPRITE ? Type.Point : Type.Triangle; |     private static final Type EMITTER_TYPE = POINT_SPRITE ? Type.Point : Type.Triangle; | ||||||
| 
 |      | ||||||
|     private final BattleshipApp app; |     private final BattleshipApp app; | ||||||
| 
 | 
 | ||||||
|     ParticleCreator(BattleshipApp app) { |     ParticleEffectFactory(BattleshipApp app) { | ||||||
|         this.app = app; |         this.app = app; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Creates a flame particle emitter. |      * Creates a flame particle emitter. | ||||||
|      * |      *  | ||||||
|      * @return a configured flame particle emitter |      * @return a configured flame particle emitter | ||||||
|      */ |      */ | ||||||
| 
 |     ParticleEmitter createFlame() { | ||||||
|      ParticleEmitter createFlame(){ |  | ||||||
|         ParticleEmitter flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR); |         ParticleEmitter flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR); | ||||||
|         flame.setSelectRandomImage(true); |         flame.setSelectRandomImage(true); | ||||||
|         flame.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (1f / COUNT_FACTOR_F))); |         flame.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (1f / COUNT_FACTOR_F))); | ||||||
| @@ -54,7 +56,7 @@ public class ParticleCreator { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Creates a flash particle emitter. |      * Creates a flash particle emitter. | ||||||
|      * |      *  | ||||||
|      * @return a configured flash particle emitter |      * @return a configured flash particle emitter | ||||||
|      */ |      */ | ||||||
|     ParticleEmitter createFlash() { |     ParticleEmitter createFlash() { | ||||||
| @@ -83,7 +85,7 @@ public class ParticleCreator { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Creates a round spark particle emitter. |      * Creates a round spark particle emitter. | ||||||
|      * |      *  | ||||||
|      * @return a configured round spark particle emitter |      * @return a configured round spark particle emitter | ||||||
|      */ |      */ | ||||||
|     ParticleEmitter createRoundSpark() { |     ParticleEmitter createRoundSpark() { | ||||||
| @@ -111,7 +113,7 @@ public class ParticleCreator { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Creates a spark particle emitter. |      * Creates a spark particle emitter. | ||||||
|      * |      *  | ||||||
|      * @return a configured spark particle emitter |      * @return a configured spark particle emitter | ||||||
|      */ |      */ | ||||||
|     ParticleEmitter createSpark() { |     ParticleEmitter createSpark() { | ||||||
| @@ -123,9 +125,9 @@ public class ParticleCreator { | |||||||
|         spark.setFacingVelocity(true); |         spark.setFacingVelocity(true); | ||||||
|         spark.setParticlesPerSec(0); |         spark.setParticlesPerSec(0); | ||||||
|         spark.setGravity(0, 5, 0); |         spark.setGravity(0, 5, 0); | ||||||
|         spark.setLowLife(0.5f); |         spark.setLowLife(1.1f); | ||||||
|         spark.setHighLife(1.5f); |         spark.setHighLife(1.5f); | ||||||
|         spark.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 8, 0)); // y20 |         spark.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 20, 0)); | ||||||
|         spark.getParticleInfluencer().setVelocityVariation(1); |         spark.getParticleInfluencer().setVelocityVariation(1); | ||||||
|         spark.setImagesX(1); |         spark.setImagesX(1); | ||||||
|         spark.setImagesY(1); |         spark.setImagesY(1); | ||||||
| @@ -138,7 +140,7 @@ public class ParticleCreator { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Creates a smoke trail particle emitter. |      * Creates a smoke trail particle emitter. | ||||||
|      * |      *  | ||||||
|      * @return a configured smoke trail particle emitter |      * @return a configured smoke trail particle emitter | ||||||
|      */ |      */ | ||||||
|     ParticleEmitter createSmokeTrail() { |     ParticleEmitter createSmokeTrail() { | ||||||
| @@ -165,7 +167,7 @@ public class ParticleCreator { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Creates a debris particle emitter. |      * Creates a debris particle emitter. | ||||||
|      * |      *  | ||||||
|      * @return a configured debris particle emitter |      * @return a configured debris particle emitter | ||||||
|      */ |      */ | ||||||
|     ParticleEmitter createDebris() { |     ParticleEmitter createDebris() { | ||||||
| @@ -194,7 +196,7 @@ public class ParticleCreator { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Creates a shockwave particle emitter. |      * Creates a shockwave particle emitter. | ||||||
|      * |      *  | ||||||
|      * @return a configured shockwave particle emitter |      * @return a configured shockwave particle emitter | ||||||
|      */ |      */ | ||||||
|     ParticleEmitter createShockwave() { |     ParticleEmitter createShockwave() { | ||||||
| @@ -221,7 +223,7 @@ public class ParticleCreator { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Creates a moving smoke emitter. |      * Creates a moving smoke emitter. | ||||||
|      * |      *  | ||||||
|      * @return a configured smoke emitter |      * @return a configured smoke emitter | ||||||
|      */ |      */ | ||||||
|     ParticleEmitter createMovingSmokeEmitter() { |     ParticleEmitter createMovingSmokeEmitter() { | ||||||
| @@ -241,20 +243,20 @@ public class ParticleCreator { | |||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Creates a one-time water splash particle emitter. |      * Creates a one-time water splash particle emitter. | ||||||
|      * |      *  | ||||||
|      * @return a configured one-time water splash particle emitter |      * @return a configured one-time water splash particle emitter | ||||||
|      */ |      */ | ||||||
|     public ParticleEmitter createWaterSplash() { |     public ParticleEmitter createWaterSplash() { | ||||||
|         // Create a new particle emitter for the splash effect |         // Create a new particle emitter for the splash effect | ||||||
|         ParticleEmitter waterSplash = new ParticleEmitter("WaterSplash", Type.Triangle, 30); |         ParticleEmitter waterSplash = new ParticleEmitter("WaterSplash", Type.Triangle, 30); | ||||||
| 
 |          | ||||||
|         // Set the shape of the emitter, making particles emit from a point or small area |         // Set the shape of the emitter, making particles emit from a point or small area | ||||||
|         waterSplash.setShape(new EmitterSphereShape(Vector3f.ZERO, 0.2f)); |         waterSplash.setShape(new EmitterSphereShape(Vector3f.ZERO, 0.2f)); | ||||||
| 
 |          | ||||||
|         // Start and end colors for water (blue, fading out) |         // Start and end colors for water (blue, fading out) | ||||||
|         waterSplash.setStartColor(new ColorRGBA(0.4f, 0.4f, 1f, 1f));  // Light blue at start |         waterSplash.setStartColor(new ColorRGBA(0.4f, 0.4f, 1f, 1f));  // Light blue at start | ||||||
|         waterSplash.setEndColor(new ColorRGBA(0.4f, 0.4f, 1f, 0f));    // Transparent at the end |         waterSplash.setEndColor(new ColorRGBA(0.4f, 0.4f, 1f, 0f));    // Transparent at the end | ||||||
| 
 |          | ||||||
|         // Particle size: small at start, larger before fading out |         // Particle size: small at start, larger before fading out | ||||||
|         waterSplash.setStartSize(0.1f); |         waterSplash.setStartSize(0.1f); | ||||||
|         waterSplash.setEndSize(0.3f); |         waterSplash.setEndSize(0.3f); | ||||||
| @@ -265,14 +267,14 @@ public class ParticleCreator { | |||||||
| 
 | 
 | ||||||
|         // Gravity: Pull the water particles downwards |         // Gravity: Pull the water particles downwards | ||||||
|         waterSplash.setGravity(0, -9.81f, 0);  // Earth's gravity simulation |         waterSplash.setGravity(0, -9.81f, 0);  // Earth's gravity simulation | ||||||
| 
 |          | ||||||
|         // Velocity: Give particles an initial burst upward (simulates splash) |         // Velocity: Give particles an initial burst upward (simulates splash) | ||||||
|         waterSplash.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 3, 0)); |         waterSplash.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 3, 0)); | ||||||
|         waterSplash.getParticleInfluencer().setVelocityVariation(0.6f);  // Add randomness to splash |         waterSplash.getParticleInfluencer().setVelocityVariation(0.6f);  // Add randomness to splash | ||||||
| 
 |          | ||||||
|         // Set how many particles are emitted per second (0 to emit all particles at once) |         // Set how many particles are emitted per second (0 to emit all particles at once) | ||||||
|         waterSplash.setParticlesPerSec(0); |         waterSplash.setParticlesPerSec(0); | ||||||
| 
 |          | ||||||
|         // Load a texture for the water splash (assuming a texture exists at this path) |         // Load a texture for the water splash (assuming a texture exists at this path) | ||||||
|         Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md"); |         Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md"); | ||||||
|         mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Splash/splash.png")); |         mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Splash/splash.png")); | ||||||
| @@ -280,5 +282,4 @@ public class ParticleCreator { | |||||||
| 
 | 
 | ||||||
|         return waterSplash; |         return waterSplash; | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
| } | } | ||||||
| @@ -37,9 +37,9 @@ import static pp.util.FloatMath.PI; | |||||||
| class SeaSynchronizer extends ShipMapSynchronizer { | class SeaSynchronizer extends ShipMapSynchronizer { | ||||||
|     private static final String UNSHADED = "Common/MatDefs/Misc/Unshaded.j3md"; //NON-NLS |     private static final String UNSHADED = "Common/MatDefs/Misc/Unshaded.j3md"; //NON-NLS | ||||||
|     private static final String KING_GEORGE_V_MODEL = "Models/KingGeorgeV/KingGeorgeV.j3o"; //NON-NLS |     private static final String KING_GEORGE_V_MODEL = "Models/KingGeorgeV/KingGeorgeV.j3o"; //NON-NLS | ||||||
|     private static final String SMALL_SHIP_MODEL = "Models/SmallShip/SmallShip.j3o"; //NON-NLS |     private static final String BOAT_SMALL_MODEL = "Models/BoatSmall/12219_boat_v2_L2.j3o"; //NON-NLS | ||||||
|     private static final String U_BOAT_MODEL = "Models/WWII_ship_German_Type_II_U-boat_v2/WW2Uboat.j3o"; //NON-NLS |     private static final String CV_MODEL = "Models/CV/CV.j3o"; //NON-NLS | ||||||
|     private static final String TUG_BOAT_MODEL = "Models/TugBoat/TugBoat.j3o"; //NON-NLS |     private static final String BATTLE_MODEL = "Models/Battle/Battle.j3o"; //NON-NLS | ||||||
|     private static final String LIGHTING = "Common/MatDefs/Light/Lighting.j3md"; |     private static final String LIGHTING = "Common/MatDefs/Light/Lighting.j3md"; | ||||||
|     private static final String COLOR = "Color"; //NON-NLS |     private static final String COLOR = "Color"; //NON-NLS | ||||||
|     private static final String SHIP = "ship"; //NON-NLS |     private static final String SHIP = "ship"; //NON-NLS | ||||||
| @@ -50,8 +50,7 @@ class SeaSynchronizer extends ShipMapSynchronizer { | |||||||
|  |  | ||||||
|     private final ShipMap map; |     private final ShipMap map; | ||||||
|     private final BattleshipApp app; |     private final BattleshipApp app; | ||||||
|     private final ParticleCreator particlecreator; |     private final ParticleEffectFactory particleFactory; | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Constructs a {@code SeaSynchronizer} object with the specified application, root node, and ship map. |      * Constructs a {@code SeaSynchronizer} object with the specified application, root node, and ship map. | ||||||
| @@ -64,7 +63,7 @@ class SeaSynchronizer extends ShipMapSynchronizer { | |||||||
|         super(app.getGameLogic().getOwnMap(), root); |         super(app.getGameLogic().getOwnMap(), root); | ||||||
|         this.app = app; |         this.app = app; | ||||||
|         this.map = map; |         this.map = map; | ||||||
|         this.particlecreator = new ParticleCreator(app); |         this.particleFactory = new ParticleEffectFactory(app); | ||||||
|         addExisting(); |         addExisting(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -91,7 +90,7 @@ class SeaSynchronizer extends ShipMapSynchronizer { | |||||||
|         Node shotNode = new Node("ShotNode"); |         Node shotNode = new Node("ShotNode"); | ||||||
|         Geometry shotCylinder = createCylinder(shot); |         Geometry shotCylinder = createCylinder(shot); | ||||||
|         shotNode.attachChild(shotCylinder); |         shotNode.attachChild(shotCylinder); | ||||||
|         ParticleEmitter waterSplash = particlecreator.createWaterSplash(); |         ParticleEmitter waterSplash = particleFactory.createWaterSplash(); | ||||||
|         waterSplash.setLocalTranslation(shot.getY() + 0.5f, 0f, shot.getX() + 0.5f); |         waterSplash.setLocalTranslation(shot.getY() + 0.5f, 0f, shot.getX() + 0.5f); | ||||||
|         shotNode.attachChild(waterSplash); |         shotNode.attachChild(waterSplash); | ||||||
|         waterSplash.emitAllParticles(); |         waterSplash.emitAllParticles(); | ||||||
| @@ -104,46 +103,45 @@ class SeaSynchronizer extends ShipMapSynchronizer { | |||||||
|      * @param ship the ship to be sunk |      * @param ship the ship to be sunk | ||||||
|      */ |      */ | ||||||
|     private void sinkAndRemoveShip(Battleship ship) { |     private void sinkAndRemoveShip(Battleship ship) { | ||||||
|         Battleship dasIstGelebteTeamarbeit = ship; |         Battleship wilkeningklaunichtmeinencode = ship; | ||||||
|         final Node shipNode = (Node) getSpatial(dasIstGelebteTeamarbeit); |         final Node shipNode = (Node) getSpatial(wilkeningklaunichtmeinencode); | ||||||
|         if (shipNode == null) return; |         if (shipNode == null) return; | ||||||
|  |  | ||||||
|         // Add sinking control to animate the sinking |         // Add sinking control to animate the sinking | ||||||
|         shipNode.addControl(new SinkControl(shipNode)); |         shipNode.addControl(new SinkingControl(shipNode)); | ||||||
|  |  | ||||||
|         // Add particle effects |         // Add particle effects | ||||||
|         ParticleEmitter bubbles = particlecreator.createWaterSplash(); |         ParticleEmitter bubbles = particleFactory.createWaterSplash(); | ||||||
|         bubbles.setLocalTranslation(shipNode.getLocalTranslation()); |         bubbles.setLocalTranslation(shipNode.getLocalTranslation()); | ||||||
|         shipNode.attachChild(bubbles); |         shipNode.attachChild(bubbles); | ||||||
|         bubbles.emitAllParticles(); |         bubbles.emitAllParticles(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Handles a hit by attaching its representation to the node that |      * Handles a hit by attaching its representation to the node that | ||||||
|      * contains the ship model as a child so that it moves with the ship. |      * contains the ship model as a child so that it moves with the ship. | ||||||
|      * |      * | ||||||
|      * @param shot a hit |      * @param shot a hit | ||||||
|      * @return always null to prevent the representation from being attached |      * @return always null to prevent the representation from being attached to the items node as well | ||||||
|      * to the items node as well |  | ||||||
|      */ |      */ | ||||||
|     private Spatial handleHit(Shot shot) { |     private Spatial handleHit(Shot shot) { | ||||||
|         final Battleship ship = requireNonNull(map.findShipAt(shot), "Missing ship"); |         final Battleship ship = requireNonNull(map.findShipAt(shot), "Missing ship"); | ||||||
|         final Node shipNode = requireNonNull((Node) getSpatial(ship), "Missing ship node"); |         final Node shipNode = requireNonNull((Node) getSpatial(ship), "Missing ship node"); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         // Create a new node specifically for the hit effects |         // Create a new node specifically for the hit effects | ||||||
|         Node hitEffectNode = new Node("HitEffectNode"); |         Node hitEffectNode = new Node("HitEffectNode"); | ||||||
|  |  | ||||||
|         // Create particle effects |         // Create particle effects | ||||||
|         ParticleEmitter flame = particlecreator.createFlame(); |         ParticleEmitter flame = particleFactory.createFlame(); | ||||||
|         ParticleEmitter flash = particlecreator.createFlash(); |         ParticleEmitter flash = particleFactory.createFlash(); | ||||||
|         ParticleEmitter spark = particlecreator.createSpark(); |         ParticleEmitter spark = particleFactory.createSpark(); | ||||||
|         ParticleEmitter roundSpark = particlecreator.createRoundSpark(); |         ParticleEmitter roundSpark = particleFactory.createRoundSpark(); | ||||||
|         ParticleEmitter smokeTrail = particlecreator.createSmokeTrail(); |         ParticleEmitter smokeTrail = particleFactory.createSmokeTrail(); | ||||||
|         ParticleEmitter debris = particlecreator.createDebris(); |         ParticleEmitter debris = particleFactory.createDebris(); | ||||||
|         ParticleEmitter shockwave = particlecreator.createShockwave(); |         ParticleEmitter shockwave = particleFactory.createShockwave(); | ||||||
|         ParticleEmitter movingSmoke = particlecreator.createMovingSmokeEmitter(); |         ParticleEmitter movingSmoke = particleFactory.createMovingSmokeEmitter(); | ||||||
|  |  | ||||||
|         // Attach all effects to the hitEffectNode |         // Attach all effects to the hitEffectNode | ||||||
|         hitEffectNode.attachChild(flame); |         hitEffectNode.attachChild(flame); | ||||||
| @@ -157,8 +155,8 @@ class SeaSynchronizer extends ShipMapSynchronizer { | |||||||
|  |  | ||||||
|         // Set the local translation for the hit effect to the point of impact |         // Set the local translation for the hit effect to the point of impact | ||||||
|         hitEffectNode.setLocalTranslation(shot.getY() + 0.5f - shipNode.getLocalTranslation().x, |         hitEffectNode.setLocalTranslation(shot.getY() + 0.5f - shipNode.getLocalTranslation().x, | ||||||
|                 0.5f, // Adjust as needed for height above the ship |                                           0.5f, // Adjust as needed for height above the ship | ||||||
|                 shot.getX() + 0.5f - shipNode.getLocalTranslation().z); |                                           shot.getX() + 0.5f - shipNode.getLocalTranslation().z); | ||||||
|  |  | ||||||
|         // Attach the hitEffectNode to the shipNode so it moves with the ship |         // Attach the hitEffectNode to the shipNode so it moves with the ship | ||||||
|         shipNode.attachChild(hitEffectNode); |         shipNode.attachChild(hitEffectNode); | ||||||
| @@ -231,18 +229,12 @@ class SeaSynchronizer extends ShipMapSynchronizer { | |||||||
|      */ |      */ | ||||||
|     private Spatial createShip(Battleship ship) { |     private Spatial createShip(Battleship ship) { | ||||||
|         switch (ship.getLength()) { |         switch (ship.getLength()) { | ||||||
|             case 4: |             case 4: return createBattleship(ship); | ||||||
|                 return createBattleship(ship); |             case 3: return createCV(ship); | ||||||
|             case 3: |             case 2: return createBattle(ship); | ||||||
|                 return createLargeship(ship); |             case 1: return createSmallship(ship); | ||||||
|             case 2: |             default: return createBox(ship); | ||||||
|                return createMediumship(ship); |  | ||||||
|             case 1: |  | ||||||
|                return createSmallship(ship); |  | ||||||
|             default: |  | ||||||
|                 return createBox(ship); |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @@ -292,13 +284,20 @@ class SeaSynchronizer extends ShipMapSynchronizer { | |||||||
|  |  | ||||||
|         model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f); |         model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f); | ||||||
|         model.scale(1.48f); |         model.scale(1.48f); | ||||||
|  |         // model.scale(0.0007f); | ||||||
|         model.setShadowMode(ShadowMode.CastAndReceive); |         model.setShadowMode(ShadowMode.CastAndReceive); | ||||||
|  |  | ||||||
|         return model; |         return model; | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     /** | ||||||
|  |      * Creates a detailed 3D model to represent a small tug boat. | ||||||
|  |      * | ||||||
|  |      * @param ship the battleship to be represented | ||||||
|  |      * @return the spatial representing a small tug boat | ||||||
|  |      */ | ||||||
|     private Spatial createSmallship(Battleship ship) { |     private Spatial createSmallship(Battleship ship) { | ||||||
|         final Spatial model = app.getAssetManager().loadModel(SMALL_SHIP_MODEL); |         final Spatial model = app.getAssetManager().loadModel(BOAT_SMALL_MODEL); | ||||||
|  |  | ||||||
|         model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f); |         model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f); | ||||||
|         model.scale(0.0005f); |         model.scale(0.0005f); | ||||||
| @@ -307,21 +306,35 @@ class SeaSynchronizer extends ShipMapSynchronizer { | |||||||
|         return model; |         return model; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private Spatial createMediumship(Battleship ship) { |     /** | ||||||
|         final Spatial model = app.getAssetManager().loadModel(U_BOAT_MODEL); |      * Creates a detailed 3D model to represent a "German WWII UBoat". | ||||||
|  |      * | ||||||
|  |      * @param ship the battleship to be represented | ||||||
|  |      * @return the spatial representing the "German WWII UBoat" | ||||||
|  |      */ | ||||||
|  |     private Spatial createCV(Battleship ship) { | ||||||
|  |         final Spatial model = app.getAssetManager().loadModel(CV_MODEL); | ||||||
|  |  | ||||||
|         model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f); |         model.rotate(0f, calculateRotationAngle(ship.getRot()), 0f); | ||||||
|         model.scale(0.27f); |         model.move(0f, 0.25f, 0f); | ||||||
|  |         model.scale(0.85f); | ||||||
|         model.setShadowMode(ShadowMode.CastAndReceive); |         model.setShadowMode(ShadowMode.CastAndReceive); | ||||||
|  |  | ||||||
|         return model; |         return model; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private Spatial createLargeship(Battleship ship) { |     /** | ||||||
|         final Spatial model = app.getAssetManager().loadModel(TUG_BOAT_MODEL); |      * Creates a detailed 3D model to represent a battleship. | ||||||
|  |      * | ||||||
|  |      * @param ship the battleship to be represented | ||||||
|  |      * @return the spatial representing a battleship | ||||||
|  |      */ | ||||||
|  |     private Spatial createBattle(Battleship ship) { | ||||||
|  |         final Spatial model = app.getAssetManager().loadModel(BATTLE_MODEL); | ||||||
|  |  | ||||||
|         model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f); |         model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f); | ||||||
|         model.scale(0.0004f); |         model.move(0f, -0.06f, 0f); | ||||||
|  |         model.scale(0.27f); | ||||||
|         model.setShadowMode(ShadowMode.CastAndReceive); |         model.setShadowMode(ShadowMode.CastAndReceive); | ||||||
|  |  | ||||||
|         return model; |         return model; | ||||||
| @@ -362,4 +375,4 @@ class SeaSynchronizer extends ShipMapSynchronizer { | |||||||
|         model.addControl(new ShellControl(shell)); |         model.addControl(new ShellControl(shell)); | ||||||
|         return model; |         return model; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -42,6 +42,14 @@ public class Shell2DControl extends AbstractControl { | |||||||
|         spatial.setLocalTranslation(viewPos.getX() + MapView.FIELD_SIZE / 2, viewPos.getY() + MapView.FIELD_SIZE / 2, 0); |         spatial.setLocalTranslation(viewPos.getX() + MapView.FIELD_SIZE / 2, viewPos.getY() + MapView.FIELD_SIZE / 2, 0); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * This method is called during the rendering phase, but it does not perform any | ||||||
|  |      * operations in this implementation as the control only influences the spatial's | ||||||
|  |      * transformation, not its rendering process. | ||||||
|  |      * | ||||||
|  |      * @param rm the RenderManager rendering the controlled Spatial (not null) | ||||||
|  |      * @param vp the ViewPort being rendered (not null) | ||||||
|  |      */ | ||||||
|     @Override |     @Override | ||||||
|     protected void controlRender(RenderManager rm, ViewPort vp) { |     protected void controlRender(RenderManager rm, ViewPort vp) { | ||||||
|         // No rendering-specific behavior required for this control |         // No rendering-specific behavior required for this control | ||||||
|   | |||||||
| @@ -43,6 +43,14 @@ public class ShellControl extends AbstractControl { | |||||||
|         spatial.rotate(PI/2,0,0); |         spatial.rotate(PI/2,0,0); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * This method is called during the rendering phase, but it does not perform any | ||||||
|  |      * operations in this implementation as the control only influences the spatial's | ||||||
|  |      * transformation, not its rendering process. | ||||||
|  |      * | ||||||
|  |      * @param rm the RenderManager rendering the controlled Spatial (not null) | ||||||
|  |      * @param vp the ViewPort being rendered (not null) | ||||||
|  |      */ | ||||||
|     @Override |     @Override | ||||||
|     protected void controlRender(RenderManager rm, ViewPort vp) { |     protected void controlRender(RenderManager rm, ViewPort vp) { | ||||||
|         // No rendering-specific behavior required for this control |         // No rendering-specific behavior required for this control | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ import com.jme3.scene.Node; | |||||||
|  * Control that handles the sinking effect for destroyed ships. |  * Control that handles the sinking effect for destroyed ships. | ||||||
|  * It will gradually move the ship downwards and then remove it from the scene. |  * It will gradually move the ship downwards and then remove it from the scene. | ||||||
|  */ |  */ | ||||||
| class SinkControl extends AbstractControl { | class SinkingControl extends AbstractControl { | ||||||
|     private static final float SINK_DURATION = 5f;  // Duration of the sinking animation |     private static final float SINK_DURATION = 5f;  // Duration of the sinking animation | ||||||
|     private static final float SINK_SPEED = 0.1f;   // Speed at which the ship sinks |     private static final float SINK_SPEED = 0.1f;   // Speed at which the ship sinks | ||||||
|     private float elapsedTime = 0; |     private float elapsedTime = 0; | ||||||
| @@ -21,13 +21,13 @@ class SinkControl extends AbstractControl { | |||||||
|      * Constructs a {@code SinkingControl} object with the shipNode to be to be sunk |      * Constructs a {@code SinkingControl} object with the shipNode to be to be sunk | ||||||
|      * @param shipNode the node to handeld |      * @param shipNode the node to handeld | ||||||
|      */ |      */ | ||||||
|     public SinkControl(Node shipNode) { |     public SinkingControl(Node shipNode) { | ||||||
|         this.shipNode = shipNode; |         this.shipNode = shipNode; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Updated the Map to sink the ship |      * Updated the Map to sink the ship | ||||||
|      * |      *  | ||||||
|      * @param tpf time per frame |      * @param tpf time per frame | ||||||
|      */ |      */ | ||||||
|     @Override |     @Override | ||||||
| @@ -46,9 +46,16 @@ class SinkControl extends AbstractControl { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * This method is called during the rendering phase, but it does not perform any | ||||||
|  |      * operations in this implementation as the control only influences the spatial's | ||||||
|  |      * transformation, not its rendering process. | ||||||
|  |      * | ||||||
|  |      * @param rm the RenderManager rendering the controlled Spatial (not null) | ||||||
|  |      * @param vp the ViewPort being rendered (not null) | ||||||
|  |      */ | ||||||
|     @Override |     @Override | ||||||
|     protected void controlRender(RenderManager rm, ViewPort vp) { |     protected void controlRender(RenderManager rm, ViewPort vp) { | ||||||
|         // No rendering-related code needed |         // No rendering-related code needed | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 |  | ||||||
| @@ -1,13 +1,21 @@ | |||||||
| package pp.battleship.client; | package pp.battleship.client.gui; | ||||||
| 
 | 
 | ||||||
| import com.simsilica.lemur.Slider; | import com.simsilica.lemur.Slider; | ||||||
| 
 | 
 | ||||||
|  | /** | ||||||
|  |  * The VolumeSlider class represents the Volume Slider in the Menu. | ||||||
|  |  * It extends the Slider class and provides functionalities for setting the music volume, | ||||||
|  |  * with the help of the Slider in the GUI  | ||||||
|  |  */ | ||||||
| public class VolumeSlider extends Slider { | public class VolumeSlider extends Slider { | ||||||
| 
 | 
 | ||||||
|     private final GameMusic music; |     private final GameMusic music; | ||||||
| 
 |  | ||||||
|     private double vol; |     private double vol; | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Constructs the Volume Slider for the Menu dialog | ||||||
|  |      * @param music the music instance | ||||||
|  |      */ | ||||||
|     public VolumeSlider(GameMusic music) { |     public VolumeSlider(GameMusic music) { | ||||||
|         super(); |         super(); | ||||||
|         this.music = music; |         this.music = music; | ||||||
| @@ -15,10 +23,14 @@ public class VolumeSlider extends Slider { | |||||||
|         getModel().setPercent(vol); |         getModel().setPercent(vol); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * when triggered it updates the volume to the value set with the slider | ||||||
|  |      */ | ||||||
|     public void update() { |     public void update() { | ||||||
|         if (vol != getModel().getPercent()) { |         if (vol != getModel().getPercent()) { | ||||||
|             vol = getModel().getPercent(); |             vol = getModel().getPercent(); | ||||||
|             music.setVolume( (float) vol); |             music.setVolume( (float) vol); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } |      | ||||||
|  | } | ||||||
| @@ -18,8 +18,8 @@ import pp.battleship.BattleshipConfig; | |||||||
| import pp.battleship.game.server.Player; | import pp.battleship.game.server.Player; | ||||||
| import pp.battleship.game.server.ServerGameLogic; | import pp.battleship.game.server.ServerGameLogic; | ||||||
| import pp.battleship.game.server.ServerSender; | import pp.battleship.game.server.ServerSender; | ||||||
| import pp.battleship.message.client.ClientMessage; |  | ||||||
| import pp.battleship.message.client.AnimationFinishedMessage; | import pp.battleship.message.client.AnimationFinishedMessage; | ||||||
|  | import pp.battleship.message.client.ClientMessage; | ||||||
| import pp.battleship.message.client.MapMessage; | import pp.battleship.message.client.MapMessage; | ||||||
| import pp.battleship.message.client.ShootMessage; | import pp.battleship.message.client.ShootMessage; | ||||||
| import pp.battleship.message.server.EffectMessage; | import pp.battleship.message.server.EffectMessage; | ||||||
| @@ -179,5 +179,4 @@ public class BattleshipServer implements MessageListener<HostedConnection>, Conn | |||||||
|         else |         else | ||||||
|             LOGGER.log(Level.ERROR, "there is no connection with id={0}", id); //NON-NLS |             LOGGER.log(Level.ERROR, "there is no connection with id={0}", id); //NON-NLS | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -15,4 +15,3 @@ record ReceivedMessage(ClientMessage message, int from) { | |||||||
|         message.accept(interpreter, from); |         message.accept(interpreter, from); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 168 KiB | 
| Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB | 
| Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 166 KiB | 
| Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB | 
| After Width: | Height: | Size: 35 KiB | 
| After Width: | Height: | Size: 54 KiB | 
| After Width: | Height: | Size: 9.3 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Projekte/battleship/client/src/main/resources/Models/CV/CV.j3o
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 66 KiB | 
| After Width: | Height: | Size: 3.2 KiB | 
| After Width: | Height: | Size: 30 KiB | 
| After Width: | Height: | Size: 10 KiB | 
| After Width: | Height: | Size: 9.4 KiB | 
| After Width: | Height: | Size: 264 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Projekte/battleship/client/src/main/resources/Models/CV/_2.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 80 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Projekte/battleship/client/src/main/resources/Models/CV/_6.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 91 KiB | 
| After Width: | Height: | Size: 33 KiB | 
| After Width: | Height: | Size: 98 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 78 B | 
| After Width: | Height: | Size: 79 B | 
| After Width: | Height: | Size: 96 KiB | 
| After Width: | Height: | Size: 82 KiB | 
							
								
								
									
										
											BIN
										
									
								
								Projekte/battleship/client/src/main/resources/Models/CV/prev.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 670 KiB | 
| Before Width: | Height: | Size: 51 KiB | 
| Before Width: | Height: | Size: 29 KiB | 
| Before Width: | Height: | Size: 30 KiB | 
| Before Width: | Height: | Size: 47 KiB | 
| @@ -42,9 +42,15 @@ public class ModelExporter extends SimpleApplication { | |||||||
|     @Override |     @Override | ||||||
|     public void simpleInitApp() { |     public void simpleInitApp() { | ||||||
|         export("Models/KingGeorgeV/King_George_V.obj", "KingGeorgeV.j3o"); //NON-NLS |         export("Models/KingGeorgeV/King_George_V.obj", "KingGeorgeV.j3o"); //NON-NLS | ||||||
|         export("Models/SmallShip/12219_boat_v2_L2.obj", "SmallShip.j3o"); //NON-NLS |         export("Models/BoatSmall/12219_boat_v2_L2.obj", "BoatSmall.j3o"); //NON-NLS | ||||||
|         export("Models/WWII_ship_German_Type_II_U-boat_v2/14084_WWII_Ship_German_Type_II_U-boat_v2_L1.obj", "WW2Uboat.j3o"); //NON-NLS |         export("Models/Battle/14084_WWII_Ship_German_Type_II_U-boat_v2_L1.obj", "Battle.j3o"); //NON-NLS | ||||||
|         export("Models/TugBoat/12218_tugboat_v1_L2.obj", "TugBoat.j3o"); //NON-NLS |         export("Models/CV/essex_scb-125_generic.obj", "CV.j3o"); //NON-NLS | ||||||
|  |         export("Models/Figures/Würfel_blau.obj", "Würfel_blau.j30"); | ||||||
|  |         export("Models/Figures/Würfel_gelb.obj", "Würfel_gelb.j30"); | ||||||
|  |         export("Models/Figures/Würfel_grün.obj", "Würfel_grün.j30"); | ||||||
|  |         export("Models/Figures/Würfel_rosa.obj", "Würfel_rosa.j30"); | ||||||
|  |         export("Models/Figures/Würfel_rot.obj", "Würfel_rot.j30"); | ||||||
|  |         export("Models/Figures/Würfel_schwarz.obj", "Würfel_schwarz.j30"); | ||||||
|         stop(); |         stop(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 168 KiB | 
| Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB | 
| Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 166 KiB | 
| Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB | 
| After Width: | Height: | Size: 35 KiB | 
| After Width: | Height: | Size: 54 KiB | 
| After Width: | Height: | Size: 9.3 KiB | 
| After Width: | Height: | Size: 66 KiB | 
| After Width: | Height: | Size: 3.2 KiB |