Compare commits
	
		
			107 Commits
		
	
	
		
			b_puderbac
			...
			b6968df451
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					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 | 
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -4,6 +4,7 @@ build
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# VSC
 | 
					# VSC
 | 
				
			||||||
bin
 | 
					bin
 | 
				
			||||||
 | 
					.vscode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# IntelliJ
 | 
					# IntelliJ
 | 
				
			||||||
*.iml
 | 
					*.iml
 | 
				
			||||||
@@ -24,5 +25,3 @@ out
 | 
				
			|||||||
.DS_Store
 | 
					.DS_Store
 | 
				
			||||||
!Projekte/gradle/wrapper/gradle-wrapper.jar
 | 
					!Projekte/gradle/wrapper/gradle-wrapper.jar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
45.j3o
 | 
					 | 
				
			||||||
KingGeorge.j3o
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										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>
 | 
				
			||||||
@@ -73,7 +73,8 @@ Betriebssystem:
 | 
				
			|||||||
  die Zeile:
 | 
					  die Zeile:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  `export JAVA_HOME="<Pfad zum entpackten Archiv>"`
 | 
					  `export JAVA_HOME="<Pfad zum entpackten Archiv>"`
 | 
				
			||||||
cd  Ersetzen Sie dabei `<Pfad zum entpackten Archiv>` mit dem entsprechenden Pfad.
 | 
					
 | 
				
			||||||
 | 
					  Ersetzen Sie dabei `<Pfad zum entpackten Archiv>` mit dem entsprechenden Pfad.
 | 
				
			||||||
  Zum Beispiel:
 | 
					  Zum Beispiel:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  `export JAVA_HOME="/home/user/jdk-20.0.2"`
 | 
					  `export JAVA_HOME="/home/user/jdk-20.0.2"`
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,15 +7,9 @@ description = 'Battleship Client'
 | 
				
			|||||||
