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