mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-24 23:59:44 +01:00
Angleichen Monopolyapp
This commit is contained in:
parent
8e3cb43244
commit
e73c434c1b
@ -9,19 +9,14 @@ 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;
|
||||
|
||||
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;
|
||||
@ -37,7 +32,6 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
private final DialogManager dialogManager = new DialogManager(this);
|
||||
private final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
private SettingsMenu settingsMenu;
|
||||
private final Draw draw;
|
||||
|
||||
/**
|
||||
* Path to the styles script for GUI elements.
|
||||
@ -55,7 +49,6 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
}
|
||||
|
||||
public MonopolyApp() {
|
||||
this.draw = new Draw(assetManager);
|
||||
config = new MonopolyAppConfig();
|
||||
serverConnection = new NetworkSupport(this);
|
||||
logic = new ClientGameLogic(serverConnection);
|
||||
@ -95,8 +88,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
GuiGlobals.initialize(this);
|
||||
BaseStyles.loadStyleResources(STYLES_SCRIPT);
|
||||
GuiGlobals.getInstance().getStyles().setDefaultStyle("pp"); //NON-NLS
|
||||
final BitmapFont normalFont = assetManager.loadFont(FONT); //NON-NLS
|
||||
|
||||
final BitmapFont normalFont = assetManager.loadFont(FONT);
|
||||
setupInput();
|
||||
setupGui();
|
||||
|
||||
@ -105,7 +97,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
}
|
||||
|
||||
private void setupGui() {
|
||||
BitmapFont normalFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
|
||||
BitmapFont normalFont = assetManager.loadFont(FONT);
|
||||
topText = new BitmapText(normalFont);
|
||||
topText.setLocalTranslation(10, settings.getHeight() - 10, 0);
|
||||
guiNode.attachChild(topText);
|
||||
@ -117,7 +109,6 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
inputManager.addMapping("ESC", new KeyTrigger(KeyInput.KEY_ESCAPE));
|
||||
inputManager.addListener(escapeListener, "ESC");
|
||||
}
|
||||
|
||||
|
||||
private void handleEscape(boolean isPressed) {
|
||||
if (isPressed) {
|
||||
@ -132,8 +123,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setInfoText(String text) {
|
||||
public void setInfoText(String text) {
|
||||
topText.setText(text);
|
||||
}
|
||||
|
||||
@ -153,14 +143,6 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
return dialogManager;
|
||||
}
|
||||
|
||||
public Draw getDraw() {
|
||||
return draw;
|
||||
}
|
||||
|
||||
public ExecutorService getExecutor() {
|
||||
return executor;
|
||||
}
|
||||
|
||||
public void closeApp() {
|
||||
stop();
|
||||
}
|
||||
@ -173,35 +155,21 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
|
||||
.build()
|
||||
.open();
|
||||
}
|
||||
//altes Fenster beim Start von TestWorld schließen
|
||||
|
||||
/**
|
||||
* Wechselt zur TestWorld.
|
||||
*/
|
||||
public void startTestWorld() {
|
||||
// Entferne die aktuelle GUI
|
||||
guiNode.detachAllChildren();
|
||||
|
||||
// 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);
|
||||
guiNode.detachAllChildren(); // GUI entfernen
|
||||
stop(); // MonopolyApp anhalten
|
||||
TestWorld.startTestWorld(); // TestWorld starten
|
||||
}
|
||||
|
||||
/**
|
||||
* Kehrt zum Hauptmenü zurück.
|
||||
*/
|
||||
public void returnToMenu() {
|
||||
// Entferne die Testszene
|
||||
rootNode.detachAllChildren();
|
||||
|
||||
// Zeige das Startmenü erneut
|
||||
guiNode.detachAllChildren();
|
||||
StartMenu.createStartMenu(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user