124 Commits

Author SHA1 Message Date
Johannes Schmelz
9120e4d53c show test world when GameStart message is recieved 2024-11-25 17:50:54 +01:00
Johannes Schmelz
1a62b76104 corrected map size 2024-11-25 16:28:50 +01:00
Johannes Schmelz
cc7f277bef fixed b button 2024-11-25 15:05:02 +01:00
Johannes Schmelz
274df8dfd1 Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-25 06:50:05 +01:00
Johannes Schmelz
0c2b266f5e Merge branch 'main' into 'gui'
# Conflicts:
#   Projekte/battleship/client/src/main/java/pp/battleship/client/Menu.java
#   Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy
#   Projekte/monopoly/model/src/main/java/pp/monopoly/game/server/Player.java
2024-11-25 05:33:21 +00:00
Simon Wilkening
16b4dbae18 Deckhelper korrigiert 2024-11-25 06:30:04 +01:00
Johannes Schmelz
88409dcc99 Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-25 05:42:49 +01:00
Johannes Schmelz
5cacff39b7 refactor typo 2024-11-25 05:42:45 +01:00
Yvonne Schmidt
093723a9d0 added outline for ChoosePartner Menu 2024-11-25 05:40:49 +01:00
Johannes Schmelz
dfdbcdc9f3 board visible again 2024-11-25 05:16:24 +01:00
Johannes Schmelz
bd725e2dc4 refactor 2024-11-25 04:54:35 +01:00
Johannes Schmelz
dd9d9144dd Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-25 04:52:56 +01:00
Johannes Schmelz
1a429e4bb6 fixed settings in toolbar 2024-11-25 04:52:53 +01:00
Yvonne Schmidt
ad6fb5e926 added dice containers 2024-11-25 04:52:34 +01:00
Johannes Schmelz
72cb7049ba remove demo cube 2024-11-25 04:19:13 +01:00
Johannes Schmelz
2e42f3afac added testing shortcuts 2024-11-25 04:09:48 +01:00
Yvonne Schmidt
8474c9f5bc fixed EventCard sizing 2024-11-25 03:56:07 +01:00
Johannes Schmelz
b7ed03f7e8 resolve merge conflicts 2024-11-25 03:55:06 +01:00
Johannes Schmelz
a44b6b5e4c Merge branch 'connect' into 'gui'
Client connect to server

