Merge remote-tracking branch 'origin/connect' into connect

This commit is contained in:
Yvonne Schmidt 2024-11-25 00:24:43 +01:00
commit a27ac31086
6 changed files with 140 additions and 1 deletions

View File

@ -21,7 +21,7 @@ import pp.battleship.client.gui.GameMusic;
import pp.dialog.Dialog;
import pp.dialog.StateCheckboxModel;
import pp.dialog.TextInputDialog;
import pp.monopoly.client.gui.VolumeSlider;
import pp.battleship.client.gui.VolumeSlider;
import static pp.util.PreferencesUtils.getPreferences;

View File

@ -0,0 +1,36 @@
package pp.battleship.client.gui;
import com.simsilica.lemur.Slider;
/**
* The VolumeSlider class represents the Volume Slider in the Menu.
* It extends the Slider class and provides functionalities for setting the music volume,
* with the help of the Slider in the GUI
*/
public class VolumeSlider extends Slider {
private final GameMusic music;
private double vol;
/**
* Constructs the Volume Slider for the Menu dialog
* @param music the music instance
*/
public VolumeSlider(GameMusic music) {
super();
this.music = music;
vol = GameMusic.volumeInPreferences();
getModel().setPercent(vol);
}
/**
* when triggered it updates the volume to the value set with the slider
*/
public void update() {
if (vol != getModel().getPercent()) {
vol = getModel().getPercent();
music.setVolume( (float) vol);
}
}
}

View File

@ -0,0 +1,52 @@
package pp.monopoly.client.gui.popups;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.component.IconComponent;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
public class LooserPopUp extends Dialog {
private final MonopolyApp app;
/**
* Constructs a new NetworkDialog.
*
* @param network The NetworkSupport instance to be used for network operations.
*/
public LooserPopUp(MonopolyApp app) {
super(app.getDialogManager());
this.app = app;
initializeDialog();
}
/**
* Initializes the dialog with input fields and connection buttons.
*/
private void initializeDialog() {
Container inputContainer = new Container();
// Titel und Eingabefelder für Host und Port
inputContainer.addChild(new Label("Schade, du hast leider verloren!"));
inputContainer.addChild(new Label("Die nächste Runde wird besser!"));
Label imageLabel = new Label("");
IconComponent icon = new IconComponent("Pictures/MonopolyLooser.png"); // Icon mit Textur erstellen
icon.setIconScale(1); // Skalierung des Bildes
imageLabel.setIcon(icon);
// Setze das Icon im Label
inputContainer.addChild(imageLabel);
Button cancelButton = inputContainer.addChild(new Button("Spiel beenden"));
cancelButton.addClickCommands(source -> ifTopDialog(app::closeApp));
inputContainer.setLocalTranslation(300, 800, 0);
app.getGuiNode().attachChild(inputContainer);
}
}

View File

@ -0,0 +1,51 @@
package pp.monopoly.client.gui.popups;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.component.IconComponent;
import pp.dialog.Dialog;
import pp.monopoly.client.MonopolyApp;
public class WinnerPopUp extends Dialog {
private final MonopolyApp app;
/**
* Constructs a new NetworkDialog.
*
* @param app The NetworkSupport instance to be used for network operations.
*/
public WinnerPopUp(MonopolyApp app) {
super(app.getDialogManager());
this.app = app;
initializeDialog();
}
/**
* Initializes the dialog with input fields and connection buttons.
*/
private void initializeDialog() {
Container inputContainer = new Container();
// Titel und Eingabefelder für Host und Port
inputContainer.addChild(new Label("Herlichen Glückwunsch!"));
inputContainer.addChild(new Label("Du,bist der Monopoly Champion!!!"));
Label imageLabel = new Label("");
IconComponent icon = new IconComponent("Pictures/MonopolyWinner.png"); // Icon mit Textur erstellen
icon.setIconScale(1); // Skalierung des Bildes
imageLabel.setIcon(icon);
// Setze das Icon im Label
inputContainer.addChild(imageLabel);
Button cancelButton = inputContainer.addChild(new Button("Spiel beenden"));
cancelButton.addClickCommands(source -> ifTopDialog(app::closeApp));
inputContainer.setLocalTranslation(300, 800, 0);
app.getGuiNode().attachChild(inputContainer);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 KiB