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