See merge request progproj/gruppen-ht24/Gruppe-02!14
2024-11-25 02:46:03 +00:00
Johannes Schmelz
5268f75e17 Client connect to server 2024-11-25 02:46:03 +00:00
Simon Wilkening
687d1621fc EventCard erweitert 2024-11-25 00:06:12 +01:00
Johannes Schmelz
a6944aa6e3 added dice images 2024-11-24 23:38:22 +01:00
Johannes Schmelz
b8365c76a1 fix mac executable 2024-11-24 22:58:47 +01:00
Johannes Schmelz
19216cc174 refactor 2024-11-24 22:57:19 +01:00
Johannes Schmelz
c6a23b9b8e execute for apple 2024-11-24 22:56:52 +01:00
Johannes Schmelz
c0f42fb1eb refactor 2024-11-24 22:50:52 +01:00
Tamino Mueller
160873e2cc added pictures and popups fixed 2024-11-24 22:42:32 +01:00
Tamino Mueller
8df859bbef Merge remote-tracking branch 'origin/gui' into gui 2024-11-24 22:34:54 +01:00
Tamino Mueller
e30d10a85d Pop-Up hinzugefügt 2024-11-24 22:34:19 +01:00
Yvonne Schmidt
bafc3f1db6 Merge remote-tracking branch 'origin/gui' into gui 2024-11-24 19:25:12 +01:00
Yvonne Schmidt
03571fcf74 code cleanup in der lobby 2024-11-24 19:24:51 +01:00
Johannes Schmelz
e7a6802488 fixed buyProperty 2024-11-24 19:14:56 +01:00
Yvonne Schmidt
a6e6b5e158 lobby übergibt figur 2024-11-24 19:05:28 +01:00
Simon Wilkening
74c3d925e6 TODOs und Kommentare ergänst 2024-11-24 19:04:58 +01:00
Yvonne Schmidt
f67fa4d7f0 lobby übergibt namen 2024-11-24 18:39:32 +01:00
Simon Wilkening
225a8c0e08 BuildingPropertyCard adjusted 2024-11-24 18:11:42 +01:00
Yvonne Schmidt
9a6ce27fe1 lobby uebergibt farbe und startgeld 2024-11-24 18:07:39 +01:00
Johannes Schmelz
437114704a get client id 2024-11-24 17:20:35 +01:00
Johannes Schmelz
9b4cac4e56 send PlayerHandler when starting game 2024-11-24 16:51:00 +01:00
Johannes Schmelz
e780513b35 saving the players 2024-11-24 00:32:16 +01:00
Johannes Schmelz
d582c59a7d added playerState changes 2024-11-24 00:29:48 +01:00
Johannes Schmelz
7d2c85f617 fixed card bug 2024-11-24 00:13:32 +01:00
Johannes Schmelz
4a882bc4ac Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-24 00:11:18 +01:00
Johannes Schmelz
3c4eac1fcd added logic for visiting event field 2024-11-24 00:11:14 +01:00
Yvonne Schmidt
75d5a15bdb defaultwerte in die Lobby eingefügt 2024-11-23 23:19:53 +01:00
Yvonne Schmidt
17f121f7d1 Merge remote-tracking branch 'origin/gui' into gui 2024-11-23 23:15:04 +01:00
Johannes Schmelz
a66c570b51 remove 2d map view 2024-11-23 23:09:02 +01:00
Yvonne Schmidt
e1e7f2eaf6 überschneidungen von elementen beseitigt 2024-11-23 23:07:42 +01:00
Johannes Schmelz
46d2dce372 Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-23 22:12:39 +01:00
Johannes Schmelz
c39f1f6d4c tweaked camera params 2024-11-23 22:12:34 +01:00
Yvonne Schmidt
738b04f2d9 oberfläche der lobby fertig 2024-11-23 21:29:14 +01:00
Simon Wilkening
ecba1c3135 GateField korrigiert 2024-11-23 21:22:54 +01:00
Johannes Schmelz
748226f4ed added Move Camera based on player position 2024-11-23 19:27:04 +01:00
Johannes Schmelz
f658f53ba9 refactor 2024-11-23 19:26:36 +01:00
Johannes Schmelz
4a8304ee4f relabled FoodField 2024-11-23 18:53:29 +01:00
Simon Wilkening
7fe9604338 FoodField korrigiert 2024-11-23 18:28:28 +01:00
Johannes Schmelz
7f09a6dae8 refactor 2024-11-23 18:02:46 +01:00
Johannes Schmelz
270129bc97 fixed typo 2024-11-23 17:58:56 +01:00
Johannes Schmelz
62ec6f6bef dynamically allocate values 2024-11-23 17:58:17 +01:00
Johannes Schmelz
b24c14900c food field dynamic value allocation 2024-11-23 17:54:11 +01:00
Johannes Schmelz
44c55ce3a6 refactor 2024-11-23 17:42:51 +01:00
Johannes Schmelz
895bea048c Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-23 17:41:47 +01:00
Johannes Schmelz
885ab5bdc9 dynamically allocate values 2024-11-23 17:41:20 +01:00
Yvonne Schmidt
c6355b2c09 dropdown lesbar 2024-11-23 17:37:27 +01:00
Yvonne Schmidt
ada6bf3f24 changed GateField font color 2024-11-23 17:24:41 +01:00
Simon Wilkening
db471ac679 Merge remote-tracking branch 'origin/gui' into gui 2024-11-23 17:22:37 +01:00
Simon Wilkening
84059c4085 GateField 2024-11-23 17:22:24 +01:00
Yvonne Schmidt
09b363f943 auswahllogik im dropdown implementiert 2024-11-23 17:03:56 +01:00
Simon Wilkening
fd347c7780 Building property eingefügt 2024-11-23 16:50:16 +01:00
Johannes Schmelz
b38a34efa5 add figure when player added 2024-11-23 16:35:33 +01:00
Johannes Schmelz
10e24cf30e small bug fixes 2024-11-23 16:16:40 +01:00
Johannes Schmelz
3369057afb update the players figure when moved 2024-11-23 16:08:46 +01:00
Johannes Schmelz
7ada56e215 limit the amount of players to 6 2024-11-23 14:41:17 +01:00
Johannes Schmelz
373b9e6d53 allow the host player to set start money 2024-11-23 13:20:05 +01:00
Johannes Schmelz
3de31de9f7 bind playercolor to join order 2024-11-23 12:46:20 +01:00
Johannes Schmelz
7252259ab3 updated trade and client logic 2024-11-23 09:15:57 +01:00
Yvonne Schmidt
f33c673a05 lobby für feinschliff vorbereitet 2024-11-22 07:15:25 +01:00
Yvonne Schmidt
65a7958b66 popup ebenen angepasst und dropdown entfernt 2024-11-22 05:28:51 +01:00
Simon Wilkening
91e4df7478 B-Taste um Karte Kaufen Popup zu öffnen 2024-11-22 05:23:52 +01:00
Yvonne Schmidt
399606d9a0 Toolbar-Design angepasst 2024-11-22 04:45:27 +01:00
Johannes Schmelz
559afcaffd added NextPlayerTurn 2024-11-22 01:38:48 +01:00
Johannes Schmelz
15f5f91ddb rename sound files 2024-11-22 01:02:48 +01:00
Johannes Schmelz
067a8063a5 Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-22 00:54:13 +01:00
Johannes Schmelz
35e367ba24 added sounds 2024-11-22 00:54:09 +01:00
Simon Wilkening
fe68d991fc Merge remote-tracking branch 'origin/gui' into gui 2024-11-22 00:44:55 +01:00
Simon Wilkening
88dc633e8e Würfellogik mit toolbar erneut verbunden 2024-11-22 00:44:36 +01:00
Johannes Schmelz
0b9cbb0f5f view assets response now send alls properties and fixed which players properties are sent 2024-11-22 00:42:07 +01:00
Johannes Schmelz
c3a33b4402 added house prices and color to buildingfields 2024-11-21 15:30:34 +01:00
Luca Puderbach
e12f00aad6 Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-20 03:36:59 +01:00
Luca Puderbach
47bac0185f Port fix 2024-11-20 03:36:54 +01:00
Yvonne Schmidt
dafe1dab2a Merge remote-tracking branch 'origin/gui' into gui 2024-11-20 03:24:46 +01:00
Yvonne Schmidt
8ba4ea2819 menues angepasst und vorlage für dropdown implementiert 2024-11-20 03:24:27 +01:00
Simon Wilkening
f6f708fd5b Angepasste Toolbar 2024-11-20 03:17:10 +01:00
Luca Puderbach
1203077aed Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-20 02:39:20 +01:00
Luca Puderbach
ddbf79c928 can now add players 2024-11-20 02:37:00 +01:00
Johannes Schmelz
aa47dd579f added selenium dependecy for drop down menu 2024-11-20 02:21:23 +01:00
Johannes Schmelz
cdce478d77 send GameStart message with a list of all Players 2024-11-20 01:45:34 +01:00
Johannes Schmelz
f11f4a59f1 fixed lemurproto dependecy 2024-11-20 00:55:33 +01:00
Luca Puderbach
d631e8df1e TempFix 2024-11-20 00:50:19 +01:00
Johannes Schmelz
af80d40700 fix server start 2024-11-19 23:59:23 +01:00
Johannes Schmelz
3a6f8a945a palyer ready fix 2024-11-19 23:59:16 +01:00
Luca Puderbach
bb9727d54a Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-19 23:09:44 +01:00
Luca Puderbach
7da8b3e545 Spieler Lobby 2024-11-19 23:09:39 +01:00
Johannes Schmelz
b6968df451 Merge branch 'main' into 'gui'
Main

