Merge branch 'development2' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-01 into development2
This commit is contained in:
@@ -66,7 +66,7 @@ public class MdgaApp extends SimpleApplication {
|
|||||||
|
|
||||||
private ServerConnection networkConnection;
|
private ServerConnection networkConnection;
|
||||||
|
|
||||||
public static final int DEBUG_MULTIPLIER = 0;
|
public static final int DEBUG_MULTIPLIER = 1;
|
||||||
|
|
||||||
public MdgaApp() {
|
public MdgaApp() {
|
||||||
networkConnection = new NetworkSupport(this);
|
networkConnection = new NetworkSupport(this);
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ public void confirm() {
|
|||||||
|
|
||||||
GameView gameView = (GameView) app.getView();
|
GameView gameView = (GameView) app.getView();
|
||||||
|
|
||||||
|
gameView.getGuiHandler().hideText();
|
||||||
|
|
||||||
if(a != null && b != null) {
|
if(a != null && b != null) {
|
||||||
app.getGameLogic().selectPiece(a);
|
app.getGameLogic().selectPiece(a);
|
||||||
app.getGameLogic().selectPiece(b);
|
app.getGameLogic().selectPiece(b);
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
import pp.mdga.notification.*;
|
import pp.mdga.notification.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
public class NotificationSynchronizer {
|
public class NotificationSynchronizer {
|
||||||
private final MdgaApp app;
|
private final MdgaApp app;
|
||||||
@@ -69,10 +71,12 @@ public void update() {
|
|||||||
throw new RuntimeException("no notification expected: " + n.getClass().getName());
|
throw new RuntimeException("no notification expected: " + n.getClass().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(0 == MdgaApp.DEBUG_MULTIPLIER) {
|
||||||
delay = 0;
|
delay = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleMain(Notification notification) {
|
private void handleMain(Notification notification) {
|
||||||
if (notification instanceof LobbyDialogNotification) {
|
if (notification instanceof LobbyDialogNotification) {
|
||||||
@@ -151,6 +155,7 @@ private void handleGame(Notification notification) {
|
|||||||
guiHandler.showDice();
|
guiHandler.showDice();
|
||||||
} else if (notification instanceof DrawCardNotification n) {
|
} else if (notification instanceof DrawCardNotification n) {
|
||||||
guiHandler.drawCard(n.getColor());
|
guiHandler.drawCard(n.getColor());
|
||||||
|
delay = STANDARD_DELAY;
|
||||||
} else if (notification instanceof HomeMoveNotification home) {
|
} else if (notification instanceof HomeMoveNotification home) {
|
||||||
boardHandler.movePieceHomeAnim(home.getPieceId(), home.getHomeIndex());
|
boardHandler.movePieceHomeAnim(home.getPieceId(), home.getHomeIndex());
|
||||||
guiHandler.hideText();
|
guiHandler.hideText();
|
||||||
@@ -178,7 +183,12 @@ private void handleGame(Notification notification) {
|
|||||||
if(n.getColor() == ownColor) guiHandler.playCardOwn(n.getCard());
|
if(n.getColor() == ownColor) guiHandler.playCardOwn(n.getCard());
|
||||||
else guiHandler.playCardEnemy(n.getColor(), n.getCard());
|
else guiHandler.playCardEnemy(n.getColor(), n.getCard());
|
||||||
|
|
||||||
|
new Timer().schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
app.getModelSynchronize().animationEnd();
|
app.getModelSynchronize().animationEnd();
|
||||||
|
}
|
||||||
|
}, 2200 * MdgaApp.DEBUG_MULTIPLIER);
|
||||||
} else if (notification instanceof PlayerInGameNotification n) {
|
} else if (notification instanceof PlayerInGameNotification n) {
|
||||||
boardHandler.addPlayer(n.getColor(),n.getPiecesList());
|
boardHandler.addPlayer(n.getColor(),n.getPiecesList());
|
||||||
guiHandler.addPlayer(n.getColor(),n.getName());
|
guiHandler.addPlayer(n.getColor(),n.getName());
|
||||||
@@ -188,13 +198,13 @@ private void handleGame(Notification notification) {
|
|||||||
gameView.getGuiHandler().hideText();
|
gameView.getGuiHandler().hideText();
|
||||||
if(n.getColor() == ownColor){
|
if(n.getColor() == ownColor){
|
||||||
guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
|
guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
|
||||||
|
waitForAnimation = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
boardHandler.hideDice();
|
boardHandler.hideDice();
|
||||||
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());
|
||||||
}
|
}
|
||||||
delay = 7;
|
|
||||||
} else if (notification instanceof SelectableCardsNotification n) {
|
} else if (notification instanceof SelectableCardsNotification n) {
|
||||||
guiHandler.setSelectableCards(n.getCards());
|
guiHandler.setSelectableCards(n.getCards());
|
||||||
gameView.showNoPower();
|
gameView.showNoPower();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
import com.jme3.scene.control.AbstractControl;
|
import com.jme3.scene.control.AbstractControl;
|
||||||
import pp.mdga.client.Asset;
|
import pp.mdga.client.Asset;
|
||||||
|
import pp.mdga.client.MdgaApp;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@@ -51,8 +52,7 @@ protected void controlUpdate(float tpf) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Stop rolling when angular velocity is close to zero
|
// Stop rolling when angular velocity is close to zero
|
||||||
// if (angularVelocity.lengthSquared() < 3f) {
|
if (angularVelocity.lengthSquared() <= 3f || MdgaApp.DEBUG_MULTIPLIER == 0) {
|
||||||
if(true){
|
|
||||||
slerp = true;
|
slerp = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -66,8 +66,7 @@ protected void controlUpdate(float tpf) {
|
|||||||
spatial.setLocalRotation(interpolated);
|
spatial.setLocalRotation(interpolated);
|
||||||
|
|
||||||
// Stop rolling once duration is complete
|
// Stop rolling once duration is complete
|
||||||
// if (timeElapsed >= 1.0f) {
|
if (timeElapsed >= 1.0f * MdgaApp.DEBUG_MULTIPLIER) {
|
||||||
if(true){
|
|
||||||
isRolling = false;
|
isRolling = false;
|
||||||
slerp = false;
|
slerp = false;
|
||||||
actionAfter.run();
|
actionAfter.run();
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public void rollDice(int rollNum, int mult) {
|
|||||||
else actionTextHandler.ownDiceMult(rollNum, mult);
|
else actionTextHandler.ownDiceMult(rollNum, mult);
|
||||||
hideDice();
|
hideDice();
|
||||||
app.getModelSynchronize().animationEnd();
|
app.getModelSynchronize().animationEnd();
|
||||||
|
app.getModelSynchronize().animationEnd();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class TurnState extends GameStates {
|
|||||||
private final PlayPowerCardState playPowerCardState = new PlayPowerCardState(this, logic);
|
private final PlayPowerCardState playPowerCardState = new PlayPowerCardState(this, logic);
|
||||||
private final PowerCardState powerCardState = new PowerCardState(this, logic);
|
private final PowerCardState powerCardState = new PowerCardState(this, logic);
|
||||||
private final RollDiceState rollDiceState = new RollDiceState(this, logic);
|
private final RollDiceState rollDiceState = new RollDiceState(this, logic);
|
||||||
|
private boolean canChangeTurbo = false;
|
||||||
|
|
||||||
public TurnState(ClientState parent, ClientGameLogic logic) {
|
public TurnState(ClientState parent, ClientGameLogic logic) {
|
||||||
super(parent, logic);
|
super(parent, logic);
|
||||||
@@ -39,13 +40,14 @@ public TurnState(ClientState parent, ClientGameLogic logic) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
this.setState(this.powerCardState);
|
|
||||||
for (Piece piece : logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPieces()) {
|
for (Piece piece : logic.getGame().getPlayerByColor(logic.getGame().getActiveColor()).getPieces()) {
|
||||||
if (piece.isShielded() || piece.isSuppressed()){
|
if (piece.isShielded() || piece.isSuppressed()){
|
||||||
piece.setShield(ShieldState.NONE);
|
piece.setShield(ShieldState.NONE);
|
||||||
logic.addNotification(new RemoveShieldNotification(piece.getUuid()));
|
logic.addNotification(new RemoveShieldNotification(piece.getUuid()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logic.getGame().setTurboFlag(false);
|
||||||
|
this.setState(this.powerCardState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -189,4 +191,12 @@ public GameState getParent(){
|
|||||||
public TurnStates getState(){
|
public TurnStates getState(){
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCanChangeTurbo() {
|
||||||
|
return canChangeTurbo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCanChangeTurbo(boolean canChangeTurbo) {
|
||||||
|
this.canChangeTurbo = canChangeTurbo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,13 @@ public RollDiceState(ClientState parent, ClientGameLogic logic) {
|
|||||||
@Override
|
@Override
|
||||||
public void enter() {
|
public void enter() {
|
||||||
logic.addNotification(new DiceNowNotification());
|
logic.addNotification(new DiceNowNotification());
|
||||||
|
if (logic.getGame().getTurboFlag()){
|
||||||
|
if (parent.isCanChangeTurbo()){
|
||||||
|
logic.getGame().setTurboFlag(false);
|
||||||
|
} else {
|
||||||
|
parent.setCanChangeTurbo(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ public void received(PlayCardMessage msg){
|
|||||||
if(msg.getCard().getCard().equals(BonusCard.TURBO)){
|
if(msg.getCard().getCard().equals(BonusCard.TURBO)){
|
||||||
logic.getGame().setDiceModifier(msg.getDiceModifier());
|
logic.getGame().setDiceModifier(msg.getDiceModifier());
|
||||||
parent.getParent().getPlayPowerCard().setPlayCard(msg);
|
parent.getParent().getPlayPowerCard().setPlayCard(msg);
|
||||||
|
logic.getGame().setTurboFlag(true);
|
||||||
parent.getParent().setState(parent.getParent().getPlayPowerCard());
|
parent.getParent().setState(parent.getParent().getPlayPowerCard());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ public class Game {
|
|||||||
*/
|
*/
|
||||||
private int diceEyes;
|
private int diceEyes;
|
||||||
|
|
||||||
|
private boolean turboFlag = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This constructor creates a new Game object.
|
* This constructor creates a new Game object.
|
||||||
*/
|
*/
|
||||||
@@ -300,6 +302,14 @@ public boolean isHost() {
|
|||||||
return this.host != -1;
|
return this.host != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTurboFlag(boolean flag) {
|
||||||
|
this.turboFlag = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getTurboFlag() {
|
||||||
|
return this.turboFlag;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the players.
|
* This method returns the players.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user