merge development into test #26
@@ -114,11 +114,11 @@ public MdgaView getView() {
|
|||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelSynchronizer getModelSyncronizer() {
|
public ModelSynchronizer getModelSynchronize() {
|
||||||
return modelSynchronizer;
|
return modelSynchronizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputSynchronizer getInputSyncronizer() { return inputSynchronizer; }
|
public InputSynchronizer getInputSynchronize() { return inputSynchronizer; }
|
||||||
|
|
||||||
public NotificationSynchronizer getNotificationSynchronizer() { return notificationSynchronizer; }
|
public NotificationSynchronizer getNotificationSynchronizer() { return notificationSynchronizer; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ public void enter(MdgaState state) {
|
|||||||
if (state == MdgaState.LOBBY) {
|
if (state == MdgaState.LOBBY) {
|
||||||
LobbyView lobbyView = (LobbyView) app.getView();
|
LobbyView lobbyView = (LobbyView) app.getView();
|
||||||
|
|
||||||
app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.CYBER, "blablabupp", false));
|
//app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.CYBER, "blablabupp", false));
|
||||||
app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.ARMY, "Spieler 2", false));
|
//app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.ARMY, "Spieler 2", false));
|
||||||
lobbyView.setReady(Color.ARMY, true);
|
lobbyView.setReady(Color.ARMY, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ private void handleGame(Notification notification) {
|
|||||||
} else if (notification instanceof ActivePlayerNotification n) {
|
} else if (notification instanceof ActivePlayerNotification n) {
|
||||||
gameView.getGuiHandler().setActivePlayer(n.getColor());
|
gameView.getGuiHandler().setActivePlayer(n.getColor());
|
||||||
} else if (notification instanceof CeremonyNotification ceremonyNotification) {
|
} else if (notification instanceof CeremonyNotification ceremonyNotification) {
|
||||||
app.enter(MdgaState.CEREMONY);
|
/*app.enter(MdgaState.CEREMONY);
|
||||||
CeremonyView ceremonyView = (CeremonyView) app.getView();
|
CeremonyView ceremonyView = (CeremonyView) app.getView();
|
||||||
int size = ceremonyNotification.getNames().size();
|
int size = ceremonyNotification.getNames().size();
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ private void handleGame(Notification notification) {
|
|||||||
|
|
||||||
ceremonyView.addCeremonyParticipant(color, i, name);
|
ceremonyView.addCeremonyParticipant(color, i, name);
|
||||||
ceremonyView.addStatisticsRow(name, v1, v2, v3, v4, v5, v6);
|
ceremonyView.addStatisticsRow(name, v1, v2, v3, v4, v5, v6);
|
||||||
}
|
}*/
|
||||||
} else if (notification instanceof DiceNowNotification) {
|
} else if (notification instanceof DiceNowNotification) {
|
||||||
guiHandler.showDice();
|
guiHandler.showDice();
|
||||||
} else if (notification instanceof DicingNotification n) {
|
} else if (notification instanceof DicingNotification n) {
|
||||||
@@ -145,11 +145,11 @@ private void handleGame(Notification notification) {
|
|||||||
//TODO
|
//TODO
|
||||||
} else if (notification instanceof RollDiceNotification n) {
|
} else if (notification instanceof RollDiceNotification n) {
|
||||||
if(n.getColor() == gameView.getOwnColor()){
|
if(n.getColor() == gameView.getOwnColor()){
|
||||||
guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
|
//guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (n.isTurbo()) guiHandler.showRolledDiceMult(n.getEyes(), n.getMultiplier(), n.getColor());
|
//if (n.isTurbo()) guiHandler.showRolledDiceMult(n.getEyes(), n.getMultiplier(), n.getColor());
|
||||||
else guiHandler.showRolledDice(n.getEyes(), n.getColor());
|
//else guiHandler.showRolledDice(n.getEyes(), n.getColor());
|
||||||
}
|
}
|
||||||
} else if (notification instanceof SelectableCardsNotification n) {
|
} else if (notification instanceof SelectableCardsNotification n) {
|
||||||
guiHandler.setSelectableCards(n.getCards());
|
guiHandler.setSelectableCards(n.getCards());
|
||||||
@@ -168,10 +168,10 @@ private void handleGame(Notification notification) {
|
|||||||
boardHandler.outlineMove(n.getPieces(), n.getMoveIndexe(), n.getHomeMoves());
|
boardHandler.outlineMove(n.getPieces(), n.getMoveIndexe(), n.getHomeMoves());
|
||||||
} else if (notification instanceof SelectableSwapNotification n) {
|
} else if (notification instanceof SelectableSwapNotification n) {
|
||||||
boardHandler.outlineSwap(n.getOwnPieces(), n.getEnemyPieces());
|
boardHandler.outlineSwap(n.getOwnPieces(), n.getEnemyPieces());
|
||||||
} else if (notification instanceof SelectableShieldNotification n) {
|
// } //else if (notification instanceof SelectableShieldNotification n) {
|
||||||
boardHandler.outlineShield(n.getOwnPieces());
|
// boardHandler.outlineShield(n.getOwnPieces());
|
||||||
} else if (notification instanceof TurboActiveNotification){
|
//} else if (notification instanceof TurboActiveNotification){
|
||||||
guiHandler.turbo();
|
// guiHandler.turbo();
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("notification not expected: " + notification.toString());
|
throw new RuntimeException("notification not expected: " + notification.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class BoardHandler {
|
|||||||
private Map<UUID, Color> pieceColor;
|
private Map<UUID, Color> pieceColor;
|
||||||
|
|
||||||
private Node node;
|
private Node node;
|
||||||
|
private final Node rootNode;
|
||||||
|
|
||||||
private final FilterPostProcessor fpp;
|
private final FilterPostProcessor fpp;
|
||||||
|
|
||||||
@@ -43,11 +44,12 @@ public class BoardHandler {
|
|||||||
private PieceControl selectedEnemyPiece;
|
private PieceControl selectedEnemyPiece;
|
||||||
private DiceControl diceControl;
|
private DiceControl diceControl;
|
||||||
|
|
||||||
public BoardHandler(MdgaApp app, FilterPostProcessor fpp) {
|
public BoardHandler(MdgaApp app, Node rootNode, FilterPostProcessor fpp) {
|
||||||
if(app == null) throw new RuntimeException("app is null");
|
if(app == null) throw new RuntimeException("app is null");
|
||||||
|
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.fpp = fpp;
|
this.fpp = fpp;
|
||||||
|
this.rootNode = rootNode;
|
||||||
isInitialised = false;
|
isInitialised = false;
|
||||||
|
|
||||||
node = new Node("BoardHandler root node");
|
node = new Node("BoardHandler root node");
|
||||||
@@ -61,14 +63,14 @@ public void init() {
|
|||||||
selectedOwnPiece = null;
|
selectedOwnPiece = null;
|
||||||
selectedEnemyPiece = null;
|
selectedEnemyPiece = null;
|
||||||
initMap();
|
initMap();
|
||||||
app.getRootNode().attachChild(node);
|
rootNode.attachChild(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown(){
|
public void shutdown(){
|
||||||
clearSelectable();
|
clearSelectable();
|
||||||
isInitialised = false;
|
isInitialised = false;
|
||||||
initMap();
|
initMap();
|
||||||
app.getRootNode().detachChild(node);
|
rootNode.detachChild(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addFigureToPlayerMap(Color col, AssetOnMap assetOnMap) {
|
private void addFigureToPlayerMap(Color col, AssetOnMap assetOnMap) {
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ public class GuiHandler {
|
|||||||
private final ActionTextHandler actionTextHandler;
|
private final ActionTextHandler actionTextHandler;
|
||||||
private final Color ownColor;
|
private final Color ownColor;
|
||||||
|
|
||||||
public GuiHandler(MdgaApp app, Texture2D backTexture, Color ownColor) {
|
public GuiHandler(MdgaApp app, Node guiNode, Texture2D backTexture, Color ownColor) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.ownColor = ownColor;
|
this.ownColor = ownColor;
|
||||||
cardLayerHandler = new CardLayerHandler(app, backTexture);
|
cardLayerHandler = new CardLayerHandler(app, backTexture);
|
||||||
playerNameHandler = new PlayerNameHandler(app.getGuiNode(), app.getAssetManager(), app.getContext().getSettings());
|
playerNameHandler = new PlayerNameHandler(guiNode, app.getAssetManager(), app.getContext().getSettings());
|
||||||
actionTextHandler = new ActionTextHandler(app.getGuiNode(), app.getAssetManager(), app.getContext().getSettings());
|
actionTextHandler = new ActionTextHandler(guiNode, app.getAssetManager(), app.getContext().getSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public void forward() {
|
|||||||
enterSub(SubState.STATISTICS);
|
enterSub(SubState.STATISTICS);
|
||||||
break;
|
break;
|
||||||
case STATISTICS:
|
case STATISTICS:
|
||||||
app.getModelSyncronizer().enter(MdgaState.MAIN);
|
app.getModelSynchronize().enter(MdgaState.MAIN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,6 @@
|
|||||||
package pp.mdga.client.view;
|
package pp.mdga.client.view;
|
||||||
|
|
||||||
import com.jme3.input.KeyInput;
|
|
||||||
import com.jme3.input.MouseInput;
|
|
||||||
import com.jme3.input.controls.ActionListener;
|
|
||||||
import com.jme3.input.controls.KeyTrigger;
|
|
||||||
import com.jme3.input.controls.MouseButtonTrigger;
|
|
||||||
import com.jme3.post.FilterPostProcessor;
|
import com.jme3.post.FilterPostProcessor;
|
||||||
import com.jme3.post.filters.ComposeFilter;
|
|
||||||
import com.jme3.renderer.ViewPort;
|
|
||||||
import com.jme3.shadow.DirectionalLightShadowFilter;
|
|
||||||
import com.jme3.shadow.EdgeFilteringMode;
|
|
||||||
import com.jme3.texture.FrameBuffer;
|
import com.jme3.texture.FrameBuffer;
|
||||||
import com.jme3.texture.Image;
|
import com.jme3.texture.Image;
|
||||||
import com.jme3.texture.Texture2D;
|
import com.jme3.texture.Texture2D;
|
||||||
@@ -20,7 +11,6 @@
|
|||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.button.ButtonLeft;
|
import pp.mdga.client.button.ButtonLeft;
|
||||||
import pp.mdga.client.button.ButtonRight;
|
import pp.mdga.client.button.ButtonRight;
|
||||||
import pp.mdga.client.button.SettingsButton;
|
|
||||||
import pp.mdga.client.gui.GuiHandler;
|
import pp.mdga.client.gui.GuiHandler;
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
@@ -41,10 +31,10 @@ public class GameView extends MdgaView {
|
|||||||
public GameView(MdgaApp app) {
|
public GameView(MdgaApp app) {
|
||||||
super(app);
|
super(app);
|
||||||
|
|
||||||
cheatButton = new ButtonRight(app, settingsNode, () -> app.getModelSyncronizer().enter(MdgaState.CEREMONY), "CHEAT", 1);
|
cheatButton = new ButtonRight(app, settingsNode, () -> app.getModelSynchronize().enter(MdgaState.CEREMONY), "CHEAT", 1);
|
||||||
|
|
||||||
leaveButton = new ButtonLeft(app, settingsNode, () -> app.getModelSyncronizer().leave(), "Spiel verlassen", 1);
|
leaveButton = new ButtonLeft(app, settingsNode, () -> app.getModelSynchronize().leave(), "Spiel verlassen", 1);
|
||||||
confirmButton = new ButtonRight(app, settingsNode, () -> app.getModelSyncronizer().confirm(), "Bestätigen", 1);
|
confirmButton = new ButtonRight(app, settingsNode, () -> app.getModelSynchronize().confirm(), "Bestätigen", 1);
|
||||||
|
|
||||||
fpp = new FilterPostProcessor(app.getAssetManager());
|
fpp = new FilterPostProcessor(app.getAssetManager());
|
||||||
this.camera = new CameraHandler(app, fpp);
|
this.camera = new CameraHandler(app, fpp);
|
||||||
@@ -82,7 +72,7 @@ public void onLeave() {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate(float tpf) {
|
public void onUpdate(float tpf) {
|
||||||
camera.update(app.getInputSyncronizer().getScroll(), app.getInputSyncronizer().getRotation());
|
camera.update(app.getInputSynchronize().getScroll(), app.getInputSynchronize().getRotation());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -102,7 +92,7 @@ protected void onLeaveOverlay(Overlay overlay) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void leaveGame() {
|
private void leaveGame() {
|
||||||
app.getModelSyncronizer().leave();
|
app.getModelSynchronize().leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoardHandler getBoardHandler() {
|
public BoardHandler getBoardHandler() {
|
||||||
|
|||||||
@@ -1,19 +1,13 @@
|
|||||||
package pp.mdga.client.view;
|
package pp.mdga.client.view;
|
||||||
|
|
||||||
import com.jme3.asset.TextureKey;
|
|
||||||
import com.jme3.light.AmbientLight;
|
import com.jme3.light.AmbientLight;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.renderer.Camera;
|
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import com.jme3.scene.Spatial;
|
|
||||||
import com.jme3.texture.Texture;
|
|
||||||
import com.jme3.util.SkyFactory;
|
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.button.ButtonLeft;
|
import pp.mdga.client.button.ButtonLeft;
|
||||||
import pp.mdga.client.button.ButtonRight;
|
import pp.mdga.client.button.ButtonRight;
|
||||||
import pp.mdga.client.button.LobbyButton;
|
import pp.mdga.client.button.LobbyButton;
|
||||||
import pp.mdga.client.button.SettingsButton;
|
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
|
|
||||||
public class LobbyView extends MdgaView {
|
public class LobbyView extends MdgaView {
|
||||||
@@ -176,10 +170,10 @@ private void toggleTsk(Color color) {
|
|||||||
|
|
||||||
switch (taken) {
|
switch (taken) {
|
||||||
case NOT:
|
case NOT:
|
||||||
app.getModelSyncronizer().selectTsk(color);
|
app.getModelSynchronize().selectTsk(color);
|
||||||
break;
|
break;
|
||||||
case SELF:
|
case SELF:
|
||||||
app.getModelSyncronizer().unselectTsk();
|
app.getModelSynchronize().unselectTsk();
|
||||||
break;
|
break;
|
||||||
case OTHER:
|
case OTHER:
|
||||||
//nothing
|
//nothing
|
||||||
@@ -188,12 +182,12 @@ private void toggleTsk(Color color) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ready() {
|
private void ready() {
|
||||||
app.getModelSyncronizer().setReady();
|
app.getModelSynchronize().setReady();
|
||||||
//TODO: playSound
|
//TODO: playSound
|
||||||
}
|
}
|
||||||
|
|
||||||
private void leaveLobby() {
|
private void leaveLobby() {
|
||||||
app.getModelSyncronizer().leave();
|
app.getModelSynchronize().leave();
|
||||||
//TODO: playSound
|
//TODO: playSound
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,7 @@
|
|||||||
|
|
||||||
import com.jme3.scene.Geometry;
|
import com.jme3.scene.Geometry;
|
||||||
import pp.mdga.client.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.MdgaState;
|
|
||||||
import pp.mdga.client.acoustic.MdgaSound;
|
import pp.mdga.client.acoustic.MdgaSound;
|
||||||
import pp.mdga.client.button.ButtonRight;
|
|
||||||
import pp.mdga.client.button.MenuButton;
|
|
||||||
import pp.mdga.client.button.SettingsButton;
|
|
||||||
import pp.mdga.client.dialog.HostDialog;
|
import pp.mdga.client.dialog.HostDialog;
|
||||||
import pp.mdga.client.dialog.JoinDialog;
|
import pp.mdga.client.dialog.JoinDialog;
|
||||||
import pp.mdga.client.dialog.StartDialog;
|
import pp.mdga.client.dialog.StartDialog;
|
||||||
@@ -98,8 +94,8 @@ private void tryHost() {
|
|||||||
port = Integer.parseInt(text);
|
port = Integer.parseInt(text);
|
||||||
|
|
||||||
if(port >= 1 && port <= 65535) {
|
if(port >= 1 && port <= 65535) {
|
||||||
app.getModelSyncronizer().setName(startDialog.getName());
|
app.getModelSynchronize().setName(startDialog.getName());
|
||||||
app.getModelSyncronizer().setHost(port);
|
app.getModelSynchronize().setHost(port);
|
||||||
//app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
//app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -125,8 +121,8 @@ private void tryJoin() {
|
|||||||
|
|
||||||
// Validate the IP address
|
// Validate the IP address
|
||||||
if (isValidIpAddress(ip)) {
|
if (isValidIpAddress(ip)) {
|
||||||
app.getModelSyncronizer().setName(startDialog.getName());
|
app.getModelSynchronize().setName(startDialog.getName());
|
||||||
app.getModelSyncronizer().setJoin(ip, port);
|
app.getModelSynchronize().setJoin(ip, port);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user