See merge request progproj/gruppen-ht24/Gruppe-02!13
2024-11-19 20:30:56 +00:00
Johannes Schmelz
aa986fb948 added backgroud music file 2024-11-19 20:51:24 +01:00
Yvonne Schmidt
6e63de6e99 Merge remote-tracking branch 'origin/gui' into gui 2024-11-19 19:54:40 +01:00
Yvonne Schmidt
962ecd08fa SettingsMenu hat neues design 2024-11-19 19:54:22 +01:00
Luca Puderbach
580a26b3ea Grundlage Toolbar 2024-11-19 19:50:25 +01:00
Johannes Schmelz
0cda6b5fa0 added first sound files 2024-11-19 19:40:27 +01:00
Johannes Schmelz
cc8c3795b8 added game sound logic 2024-11-19 19:27:52 +01:00
Johannes Schmelz
3c21165efb adjusted config params 2024-11-19 19:09:37 +01:00
Luca Puderbach
818fdf4670 Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-19 17:44:57 +01:00
Luca Puderbach
b7d679b492 neue map 2024-11-19 17:44:52 +01:00
Yvonne Schmidt
a42093df23 SettingsMenu nochmal angepasst 2024-11-19 17:34:22 +01:00
Johannes Schmelz
6157db51da added server label 2024-11-19 14:46:11 +01:00
Yvonne Schmidt
843052989b Merge remote-tracking branch 'origin/gui' into gui 2024-11-18 23:04:43 +01:00
Yvonne Schmidt
8e01fa3192 SettingsMenu angepasst 2024-11-18 23:04:09 +01:00
Johannes Schmelz
e2126a7ea7 implemented self host for server 2024-11-18 23:01:34 +01:00
Luca Puderbach
0b46d14650 LobbyServer Einfügen 2024-11-18 18:56:42 +01:00
Luca Puderbach
9e28deedf7 Grundlagen Lobby 2024-11-18 18:30:35 +01:00
Luca Puderbach
9c0172b413 Merge branch 'gui' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into gui 2024-11-18 17:27:51 +01:00
Luca Puderbach
2933d022aa Veränderung Erreichen der Testwelt 2024-11-18 17:27:46 +01:00
Yvonne Schmidt
bdefb7193e Merge remote-tracking branch 'origin/gui' into gui 2024-11-18 17:13:13 +01:00
Yvonne Schmidt
69b68a6975 toolbar style hinzugefügt 2024-11-18 17:08:58 +01:00
19 changed files with 238 additions and 55 deletions

