mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-25 05:49:44 +01:00
refactor
This commit is contained in:
parent
160873e2cc
commit
c0f42fb1eb
@ -1,4 +1,4 @@
|
|||||||
package pp.monopoly.client;
|
package pp.monopoly.client.gui.popups;
|
||||||
|
|
||||||
import com.jme3.asset.TextureKey;
|
import com.jme3.asset.TextureKey;
|
||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
@ -8,25 +8,20 @@ import com.simsilica.lemur.Container;
|
|||||||
import com.simsilica.lemur.Label;
|
import com.simsilica.lemur.Label;
|
||||||
import com.simsilica.lemur.component.IconComponent;
|
import com.simsilica.lemur.component.IconComponent;
|
||||||
import pp.dialog.SimpleDialog;
|
import pp.dialog.SimpleDialog;
|
||||||
|
import pp.monopoly.client.MonopolyApp;
|
||||||
|
|
||||||
public class LoserPopUp extends SimpleDialog {
|
public class LoserPopUp extends SimpleDialog {
|
||||||
|
|
||||||
|
private final MonopolyApp app;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private final NetworkSupport network;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new NetworkDialog.
|
* Constructs a new NetworkDialog.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @param network The NetworkSupport instance to be used for network operations.
|
* @param network The NetworkSupport instance to be used for network operations.
|
||||||
*/
|
*/
|
||||||
public LoserPopUp( NetworkSupport network) {
|
public LoserPopUp(MonopolyApp app) {
|
||||||
super(network.getApp().getDialogManager());
|
super(app.getDialogManager());
|
||||||
this.network = network;
|
this.app = app;
|
||||||
initializeDialog();
|
initializeDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +29,6 @@ public class LoserPopUp extends SimpleDialog {
|
|||||||
* Initializes the dialog with input fields and connection buttons.
|
* Initializes the dialog with input fields and connection buttons.
|
||||||
*/
|
*/
|
||||||
private void initializeDialog() {
|
private void initializeDialog() {
|
||||||
final MonopolyApp hallo = network.getApp();
|
|
||||||
Container inputContainer = new Container();
|
Container inputContainer = new Container();
|
||||||
|
|
||||||
// Titel und Eingabefelder für Host und Port
|
// Titel und Eingabefelder für Host und Port
|
||||||
@ -43,24 +37,18 @@ public class LoserPopUp extends SimpleDialog {
|
|||||||
|
|
||||||
Label imageLabel = new Label("");
|
Label imageLabel = new Label("");
|
||||||
TextureKey key = new TextureKey("Pictures/MonopolyLoser.png", true);
|
TextureKey key = new TextureKey("Pictures/MonopolyLoser.png", true);
|
||||||
Texture texture = hallo.getAssetManager().loadTexture(key);
|
Texture texture = app.getAssetManager().loadTexture(key);
|
||||||
IconComponent icon = new IconComponent(texture.toString()); // Icon mit Textur erstellen
|
IconComponent icon = new IconComponent(texture.toString()); // Icon mit Textur erstellen
|
||||||
icon.setIconSize(new Vector2f(155f, 120f)); // Skalierung des Bildes
|
icon.setIconSize(new Vector2f(155f, 120f)); // Skalierung des Bildes
|
||||||
imageLabel.setIcon(icon); // Setze das Icon im Label
|
imageLabel.setIcon(icon); // Setze das Icon im Label
|
||||||
|
|
||||||
|
|
||||||
inputContainer.addChild(imageLabel);
|
inputContainer.addChild(imageLabel);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Button cancelButton = inputContainer.addChild(new Button("Spiel beenden"));
|
Button cancelButton = inputContainer.addChild(new Button("Spiel beenden"));
|
||||||
cancelButton.addClickCommands(source -> hallo.closeApp());
|
cancelButton.addClickCommands(source -> ifTopDialog(app::closeApp));
|
||||||
inputContainer.setLocalTranslation(300,500,0);
|
inputContainer.setLocalTranslation(300,500,0);
|
||||||
hallo.getGuiNode().attachChild(inputContainer);
|
attachChild(inputContainer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package pp.monopoly.client;
|
package pp.monopoly.client.gui.popups;
|
||||||
|
|
||||||
import com.jme3.asset.TextureKey;
|
import com.jme3.asset.TextureKey;
|
||||||
import com.jme3.math.Vector2f;
|
import com.jme3.math.Vector2f;
|
||||||
@ -7,20 +7,22 @@ import com.simsilica.lemur.Button;
|
|||||||
import com.simsilica.lemur.Container;
|
import com.simsilica.lemur.Container;
|
||||||
import com.simsilica.lemur.Label;
|
import com.simsilica.lemur.Label;
|
||||||
import com.simsilica.lemur.component.IconComponent;
|
import com.simsilica.lemur.component.IconComponent;
|
||||||
import pp.dialog.SimpleDialog;
|
|
||||||
|
|
||||||
public class WinnerPopUp extends SimpleDialog {
|
import pp.dialog.Dialog;
|
||||||
|
import pp.monopoly.client.MonopolyApp;
|
||||||
|
|
||||||
private final NetworkSupport network;
|
public class WinnerPopUp extends Dialog {
|
||||||
|
|
||||||
|
private final MonopolyApp app;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new NetworkDialog.
|
* Constructs a new NetworkDialog.
|
||||||
*
|
*
|
||||||
* @param network The NetworkSupport instance to be used for network operations.
|
* @param app The NetworkSupport instance to be used for network operations.
|
||||||
*/
|
*/
|
||||||
public WinnerPopUp(NetworkSupport network) {
|
public WinnerPopUp(MonopolyApp app) {
|
||||||
super(network.getApp().getDialogManager());
|
super(app.getDialogManager());
|
||||||
this.network = network;
|
this.app = app;
|
||||||
initializeDialog();
|
initializeDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +30,6 @@ public class WinnerPopUp extends SimpleDialog {
|
|||||||
* Initializes the dialog with input fields and connection buttons.
|
* Initializes the dialog with input fields and connection buttons.
|
||||||
*/
|
*/
|
||||||
private void initializeDialog() {
|
private void initializeDialog() {
|
||||||
final MonopolyApp appp = network.getApp();
|
|
||||||
Container inputContainer = new Container();
|
Container inputContainer = new Container();
|
||||||
|
|
||||||
// Titel und Eingabefelder für Host und Port
|
// Titel und Eingabefelder für Host und Port
|
||||||
@ -37,7 +38,7 @@ public class WinnerPopUp extends SimpleDialog {
|
|||||||
|
|
||||||
Label imageLabel = new Label("");
|
Label imageLabel = new Label("");
|
||||||
TextureKey key = new TextureKey("Pictures/MonopolyWinner.png", true);
|
TextureKey key = new TextureKey("Pictures/MonopolyWinner.png", true);
|
||||||
Texture texture = appp.getAssetManager().loadTexture(key);
|
Texture texture = app.getAssetManager().loadTexture(key);
|
||||||
IconComponent icon = new IconComponent(texture.toString()); // Icon mit Textur erstellen
|
IconComponent icon = new IconComponent(texture.toString()); // Icon mit Textur erstellen
|
||||||
icon.setIconSize(new Vector2f(150f, 100f)); // Skalierung des Bildes
|
icon.setIconSize(new Vector2f(150f, 100f)); // Skalierung des Bildes
|
||||||
imageLabel.setIcon(icon);
|
imageLabel.setIcon(icon);
|
||||||
@ -47,9 +48,9 @@ public class WinnerPopUp extends SimpleDialog {
|
|||||||
inputContainer.addChild(imageLabel);
|
inputContainer.addChild(imageLabel);
|
||||||
|
|
||||||
Button cancelButton = inputContainer.addChild(new Button("Spiel beenden"));
|
Button cancelButton = inputContainer.addChild(new Button("Spiel beenden"));
|
||||||
cancelButton.addClickCommands(source -> appp.closeApp());
|
cancelButton.addClickCommands(source -> ifTopDialog(app::closeApp));
|
||||||
inputContainer.setLocalTranslation(300, 500, 0);
|
inputContainer.setLocalTranslation(300, 500, 0);
|
||||||
appp.getGuiNode().attachChild(inputContainer);
|
attachChild(inputContainer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user