mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 19:19:44 +01:00
Übergang zu TestMap verbessert
This commit is contained in:
parent
2e0d1c059d
commit
afdf43ebf1
@ -9,7 +9,12 @@ import com.jme3.font.BitmapText;
|
||||
import com.jme3.input.KeyInput;
|
||||
import com.jme3.input.controls.ActionListener;
|
||||
import com.jme3.input.controls.KeyTrigger;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.shape.Box;
|
||||
import com.jme3.system.AppSettings;
|
||||
import com.jme3.texture.Texture;
|
||||
import com.simsilica.lemur.GuiGlobals;
|
||||
import com.simsilica.lemur.style.BaseStyles;
|
||||
|
||||
@ -17,7 +22,6 @@ import pp.dialog.DialogBuilder;
|
||||
import pp.dialog.DialogManager;
|
||||
import pp.graphics.Draw;
|
||||
import pp.monopoly.client.gui.SettingsMenu;
|
||||
import pp.monopoly.client.gui.TestWorld;
|
||||
import pp.monopoly.game.client.ClientGameLogic;
|
||||
import pp.monopoly.game.client.MonopolyClient;
|
||||
import pp.monopoly.game.client.ServerConnection;
|
||||
@ -161,12 +165,32 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
}
|
||||
//altes Fenster beim Start von TestWorld schließen
|
||||
public void startTestWorld() {
|
||||
// Beendet das MonopolyApp-Fenster
|
||||
stop(false);
|
||||
// Entferne die aktuelle GUI
|
||||
guiNode.detachAllChildren();
|
||||
|
||||
// Startet die TestWorld
|
||||
TestWorld testWorld = new TestWorld();
|
||||
testWorld.start();
|
||||
// Erstelle ein Quadrat mit Textur
|
||||
Box box = new Box(1, 0.01f, 1); // Dünnes Quadrat
|
||||
Geometry geom = new Geometry("Box", box);
|
||||
|
||||
// Setze das Material mit Textur
|
||||
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
|
||||
Texture texture = assetManager.loadTexture("Pictures/board.png");
|
||||
mat.setTexture("ColorMap", texture);
|
||||
geom.setMaterial(mat);
|
||||
|
||||
// Füge das Quadrat zur Szene hinzu
|
||||
rootNode.attachChild(geom);
|
||||
|
||||
// Setze die Kameraposition
|
||||
cam.setLocation(new Vector3f(0, 0, 3));
|
||||
cam.lookAt(geom.getLocalTranslation(), Vector3f.UNIT_Y);
|
||||
}
|
||||
public void returnToMenu() {
|
||||
// Entferne die Testszene
|
||||
rootNode.detachAllChildren();
|
||||
|
||||
// Zeige das Startmenü erneut
|
||||
StartMenu.createStartMenu(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +63,10 @@ public class CreateGameMenu {
|
||||
// "Spiel hosten"-Button
|
||||
Button hostButton = buttonContainer.addChild(new Button("Spiel hosten"));
|
||||
hostButton.setPreferredSize(new Vector3f(120, 40, 0));
|
||||
hostButton.addClickCommands(source -> startTestWorld());
|
||||
hostButton.addClickCommands(source -> {
|
||||
closeCreateGameMenu(); // Schließt das Menü
|
||||
app.startTestWorld(); // Startet die Testwelt in der Hauptanwendung
|
||||
});
|
||||
|
||||
|
||||
// "Beitreten"-Button
|
||||
@ -116,6 +119,11 @@ public class CreateGameMenu {
|
||||
// Startet die Testszene
|
||||
TestWorld.startTestWorld();
|
||||
}
|
||||
|
||||
private void closeCreateGameMenu() {
|
||||
app.getGuiNode().detachChild(menuContainer); // Entfernt den Menü-Container
|
||||
app.getGuiNode().detachChild(background); // Entfernt das Hintergrundbild
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user