View File

@@ -0,0 +1,110 @@
////////////////////////////////////////
// Programming project code
// UniBw M, 2022, 2023, 2024
// www.unibw.de/inf2
// (c) Mark Minas (mark.minas@unibw.de)
////////////////////////////////////////
package pp.monopoly.client;
import com.jme3.input.controls.ActionListener;
import com.jme3.scene.Node;
import com.jme3.system.AppSettings;
import pp.monopoly.client.MonopolyAppState;
import pp.monopoly.client.gui.TestWorld;
import pp.monopoly.model.IntPoint;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
/**
* Represents the state responsible for managing the battle interface within the Battleship game.
* This state handles the display and interaction of the battle map, including the opponent's map.
* It manages GUI components, input events, and the layout of the interface when this state is enabled.
*/
public class GameAppState extends MonopolyAppState {
private static final Logger LOGGER = System.getLogger(MonopolyAppState.class.getName());
private static final float DEPTH = 0f;
private static final float GAP = 20f;
/**
* A listener for handling click events in the battle interface.
* When a click is detected, it triggers the corresponding actions on the opponent's map.
*/
private final ActionListener clickListener = (name, isPressed, tpf) -> click(isPressed);
/**
* The root node for all GUI components in the battle state.
*/
private final Node battleNode = new Node("Game"); //NON-NLS
/**
* A view representing the opponent's map in the GUI.
*/
private TestWorld testWorld;
/**
* Enables the battle state by initializing, laying out, and adding GUI components.
* Attaches the components to the GUI node and registers input listeners.
*/
@Override
protected void enableState() {
battleNode.detachAllChildren();
initializeGuiComponents();
layoutGuiComponents();
addGuiComponents();
getApp().getGuiNode().attachChild(battleNode);
}
/**
* Disables the battle state by removing GUI components and unregistering input listeners.
* Also handles cleanup of resources, such as the opponent's map view.
*/
@Override
protected void disableState() {
getApp().getGuiNode().detachChild(battleNode);
getApp().getInputManager().removeListener(clickListener);
}
/**
* Initializes the GUI components used in the battle state.
* Creates the opponent's map view and adds a grid overlay to it.
*/
private void initializeGuiComponents() {
testWorld = new TestWorld(getApp());
testWorld.initializeScene();
}
/**
* Adds the initialized GUI components to the battle node.
* Currently, it attaches the opponent's map view to the node.
*/
private void addGuiComponents() {
}
/**
* Lays out the GUI components within the window, positioning them appropriately.
* The opponent's map view is positioned based on the window's dimensions and a specified gap.
*/
private void layoutGuiComponents() {
final AppSettings s = getApp().getContext().getSettings();
final float windowWidth = s.getWidth();
final float windowHeight = s.getHeight();
}
/**
* Handles click events in the battle interface. If the event indicates a click (not a release),
* it translates the cursor position to the model's coordinate system and triggers the game logic
* for interacting with the opponent's map.
*
* @param isPressed whether the mouse button is currently pressed (true) or released (false)
*/
private void click(boolean isPressed) {
}
@Override
public void update(float tpf) {
testWorld.update(tpf);
super.update(tpf);
}
}

