mirror of
				https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
				synced 2025-10-31 00:31:52 +01:00 
			
		
		
		
	klassen angepasst
This commit is contained in:
		| @@ -217,7 +217,12 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga | |||||||
|         setupInput(); |         setupInput(); | ||||||
|         setupStates(); |         setupStates(); | ||||||
|         setupGui(); |         setupGui(); | ||||||
|         serverConnection.connect(); |         createStartMenu(); | ||||||
|  |         //serverConnection.connect(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     private void createStartMenu() { | ||||||
|  |         StartMenu.createStartMenu(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -1,22 +1,18 @@ | |||||||
| package pp.monopoly.client; | package pp.monopoly.client; | ||||||
|  |  | ||||||
| import com.jme3.asset.TextureKey; |  | ||||||
| import com.jme3.material.Material; |  | ||||||
| import com.jme3.math.Vector3f; |  | ||||||
| import com.jme3.scene.Geometry; |  | ||||||
| import com.jme3.scene.shape.Quad; |  | ||||||
| import com.jme3.texture.Texture; |  | ||||||
| import com.simsilica.lemur.Button; |  | ||||||
| import com.simsilica.lemur.Insets3f; |  | ||||||
| import com.simsilica.lemur.Label; |  | ||||||
| import com.simsilica.lemur.Panel; |  | ||||||
| import com.simsilica.lemur.style.ElementId; |  | ||||||
| import com.simsilica.lemur.component.QuadBackgroundComponent; |  | ||||||
| import com.jme3.math.ColorRGBA; |  | ||||||
| import pp.dialog.Dialog; |  | ||||||
| import pp.monopoly.client.gui.GameMenu; |  | ||||||
| import pp.dialog.DialogManager; |  | ||||||
|  |  | ||||||
|  | import com.jme3.math.Vector3f; | ||||||
|  | import com.simsilica.lemur.Button; | ||||||
|  | import com.simsilica.lemur.Checkbox; | ||||||
|  | import com.simsilica.lemur.Container; | ||||||
|  | import com.simsilica.lemur.Label; | ||||||
|  | import com.simsilica.lemur.style.ElementId; | ||||||
|  | import pp.dialog.Dialog; | ||||||
|  | import pp.dialog.StateCheckboxModel; | ||||||
|  | import pp.dialog.TextInputDialog; | ||||||
|  |  | ||||||
|  | import java.io.File; | ||||||
|  | import java.io.IOException; | ||||||
| import java.util.prefs.Preferences; | import java.util.prefs.Preferences; | ||||||
|  |  | ||||||
| import static pp.monopoly.Resources.lookup; | import static pp.monopoly.Resources.lookup; | ||||||
| @@ -24,94 +20,49 @@ import static pp.util.PreferencesUtils.getPreferences; | |||||||
|  |  | ||||||
| public class StartMenu extends Dialog { | public class StartMenu extends Dialog { | ||||||
|     private static final Preferences PREFERENCES = getPreferences(StartMenu.class); |     private static final Preferences PREFERENCES = getPreferences(StartMenu.class); | ||||||
|  |     private static final String LAST_PATH = "last.file.path"; | ||||||
|     private final MonopolyApp app; |     private final MonopolyApp app; | ||||||
|  |     //private final Button playButton = new Button(lookup("Button.Play")); | ||||||
|     // Buttons for the menu |     //private final Button QuitButton = new Button(lookup("menu.quit")); | ||||||
|     private final Button playButton = new Button(lookup("button.play")); |    // private final Button GameMenu = new Button();/TODO Spielmenü Button funktionalität implementieren | ||||||
|     private final Button quitButton = new Button(lookup("menu.quit")); |  | ||||||
|     private final Button settingsButton = new Button("Einstellungen", new ElementId("menu-button")); |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Constructs the StartMenu dialog for the Monopoly application. |      * Constructs the Startup Menu dialog for the Monopoly application. | ||||||
|      * |      * | ||||||
|      * @param app the MonopolyApp instance |      * @param app the MonopolyApp instance | ||||||
|      */ |      */ | ||||||
|     public StartMenu(MonopolyApp app) { |     public StartMenu(MonopolyApp app) { | ||||||
|         super(app.getDialogManager()); |         super(app.getDialogManager()); | ||||||
|         this.app = app; |         this.app = app; | ||||||
|  |     } | ||||||
|  |  | ||||||
|         // Load and display the background image |     public static void createStartMenu() { | ||||||
|         TextureKey backgroundKey = new TextureKey("unibw-bib", false); |         Container mainMenu = new Container(); | ||||||
|         Texture backgroundTexture = app.getAssetManager().loadTexture(backgroundKey); |         mainMenu.setLocalTranslation(new Vector3f(300, 300, 0));  // Positionierung | ||||||
|         Material backgroundMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); |  | ||||||
|         backgroundMaterial.setTexture("ColorMap", backgroundTexture); |  | ||||||
|  |  | ||||||
|         // Create a large Quad for the background |         // Titel des Hauptmenüs | ||||||
|         Quad backgroundQuad = new Quad(16, 9); // Adjust size as necessary to fill the screen |         mainMenu.addChild(new Label("Hauptmenü")); | ||||||
|         Geometry background = new Geometry("Background", backgroundQuad); |  | ||||||
|         background.setMaterial(backgroundMaterial); |  | ||||||
|         background.setLocalTranslation(new Vector3f(-8, -4.5f, -1)); // Position it behind the UI components |  | ||||||
|  |  | ||||||
|         // Attach the background as the first element |         // Schaltflächen hinzufügen | ||||||
|         app.getGuiNode().attachChild(background); |         Button startButton = mainMenu.addChild(new Button("Spielen")); | ||||||
|  |         startButton.addClickCommands(source -> startGame()); | ||||||
|  |  | ||||||
|         // Load and display the Monopoly logo |         Button settingsButton = mainMenu.addChild(new Button("Einstellungen")); | ||||||
|         TextureKey monopolyLogoKey = new TextureKey("log-Monopoly", false); |  | ||||||
|         Texture monopolyLogoTexture = app.getAssetManager().loadTexture(monopolyLogoKey); |  | ||||||
|         Material monopolyLogoMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); |  | ||||||
|         monopolyLogoMaterial.setTexture("ColorMap", monopolyLogoTexture); |  | ||||||
|  |  | ||||||
|         Quad monopolyQuad = new Quad(5, 1.5f); // Adjust dimensions as necessary |  | ||||||
|         Geometry monopolyLogo = new Geometry("MonopolyLogo", monopolyQuad); |  | ||||||
|         monopolyLogo.setMaterial(monopolyLogoMaterial); |  | ||||||
|         monopolyLogo.setLocalTranslation(new Vector3f(0, 5, 0)); // Position Monopoly logo at the top |  | ||||||
|  |  | ||||||
|         Panel monopolyLogoPanel = new Panel(); |  | ||||||
|         addChild(monopolyLogoPanel); |  | ||||||
|  |  | ||||||
|         // Load and display the university logo |  | ||||||
|         TextureKey universityLogoKey = new TextureKey("unibw-logo.png", false); |  | ||||||
|         Texture universityLogoTexture = app.getAssetManager().loadTexture(universityLogoKey); |  | ||||||
|         Material universityLogoMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md"); |  | ||||||
|         universityLogoMaterial.setTexture("ColorMap", universityLogoTexture); |  | ||||||
|  |  | ||||||
|         Quad universityQuad = new Quad(4, 1); // Adjust dimensions to fit below Monopoly logo |  | ||||||
|         Geometry universityLogo = new Geometry("UniversityLogo", universityQuad); |  | ||||||
|         universityLogo.setMaterial(universityLogoMaterial); |  | ||||||
|         universityLogo.setLocalTranslation(new Vector3f(0, 3, 0)); // Position below the Monopoly logo |  | ||||||
|  |  | ||||||
|         Panel universityLogoPanel = new Panel(); |  | ||||||
|         addChild(universityLogoPanel); |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         // Button actions |  | ||||||
|         playButton.addClickCommands(source -> startGame()); |  | ||||||
|         quitButton.addClickCommands(source -> app.closeApp()); |  | ||||||
|         settingsButton.addClickCommands(source -> openSettings()); |         settingsButton.addClickCommands(source -> openSettings()); | ||||||
|  |  | ||||||
|         addChild(monopolyLogoPanel); |         Button quitButton = mainMenu.addChild(new Button("Spiel beenden")); | ||||||
|         addChild(universityLogoPanel); |         quitButton.addClickCommands(source -> quitGame()); | ||||||
|         addChild(playButton); |  | ||||||
|         addChild(quitButton); |         attachChild(mainMenu); | ||||||
|         addChild(settingsButton); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void startGame() { |     private void startGame() { | ||||||
|         System.out.println("Starting game..."); |         app.serverConnection.connect(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void openSettings() { |     private void quitGame() { | ||||||
|         app.getDialogManager().close(this); |  | ||||||
|         app.getDialogManager().open(new GameMenu(app)); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public void update() { |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public void escape() { |  | ||||||
|         close(); |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ import com.simsilica.lemur.style.ElementId; | |||||||
| import pp.dialog.Dialog; | import pp.dialog.Dialog; | ||||||
| import pp.monopoly.client.MonopolyApp; | import pp.monopoly.client.MonopolyApp; | ||||||
| 
 | 
 | ||||||
| public class GameMenu extends Dialog { | public class SettingsMenu extends Dialog { | ||||||
|     private final MonopolyApp app; |     private final MonopolyApp app; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
| @@ -16,7 +16,7 @@ public class GameMenu extends Dialog { | |||||||
|      * |      * | ||||||
|      * @param app the MonopolyApp instance |      * @param app the MonopolyApp instance | ||||||
|      */ |      */ | ||||||
|     public GameMenu(MonopolyApp app) { |     public SettingsMenu(MonopolyApp app) { | ||||||
|         super(app.getDialogManager()); |         super(app.getDialogManager()); | ||||||
|         this.app = app; |         this.app = app; | ||||||
| 
 | 
 | ||||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 144 KiB | 
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 750 KiB | 
| @@ -40,3 +40,4 @@ dialog.question=Question | |||||||
| port.must.be.integer=Port must be an integer number | port.must.be.integer=Port must be an integer number | ||||||
| map.doesnt.fit=The map doesn't fit to this game | map.doesnt.fit=The map doesn't fit to this game | ||||||
| client.server-start=Start server | client.server-start=Start server | ||||||
|  | menu.settings=Open Settings | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user