Add DEBUG_MULTIPLIER

This commit is contained in:
Felix Koppe
2024-12-09 03:17:28 +01:00
parent f79d590620
commit 3dd6fc9f37
5 changed files with 13 additions and 8 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -69,7 +69,9 @@ public void update() {
throw new RuntimeException("no notification expected: " + n.getClass().getName());
}
delay = 0;
if(0 == MdgaApp.DEBUG_MULTIPLIER) {
delay = 0;
}
}
}
}
@@ -151,6 +153,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();
@@ -188,13 +191,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();

View File

@@ -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);
}
}

View File

@@ -52,6 +52,7 @@ public void rollDice(int rollNum, int mult) {
else actionTextHandler.ownDiceMult(rollNum, mult);
hideDice();
app.getModelSynchronize().animationEnd();
app.getModelSynchronize().animationEnd();
});
}