View File

@@ -279,19 +279,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
private void handleB(boolean isPressed) { private void handleB(boolean isPressed) {
if (isPressed) { if (isPressed) {
Dialog tmp = new BuyCard(this); Dialog tmp = new BuyCard(this);
if (eventCard != null && isBuyCardPopupOpen) { tmp.open();
// Schließe das SettingsMenu
System.out.println("Schließe BuyCardPopup...");
eventCard.close();
eventCard = null;
tmp.open();
} else {
// Öffne das SettingsMenu
System.out.println("Öffne BuyCardPopup...");
eventCard = new EventCard(this);
eventCard.open();
dialogManager.close(tmp);
}
} }
} }
@@ -320,6 +308,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
attachGameSound(); attachGameSound();
attachGameMusic(); attachGameMusic();
stateManager.attach(new GameAppState());
} }
/** /**
@@ -443,6 +432,7 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
*/ */
@Override @Override
public void receivedEvent(ClientStateEvent event) { public void receivedEvent(ClientStateEvent event) {
stateManager.getState(GameAppState.class).setEnabled(true);
} }
/** /**

View File

@@ -34,13 +34,13 @@ public class MonopolyConfig extends Config {
* The width of the game map in terms of grid units. * The width of the game map in terms of grid units.
*/ */
@Property("map.width") @Property("map.width")
private int mapWidth = 12; private int mapWidth = 10;
/** /**
* The height of the game map in terms of grid units. * The height of the game map in terms of grid units.
*/ */
@Property("map.height") @Property("map.height")
private int mapHeight = 12; private int mapHeight = 10;
/** /**
* Creates an instance of {@code MonopolyConfig} with default settings. * Creates an instance of {@code MonopolyConfig} with default settings.

View File

@@ -199,10 +199,10 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
@Override @Override
public void received(BuyPropertyResponse msg) { public void received(BuyPropertyResponse msg) {
if (msg.isSuccessful()) { if (msg.isSuccessful()) {
setInfoText("You successfully bought " + msg.getPropertyName() + "!");
playSound(Sound.MONEY_LOST); playSound(Sound.MONEY_LOST);
} else { } else {
setInfoText("Unable to buy " + msg.getPropertyName() + ". Reason: " + msg.getReason());
} }
} }
@@ -213,7 +213,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
*/ */
@Override @Override
public void received(DiceResult msg) { public void received(DiceResult msg) {
setInfoText("You rolled a " + msg.calcTotal() + "!");
//Set the dice images //Set the dice images
playSound(Sound.DICE_ROLL); playSound(Sound.DICE_ROLL);
} }
@@ -225,7 +225,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
*/ */
@Override @Override
public void received(EventDrawCard msg) { public void received(EventDrawCard msg) {
setInfoText("Event card drawn: " + msg.getCardDescription());
// Kartenlogik // Kartenlogik
playSound(Sound.EVENT_CARD); playSound(Sound.EVENT_CARD);
} }
@@ -238,11 +238,11 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
@Override @Override
public void received(GameOver msg) { public void received(GameOver msg) {
if (msg.isWinner()) { if (msg.isWinner()) {
setInfoText("Congratulations! You have won the game!");
//Winner popup //Winner popup
playSound(Sound.WINNER); playSound(Sound.WINNER);
} else { } else {
setInfoText("Game over. Better luck next time!");
// Looser popup // Looser popup
playSound(Sound.LOSER); playSound(Sound.LOSER);
} }
@@ -256,8 +256,8 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
@Override @Override
public void received(GameStart msg) { public void received(GameStart msg) {
players = msg.getPlayers(); players = msg.getPlayers();
setInfoText("The game has started! Good luck!");
setState(new WaitForTurnState(this)); setState(new WaitForTurnState(this));
} }
/** /**
@@ -268,10 +268,10 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
@Override @Override
public void received(JailEvent msg) { public void received(JailEvent msg) {
if (msg.isGoingToJail()) { if (msg.isGoingToJail()) {
setInfoText("You are sent to jail!");
playSound(Sound.GULAG); playSound(Sound.GULAG);
} else { } else {
setInfoText("You are out of jail!");
} }
} }
@@ -283,7 +283,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
@Override @Override
public void received(PlayerStatusUpdate msg) { public void received(PlayerStatusUpdate msg) {
setInfoText("Player " + msg.getPlayerName() + " status updated: " + msg.getStatus());
} }
/** /**
@@ -293,7 +293,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
*/ */
@Override @Override
public void received(TimeOutWarning msg) { public void received(TimeOutWarning msg) {
setInfoText("Warning! Time is running out. You have " + msg.getRemainingTime() + " seconds left.");
} }
/** /**
@@ -303,7 +303,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
*/ */
@Override @Override
public void received(ViewAssetsResponse msg) { public void received(ViewAssetsResponse msg) {
setInfoText("Your current assets are being displayed.");
} }
/** /**
@@ -314,10 +314,10 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
@Override @Override
public void received(TradeReply msg) { public void received(TradeReply msg) {
if (msg.getTradeHandler().getStatus()) { if (msg.getTradeHandler().getStatus()) {
setInfoText("Trade accepted by " + msg.getTradeHandler().getReceiver().getName() + ".");
playSound(Sound.TRADE_ACCEPTED); playSound(Sound.TRADE_ACCEPTED);
} else { } else {
setInfoText("Trade rejected by " + msg.getTradeHandler().getReceiver().getName() + ".");
playSound(Sound.TRADE_REJECTED); playSound(Sound.TRADE_REJECTED);
} }
} }
@@ -329,7 +329,7 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
*/ */
@Override @Override
public void received(TradeRequest msg) { public void received(TradeRequest msg) {
setInfoText("Trade offer received from " + msg.getTradeHandler().getSender().getName());
// playSound(Sound.TRADE_REQUEST); no sound effect // playSound(Sound.TRADE_REQUEST); no sound effect
// notifyListeners(); // notifyListeners();
} }
@@ -341,7 +341,8 @@ public class ClientGameLogic implements ServerInterpreter, GameEventBroker {
*/ */
@Override @Override
public void received(NextPlayerTurn msg) { public void received(NextPlayerTurn msg) {
setInfoText("It's your turn!");
System.out.println("Du bsit am zug message empfangen");
setState(new ActiveState(this)); setState(new ActiveState(this));
} }
} }

View File

@@ -175,7 +175,7 @@ public class ServerGameLogic implements ClientInterpreter {
LOGGER.log(Level.DEBUG, "Ending turn for player {0}", player.getName()); LOGGER.log(Level.DEBUG, "Ending turn for player {0}", player.getName());
Player next = playerHandler.nextPlayer(); Player next = playerHandler.nextPlayer();
next.setActive(); next.setActive();
send(next, new NextPlayerTurn(next)); send(next, new NextPlayerTurn());
} }
} }
} }
@@ -207,7 +207,7 @@ public class ServerGameLogic implements ClientInterpreter {
send(p, new GameStart(playerHandler.getPlayers())); send(p, new GameStart(playerHandler.getPlayers()));
} }
playerHandler.randomOrder(); playerHandler.randomOrder();
send(playerHandler.getPlayerAtIndex(0), new NextPlayerTurn(playerHandler.getPlayerAtIndex(0))); send(playerHandler.getPlayerAtIndex(0), new NextPlayerTurn());
} }
} }

