mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-25 01:09:46 +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.KeyInput;
|
||||||
import com.jme3.input.controls.ActionListener;
|
import com.jme3.input.controls.ActionListener;
|
||||||
import com.jme3.input.controls.KeyTrigger;
|
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.system.AppSettings;
|
||||||
|
import com.jme3.texture.Texture;
|
||||||
import com.simsilica.lemur.GuiGlobals;
|
import com.simsilica.lemur.GuiGlobals;
|
||||||
import com.simsilica.lemur.style.BaseStyles;
|
import com.simsilica.lemur.style.BaseStyles;
|
||||||
|
|
||||||
@ -17,7 +22,6 @@ import pp.dialog.DialogBuilder;
|
|||||||
import pp.dialog.DialogManager;
|
import pp.dialog.DialogManager;
|
||||||
import pp.graphics.Draw;
|
import pp.graphics.Draw;
|
||||||
import pp.monopoly.client.gui.SettingsMenu;
|
import pp.monopoly.client.gui.SettingsMenu;
|
||||||
import pp.monopoly.client.gui.TestWorld;
|
|
||||||
import pp.monopoly.game.client.ClientGameLogic;
|
import pp.monopoly.game.client.ClientGameLogic;
|
||||||
import pp.monopoly.game.client.MonopolyClient;
|
import pp.monopoly.game.client.MonopolyClient;
|
||||||
import pp.monopoly.game.client.ServerConnection;
|
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
|
//altes Fenster beim Start von TestWorld schließen
|
||||||
public void startTestWorld() {
|
public void startTestWorld() {
|
||||||
// Beendet das MonopolyApp-Fenster
|
// Entferne die aktuelle GUI
|
||||||
stop(false);
|
guiNode.detachAllChildren();
|
||||||
|
|
||||||
// Startet die TestWorld
|
// Erstelle ein Quadrat mit Textur
|
||||||
TestWorld testWorld = new TestWorld();
|
Box box = new Box(1, 0.01f, 1); // Dünnes Quadrat
|
||||||
testWorld.start();
|
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
|
// "Spiel hosten"-Button
|
||||||
Button hostButton = buttonContainer.addChild(new Button("Spiel hosten"));
|
Button hostButton = buttonContainer.addChild(new Button("Spiel hosten"));
|
||||||
hostButton.setPreferredSize(new Vector3f(120, 40, 0));
|
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
|
// "Beitreten"-Button
|
||||||
@ -117,5 +120,10 @@ public class CreateGameMenu {
|
|||||||
TestWorld.startTestWorld();
|
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