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