View File

@@ -2,20 +2,13 @@ package pp.monopoly.message.server;
import com.jme3.network.serializing.Serializable; import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player;
@Serializable @Serializable
public class NextPlayerTurn extends ServerMessage{ public class NextPlayerTurn extends ServerMessage{
private Player player;
/** /**
* Default constructor for serialization purposes. * Default constructor for serialization purposes.
*/ */
private NextPlayerTurn() { /* empty */ } public NextPlayerTurn() {
public NextPlayerTurn(Player player) {
this.player = player;
} }
@Override @Override
@@ -28,9 +21,4 @@ public class NextPlayerTurn extends ServerMessage{
// TODO Auto-generated method stub // TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'"); throw new UnsupportedOperationException("Unimplemented method 'getInfoTextKey'");
} }
public Player getPlayer() {
return player;
}
} }

View File

@@ -3,8 +3,11 @@ package pp.monopoly.model.fields;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player; import pp.monopoly.game.server.Player;
@Serializable
public class BuildingProperty extends PropertyField { public class BuildingProperty extends PropertyField {
private int houses; private int houses;
@@ -17,6 +20,12 @@ public class BuildingProperty extends PropertyField {
private final int rentFactor4 = 55; private final int rentFactor4 = 55;
private final int rentFactorHotel = 70; private final int rentFactorHotel = 70;
private BuildingProperty(){
super("", 0, 0, 0);
this.housePrice = 0;
this.color = null;
}
BuildingProperty(String name, int id, int price, int rent, int housePrice, FieldColor color) { BuildingProperty(String name, int id, int price, int rent, int housePrice, FieldColor color) {
super(name, id, price, rent); super(name, id, price, rent);
this.housePrice = housePrice; this.housePrice = housePrice;

View File

@@ -1,11 +1,18 @@
package pp.monopoly.model.fields; package pp.monopoly.model.fields;
import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player; import pp.monopoly.game.server.Player;
@Serializable
public class EventField extends Field{ public class EventField extends Field{
public EventField(String name, int id) { private EventField() {
super("", 0);
}
EventField(String name, int id) {
super(name, id); super(name, id);
} }

View File

@@ -1,11 +1,19 @@
package pp.monopoly.model.fields; package pp.monopoly.model.fields;
import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player; import pp.monopoly.game.server.Player;
abstract class Field { @Serializable
public abstract class Field {
protected final String name; protected final String name;
protected final int id; protected final int id;
private Field() {
this.name = "";
this.id = 0;
}
protected Field(String name, int id) { protected Field(String name, int id) {
this.name = name; this.name = name;
this.id= id; this.id= id;

View File

@@ -1,10 +1,12 @@
package pp.monopoly.model.fields; package pp.monopoly.model.fields;
import com.jme3.math.ColorRGBA; import com.jme3.math.ColorRGBA;
import com.jme3.network.serializing.Serializable;
/** /**
* Enum representing eight distinct colors for properties in the game. * Enum representing eight distinct colors for properties in the game.
*/ */
// @Serializable
public enum FieldColor { public enum FieldColor {
BROWN(new ColorRGBA(148 / 255f, 86 / 255f, 57 / 255f, 1)), BROWN(new ColorRGBA(148 / 255f, 86 / 255f, 57 / 255f, 1)),
GREEN(new ColorRGBA(30 / 255f, 179 / 255f, 90 / 255f, 1)), GREEN(new ColorRGBA(30 / 255f, 179 / 255f, 90 / 255f, 1)),
@@ -17,6 +19,10 @@ public enum FieldColor {
private final ColorRGBA color; private final ColorRGBA color;
private FieldColor() {
this.color = null;
}
/** /**
* Constructs a FieldColor with the specified ColorRGBA value. * Constructs a FieldColor with the specified ColorRGBA value.
* *

View File

@@ -1,11 +1,19 @@
package pp.monopoly.model.fields; package pp.monopoly.model.fields;
import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player; import pp.monopoly.game.server.Player;
@Serializable
public class FineField extends Field{ public class FineField extends Field{
private final int fine; private final int fine;
private FineField() {
super("", 0);
this.fine = 0;
}
FineField(String name, int id, int fine) { FineField(String name, int id, int fine) {
super(name, id); super(name, id);
this.fine = fine; this.fine = fine;

View File

@@ -1,10 +1,17 @@
package pp.monopoly.model.fields; package pp.monopoly.model.fields;
import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player; import pp.monopoly.game.server.Player;
@Serializable
public class FoodField extends PropertyField { public class FoodField extends PropertyField {
public FoodField(String name, int id) { private FoodField() {
super("", 0, 0, 0);
}
FoodField(String name, int id) {
super(name, id, 1500,0); super(name, id, 1500,0);
} }

View File

@@ -1,9 +1,15 @@
package pp.monopoly.model.fields; package pp.monopoly.model.fields;
import pp.monopoly.game.server.Player; import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player;
@Serializable
public class GateField extends PropertyField{ public class GateField extends PropertyField{
private GateField() {
super("", 0, 0, 0);
}
GateField(String name, int id) { GateField(String name, int id) {
super(name, id, 2000, 25); super(name, id, 2000, 25);
} }

View File

@@ -1,10 +1,12 @@
package pp.monopoly.model.fields; package pp.monopoly.model.fields;
import pp.monopoly.game.server.Player; import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player;
@Serializable
public class GoField extends Field{ public class GoField extends Field{
public GoField() { GoField() {
super("Monatsgehalt", 0); super("Monatsgehalt", 0);
} }

View File

@@ -1,7 +1,9 @@
package pp.monopoly.model.fields; package pp.monopoly.model.fields;
import pp.monopoly.game.server.Player; import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player;
@Serializable
public class GulagField extends Field{ public class GulagField extends Field{
private int bailCost = 500; private int bailCost = 500;

View File

@@ -1,11 +1,14 @@
package pp.monopoly.model.fields; package pp.monopoly.model.fields;
import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player; import pp.monopoly.game.server.Player;
/** /**
* Represents an abstract property field in the Monopoly game. * Represents an abstract property field in the Monopoly game.
* Contains attributes related to ownership, price, rent, and mortgage status. * Contains attributes related to ownership, price, rent, and mortgage status.
*/ */
@Serializable
public abstract class PropertyField extends Field { public abstract class PropertyField extends Field {
private final int price; private final int price;
@@ -13,6 +16,12 @@ public abstract class PropertyField extends Field {
private Player owner; private Player owner;
private boolean mortgaged = false; private boolean mortgaged = false;
private PropertyField() {
super("", 0);
this.price = 0;
this.rent = 0;
}
/** /**
* Constructs a PropertyField with the specified name, ID, price, and rent. * Constructs a PropertyField with the specified name, ID, price, and rent.
* *

View File

@@ -1,7 +1,10 @@
package pp.monopoly.model.fields; package pp.monopoly.model.fields;
import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player; import pp.monopoly.game.server.Player;
@Serializable
public class TestStreckeField extends Field{ public class TestStreckeField extends Field{
private int money; private int money;

View File

@@ -1,10 +1,13 @@
package pp.monopoly.model.fields; package pp.monopoly.model.fields;
import com.jme3.network.serializing.Serializable;
import pp.monopoly.game.server.Player; import pp.monopoly.game.server.Player;
@Serializable
public class WacheField extends Field{ public class WacheField extends Field{
public WacheField() { WacheField() {
super("Wache", 30); super("Wache", 30);
} }

View File

@@ -43,6 +43,18 @@ import pp.monopoly.message.server.ServerMessage;
import pp.monopoly.model.Figure; import pp.monopoly.model.Figure;
import pp.monopoly.model.IntPoint; import pp.monopoly.model.IntPoint;
import pp.monopoly.model.LimitedLinkedList; import pp.monopoly.model.LimitedLinkedList;
import pp.monopoly.model.fields.BuildingProperty;
import pp.monopoly.model.fields.EventField;
import pp.monopoly.model.fields.Field;
import pp.monopoly.model.fields.FieldColor;
import pp.monopoly.model.fields.FineField;
import pp.monopoly.model.fields.FoodField;
import pp.monopoly.model.fields.GateField;
import pp.monopoly.model.fields.GoField;
import pp.monopoly.model.fields.GulagField;
import pp.monopoly.model.fields.PropertyField;
import pp.monopoly.model.fields.TestStreckeField;
import pp.monopoly.model.fields.WacheField;
/** /**
* Server implementing the visitor pattern as MessageReceiver for ClientMessages * Server implementing the visitor pattern as MessageReceiver for ClientMessages
@@ -129,7 +141,19 @@ public class MonopolyServer implements MessageListener<HostedConnection>, Connec
Serializer.registerClass(NextPlayerTurn.class); Serializer.registerClass(NextPlayerTurn.class);
Serializer.registerClass(Player.class); Serializer.registerClass(Player.class);
Serializer.registerClass(Figure.class); Serializer.registerClass(Figure.class);
Serializer.registerClass(PlayerHandler.class); // Serializer.registerClass(PlayerHandler.class);
// Serializer.registerClass(BuildingProperty.class);
// Serializer.registerClass(EventField.class);
// Serializer.registerClass(Field.class);
// // Serializer.registerClass(FieldColor.class);
// Serializer.registerClass(FineField.class);
// Serializer.registerClass(FoodField.class);
// Serializer.registerClass(GateField.class);
// Serializer.registerClass(GoField.class);
// Serializer.registerClass(GulagField.class);
// Serializer.registerClass(PropertyField.class);
// Serializer.registerClass(TestStreckeField.class);
// Serializer.registerClass(WacheField.class);
} }
private void registerListeners() { private void registerListeners() {