dependencies {
 | 
					dependencies {
 | 
				
			||||||
    implementation project(":jme-common")
 | 
					    implementation project(":jme-common")
 | 
				
			||||||
    implementation project(":battleship:model")
 | 
					    implementation project(":battleship:model")
 | 
				
			||||||
    implementation 'org.jmonkeyengine:jme3-core:3.6.0-stable'
 | 
					 | 
				
			||||||
    implementation 'org.jmonkeyengine:jme3-effects:3.6.0-stable'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    implementation libs.jme3.desktop
 | 
					    implementation libs.jme3.desktop
 | 
				
			||||||
    implementation project(path: ':battleship:server')
 | 
					    implementation libs.jme3.effects
 | 
				
			||||||
    implementation project(path: ':battleship:server')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    runtimeOnly libs.jme3.awt.dialogs
 | 
					    runtimeOnly libs.jme3.awt.dialogs
 | 
				
			||||||
    runtimeOnly libs.jme3.plugins
 | 
					    runtimeOnly libs.jme3.plugins
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,7 +23,7 @@
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      "length": 2,
 | 
					      "length": 2,
 | 
				
			||||||
      "x": 4,
 | 
					      "x": 4,
 | 
				
			||||||
      "y": 12,
 | 
					      "y": 8,
 | 
				
			||||||
      "rot": "RIGHT"
 | 
					      "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": 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": 4,
 | 
					 | 
				
			||||||
      "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"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  ]
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -7,15 +7,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package pp.battleship.client;
 | 
					package pp.battleship.client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.File;
 | 
					 | 
				
			||||||
import java.io.FileInputStream;
 | 
					 | 
				
			||||||
import java.io.IOException;
 | 
					 | 
				
			||||||
import java.lang.System.Logger;
 | 
					 | 
				
			||||||
import java.lang.System.Logger.Level;
 | 
					 | 
				
			||||||
import java.util.concurrent.ExecutorService;
 | 
					 | 
				
			||||||
import java.util.concurrent.Executors;
 | 
					 | 
				
			||||||
import java.util.logging.LogManager;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.jme3.app.DebugKeysAppState;
 | 
					import com.jme3.app.DebugKeysAppState;
 | 
				
			||||||
import com.jme3.app.SimpleApplication;
 | 
					import com.jme3.app.SimpleApplication;
 | 
				
			||||||
import com.jme3.app.StatsAppState;
 | 
					import com.jme3.app.StatsAppState;
 | 
				
			||||||
@@ -29,11 +20,9 @@ import com.jme3.input.controls.MouseButtonTrigger;
 | 
				
			|||||||
import com.jme3.system.AppSettings;
 | 
					import com.jme3.system.AppSettings;
 | 
				
			||||||
import com.simsilica.lemur.GuiGlobals;
 | 
					import com.simsilica.lemur.GuiGlobals;
 | 
				
			||||||
import com.simsilica.lemur.style.BaseStyles;
 | 
					import com.simsilica.lemur.style.BaseStyles;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import static pp.battleship.Resources.lookup;
 | 
					 | 
				
			||||||
import pp.battleship.client.gui.BattleAppState;
 | 
					import pp.battleship.client.gui.BattleAppState;
 | 
				
			||||||
import pp.battleship.client.gui.BgMusic;
 | 
					 | 
				
			||||||
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;
 | 
				
			||||||
@@ -47,6 +36,17 @@ import pp.dialog.DialogBuilder;
 | 
				
			|||||||
import pp.dialog.DialogManager;
 | 
					import pp.dialog.DialogManager;
 | 
				
			||||||
import pp.graphics.Draw;
 | 
					import pp.graphics.Draw;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.File;
 | 
				
			||||||
 | 
					import java.io.FileInputStream;
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import java.lang.System.Logger;
 | 
				
			||||||
 | 
					import java.lang.System.Logger.Level;
 | 
				
			||||||
 | 
					import java.util.concurrent.ExecutorService;
 | 
				
			||||||
 | 
					import java.util.concurrent.Executors;
 | 
				
			||||||
 | 
					import java.util.logging.LogManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static pp.battleship.Resources.lookup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * The main class for the Battleship client application.
 | 
					 * The main class for the Battleship client application.
 | 
				
			||||||
 * It manages the initialization, input setup, GUI setup, and game states for the client.
 | 
					 * It manages the initialization, input setup, GUI setup, and game states for the client.
 | 
				
			||||||
@@ -268,8 +268,8 @@ public class BattleshipApp extends SimpleApplication implements BattleshipClient
 | 
				
			|||||||
        stateManager.detach(stateManager.getState(DebugKeysAppState.class));
 | 
					        stateManager.detach(stateManager.getState(DebugKeysAppState.class));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        attachGameSound();
 | 
					        attachGameSound();
 | 
				
			||||||
 | 
					        attachGameMusic();
 | 
				
			||||||
        stateManager.attachAll(new EditorAppState(), new BattleAppState(), new SeaAppState());
 | 
					        stateManager.attachAll(new EditorAppState(), new BattleAppState(), new SeaAppState());
 | 
				
			||||||
        attachBgMusic();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -281,13 +281,16 @@ public class BattleshipApp extends SimpleApplication implements BattleshipClient
 | 
				
			|||||||
        gameSound.setEnabled(GameSound.enabledInPreferences());
 | 
					        gameSound.setEnabled(GameSound.enabledInPreferences());
 | 
				
			||||||
        stateManager.attach(gameSound);
 | 
					        stateManager.attach(gameSound);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    private void attachBgMusic() {
 | 
					
 | 
				
			||||||
        final BgMusic gameSound = new BgMusic();
 | 
					    /**
 | 
				
			||||||
        gameSound.setEnabled(BgMusic.enabledInPreferences());
 | 
					     * Attaches the background music state and sets its initial enabled state.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void attachGameMusic() {
 | 
				
			||||||
 | 
					        final GameMusic gameSound = new GameMusic();
 | 
				
			||||||
 | 
					        gameSound.setEnabled(GameMusic.enabledInPreferences());
 | 
				
			||||||
        stateManager.attach(gameSound);
 | 
					        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.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,10 +7,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package pp.battleship.client;
 | 
					package pp.battleship.client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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.Application;
 | 
				
			||||||
import com.jme3.app.state.AbstractAppState;
 | 
					import com.jme3.app.state.AbstractAppState;
 | 
				
			||||||
import com.jme3.app.state.AppStateManager;
 | 
					import com.jme3.app.state.AppStateManager;
 | 
				
			||||||
@@ -18,9 +14,13 @@ import com.jme3.asset.AssetLoadException;
 | 
				
			|||||||
import com.jme3.asset.AssetNotFoundException;
 | 
					import com.jme3.asset.AssetNotFoundException;
 | 
				
			||||||
import com.jme3.audio.AudioData;
 | 
					import com.jme3.audio.AudioData;
 | 
				
			||||||
import com.jme3.audio.AudioNode;
 | 
					import com.jme3.audio.AudioNode;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import pp.battleship.notification.GameEventListener;
 | 
					import pp.battleship.notification.GameEventListener;
 | 
				
			||||||
import pp.battleship.notification.SoundEvent;
 | 
					import pp.battleship.notification.SoundEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.System.Logger;
 | 
				
			||||||
 | 
					import java.lang.System.Logger.Level;
 | 
				
			||||||
 | 
					import java.util.prefs.Preferences;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static pp.util.PreferencesUtils.getPreferences;
 | 
					import static pp.util.PreferencesUtils.getPreferences;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -34,6 +34,7 @@ public class GameSound extends AbstractAppState implements GameEventListener {
 | 
				
			|||||||
    private AudioNode splashSound;
 | 
					    private AudioNode splashSound;
 | 
				
			||||||
    private AudioNode shipDestroyedSound;
 | 
					    private AudioNode shipDestroyedSound;
 | 
				
			||||||
    private AudioNode explosionSound;
 | 
					    private AudioNode explosionSound;
 | 
				
			||||||
 | 
					    private AudioNode shellFlyingSound;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Checks if sound is enabled in the preferences.
 | 
					     * Checks if sound is enabled in the preferences.
 | 
				
			||||||
@@ -78,6 +79,7 @@ public class GameSound extends AbstractAppState implements GameEventListener {
 | 
				
			|||||||
        shipDestroyedSound = loadSound(app, "Sound/Effects/sunken.wav"); //NON-NLS
 | 
					        shipDestroyedSound = loadSound(app, "Sound/Effects/sunken.wav"); //NON-NLS
 | 
				
			||||||
        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");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -124,12 +126,27 @@ public class GameSound extends AbstractAppState implements GameEventListener {
 | 
				
			|||||||
            shipDestroyedSound.playInstance();
 | 
					            shipDestroyedSound.playInstance();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Plays the shell flying sound effect.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public void shellFly() {
 | 
				
			||||||
 | 
					        if (isEnabled() && shellFlyingSound != null) {
 | 
				
			||||||
 | 
					            shellFlyingSound.playInstance();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Handles a recieved {@code SoundEvent} and plays the according sound.
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param event the Sound event to be processed
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void receivedEvent(SoundEvent event) {
 | 
					    public void receivedEvent(SoundEvent event) {
 | 
				
			||||||
        switch (event.sound()) {
 | 
					        switch (event.sound()) {
 | 
				
			||||||
            case EXPLOSION -> explosion();
 | 
					            case EXPLOSION -> explosion();
 | 
				
			||||||
            case SPLASH -> splash();
 | 
					            case SPLASH -> splash();
 | 
				
			||||||
            case DESTROYED_SHIP -> shipDestroyed();
 | 
					            case DESTROYED_SHIP -> shipDestroyed();
 | 
				
			||||||
 | 
					            case SHELL_FLYING -> shellFly();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,15 +17,13 @@ import com.simsilica.lemur.Label;
 | 
				
			|||||||
import com.simsilica.lemur.style.ElementId;
 | 
					import com.simsilica.lemur.style.ElementId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static pp.battleship.Resources.lookup;
 | 
					import static pp.battleship.Resources.lookup;
 | 
				
			||||||
import pp.battleship.client.gui.BgMusic;
 | 
					import pp.battleship.client.gui.GameMusic;
 | 
				
			||||||
import pp.battleship.client.gui.VolumeSlider;
 | 
					import pp.battleship.client.gui.VolumeSlider;
 | 
				
			||||||
import pp.dialog.Dialog;
 | 
					import pp.dialog.Dialog;
 | 
				
			||||||
import pp.dialog.StateCheckboxModel;
 | 
					import pp.dialog.StateCheckboxModel;
 | 
				
			||||||
import pp.dialog.TextInputDialog;
 | 
					import pp.dialog.TextInputDialog;
 | 
				
			||||||
import static pp.util.PreferencesUtils.getPreferences;
 | 
					import static pp.util.PreferencesUtils.getPreferences;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * The Menu class represents the main menu in the Battleship game application.
 | 
					 * The Menu class represents the main menu in the Battleship game application.
 | 
				
			||||||
 * It extends the Dialog class and provides functionalities for loading, saving,
 | 
					 * It extends the Dialog class and provides functionalities for loading, saving,
 | 
				
			||||||
@@ -40,31 +38,26 @@ 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
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public Menu(BattleshipApp app) {
 | 
					    public Menu(BattleshipApp app) {
 | 
				
			||||||
        super(app.getDialogManager());
 | 
					        super(app.getDialogManager());
 | 
				
			||||||
        this.app = app;
 | 
					        this.app = app;
 | 
				
			||||||
        slider = new VolumeSlider(app.getStateManager().getState(BgMusic.class));
 | 
					        slider = new VolumeSlider(app.getStateManager().getState(GameMusic.class));
 | 
				
			||||||
        addChild(new Label(lookup("battleship.name"), new ElementId("header"))); //NON-NLS
 | 
					        addChild(new Label(lookup("battleship.name"), new ElementId("header"))); //NON-NLS
 | 
				
			||||||
       // 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.sound-enabled"), new StateCheckboxModel(app, GameSound.class)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        addChild(new Checkbox(lookup("menu.background-sound-enabled"), new StateCheckboxModel(app, BgMusic.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();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -76,6 +69,7 @@ class Menu extends Dialog {
 | 
				
			|||||||
        loadButton.setEnabled(app.getGameLogic().mayLoadMap());
 | 
					        loadButton.setEnabled(app.getGameLogic().mayLoadMap());
 | 
				
			||||||
        saveButton.setEnabled(app.getGameLogic().maySaveMap());
 | 
					        saveButton.setEnabled(app.getGameLogic().maySaveMap());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void update(float delta) {
 | 
					    public void update(float delta) {
 | 
				
			||||||
        slider.update();
 | 
					        slider.update();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,23 +7,24 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package pp.battleship.client;
 | 
					package pp.battleship.client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.lang.System.Logger;
 | 
					import com.simsilica.lemur.Button;
 | 
				
			||||||
import java.lang.System.Logger.Level;
 | 
					 | 
				
			||||||
import java.util.concurrent.ExecutionException;
 | 
					 | 
				
			||||||
import java.util.concurrent.Future;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.simsilica.lemur.Checkbox;
 | 
					 | 
				
			||||||
import com.simsilica.lemur.Container;
 | 
					import com.simsilica.lemur.Container;
 | 
				
			||||||
import com.simsilica.lemur.Label;
 | 
					import com.simsilica.lemur.Label;
 | 
				
			||||||
import com.simsilica.lemur.TextField;
 | 
					import com.simsilica.lemur.TextField;
 | 
				
			||||||
import com.simsilica.lemur.component.SpringGridLayout;
 | 
					import com.simsilica.lemur.component.SpringGridLayout;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static pp.battleship.Resources.lookup;
 | 
					import pp.battleship.server.BattleshipServer;
 | 
				
			||||||
import pp.battleship.client.server.BattleshipSelfhostServer;
 | 
					 | 
				
			||||||
import pp.dialog.Dialog;
 | 
					import pp.dialog.Dialog;
 | 
				
			||||||
import pp.dialog.DialogBuilder;
 | 
					import pp.dialog.DialogBuilder;
 | 
				
			||||||
import pp.dialog.SimpleDialog;
 | 
					import pp.dialog.SimpleDialog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.System.Logger;
 | 
				
			||||||
 | 
					import java.lang.System.Logger.Level;
 | 
				
			||||||
 | 
					import java.util.concurrent.ExecutionException;
 | 
				
			||||||
 | 
					import java.util.concurrent.Future;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static pp.battleship.Resources.lookup;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 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.
 | 
				
			||||||
 * Allows users to specify the host and port for connecting to a game server.
 | 
					 * Allows users to specify the host and port for connecting to a game server.
 | 
				
			||||||
@@ -35,7 +36,8 @@ class NetworkDialog extends SimpleDialog {
 | 
				
			|||||||
    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);
 | 
				
			||||||
    private static final Checkbox HOST  = new Checkbox(lookup("server.host"));
 | 
					    // private final Button serverButton = new Button(lookup("client.server-star"));
 | 
				
			||||||
 | 
					    private final Button serverButton = new Button(lookup("client.server-start"));
 | 
				
			||||||
    private String hostname;
 | 
					    private String hostname;
 | 
				
			||||||
    private int portNumber;
 | 
					    private int portNumber;
 | 
				
			||||||
    private Future<Object> connectionFuture;
 | 
					    private Future<Object> connectionFuture;
 | 
				
			||||||
@@ -59,7 +61,6 @@ class NetworkDialog extends SimpleDialog {
 | 
				
			|||||||
        input.addChild(host, 1);
 | 
					        input.addChild(host, 1);
 | 
				
			||||||
        input.addChild(new Label(lookup("port.number") + ":  "));
 | 
					        input.addChild(new Label(lookup("port.number") + ":  "));
 | 
				
			||||||
        input.addChild(port, 1);
 | 
					        input.addChild(port, 1);
 | 
				
			||||||
        input.addChild(HOST).addClickCommands(s -> ifTopDialog(this::startClientServer));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        DialogBuilder.simple(app.getDialogManager())
 | 
					        DialogBuilder.simple(app.getDialogManager())
 | 
				
			||||||
                     .setTitle(lookup("server.dialog"))
 | 
					                     .setTitle(lookup("server.dialog"))
 | 
				
			||||||
@@ -69,6 +70,9 @@ class NetworkDialog extends SimpleDialog {
 | 
				
			|||||||
                     .setOkClose(false)
 | 
					                     .setOkClose(false)
 | 
				
			||||||
                     .setNoClose(false)
 | 
					                     .setNoClose(false)
 | 
				
			||||||
                     .build(this);
 | 
					                     .build(this);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        //Add the button to start the sever
 | 
				
			||||||
 | 
					        addChild(serverButton).addClickCommands(s -> ifTopDialog(this::startServerInThread));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -156,15 +160,15 @@ class NetworkDialog extends SimpleDialog {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Starts the server of the client in a new thread and catches connectivity issues.
 | 
					     * Starts the server in a separate thread.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void startClientServer() {
 | 
					    private void startServerInThread() {
 | 
				
			||||||
        HOST.setEnabled(false);
 | 
					        serverButton.setEnabled(false);
 | 
				
			||||||
        Thread serverThread = new Thread(() -> {
 | 
					        Thread serverThread = new Thread(() -> {
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
                BattleshipSelfhostServer.main(null);
 | 
					                BattleshipServer.main(null);
 | 
				
			||||||
            } catch (Exception e) {
 | 
					            } catch (Exception e) {
 | 
				
			||||||
                HOST.setEnabled(true);
 | 
					                serverButton.setEnabled(true);
 | 
				
			||||||
                LOGGER.log(Level.ERROR, "Server could not be started", e);
 | 
					                LOGGER.log(Level.ERROR, "Server could not be started", e);
 | 
				
			||||||
                network.getApp().errorDialog("Could not start server: " + e.getMessage());
 | 
					                network.getApp().errorDialog("Could not start server: " + e.getMessage());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,19 +7,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package pp.battleship.client.gui;
 | 
					package pp.battleship.client.gui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.lang.System.Logger;
 | 
					 | 
				
			||||||
import java.lang.System.Logger.Level;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.jme3.input.controls.ActionListener;
 | 
					import com.jme3.input.controls.ActionListener;
 | 
				
			||||||
import com.jme3.math.Vector2f;
 | 
					import com.jme3.math.Vector2f;
 | 
				
			||||||
import com.jme3.scene.Node;
 | 
					import com.jme3.scene.Node;
 | 
				
			||||||
import com.jme3.system.AppSettings;
 | 
					import com.jme3.system.AppSettings;
 | 
				
			||||||
import com.simsilica.lemur.Button;
 | 
					import com.simsilica.lemur.Button;
 | 
				
			||||||
import com.simsilica.lemur.Container;
 | 
					import com.simsilica.lemur.Container;
 | 
				
			||||||
 | 
					import pp.battleship.client.BattleshipAppState;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.lang.System.Logger;
 | 
				
			||||||
 | 
					import java.lang.System.Logger.Level;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static pp.battleship.Resources.lookup;
 | 
					import static pp.battleship.Resources.lookup;
 | 
				
			||||||
import static pp.battleship.client.BattleshipApp.CLICK;
 | 
					import static pp.battleship.client.BattleshipApp.CLICK;
 | 
				
			||||||
import pp.battleship.client.BattleshipAppState;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * EditorState manages the editor mode in the Battleship game,
 | 
					 * EditorState manages the editor mode in the Battleship game,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,7 @@
 | 
				
			|||||||
////////////////////////////////////////
 | 
					 | 
				
			||||||
// Programming project code
 | 
					 | 
				
			||||||
// UniBw M, 2022, 2023, 2024
 | 
					 | 
				
			||||||
// www.unibw.de/inf2
 | 
					 | 
				
			||||||
// (c) Mark Minas (mark.minas@unibw.de)
 | 
					 | 
				
			||||||
////////////////////////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
package pp.battleship.client.gui;
 | 
					package pp.battleship.client.gui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static pp.util.PreferencesUtils.getPreferences;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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.prefs.Preferences;
 | 
					import java.util.prefs.Preferences;
 | 
				
			||||||
@@ -19,14 +14,12 @@ import com.jme3.asset.AssetNotFoundException;
 | 
				
			|||||||
import com.jme3.audio.AudioData;
 | 
					import com.jme3.audio.AudioData;
 | 
				
			||||||
import com.jme3.audio.AudioNode;
 | 
					import com.jme3.audio.AudioNode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static pp.util.PreferencesUtils.getPreferences;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * An application state that plays sounds.
 | 
					 * Handles the background music beeing played. Is able to start and stop the music. Set the Volume of the Audio.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class BgMusic extends AbstractAppState{
 | 
					public class GameMusic extends AbstractAppState{
 | 
				
			||||||
    private static final Logger LOGGER = System.getLogger(BgMusic.class.getName());
 | 
					    private static final Logger LOGGER = System.getLogger(GameMusic.class.getName());
 | 
				
			||||||
    private static final Preferences PREFERENCES = getPreferences(BgMusic.class);
 | 
					    private static final Preferences PREFERENCES = getPreferences(GameMusic.class);
 | 
				
			||||||
    private static final String ENABLED_PREF = "enabled"; //NON-NLS
 | 
					    private static final String ENABLED_PREF = "enabled"; //NON-NLS
 | 
				
			||||||
    private static final String VOLUME_PREF = "volume"; //NON-NLS
 | 
					    private static final String VOLUME_PREF = "volume"; //NON-NLS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -44,7 +37,7 @@ public class BgMusic extends AbstractAppState{
 | 
				
			|||||||
        /**
 | 
					        /**
 | 
				
			||||||
     * Checks if sound is enabled in the preferences.
 | 
					     * Checks if sound is enabled in the preferences.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @return //TODO
 | 
					     * @return float to which the volume is set
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static float volumeInPreferences() {
 | 
					    public static float volumeInPreferences() {
 | 
				
			||||||
        return PREFERENCES.getFloat(VOLUME_PREF, 0.5f);
 | 
					        return PREFERENCES.getFloat(VOLUME_PREF, 0.5f);
 | 
				
			||||||
@@ -60,7 +53,7 @@ public class BgMusic extends AbstractAppState{
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void initialize(AppStateManager stateManager, Application app) {
 | 
					    public void initialize(AppStateManager stateManager, Application app) {
 | 
				
			||||||
        super.initialize(stateManager, app);
 | 
					        super.initialize(stateManager, app);
 | 
				
			||||||
        music = loadSound(app, "Sound/Music/bgMusic.ogg");
 | 
					        music = loadSound(app, "Sound/background.ogg");
 | 
				
			||||||
        setVolume(volumeInPreferences());
 | 
					        setVolume(volumeInPreferences());
 | 
				
			||||||
        music.setLooping(true);
 | 
					        music.setLooping(true);
 | 
				
			||||||
        if (isEnabled() && music != null) {
 | 
					        if (isEnabled() && music != null) {
 | 
				
			||||||
@@ -88,7 +81,7 @@ public class BgMusic extends AbstractAppState{
 | 
				
			|||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** TODO
 | 
					    /**
 | 
				
			||||||
     * Sets the enabled state of this AppState.
 | 
					     * Sets the enabled state of this AppState.
 | 
				
			||||||
     * Overrides {@link com.jme3.app.state.AbstractAppState#setEnabled(boolean)}
 | 
					     * Overrides {@link com.jme3.app.state.AbstractAppState#setEnabled(boolean)}
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -97,11 +90,15 @@ public class BgMusic extends AbstractAppState{
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void setEnabled(boolean enabled) {
 | 
					    public void setEnabled(boolean enabled) {
 | 
				
			||||||
        if (isEnabled() == enabled) return;
 | 
					        if (isEnabled() == enabled) return;
 | 
				
			||||||
        else if(!isEnabled() && enabled) {
 | 
					
 | 
				
			||||||
            if (music != null) music.play();
 | 
					        if (music != null) {
 | 
				
			||||||
        } else if (isEnabled() && !enabled) {
 | 
					            if (enabled) {
 | 
				
			||||||
            if (music != null) music.stop();
 | 
					                music.play();
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                music.stop();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
        super.setEnabled(enabled);
 | 
					        super.setEnabled(enabled);
 | 
				
			||||||
        LOGGER.log(Level.INFO, "Sound enabled: {0}", enabled); //NON-NLS
 | 
					        LOGGER.log(Level.INFO, "Sound enabled: {0}", enabled); //NON-NLS
 | 
				
			||||||
        PREFERENCES.putBoolean(ENABLED_PREF, enabled);
 | 
					        PREFERENCES.putBoolean(ENABLED_PREF, enabled);
 | 
				
			||||||
@@ -114,6 +111,10 @@ public class BgMusic extends AbstractAppState{
 | 
				
			|||||||
        setEnabled(!isEnabled());
 | 
					        setEnabled(!isEnabled());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Sets the volume of music
 | 
				
			||||||
 | 
					     * @param vol the volume to which the music should be set
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    public void setVolume(float vol){
 | 
					    public void setVolume(float vol){
 | 
				
			||||||
        music.setVolume(vol);
 | 
					        music.setVolume(vol);
 | 
				
			||||||
        PREFERENCES.putFloat(VOLUME_PREF, vol);
 | 
					        PREFERENCES.putFloat(VOLUME_PREF, vol);
 | 
				
			||||||
@@ -16,7 +16,6 @@ import com.jme3.scene.Geometry;
 | 
				
			|||||||
import com.jme3.scene.Node;
 | 
					import com.jme3.scene.Node;
 | 
				
			||||||
import com.jme3.scene.Spatial.CullHint;
 | 
					import com.jme3.scene.Spatial.CullHint;
 | 
				
			||||||
import com.jme3.scene.shape.Quad;
 | 
					import com.jme3.scene.shape.Quad;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import pp.battleship.client.BattleshipApp;
 | 
					import pp.battleship.client.BattleshipApp;
 | 
				
			||||||
import pp.battleship.model.IntPoint;
 | 
					import pp.battleship.model.IntPoint;
 | 
				
			||||||
import pp.battleship.model.ShipMap;
 | 
					import pp.battleship.model.ShipMap;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,6 @@
 | 
				
			|||||||
package pp.battleship.client.gui;
 | 
					package pp.battleship.client.gui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.jme3.material.Material;
 | 
					import com.jme3.material.Material;
 | 
				
			||||||
import static com.jme3.material.Materials.UNSHADED;
 | 
					 | 
				
			||||||
import com.jme3.material.RenderState;
 | 
					import com.jme3.material.RenderState;
 | 
				
			||||||
import com.jme3.material.RenderState.BlendMode;
 | 
					import com.jme3.material.RenderState.BlendMode;
 | 
				
			||||||
import com.jme3.math.ColorRGBA;
 | 
					import com.jme3.math.ColorRGBA;
 | 
				
			||||||
@@ -22,6 +21,9 @@ 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;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Synchronizes the visual representation of the ship map with the game model.
 | 
					 * Synchronizes the visual representation of the ship map with the game model.
 | 
				
			||||||
 * It handles the rendering of ships and shots on the map view, updating the view
 | 
					 * It handles the rendering of ships and shots on the map view, updating the view
 | 
				
			||||||
@@ -116,8 +118,6 @@ class MapViewSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
        return shipNode;
 | 
					        return shipNode;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Creates a line geometry representing part of the ship's border.
 | 
					     * Creates a line geometry representing part of the ship's border.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -131,6 +131,7 @@ class MapViewSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
    private Geometry shipLine(float x1, float y1, float x2, float y2, ColorRGBA color) {
 | 
					    private Geometry shipLine(float x1, float y1, float x2, float y2, ColorRGBA color) {
 | 
				
			||||||
        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.
 | 
				
			||||||
@@ -150,5 +151,4 @@ class MapViewSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
        ellipse.addControl(new Shell2DControl(view, shell));
 | 
					        ellipse.addControl(new Shell2DControl(view, shell));
 | 
				
			||||||
        return ellipse;
 | 
					        return ellipse;
 | 
				
			||||||
    }      
 | 
					    }      
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,6 @@ 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;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -184,7 +183,6 @@ public class ParticleEffectFactory {
 | 
				
			|||||||
        debris.setGravity(0, 12f, 0);
 | 
					        debris.setGravity(0, 12f, 0);
 | 
				
			||||||
        debris.setLowLife(1.4f);
 | 
					        debris.setLowLife(1.4f);
 | 
				
			||||||
        debris.setHighLife(1.5f);
 | 
					        debris.setHighLife(1.5f);
 | 
				
			||||||
        debris.setLocalTranslation(0, 2f, 0);
 | 
					 | 
				
			||||||
        debris.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 15, 0));
 | 
					        debris.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 15, 0));
 | 
				
			||||||
        debris.getParticleInfluencer().setVelocityVariation(.60f);
 | 
					        debris.getParticleInfluencer().setVelocityVariation(.60f);
 | 
				
			||||||
        debris.setImagesX(3);
 | 
					        debris.setImagesX(3);
 | 
				
			||||||
@@ -232,18 +230,23 @@ public class ParticleEffectFactory {
 | 
				
			|||||||
        ParticleEmitter smokeEmitter = new ParticleEmitter("SmokeEmitter", Type.Triangle, 300);
 | 
					        ParticleEmitter smokeEmitter = new ParticleEmitter("SmokeEmitter", Type.Triangle, 300);
 | 
				
			||||||
        smokeEmitter.setGravity(0, 0, 0);
 | 
					        smokeEmitter.setGravity(0, 0, 0);
 | 
				
			||||||
        smokeEmitter.getParticleInfluencer().setVelocityVariation(1);
 | 
					        smokeEmitter.getParticleInfluencer().setVelocityVariation(1);
 | 
				
			||||||
        smokeEmitter.setLocalTranslation(0, 2f, 0); //___________________
 | 
					 | 
				
			||||||
        smokeEmitter.setLowLife(1);
 | 
					        smokeEmitter.setLowLife(1);
 | 
				
			||||||
        smokeEmitter.setHighLife(1);
 | 
					        smokeEmitter.setHighLife(1);
 | 
				
			||||||
        smokeEmitter.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, 0));
 | 
					        smokeEmitter.getParticleInfluencer().setInitialVelocity(new Vector3f(0, .5f, 0));
 | 
				
			||||||
        smokeEmitter.setImagesX(15); 
 | 
					        smokeEmitter.setImagesX(15); // Assuming the smoke texture is a sprite sheet with 15 frames
 | 
				
			||||||
        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/Smoke/Smoke.png"));
 | 
					        mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Smoke/Smoke.png"));
 | 
				
			||||||
        smokeEmitter.setMaterial(mat);
 | 
					        smokeEmitter.setMaterial(mat);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return smokeEmitter;
 | 
					        return smokeEmitter;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    public ParticleEmitter createWaterSplash() { //wird durch explosions animation ersetzt
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Creates a one-time water splash particle emitter.
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @return a configured one-time water splash particle emitter
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    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);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
@@ -279,5 +282,4 @@ public class ParticleEffectFactory {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return waterSplash;
 | 
					        return waterSplash;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,28 +7,24 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package pp.battleship.client.gui;
 | 
					package pp.battleship.client.gui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
import static java.util.Objects.requireNonNull;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.jme3.effect.ParticleEmitter;
 | 
					import com.jme3.effect.ParticleEmitter;
 | 
				
			||||||
import com.jme3.material.Material;
 | 
					import com.jme3.material.Material;
 | 
				
			||||||
import com.jme3.material.RenderState.BlendMode;
 | 
					import com.jme3.material.RenderState.BlendMode;
 | 
				
			||||||
import com.jme3.math.ColorRGBA;
 | 
					import com.jme3.math.ColorRGBA;
 | 
				
			||||||
import com.jme3.math.FastMath;
 | 
					 | 
				
			||||||
import com.jme3.math.Vector3f;
 | 
					 | 
				
			||||||
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
 | 
					import com.jme3.renderer.queue.RenderQueue.ShadowMode;
 | 
				
			||||||
import com.jme3.scene.Geometry;
 | 
					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.Box;
 | 
					import com.jme3.scene.shape.Box;
 | 
				
			||||||
import com.jme3.scene.shape.Cylinder;
 | 
					import com.jme3.scene.shape.Cylinder;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import pp.battleship.client.BattleshipApp;
 | 
					import pp.battleship.client.BattleshipApp;
 | 
				
			||||||
import pp.battleship.model.Battleship;
 | 
					import pp.battleship.model.Battleship;
 | 
				
			||||||
import pp.battleship.model.Rotation;
 | 
					import pp.battleship.model.Rotation;
 | 
				
			||||||
import pp.battleship.model.Shell;
 | 
					import pp.battleship.model.Shell;
 | 
				
			||||||
import pp.battleship.model.ShipMap;
 | 
					import pp.battleship.model.ShipMap;
 | 
				
			||||||
import pp.battleship.model.Shot;
 | 
					import pp.battleship.model.Shot;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static java.util.Objects.requireNonNull;
 | 
				
			||||||
import static pp.util.FloatMath.HALF_PI;
 | 
					import static pp.util.FloatMath.HALF_PI;
 | 
				
			||||||
import static pp.util.FloatMath.PI;
 | 
					import static pp.util.FloatMath.PI;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -40,25 +36,22 @@ 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/Transporter/cr90.j3o"; //NON-NLS
 | 
					    private static final String KING_GEORGE_V_MODEL = "Models/KingGeorgeV/KingGeorgeV.j3o"; //NON-NLS
 | 
				
			||||||
    private static final String TIE_FIGHTER = "Models/TieFighter/TieFighter.j3o"; //NON-NLS
 | 
					    private static final String BOAT_SMALL_MODEL = "Models/BoatSmall/12219_boat_v2_L2.j3o"; //NON-NLS
 | 
				
			||||||
    private static final String TRANSPORTER = "Models/KingGeorgeV/KingGeorge.j3o"; //NON-NLS
 | 
					    private static final String CV_MODEL = "Models/CV/CV.j3o"; //NON-NLS
 | 
				
			||||||
    //private static final String VENATOR = "Models/Venator/Venator.j3o"; //NON-NLS
 | 
					    private static final String BATTLE_MODEL = "Models/Battle/Battle.j3o"; //NON-NLS
 | 
				
			||||||
    private static final String WING = "Models/Wing/Wing.j3o"; //NON-NLS
 | 
					    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
 | 
				
			||||||
    private static final String SHOT = "shot"; //NON-NLS
 | 
					    private static final String SHOT = "shot"; //NON-NLS
 | 
				
			||||||
    private static final ColorRGBA BOX_COLOR = ColorRGBA.Gray;
 | 
					    private static final ColorRGBA BOX_COLOR = ColorRGBA.Gray;
 | 
				
			||||||
    private static final ColorRGBA SPLASH_COLOR = new ColorRGBA(0f, 0f, 1f, 0.4f);
 | 
					    private static final ColorRGBA SPLASH_COLOR = new ColorRGBA(0f, 0f, 1f, 0.4f);
 | 
				
			||||||
    private static final ColorRGBA HIT_COLOR = new ColorRGBA(1f, 0f, 0f, 0.4f);
 | 
					    private static final ColorRGBA HIT_COLOR = new ColorRGBA(1f, 0f, 0f, 0.4f);
 | 
				
			||||||
    private static final String LIGHTING = "Common/MatDefs/Light/Lighting.j3md";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final ShipMap map;
 | 
					    private final ShipMap map;
 | 
				
			||||||
    private final BattleshipApp app;
 | 
					    private final BattleshipApp app;
 | 
				
			||||||
    private final ParticleEffectFactory particleFactory;
 | 
					    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.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -86,6 +79,13 @@ class SeaSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
    public Spatial visit(Shot shot) {
 | 
					    public Spatial visit(Shot shot) {
 | 
				
			||||||
        return shot.isHit() ? handleHit(shot) : handleMiss(shot);
 | 
					        return shot.isHit() ? handleHit(shot) : handleMiss(shot);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Handles a miss by representing it with a blue cylinder
 | 
				
			||||||
 | 
					     * and attaching a water splash effect to it.
 | 
				
			||||||
 | 
					     * @param shot the shot to be processed
 | 
				
			||||||
 | 
					     * @return a Spatial simulating a miss with water splash effect
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private Spatial handleMiss(Shot shot) {
 | 
					    private Spatial handleMiss(Shot shot) {
 | 
				
			||||||
        Node shotNode = new Node("ShotNode");
 | 
					        Node shotNode = new Node("ShotNode");
 | 
				
			||||||
        Geometry shotCylinder = createCylinder(shot);
 | 
					        Geometry shotCylinder = createCylinder(shot);
 | 
				
			||||||
@@ -97,6 +97,11 @@ class SeaSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return shotNode;
 | 
					        return shotNode;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Handles the sinking animation and removal of ship if destroyed
 | 
				
			||||||
 | 
					     * @param ship the ship to be sunk
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    private void sinkAndRemoveShip(Battleship ship) {
 | 
					    private void sinkAndRemoveShip(Battleship ship) {
 | 
				
			||||||
        Battleship wilkeningklaunichtmeinencode = ship;
 | 
					        Battleship wilkeningklaunichtmeinencode = ship;
 | 
				
			||||||
        final Node shipNode = (Node) getSpatial(wilkeningklaunichtmeinencode);
 | 
					        final Node shipNode = (Node) getSpatial(wilkeningklaunichtmeinencode);
 | 
				
			||||||
@@ -112,20 +117,20 @@ class SeaSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
        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
 | 
				
			||||||
        Node hitEffectNode = new Node("HitEffectNode");
 | 
					        Node hitEffectNode = new Node("HitEffectNode");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Create particle effects
 | 
					        // Create particle effects
 | 
				
			||||||
@@ -165,12 +170,11 @@ class SeaSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
        flame.emitAllParticles();
 | 
					        flame.emitAllParticles();
 | 
				
			||||||
        roundSpark.emitAllParticles();
 | 
					        roundSpark.emitAllParticles();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Checks if ship is destroyed and triggers animation accordingly
 | 
				
			||||||
        if (ship.isDestroyed()) {
 | 
					        if (ship.isDestroyed()) {
 | 
				
			||||||
            sinkAndRemoveShip(ship);
 | 
					            sinkAndRemoveShip(ship);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -190,9 +194,8 @@ class SeaSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        geometry.setMaterial(createColoredMaterial(color));
 | 
					        geometry.setMaterial(createColoredMaterial(color));
 | 
				
			||||||
        geometry.rotate(HALF_PI, 0f, 0f);
 | 
					        geometry.rotate(HALF_PI, 0f, 0f);
 | 
				
			||||||
        
 | 
					        // compute the center of the shot in world coordinates
 | 
				
			||||||
        // compute the center of the shot in world coordinates, with an additional 2f height
 | 
					        geometry.setLocalTranslation(shot.getY() + 0.5f, 0f, shot.getX() + 0.5f);
 | 
				
			||||||
        geometry.setLocalTranslation(shot.getY() + 0.5f, 2f + height / 2, shot.getX() + 0.5f);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return geometry;
 | 
					        return geometry;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -225,21 +228,15 @@ class SeaSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
     * @return the spatial representing the battleship
 | 
					     * @return the spatial representing the battleship
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private Spatial createShip(Battleship ship) {
 | 
					    private Spatial createShip(Battleship ship) {
 | 
				
			||||||
        if (ship.getLength() == 1) {
 | 
					        switch (ship.getLength()) {
 | 
				
			||||||
            return createTie_Fighter(ship);
 | 
					            case 4: return createBattleship(ship);
 | 
				
			||||||
        } else if (ship.getLength() == 2) {
 | 
					            case 3: return createCV(ship);
 | 
				
			||||||
            return createWing(ship);
 | 
					            case 2: return createBattle(ship);
 | 
				
			||||||
        } else if (ship.getLength() == 3) {
 | 
					            case 1: return createSmallship(ship);
 | 
				
			||||||
            return createTransporter(ship);
 | 
					            default: return createBox(ship);
 | 
				
			||||||
        } else if (ship.getLength() == 4) {
 | 
					 | 
				
			||||||
            return createBattleship(ship);
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            return createBox(ship);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Creates a simple box to represent a battleship that is not of the "King George V" type.
 | 
					     * Creates a simple box to represent a battleship that is not of the "King George V" type.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@@ -277,7 +274,7 @@ class SeaSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Creates a detailed 3D model to represent all battleships.
 | 
					     * Creates a detailed 3D model to represent a "King George V" battleship.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param ship the battleship to be represented
 | 
					     * @param ship the battleship to be represented
 | 
				
			||||||
     * @return the spatial representing the "King George V" battleship
 | 
					     * @return the spatial representing the "King George V" battleship
 | 
				
			||||||
@@ -285,92 +282,63 @@ class SeaSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
    private Spatial createBattleship(Battleship ship) {
 | 
					    private Spatial createBattleship(Battleship ship) {
 | 
				
			||||||
        final Spatial model = app.getAssetManager().loadModel(KING_GEORGE_V_MODEL);
 | 
					        final Spatial model = app.getAssetManager().loadModel(KING_GEORGE_V_MODEL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f);
 | 
				
			||||||
    // Berechne den Rotationswinkel
 | 
					        model.scale(1.48f);
 | 
				
			||||||
    float rotationAngle = calculateRotationAngle(ship.getRot())+HALF_PI;
 | 
					        // model.scale(0.0007f);
 | 
				
			||||||
    model.setLocalTranslation(new Vector3f(model.getLocalTranslation().x, 2f, model.getLocalTranslation().z));
 | 
					 | 
				
			||||||
    model.rotate(0f, rotationAngle, -HALF_PI);
 | 
					 | 
				
			||||||
    model.scale(1.2f);
 | 
					 | 
				
			||||||
        model.setShadowMode(ShadowMode.CastAndReceive);
 | 
					        model.setShadowMode(ShadowMode.CastAndReceive);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Bestimme die Verschiebung basierend auf der Rotation
 | 
					 | 
				
			||||||
    Vector3f translation = model.getLocalTranslation();
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    // Bei 0 oder 180 Grad wird auf der Z-Achse verschoben, bei 90 oder 270 Grad auf der X-Achse
 | 
					 | 
				
			||||||
    if (rotationAngle == 0 || rotationAngle == FastMath.PI) {
 | 
					 | 
				
			||||||
        // Verschiebe auf der Z-Achse und um 2f nach oben
 | 
					 | 
				
			||||||
        translation = translation.subtract(0,0,1);  // Nach hinten auf der Z-Achse, und um 2f nach oben
 | 
					 | 
				
			||||||
    } else if (rotationAngle == FastMath.HALF_PI || rotationAngle == 3 * FastMath.HALF_PI) {
 | 
					 | 
				
			||||||
        // Verschiebe auf der X-Achse und um 2f nach oben
 | 
					 | 
				
			||||||
        translation = translation.subtract(1,0,0);  // Nach hinten auf der X-Achse, und um 2f nach oben
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    model.setLocalTranslation(translation);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    return model;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    private Spatial createTransporter(Battleship ship) {
 | 
					 | 
				
			||||||
        final Spatial model = app.getAssetManager().loadModel(TRANSPORTER);
 | 
					 | 
				
			||||||
        float rotationAngle = calculateRotationAngle(ship.getRot())+HALF_PI;
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot())+ PI, 0f);
 | 
					 | 
				
			||||||
        model.scale(0.008f);
 | 
					 | 
				
			||||||
        model.setShadowMode(ShadowMode.CastAndReceive);
 | 
					 | 
				
			||||||
        model.setLocalTranslation(new Vector3f(model.getLocalTranslation().x, 2f, model.getLocalTranslation().z));
 | 
					 | 
				
			||||||
        Vector3f translation = model.getLocalTranslation();
 | 
					 | 
				
			||||||
        // Bei 0 oder 180 Grad wird auf der Z-Achse verschoben, bei 90 oder 270 Grad auf der X-Achse
 | 
					 | 
				
			||||||
        if (rotationAngle == 0 || rotationAngle == FastMath.PI) {
 | 
					 | 
				
			||||||
        // Verschiebe auf der Z-Achse und um 2f nach oben
 | 
					 | 
				
			||||||
        translation = translation.subtract(0,0,1);  
 | 
					 | 
				
			||||||
        } else if (rotationAngle == FastMath.HALF_PI || rotationAngle == 3 * FastMath.HALF_PI) {
 | 
					 | 
				
			||||||
        // Verschiebe auf der X-Achse und um 2f nach oben
 | 
					 | 
				
			||||||
        translation = translation.add(1,0,0);  
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
        model.setLocalTranslation(translation);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
        return model;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    private Spatial createWing(Battleship ship) {
 | 
					 | 
				
			||||||
    final Spatial model = app.getAssetManager().loadModel(WING);
 | 
					 | 
				
			||||||
    model.setLocalTranslation(new Vector3f(model.getLocalTranslation().x, 2f, model.getLocalTranslation().z));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Berechne den Rotationswinkel
 | 
					 | 
				
			||||||
    float rotationAngle = calculateRotationAngle(ship.getRot())+HALF_PI;
 | 
					 | 
				
			||||||
    model.rotate(0f, rotationAngle, 0f);
 | 
					 | 
				
			||||||
    model.scale(0.0008f);
 | 
					 | 
				
			||||||
    model.setShadowMode(ShadowMode.CastAndReceive);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Bestimme die Verschiebung basierend auf der Rotation
 | 
					 | 
				
			||||||
    Vector3f translation = model.getLocalTranslation();
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    // Bei 0 oder 180 Grad wird auf der Z-Achse verschoben, bei 90 oder 270 Grad auf der X-Achse
 | 
					 | 
				
			||||||
    if (rotationAngle == 0 || rotationAngle == FastMath.PI) {
 | 
					 | 
				
			||||||
        // Verschiebe auf der Z-Achse und um 2f nach oben
 | 
					 | 
				
			||||||
        translation = translation.add(0,0,0);  // Nach hinten auf der Z-Achse, und um 2f nach oben
 | 
					 | 
				
			||||||
    } else if (rotationAngle == FastMath.HALF_PI || rotationAngle == 3 * FastMath.HALF_PI) {
 | 
					 | 
				
			||||||
        // Verschiebe auf der X-Achse und um 2f nach oben
 | 
					 | 
				
			||||||
        translation = translation.add(0,0,0);  // Nach hinten auf der X-Achse, und um 2f nach oben
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    model.setLocalTranslation(translation);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    return model;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
    private Spatial createTie_Fighter(Battleship ship) {
 | 
					 | 
				
			||||||
        final Spatial model = app.getAssetManager().loadModel(TIE_FIGHTER);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        model.rotate(-0f, calculateRotationAngle(ship.getRot()), 0f);
 | 
					 | 
				
			||||||
        model.scale(0.07f);
 | 
					 | 
				
			||||||
        model.setShadowMode(ShadowMode.CastAndReceive);
 | 
					 | 
				
			||||||
        model.setLocalTranslation(new Vector3f(model.getLocalTranslation().x, 2f, model.getLocalTranslation().z));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        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) {
 | 
				
			||||||
 | 
					        final Spatial model = app.getAssetManager().loadModel(BOAT_SMALL_MODEL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f);
 | 
				
			||||||
 | 
					        model.scale(0.0005f);
 | 
				
			||||||
 | 
					        model.setShadowMode(ShadowMode.CastAndReceive);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return 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(0f, calculateRotationAngle(ship.getRot()), 0f);
 | 
				
			||||||
 | 
					        model.move(0f, 0.25f, 0f);
 | 
				
			||||||
 | 
					        model.scale(0.85f);
 | 
				
			||||||
 | 
					        model.setShadowMode(ShadowMode.CastAndReceive);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return 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.move(0f, -0.06f, 0f);
 | 
				
			||||||
 | 
					        model.scale(0.27f);
 | 
				
			||||||
 | 
					        model.setShadowMode(ShadowMode.CastAndReceive);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return model;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Calculates the rotation angle for the specified rotation.
 | 
					     * Calculates the rotation angle for the specified rotation.
 | 
				
			||||||
@@ -386,6 +354,7 @@ class SeaSynchronizer extends ShipMapSynchronizer {
 | 
				
			|||||||
            case UP -> PI;
 | 
					            case UP -> PI;
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Creates and returns a 3D model representation of the given {@code Shell} object
 | 
					     * Creates and returns a 3D model representation of the given {@code Shell} object
 | 
				
			||||||
     * for visualization in the game.
 | 
					     * for visualization in the game.
 | 
				
			||||||
@@ -406,5 +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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,8 +4,8 @@ import com.jme3.math.Vector3f;
 | 
				
			|||||||
import com.jme3.renderer.RenderManager;
 | 
					import com.jme3.renderer.RenderManager;
 | 
				
			||||||
import com.jme3.renderer.ViewPort;
 | 
					import com.jme3.renderer.ViewPort;
 | 
				
			||||||
import com.jme3.scene.control.AbstractControl;
 | 
					import com.jme3.scene.control.AbstractControl;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import pp.battleship.model.Shell;
 | 
					import pp.battleship.model.Shell;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static pp.util.FloatMath.PI;
 | 
					import static pp.util.FloatMath.PI;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -36,13 +36,21 @@ public class ShellControl extends AbstractControl {
 | 
				
			|||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    protected void controlUpdate(float tpf) {
 | 
					    protected void controlUpdate(float tpf) {
 | 
				
			||||||
        Vector3f pos = shell.getPosition();
 | 
					        Vector3f pos = shell.getPosition();
 | 
				
			||||||
        Vector3f fixed = new Vector3f(pos.z + 0.5f, pos.y + 2f, pos.x + 0.5f);
 | 
					        Vector3f fixed = new Vector3f(pos.z + 0.5f, pos.y, pos.x + 0.5f);
 | 
				
			||||||
        fixed.setY(pos.y);
 | 
					        fixed.setY(pos.y);
 | 
				
			||||||
        spatial.setLocalTranslation(fixed);
 | 
					        spatial.setLocalTranslation(fixed);
 | 
				
			||||||
        spatial.setLocalRotation(shell.getRotation());
 | 
					        spatial.setLocalRotation(shell.getRotation());
 | 
				
			||||||
        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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,20 +1,18 @@
 | 
				
			|||||||
package pp.battleship.client.gui;
 | 
					package pp.battleship.client.gui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.jme3.math.FastMath;
 | 
					import com.jme3.scene.control.AbstractControl;
 | 
				
			||||||
import com.jme3.math.Quaternion;
 | 
					 | 
				
			||||||
import com.jme3.math.Vector3f;
 | 
					import com.jme3.math.Vector3f;
 | 
				
			||||||
import com.jme3.renderer.RenderManager;
 | 
					import com.jme3.renderer.RenderManager;
 | 
				
			||||||
import com.jme3.renderer.ViewPort;
 | 
					import com.jme3.renderer.ViewPort;
 | 
				
			||||||
import com.jme3.scene.Node;
 | 
					import com.jme3.scene.Node;
 | 
				
			||||||
import com.jme3.scene.control.AbstractControl;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 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 SinkingControl extends AbstractControl {
 | 
					class SinkingControl extends AbstractControl {
 | 
				
			||||||
    private static final float SINK_DURATION = 2f;  // Duration of the sinking animation
 | 
					    private static final float SINK_DURATION = 5f;  // Duration of the sinking animation
 | 
				
			||||||
    private static final float SINK_SPEED = 0.6f;   // 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;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final Node shipNode;
 | 
					    private final Node shipNode;
 | 
				
			||||||
@@ -26,7 +24,7 @@ class SinkingControl extends AbstractControl {
 | 
				
			|||||||
    public SinkingControl(Node shipNode) {
 | 
					    public SinkingControl(Node shipNode) {
 | 
				
			||||||
        this.shipNode = shipNode;
 | 
					        this.shipNode = shipNode;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    float tiltAngle= 0;
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Updated the Map to sink the ship
 | 
					     * Updated the Map to sink the ship
 | 
				
			||||||
     * 
 | 
					     * 
 | 
				
			||||||
@@ -39,20 +37,23 @@ class SinkingControl extends AbstractControl {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // Move the ship down over time
 | 
					        // Move the ship down over time
 | 
				
			||||||
        Vector3f currentPos = shipNode.getLocalTranslation();
 | 
					        Vector3f currentPos = shipNode.getLocalTranslation();
 | 
				
			||||||
        shipNode.setLocalTranslation(currentPos.x+SINK_SPEED*tpf, currentPos.y - SINK_SPEED * tpf*2, currentPos.z+SINK_SPEED*tpf*2);
 | 
					        shipNode.setLocalTranslation(currentPos.x, currentPos.y - SINK_SPEED * tpf, currentPos.z);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Check if sinking duration has passed
 | 
					        // Check if sinking duration has passed
 | 
				
			||||||
        if (elapsedTime >= SINK_DURATION) {
 | 
					        if (elapsedTime >= SINK_DURATION) {
 | 
				
			||||||
            // Remove the ship from the scene
 | 
					            // Remove the ship from the scene
 | 
				
			||||||
            shipNode.removeFromParent();
 | 
					            shipNode.removeFromParent();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // Apply the tilt angle and rotation during sinking
 | 
					 | 
				
			||||||
        float sinkingTiltAngle = FastMath.DEG_TO_RAD * tiltAngle * tpf;
 | 
					 | 
				
			||||||
        float sinkingRotationAngle = FastMath.DEG_TO_RAD * 45f * tpf; // Additional rotation during sinking
 | 
					 | 
				
			||||||
        Quaternion tiltRotation = new Quaternion().fromAngles(-sinkingTiltAngle, sinkingRotationAngle, 0);
 | 
					 | 
				
			||||||
        spatial.setLocalRotation(tiltRotation);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 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,140 +0,0 @@
 | 
				
			|||||||
package pp.battleship.client.gui;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.jme3.math.FastMath;
 | 
					 | 
				
			||||||
import com.jme3.math.Quaternion;
 | 
					 | 
				
			||||||
import com.jme3.math.Vector3f;
 | 
					 | 
				
			||||||
import com.jme3.renderer.RenderManager;
 | 
					 | 
				
			||||||
import com.jme3.renderer.ViewPort;
 | 
					 | 
				
			||||||
import com.jme3.scene.Node;
 | 
					 | 
				
			||||||
import com.jme3.scene.Spatial;
 | 
					 | 
				
			||||||
import com.jme3.scene.control.AbstractControl;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Controls the burning, tilting, and sinking behavior of a battleship.
 | 
					 | 
				
			||||||
 * The ship will burn and tilt for a specified duration, then sink below the water surface.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
public class SinkingShip extends AbstractControl {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private float elapsedTime = 0.2f;
 | 
					 | 
				
			||||||
    private final float burnTiltDuration;
 | 
					 | 
				
			||||||
    private final float sinkDuration;
 | 
					 | 
				
			||||||
    private final float sinkDepth;
 | 
					 | 
				
			||||||
    private final float tiltAngle;
 | 
					 | 
				
			||||||
    private final Vector3f initialPosition;
 | 
					 | 
				
			||||||
    private boolean sinkingStarted = false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Constructs a new ShipSinkingControl instance.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @param burnTiltDuration Time in seconds for the ship to burn and tilt on the surface
 | 
					 | 
				
			||||||
     * @param sinkDuration     Time in seconds for the ship to fully sink
 | 
					 | 
				
			||||||
     * @param sinkDepth        Depth below the water to sink the ship
 | 
					 | 
				
			||||||
     * @param tiltAngle        Final tilt angle in degrees
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public SinkingShip(float burnTiltDuration, float sinkDuration, float sinkDepth, float tiltAngle) {
 | 
					 | 
				
			||||||
        this.burnTiltDuration = burnTiltDuration;
 | 
					 | 
				
			||||||
        this.sinkDuration = sinkDuration;
 | 
					 | 
				
			||||||
        this.sinkDepth = sinkDepth;
 | 
					 | 
				
			||||||
        this.tiltAngle = tiltAngle;
 | 
					 | 
				
			||||||
        this.initialPosition = new Vector3f(); // Placeholder; will be set in controlUpdate
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Overrides controlUpdate in AbstractControl
 | 
					 | 
				
			||||||
     * regulates the burn and tilt timeframe
 | 
					 | 
				
			||||||
     * @param tpf time per frame (in seconds)
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    protected void controlUpdate(float tpf) {
 | 
					 | 
				
			||||||
        if (spatial == null) return;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        elapsedTime += tpf;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (elapsedTime < burnTiltDuration) {
 | 
					 | 
				
			||||||
            float progress = elapsedTime / burnTiltDuration;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            float angleInRadians = FastMath.DEG_TO_RAD * FastMath.interpolateLinear(progress, 0f, -tiltAngle);
 | 
					 | 
				
			||||||
            Quaternion tiltRotation = new Quaternion().fromAngles(angleInRadians, 0, 0);
 | 
					 | 
				
			||||||
            spatial.setLocalRotation(tiltRotation);
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Start sinking if it hasn't started yet
 | 
					 | 
				
			||||||
        if (!sinkingStarted) {
 | 
					 | 
				
			||||||
            sinkingStarted = true;
 | 
					 | 
				
			||||||
            // Save the initial position when sinking starts
 | 
					 | 
				
			||||||
            initialPosition.set(spatial.getLocalTranslation());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // Remove the hitEffectNode
 | 
					 | 
				
			||||||
            Node parentNode = (Node) spatial;
 | 
					 | 
				
			||||||
            Spatial hitEffects = parentNode.getChild("HitEffectNode");
 | 
					 | 
				
			||||||
            if (hitEffects != null) {
 | 
					 | 
				
			||||||
                parentNode.detachChild(hitEffects);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Calculate the progress of the sinking (0 to 1)
 | 
					 | 
				
			||||||
        float progress = Math.min((elapsedTime - burnTiltDuration) / sinkDuration, 1f);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Apply the tilt angle (remains constant during sinking)
 | 
					 | 
				
			||||||
        float sinkingTiltAngle = FastMath.DEG_TO_RAD * tiltAngle * progress;
 | 
					 | 
				
			||||||
        float sinkingRotationAngle = FastMath.DEG_TO_RAD * 45f * progress; // Additional rotation during sinking (test)
 | 
					 | 
				
			||||||
        Quaternion tiltRotation = new Quaternion().fromAngles(-sinkingTiltAngle, sinkingRotationAngle, sinkingRotationAngle);
 | 
					 | 
				
			||||||
        spatial.setLocalRotation(tiltRotation);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // Sink the ship by interpolating the Y position
 | 
					 | 
				
			||||||
        float currentY = FastMath.interpolateLinear(progress, initialPosition.y, sinkDepth);
 | 
					 | 
				
			||||||
        spatial.setLocalTranslation(initialPosition.x, currentY, initialPosition.z);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (currentY <= sinkDepth) {
 | 
					 | 
				
			||||||
            Node parentNode = (Node) spatial.getParent();
 | 
					 | 
				
			||||||
            if (parentNode != null) {
 | 
					 | 
				
			||||||
                parentNode.detachChild(spatial);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            spatial.removeControl(this);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      // public void checkAndTriggerExplosion() {
 | 
					 | 
				
			||||||
      //     // Prüfen, ob das sinkende Schiff den Boden erreicht hat
 | 
					 | 
				
			||||||
      //     if (spatial != null && spatial.getLocalTranslation().y <= sinkDepth) {
 | 
					 | 
				
			||||||
      //         // Explosion ausführen, wenn der Boden erreicht ist
 | 
					 | 
				
			||||||
      //         triggerExplosionAnimation();
 | 
					 | 
				
			||||||
      //         
 | 
					 | 
				
			||||||
      //         // Entfernen des Schiffs aus dem Elternknoten
 | 
					 | 
				
			||||||
      //         Node parentNode = (Node) spatial.getParent();
 | 
					 | 
				
			||||||
      //         if (parentNode != null) {
 | 
					 | 
				
			||||||
      //             parentNode.detachChild(spatial);
 | 
					 | 
				
			||||||
      //         }
 | 
					 | 
				
			||||||
      //         
 | 
					 | 
				
			||||||
      //         // Entfernen der Kontrolle vom Spatial
 | 
					 | 
				
			||||||
      //         spatial.removeControl(this);
 | 
					 | 
				
			||||||
      //     }
 | 
					 | 
				
			||||||
      // }
 | 
					 | 
				
			||||||
      // 
 | 
					 | 
				
			||||||
      // private void triggerExplosionAnimation() {
 | 
					 | 
				
			||||||
      //     // Code für die Explosion-Animation (alibi Methode)
 | 
					 | 
				
			||||||
      //     System.out.println("Explosion wird ausgeführt: Das Schiff hat den Boden erreicht!");
 | 
					 | 
				
			||||||
      //     // Hier könnte eine echte Animation eingefügt werden, z.B. Partikeleffekte
 | 
					 | 
				
			||||||
      // }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 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
 | 
					 | 
				
			||||||
    protected void controlRender(RenderManager rm, ViewPort vp) {
 | 
					 | 
				
			||||||
        // No rendering logic is needed for this control
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Starts the sinking process for the ship.
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public void startSinking() {
 | 
					 | 
				
			||||||
        // --> sinkingControl
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,20 +1,30 @@
 | 
				
			|||||||
package pp.battleship.client.gui;
 | 
					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 BgMusic music;
 | 
					    private final GameMusic music;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    private double vol;
 | 
					    private double vol;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public VolumeSlider(BgMusic music) {
 | 
					    /**
 | 
				
			||||||
 | 
					     * Constructs the Volume Slider for the Menu dialog
 | 
				
			||||||
 | 
					     * @param music the music instance
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public VolumeSlider(GameMusic music) {
 | 
				
			||||||
        super();
 | 
					        super();
 | 
				
			||||||
        this.music = music;
 | 
					        this.music = music;
 | 
				
			||||||
        vol = BgMusic.volumeInPreferences();
 | 
					        vol = GameMusic.volumeInPreferences();
 | 
				
			||||||
        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();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,16 +5,7 @@
 | 
				
			|||||||
// (c) Mark Minas (mark.minas@unibw.de)
 | 
					// (c) Mark Minas (mark.minas@unibw.de)
 | 
				
			||||||
////////////////////////////////////////
 | 
					////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package pp.battleship.client.server;
 | 
					package pp.battleship.server;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.io.File;
 | 
					 | 
				
			||||||
import java.io.FileInputStream;
 | 
					 | 
				
			||||||
import java.io.IOException;
 | 
					 | 
				
			||||||
import java.lang.System.Logger;
 | 
					 | 
				
			||||||
import java.lang.System.Logger.Level;
 | 
					 | 
				
			||||||
import java.util.concurrent.BlockingQueue;
 | 
					 | 
				
			||||||
import java.util.concurrent.LinkedBlockingQueue;
 | 
					 | 
				
			||||||
import java.util.logging.LogManager;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.jme3.network.ConnectionListener;
 | 
					import com.jme3.network.ConnectionListener;
 | 
				
			||||||
import com.jme3.network.HostedConnection;
 | 
					import com.jme3.network.HostedConnection;
 | 
				
			||||||
@@ -23,7 +14,6 @@ import com.jme3.network.MessageListener;
 | 
				
			|||||||
import com.jme3.network.Network;
 | 
					import com.jme3.network.Network;
 | 
				
			||||||
import com.jme3.network.Server;
 | 
					import com.jme3.network.Server;
 | 
				
			||||||
import com.jme3.network.serializing.Serializer;
 | 
					import com.jme3.network.serializing.Serializer;
 | 
				
			||||||
 | 
					 | 
				
			||||||
import pp.battleship.BattleshipConfig;
 | 
					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;
 | 
				
			||||||
@@ -40,17 +30,26 @@ import pp.battleship.model.Battleship;
 | 
				
			|||||||
import pp.battleship.model.IntPoint;
 | 
					import pp.battleship.model.IntPoint;
 | 
				
			||||||
import pp.battleship.model.Shot;
 | 
					import pp.battleship.model.Shot;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.File;
 | 
				
			||||||
 | 
					import java.io.FileInputStream;
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import java.lang.System.Logger;
 | 
				
			||||||
 | 
					import java.lang.System.Logger.Level;
 | 
				
			||||||
 | 
					import java.util.concurrent.BlockingQueue;
 | 
				
			||||||
 | 
					import java.util.concurrent.LinkedBlockingQueue;
 | 
				
			||||||
 | 
					import java.util.logging.LogManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Server implementing the visitor pattern as MessageReceiver for ClientMessages
 | 
					 * Server implementing the visitor pattern as MessageReceiver for ClientMessages
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class BattleshipSelfhostServer implements MessageListener<HostedConnection>, ConnectionListener, ServerSender {
 | 
					public class BattleshipServer implements MessageListener<HostedConnection>, ConnectionListener, ServerSender {
 | 
				
			||||||
    private static final Logger LOGGER = System.getLogger(BattleshipSelfhostServer.class.getName());
 | 
					    private static final Logger LOGGER = System.getLogger(BattleshipServer.class.getName());
 | 
				
			||||||
    private static final File CONFIG_FILE = new File("server.properties");
 | 
					    private static final File CONFIG_FILE = new File("server.properties");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private final BattleshipConfig config = new BattleshipConfig();
 | 
					    private final BattleshipConfig config = new BattleshipConfig();
 | 
				
			||||||
    private Server myServer;
 | 
					    private Server myServer;
 | 
				
			||||||
    private final ServerGameLogic logic;
 | 
					    private final ServerGameLogic logic;
 | 
				
			||||||
    private final BlockingQueue<ReceivedMessageSelfhost> pendingMessages = new LinkedBlockingQueue<>();
 | 
					    private final BlockingQueue<ReceivedMessage> pendingMessages = new LinkedBlockingQueue<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    static {
 | 
					    static {
 | 
				
			||||||
        // Configure logging
 | 
					        // Configure logging
 | 
				
			||||||
@@ -68,13 +67,13 @@ public class BattleshipSelfhostServer implements MessageListener<HostedConnectio
 | 
				
			|||||||
     * Starts the Battleships server.
 | 
					     * Starts the Battleships server.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static void main(String[] args) {
 | 
					    public static void main(String[] args) {
 | 
				
			||||||
        new BattleshipSelfhostServer().run();
 | 
					        new BattleshipServer().run();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Creates the server.
 | 
					     * Creates the server.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    BattleshipSelfhostServer() {
 | 
					    BattleshipServer() {
 | 
				
			||||||
        config.readFromIfExists(CONFIG_FILE);
 | 
					        config.readFromIfExists(CONFIG_FILE);
 | 
				
			||||||
        LOGGER.log(Level.INFO, "Configuration: {0}", config); //NON-NLS
 | 
					        LOGGER.log(Level.INFO, "Configuration: {0}", config); //NON-NLS
 | 
				
			||||||
        logic = new ServerGameLogic(this, config);
 | 
					        logic = new ServerGameLogic(this, config);
 | 
				
			||||||
@@ -117,24 +116,24 @@ public class BattleshipSelfhostServer implements MessageListener<HostedConnectio
 | 
				
			|||||||
        Serializer.registerClass(MapMessage.class);
 | 
					        Serializer.registerClass(MapMessage.class);
 | 
				
			||||||
        Serializer.registerClass(ShootMessage.class);
 | 
					        Serializer.registerClass(ShootMessage.class);
 | 
				
			||||||
        Serializer.registerClass(EffectMessage.class);
 | 
					        Serializer.registerClass(EffectMessage.class);
 | 
				
			||||||
 | 
					        Serializer.registerClass(AnimationFinishedMessage.class);
 | 
				
			||||||
        Serializer.registerClass(Battleship.class);
 | 
					        Serializer.registerClass(Battleship.class);
 | 
				
			||||||
        Serializer.registerClass(IntPoint.class);
 | 
					        Serializer.registerClass(IntPoint.class);
 | 
				
			||||||
        Serializer.registerClass(Shot.class);
 | 
					        Serializer.registerClass(Shot.class);
 | 
				
			||||||
        Serializer.registerClass(AnimationFinishedMessage.class);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private void registerListeners() {
 | 
					    private void registerListeners() {
 | 
				
			||||||
        myServer.addMessageListener(this, MapMessage.class);
 | 
					        myServer.addMessageListener(this, MapMessage.class);
 | 
				
			||||||
        myServer.addMessageListener(this, ShootMessage.class);
 | 
					        myServer.addMessageListener(this, ShootMessage.class);
 | 
				
			||||||
        myServer.addConnectionListener(this);
 | 
					 | 
				
			||||||
        myServer.addMessageListener(this, AnimationFinishedMessage.class);
 | 
					        myServer.addMessageListener(this, AnimationFinishedMessage.class);
 | 
				
			||||||
 | 
					        myServer.addConnectionListener(this);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void messageReceived(HostedConnection source, Message message) {
 | 
					    public void messageReceived(HostedConnection source, Message message) {
 | 
				
			||||||
        LOGGER.log(Level.INFO, "message received from {0}: {1}", source.getId(), message); //NON-NLS
 | 
					        LOGGER.log(Level.INFO, "message received from {0}: {1}", source.getId(), message); //NON-NLS
 | 
				
			||||||
        if (message instanceof ClientMessage clientMessage)
 | 
					        if (message instanceof ClientMessage clientMessage)
 | 
				
			||||||
            pendingMessages.add(new ReceivedMessageSelfhost(clientMessage, source.getId()));
 | 
					            pendingMessages.add(new ReceivedMessage(clientMessage, source.getId()));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
@@ -5,12 +5,12 @@
 | 
				
			|||||||
// (c) Mark Minas (mark.minas@unibw.de)
 | 
					// (c) Mark Minas (mark.minas@unibw.de)
 | 
				
			||||||
////////////////////////////////////////
 | 
					////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package pp.battleship.client.server;
 | 
					package pp.battleship.server;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import pp.battleship.message.client.ClientInterpreter;
 | 
					import pp.battleship.message.client.ClientInterpreter;
 | 
				
			||||||
import pp.battleship.message.client.ClientMessage;
 | 
					import pp.battleship.message.client.ClientMessage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
record ReceivedMessageSelfhost(ClientMessage message, int from) {
 | 
					record ReceivedMessage(ClientMessage message, int from) {
 | 
				
			||||||
    void process(ClientInterpreter interpreter) {
 | 
					    void process(ClientInterpreter interpreter) {
 | 
				
			||||||
        message.accept(interpreter, from);
 | 
					        message.accept(interpreter, from);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
		 After Width: | Height: | Size: 168 KiB  | 
| 
		 After Width: | Height: | Size: 56 KiB  | 
| 
		 After Width: | Height: | Size: 166 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  | 
| 
		 After Width: | Height: | Size: 235 KiB  | 
| 
		 After Width: | Height: | Size: 94 KiB  | 
@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					based on:
 | 
				
			||||||
 | 
					https://free3d.com/3d-model/wwii-ship-uk-king-george-v-class-battleship-v1--185381.html
 | 
				
			||||||
 | 
					License: Free Personal Use Only
 | 
				
			||||||
| 
		 Before Width: | Height: | Size: 354 KiB  | 
| 
		 Before Width: | Height: | Size: 164 KiB  | 
| 
		 Before Width: | Height: | Size: 220 KiB  | 
@@ -1,6 +1,6 @@
 | 
				
			|||||||
Material Water : Common/MatDefs/Light/Lighting.j3md {
 | 
					Material Water : Common/MatDefs/Light/Lighting.j3md {
 | 
				
			||||||
     MaterialParameters {
 | 
					     MaterialParameters {
 | 
				
			||||||
         Shininess            : 6
 | 
					         Shininess            : 64
 | 
				
			||||||
         DiffuseMap           : Repeat Textures/Terrain/Water/Water_002_COLOR.jpg
 | 
					         DiffuseMap           : Repeat Textures/Terrain/Water/Water_002_COLOR.jpg
 | 
				
			||||||
         NormalMap            : Repeat Textures/Terrain/Water/Water_002_NORM.jpg
 | 
					         NormalMap            : Repeat Textures/Terrain/Water/Water_002_NORM.jpg
 | 
				
			||||||
         SpecularMap          : Repeat Textures/Terrain/Water/Water_002_ROUGH.jpg
 | 
					         SpecularMap          : Repeat Textures/Terrain/Water/Water_002_ROUGH.jpg
 | 
				
			||||||
 
 | 
				
			|||||||
| 
		 Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 15 KiB  | 
@@ -1,2 +0,0 @@
 | 
				
			|||||||
[LocalizedFileNames]
 | 
					 | 
				
			||||||
Water_002_NORM.jpg=@Water_002_NORM,0
 | 
					 | 
				
			||||||
@@ -1,9 +1,11 @@
 | 
				
			|||||||
package pp.battleship.exporter;
 | 
					////////////////////////////////////////
 | 
				
			||||||
 | 
					// Programming project code
 | 
				
			||||||
 | 
					// UniBw M, 2022, 2023, 2024
 | 
				
			||||||
 | 
					// www.unibw.de/inf2
 | 
				
			||||||
 | 
					// (c) Mark Minas (mark.minas@unibw.de)
 | 
				
			||||||
 | 
					////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.File;
 | 
					package pp.battleship.exporter;
 | 
				
			||||||
import java.io.IOException;
 | 
					 | 
				
			||||||
import java.lang.System.Logger;
 | 
					 | 
				
			||||||
import java.lang.System.Logger.Level;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.jme3.app.SimpleApplication;
 | 
					import com.jme3.app.SimpleApplication;
 | 
				
			||||||
import com.jme3.export.JmeExporter;
 | 
					import com.jme3.export.JmeExporter;
 | 
				
			||||||
@@ -12,6 +14,11 @@ import com.jme3.scene.Spatial;
 | 
				
			|||||||
import com.jme3.system.JmeContext;
 | 
					import com.jme3.system.JmeContext;
 | 
				
			||||||
import com.jme3.util.TangentBinormalGenerator;
 | 
					import com.jme3.util.TangentBinormalGenerator;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.io.File;
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import java.lang.System.Logger;
 | 
				
			||||||
 | 
					import java.lang.System.Logger.Level;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This class transforms models into j3o format.
 | 
					 * This class transforms models into j3o format.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -34,14 +41,16 @@ public class ModelExporter extends SimpleApplication {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void simpleInitApp() {
 | 
					    public void simpleInitApp() {
 | 
				
			||||||
       export("Models/45.obj", "45.j3o");//NON-NLS passt
 | 
					        export("Models/KingGeorgeV/King_George_V.obj", "KingGeorgeV.j3o"); //NON-NLS
 | 
				
			||||||
       //export("Models/.j3o"); 
 | 
					        export("Models/BoatSmall/12219_boat_v2_L2.obj", "BoatSmall.j3o"); //NON-NLS
 | 
				
			||||||
       // export("Models/Transporter/Transporter.obj", "Transporter.j3o"); //NON-NLS passt
 | 
					        export("Models/Battle/14084_WWII_Ship_German_Type_II_U-boat_v2_L1.obj", "Battle.j3o"); //NON-NLS
 | 
				
			||||||
       // export("Models/TieFighter.obj", "TieFighter.j3o"); //NON-NLS
 | 
					        export("Models/CV/essex_scb-125_generic.obj", "CV.j3o"); //NON-NLS
 | 
				
			||||||
       // export("Models/Venator/Venator.obj", "Venator.j3o"); //NON-NLS kickt
 | 
					        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();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
 | 
				
			||||||
 | 
					# File Created: 29.03.2012 14:25:39
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					newmtl default
 | 
				
			||||||
 | 
						Ns 35.0000
 | 
				
			||||||
 | 
						Ni 1.5000
 | 
				
			||||||
 | 
						d 1.0000
 | 
				
			||||||
 | 
						Tr 0.0000
 | 
				
			||||||
 | 
						Tf 1.0000 1.0000 1.0000 
 | 
				
			||||||
 | 
						illum 2
 | 
				
			||||||
 | 
						Ka 1.0000 1.0000 1.0000
 | 
				
			||||||
 | 
						Kd 1.0000 1.0000 1.0000
 | 
				
			||||||
 | 
						Ks 0.5400 0.5400 0.5400
 | 
				
			||||||
 | 
						Ke 0.0000 0.0000 0.0000
 | 
				
			||||||
 | 
						map_Ka 14084_WWII_ship_German_Type_II_U-boat_diff.jpg
 | 
				
			||||||
 | 
						map_Kd 14084_WWII_ship_German_Type_II_U-boat_diff.jpg
 | 
				
			||||||
| 
		 After Width: | Height: | Size: 168 KiB  | 
@@ -0,0 +1,104 @@
 | 
				
			|||||||
 | 
					# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
 | 
				
			||||||
 | 
					# File Created: 16.12.2011 14:18:52
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					newmtl white
 | 
				
			||||||
 | 
						Ns 53.0000
 | 
				
			||||||
 | 
						Ni 1.5000
 | 
				
			||||||
 | 
						d 1.0000
 | 
				
			||||||
 | 
						Tr 0.0000
 | 
				
			||||||
 | 
						Tf 1.0000 1.0000 1.0000 
 | 
				
			||||||
 | 
						illum 2
 | 
				
			||||||
 | 
						Ka 0.6667 0.6667 0.6667
 | 
				
			||||||
 | 
						Kd 0.6667 0.6667 0.6667
 | 
				
			||||||
 | 
						Ks 0.1800 0.1800 0.1800
 | 
				
			||||||
 | 
						Ke 0.0000 0.0000 0.0000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					newmtl boat_elements_black
 | 
				
			||||||
 | 
						Ns 55.0000
 | 
				
			||||||
 | 
						Ni 1.5000
 | 
				
			||||||
 | 
						d 1.0000
 | 
				
			||||||
 | 
						Tr 0.0000
 | 
				
			||||||
 | 
						Tf 1.0000 1.0000 1.0000 
 | 
				
			||||||
 | 
						illum 2
 | 
				
			||||||
 | 
						Ka 0.0000 0.0000 0.0000
 | 
				
			||||||
 | 
						Kd 0.0000 0.0000 0.0000
 | 
				
			||||||
 | 
						Ks 0.3600 0.3600 0.3600
 | 
				
			||||||
 | 
						Ke 0.0000 0.0000 0.0000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					newmtl boat_glass
 | 
				
			||||||
 | 
						Ns 60.0000
 | 
				
			||||||
 | 
						Ni 7.0000
 | 
				
			||||||
 | 
						d 0.4000
 | 
				
			||||||
 | 
						Tr 0.6000
 | 
				
			||||||
 | 
						Tf 0.4000 0.4000 0.4000 
 | 
				
			||||||
 | 
						illum 2
 | 
				
			||||||
 | 
						Ka 0.1059 0.1569 0.1451
 | 
				
			||||||
 | 
						Kd 0.1059 0.1569 0.1451
 | 
				
			||||||
 | 
						Ks 0.6750 0.6750 0.6750
 | 
				
			||||||
 | 
						Ke 0.0000 0.0000 0.0000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					newmtl boat_screw_hooks_bronze
 | 
				
			||||||
 | 
						Ns 80.0000
 | 
				
			||||||
 | 
						Ni 1.5000
 | 
				
			||||||
 | 
						d 1.0000
 | 
				
			||||||
 | 
						Tr 0.0000
 | 
				
			||||||
 | 
						Tf 1.0000 1.0000 1.0000 
 | 
				
			||||||
 | 
						illum 2
 | 
				
			||||||
 | 
						Ka 0.2941 0.2157 0.0510
 | 
				
			||||||
 | 
						Kd 0.2941 0.2157 0.0510
 | 
				
			||||||
 | 
						Ks 0.7200 0.7200 0.7200
 | 
				
			||||||
 | 
						Ke 0.0000 0.0000 0.0000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					newmtl boat_silver
 | 
				
			||||||
 | 
						Ns 80.0000
 | 
				
			||||||
 | 
						Ni 1.5000
 | 
				
			||||||
 | 
						d 1.0000
 | 
				
			||||||
 | 
						Tr 0.0000
 | 
				
			||||||
 | 
						Tf 1.0000 1.0000 1.0000 
 | 
				
			||||||
 | 
						illum 2
 | 
				
			||||||
 | 
						Ka 0.3333 0.3333 0.3333
 | 
				
			||||||
 | 
						Kd 0.3333 0.3333 0.3333
 | 
				
			||||||
 | 
						Ks 0.7200 0.7200 0.7200
 | 
				
			||||||
 | 
						Ke 0.0000 0.0000 0.0000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					newmtl boat_buffer
 | 
				
			||||||
 | 
						Ns 10.0000
 | 
				
			||||||
 | 
						Ni 1.5000
 | 
				
			||||||
 | 
						d 1.0000
 | 
				
			||||||
 | 
						Tr 0.0000
 | 
				
			||||||
 | 
						Tf 1.0000 1.0000 1.0000 
 | 
				
			||||||
 | 
						illum 2
 | 
				
			||||||
 | 
						Ka 1.0000 1.0000 1.0000
 | 
				
			||||||
 | 
						Kd 1.0000 1.0000 1.0000
 | 
				
			||||||
 | 
						Ks 0.2700 0.2700 0.2700
 | 
				
			||||||
 | 
						Ke 0.0000 0.0000 0.0000
 | 
				
			||||||
 | 
						map_Ka boat_buffer_diffuse.jpg
 | 
				
			||||||
 | 
						map_Kd boat_buffer_diffuse.jpg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					newmtl boat_roof_accessory
 | 
				
			||||||
 | 
						Ns 15.0000
 | 
				
			||||||
 | 
						Ni 1.5000
 | 
				
			||||||
 | 
						d 1.0000
 | 
				
			||||||
 | 
						Tr 0.0000
 | 
				
			||||||
 | 
						Tf 1.0000 1.0000 1.0000 
 | 
				
			||||||
 | 
						illum 2
 | 
				
			||||||
 | 
						Ka 1.0000 1.0000 1.0000
 | 
				
			||||||
 | 
						Kd 1.0000 1.0000 1.0000
 | 
				
			||||||
 | 
						Ks 0.3600 0.3600 0.3600
 | 
				
			||||||
 | 
						Ke 0.0000 0.0000 0.0000
 | 
				
			||||||
 | 
						map_Ka boat_roof_accessory_diffuse.jpg
 | 
				
			||||||
 | 
						map_Kd boat_roof_accessory_diffuse.jpg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					newmtl boat_body
 | 
				
			||||||
 | 
						Ns 55.0000
 | 
				
			||||||
 | 
						Ni 1.5000
 | 
				
			||||||
 | 
						d 1.0000
 | 
				
			||||||
 | 
						Tr 0.0000
 | 
				
			||||||
 | 
						Tf 1.0000 1.0000 1.0000 
 | 
				
			||||||
 | 
						illum 2
 | 
				
			||||||
 | 
						Ka 1.0000 1.0000 1.0000
 | 
				
			||||||
 | 
						Kd 1.0000 1.0000 1.0000
 | 
				
			||||||
 | 
						Ks 0.3600 0.3600 0.3600
 | 
				
			||||||
 | 
						Ke 0.0000 0.0000 0.0000
 | 
				
			||||||
 | 
						map_Ka boat_body_diffuse.jpg
 | 
				
			||||||
 | 
						map_Kd boat_body_diffuse.jpg
 | 
				
			||||||