24 Commits

Author SHA1 Message Date
Felix Koppe
ee94d901f4 Adjust print statements 2024-12-08 13:54:39 +01:00
Felix Koppe
bca02bfe4b Adjust print statements 2024-12-08 13:51:05 +01:00
Felix Koppe
acdf5ec6a9 Add missing registration of SelectPieceMessage 2024-12-08 13:29:44 +01:00
Cedric Beck
41d6f70d51 added logger 2024-12-08 12:50:58 +01:00
Felix Koppe
4c064cb615 Merge commit+ 2024-12-08 12:45:36 +01:00
Felix Koppe
121f47d070 Fix selectPieceState and startPieceState logic 2024-12-08 12:45:08 +01:00
Cedric Beck
ae436589a2 edited MoveMessage in WaitingState 2024-12-08 12:38:59 +01:00
Cedric Beck
bc399b1bf9 edited String queals in Piece 2024-12-08 12:03:05 +01:00
Cedric Beck
98a6f2e689 added debug 2024-12-08 11:57:30 +01:00
Cedric Beck
9a07375fed Merge branch 'development' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-01 into development 2024-12-08 11:39:42 +01:00
Felix Koppe
498c2eb054 Merge remote-tracking branch 'origin/development' into development 2024-12-08 11:44:38 +01:00
Cedric Beck
ce55ca8bb5 added further node select implementation 2024-12-08 11:39:37 +01:00
Felix Koppe
9c729059bf Merge branch 'refs/heads/dev/server_h' into development 2024-12-08 11:30:09 +01:00
Cedric Beck
3b7ef37364 added selectNode when right piece is selected 2024-12-08 11:27:56 +01:00
Cedric Beck
adfe2b94b8 fixed cardLayer shutdown bug 2024-12-08 11:19:00 +01:00
Cedric Beck
69108063a0 fixed Notification bug 2024-12-08 10:33:56 +01:00
Hanno Fleischer
16e7488fae Merge branch 'dev/server_h' into 'development'
added more communication fixes, states now use correct messages

See merge request progproj/gruppen-ht24/Gruppe-01!38
2024-12-08 09:13:47 +00:00
Felix Koppe
e069017375 Merge remote-tracking branch 'origin/dev/server_h' into development 2024-12-08 09:44:23 +01:00
Cedric Beck
c8d7d91de0 added import in NotiSync 2024-12-07 21:57:41 +01:00
Cedric Beck
389d1b6056 merge development into dev/client_beck 2024-12-07 17:04:43 +01:00
Cedric Beck
4430b37581 fixed wrong dice rotation because of fps drop 2024-12-07 17:00:42 +01:00
Cedric Beck
e5abcbdc8c added jet_noGear.j3o 2024-12-07 16:51:38 +01:00
Cedric Beck
e14b8cb510 added converted assets 2024-12-07 16:50:43 +01:00
Felix Koppe
bf84bfa0f9 Update animations and remove test setup 2024-12-07 16:40:45 +01:00
35 changed files with 200 additions and 496200 deletions

View File

@@ -28,7 +28,7 @@ public enum Asset {
ship(0.8f), ship(0.8f),
smallTent, smallTent,
tank, tank,
world("Models/world/world_export_newTex.obj", "Models/world/world_diff.png",1.2f), world(1.2f),
shieldRing("Models/shieldRing/shieldRing.j3o", null), shieldRing("Models/shieldRing/shieldRing.j3o", null),
treeSmall(1.2f), treeSmall(1.2f),
treeBig(1.2f), treeBig(1.2f),
@@ -40,10 +40,10 @@ public enum Asset {
shieldSymbol("Models/shieldCard/shieldSymbol.j3o", "Models/shieldCard/shieldCard_diff.png"), shieldSymbol("Models/shieldCard/shieldSymbol.j3o", "Models/shieldCard/shieldCard_diff.png"),
dice, dice,
missile("Models/missile/AVMT300.obj", "Models/missile/texture.jpg", 0.1f), missile("Models/missile/AVMT300.obj", "Models/missile/texture.jpg", 0.1f),
tankShoot("Models/tank/tank_shoot_bot.obj", "Models/tank/tank_diff.png"), tankShoot("Models/tank/tankShoot_bot.j3o", "Models/tank/tank_diff.png"),
tankShootTop("Models/tank/tank_shoot_top.obj", "Models/tank/tank_diff.png"), tankShootTop("Models/tank/tankShoot_top.j3o", "Models/tank/tank_diff.png"),
treesSmallBackground("Models/treeSmall/small_trees_background.obj", "Models/treeSmall/treeSmall_diff.png", 1.2f), treesSmallBackground("Models/treeSmall/treesSmallBackground.j3o", "Models/treeSmall/treeSmall_diff.png", 1.2f),
treesBigBackground("Models/treeBig/big_trees_background.obj", "Models/treeBig/treeBig_diff.png", 1.2f), treesBigBackground("Models/treeBig/treesBigBackground.j3o", "Models/treeBig/treeBig_diff.png", 1.2f),
shell shell
; ;

View File

@@ -156,9 +156,10 @@ else if(boardSelect != null) {
p = UUID.randomUUID(); p = UUID.randomUUID();
gameView.getBoardHandler().addPlayer(Color.AIRFORCE,List.of(p,UUID.randomUUID(),UUID.randomUUID(),UUID.randomUUID())); gameView.getBoardHandler().addPlayer(Color.AIRFORCE,List.of(p,UUID.randomUUID(),UUID.randomUUID(),UUID.randomUUID()));
gameView.getBoardHandler().movePieceStartAnim(p,0); gameView.getBoardHandler().movePieceStartAnim(p,0);
gameView.getBoardHandler().outlineMove(List.of(p),List.of(2),List.of(false));
//gameView.getBoardHandler().movePieceAnim(p,0, 8); //gameView.getBoardHandler().movePieceAnim(p,0, 8);
} else { } else {
gameView.getBoardHandler().throwPiece(p, Color.NAVY); gameView.getBoardHandler().throwPiece(p, Color.ARMY);
//gameView.getBoardHandler().movePieceStartAnim(p,0); //gameView.getBoardHandler().movePieceStartAnim(p,0);
} }

View File

@@ -34,6 +34,8 @@ public void update() {
return; return;
} }
System.out.println("receive notification:" + n.getClass().getName());
timer.reset(); timer.reset();
delay = 0; delay = 0;
@@ -98,6 +100,7 @@ private void handleGame(Notification notification) {
GuiHandler guiHandler = gameView.getGuiHandler(); GuiHandler guiHandler = gameView.getGuiHandler();
BoardHandler boardHandler = gameView.getBoardHandler(); BoardHandler boardHandler = gameView.getBoardHandler();
ModelSynchronizer modelSynchronizer = app.getModelSynchronize(); ModelSynchronizer modelSynchronizer = app.getModelSynchronize();
Color ownColor = gameView.getOwnColor();
if (notification instanceof AcquireCardNotification n) { if (notification instanceof AcquireCardNotification n) {
guiHandler.addCardOwn(n.getBonusCard()); guiHandler.addCardOwn(n.getBonusCard());
@@ -105,7 +108,7 @@ private void handleGame(Notification notification) {
delay = STANDARD_DELAY; delay = STANDARD_DELAY;
} else if (notification instanceof ActivePlayerNotification n) { } else if (notification instanceof ActivePlayerNotification n) {
gameView.getGuiHandler().setActivePlayer(n.getColor()); gameView.getGuiHandler().setActivePlayer(n.getColor());
boardHandler.showDice(n.getColor()); if(n.getColor() != ownColor) boardHandler.showDice(n.getColor());
app.getAcousticHandler().playSound(MdgaSound.UI90); app.getAcousticHandler().playSound(MdgaSound.UI90);
delay = STANDARD_DELAY; delay = STANDARD_DELAY;
} else if (notification instanceof CeremonyNotification ceremonyNotification) { } else if (notification instanceof CeremonyNotification ceremonyNotification) {
@@ -159,7 +162,7 @@ private void handleGame(Notification notification) {
} else if (notification instanceof NoShieldNotification n) { } else if (notification instanceof NoShieldNotification n) {
boardHandler.unshieldPiece(n.getPieceId()); boardHandler.unshieldPiece(n.getPieceId());
} else if (notification instanceof PlayCardNotification n) { } else if (notification instanceof PlayCardNotification n) {
if(n.getColor() == gameView.getOwnColor()) 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());
} else if (notification instanceof PlayerInGameNotification n) { } else if (notification instanceof PlayerInGameNotification n) {
boardHandler.addPlayer(n.getColor(),n.getPiecesList()); boardHandler.addPlayer(n.getColor(),n.getPiecesList());
@@ -168,7 +171,7 @@ private void handleGame(Notification notification) {
gameView.leaveInterrupt(); gameView.leaveInterrupt();
} else if (notification instanceof RollDiceNotification n) { } else if (notification instanceof RollDiceNotification n) {
gameView.getGuiHandler().hideText(); gameView.getGuiHandler().hideText();
if(n.getColor() == gameView.getOwnColor()){ if(n.getColor() == ownColor){
guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1); guiHandler.rollDice(n.getEyes(), n.isTurbo() ? n.getMultiplier() : -1);
} }
else { else {
@@ -188,7 +191,7 @@ private void handleGame(Notification notification) {
app.afterGameCleanup(); app.afterGameCleanup();
app.enter(MdgaState.MAIN); app.enter(MdgaState.MAIN);
} else if (notification instanceof SwapPieceNotification n) { } else if (notification instanceof SwapPieceNotification n) {
// boardHandler.swapPieces(n.getFirstPiece(), n.getSecondPiece()); boardHandler.swapPieceAnim(n.getFirstPiece(), n.getSecondPiece());
guiHandler.swap(); guiHandler.swap();
} else if (notification instanceof WaitMoveNotification) { } else if (notification instanceof WaitMoveNotification) {
//TODO ??? //TODO ???

View File

@@ -39,6 +39,7 @@ public Explosion(MdgaApp app, Node rootNode, Vector3f location) {
this.location = location; this.location = location;
this.mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md"); this.mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
mat.setTexture("Texture", app.getAssetManager().loadTexture("Images/particle/flame.png"));
} }
/** /**
@@ -48,12 +49,14 @@ public Explosion(MdgaApp app, Node rootNode, Vector3f location) {
private void initializeEmitter() { private void initializeEmitter() {
fire = new ParticleEmitter("Effect", Type.Triangle,50); fire = new ParticleEmitter("Effect", Type.Triangle,50);
fire.setMaterial(mat); fire.setMaterial(mat);
fire.setImagesX(2);
fire.setImagesY(2);
fire.setStartColor(ColorRGBA.Yellow); fire.setStartColor(ColorRGBA.Yellow);
fire.setEndColor(ColorRGBA.Red); fire.setEndColor(ColorRGBA.Red);
fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f,0.2f,4f)); fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f,0.2f,4f));
fire.getParticleInfluencer().setVelocityVariation(0.4f); fire.getParticleInfluencer().setVelocityVariation(0.4f);
fire.setStartSize(0.1f); fire.setStartSize(0.7f);
fire.setEndSize(0.8f); fire.setEndSize(1.8f);
fire.setGravity(0, 0, -0.1f); fire.setGravity(0, 0, -0.1f);
fire.setLowLife(0.5f); fire.setLowLife(0.5f);
fire.setHighLife(2.2f); fire.setHighLife(2.2f);
@@ -63,14 +66,14 @@ private void initializeEmitter() {
smoke = new ParticleEmitter("Effect2", Type.Triangle,40); smoke = new ParticleEmitter("Effect2", Type.Triangle,40);
smoke.setMaterial(mat); smoke.setMaterial(mat);
smoke.setImagesX(2); smoke.setImagesX(3);
smoke.setImagesY(2); smoke.setImagesY(3);
smoke.setStartColor(ColorRGBA.DarkGray); smoke.setStartColor(ColorRGBA.DarkGray);
smoke.setEndColor(new ColorRGBA(0.05f, 0.05f, 0.05f, 1)); smoke.setEndColor(new ColorRGBA(0.05f, 0.05f, 0.05f, 1));
smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f,0.0f,0.7f)); smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f,0.0f,0.7f));
smoke.getParticleInfluencer().setVelocityVariation(0.5f); smoke.getParticleInfluencer().setVelocityVariation(0.5f);
smoke.setStartSize(0.2f); smoke.setStartSize(0.8f);
smoke.setEndSize(0.5f); smoke.setEndSize(1.5f);
smoke.setGravity(0, 0, -0.3f); smoke.setGravity(0, 0, -0.3f);
smoke.setLowLife(1.2f); smoke.setLowLife(1.2f);
smoke.setHighLife(5.5f); smoke.setHighLife(5.5f);

View File

@@ -33,7 +33,6 @@ public class JetAnimation {
private final float curveHeight; private final float curveHeight;
private final float animationDuration; private final float animationDuration;
private Explosion explosion; private Explosion explosion;
private final UUID id;
private Runnable actionAfter; private Runnable actionAfter;
/** /**
@@ -41,12 +40,11 @@ public class JetAnimation {
* *
* @param app The main application managing the jet animation. * @param app The main application managing the jet animation.
* @param rootNode The root node to which the jet model will be attached. * @param rootNode The root node to which the jet model will be attached.
* @param uuid A unique identifier for the animation.
* @param targetPoint The target point where the explosion will occur. * @param targetPoint The target point where the explosion will occur.
* @param curveHeight The height of the curve for the jet's flight path. * @param curveHeight The height of the curve for the jet's flight path.
* @param animationDuration The total duration of the jet animation. * @param animationDuration The total duration of the jet animation.
*/ */
public JetAnimation(MdgaApp app, Node rootNode, UUID uuid, Vector3f targetPoint, float curveHeight, float animationDuration, Runnable actionAfter) { public JetAnimation(MdgaApp app, Node rootNode, Vector3f targetPoint, float curveHeight, float animationDuration, Runnable actionAfter) {
Vector3f spawnPoint = targetPoint.add(170, 50, 50); Vector3f spawnPoint = targetPoint.add(170, 50, 50);
Vector3f controlPoint = targetPoint.add(new Vector3f(0, 0, -45)); Vector3f controlPoint = targetPoint.add(new Vector3f(0, 0, -45));
@@ -61,9 +59,7 @@ public JetAnimation(MdgaApp app, Node rootNode, UUID uuid, Vector3f targetPoint,
this.curveHeight = curveHeight; this.curveHeight = curveHeight;
this.animationDuration = animationDuration; this.animationDuration = animationDuration;
id = uuid; explosion = new Explosion(app, rootNode, targetPoint);
explosion = new Explosion(app, rootNode, nodePoint);
this.actionAfter = actionAfter; this.actionAfter = actionAfter;
} }
@@ -92,7 +88,7 @@ private void spawnJet() {
rootNode.attachChild(jetModel); rootNode.attachChild(jetModel);
} }
/** /**actionAfter
* Animates the jet along a Bezier curve path, triggers the explosion effect at the appropriate time, * Animates the jet along a Bezier curve path, triggers the explosion effect at the appropriate time,
* and performs cleanup operations after the animation completes. * and performs cleanup operations after the animation completes.
*/ */

View File

@@ -1,6 +1,9 @@
package pp.mdga.client.animation; package pp.mdga.client.animation;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.material.Material; import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath; import com.jme3.math.FastMath;
import com.jme3.math.Vector3f; import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager; import com.jme3.renderer.RenderManager;
@@ -29,31 +32,54 @@ public class MissileAnimation {
private final float flightTime; private final float flightTime;
private Explosion explosion; private Explosion explosion;
private Spatial missileModel; private Spatial missileModel;
private Runnable actionAfter;
private ParticleEmitter smoke;
private UUID id; private Node missileNode = new Node();
private final Material mat;
/** /**
* Constructor for the {@code MissileAnimation} class. * Constructor for the {@code MissileAnimation} class.
* *
* @param app The main application managing the missile animation. * @param app The main application managing the missile animation.
* @param rootNode The root node to which the missile model will be attached. * @param rootNode The root node to which the missile model will be attached.
* @param uuid A unique identifier for the missile animation.
* @param target The target point where the missile will explode. * @param target The target point where the missile will explode.
* @param flightTime The total flight time of the missile. * @param flightTime The total flight time of the missile.
*/ */
public MissileAnimation(MdgaApp app, Node rootNode, UUID uuid, Vector3f target, float flightTime) { public MissileAnimation(MdgaApp app, Node rootNode, Vector3f target, float flightTime, Runnable actionAfter) {
this.app = app; this.app = app;
this.rootNode = rootNode; this.rootNode = rootNode;
this.flightTime = flightTime; this.flightTime = flightTime;
this.actionAfter = actionAfter;
explosion = new Explosion(app, rootNode, target); explosion = new Explosion(app, rootNode, target);
id = uuid;
this.target = target.add(new Vector3f(1.5f, -1, 0)); this.target = target.add(new Vector3f(1.5f, -1, 0));
start = BoardHandler.gridToWorld(12, 0); start = BoardHandler.gridToWorld(12, 0);
start.add(new Vector3f(0, 0, 0)); start.add(new Vector3f(0, 0, 0));
this.mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
mat.setTexture("Texture", app.getAssetManager().loadTexture("Images/particle/vapor_cloud.png"));
smoke = new ParticleEmitter("Effect2", ParticleMesh.Type.Triangle,400);
smoke.setMaterial(mat);
smoke.setImagesX(3);
smoke.setImagesY(3);
smoke.setStartColor(ColorRGBA.DarkGray);
smoke.setEndColor(new ColorRGBA(0.05f, 0.05f, 0.05f, 1));
smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f,0.0f,0.0f));
smoke.getParticleInfluencer().setVelocityVariation(0.1f);
smoke.setStartSize(0.8f);
smoke.setEndSize(1.5f);
smoke.setGravity(0, 0, -0.3f);
smoke.setLowLife(1.2f);
smoke.setHighLife(3.5f);
smoke.setParticlesPerSec(100);
missileNode.attachChild(smoke);
smoke.move(1, 0.85f, 1.0f);
} }
/** /**
@@ -77,8 +103,11 @@ private void loadMissile() {
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md"); Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
mat.setTexture("DiffuseMap", app.getAssetManager().loadTexture(Asset.missile.getDiffPath())); mat.setTexture("DiffuseMap", app.getAssetManager().loadTexture(Asset.missile.getDiffPath()));
missileModel.setMaterial(mat); missileModel.setMaterial(mat);
missileModel.setLocalTranslation(start);
rootNode.attachChild(missileModel); missileNode.setLocalTranslation(start);
missileNode.attachChild(missileModel);
rootNode.attachChild(missileNode);
} }
/** /**
@@ -86,28 +115,39 @@ private void loadMissile() {
* and removes the missile model after the animation completes. * and removes the missile model after the animation completes.
*/ */
private void animateMissile() { private void animateMissile() {
missileModel.addControl(new AbstractControl() { missileNode.addControl(new AbstractControl() {
private float elapsedTime = 0; private float elapsedTime = 0;
@Override @Override
protected void controlUpdate(float tpf) { protected void controlUpdate(float tpf) {
if(elapsedTime > 6) {
endAnim();
rootNode.detachChild(missileNode);
this.spatial.removeControl(this);
}
elapsedTime += tpf; elapsedTime += tpf;
float progress = elapsedTime / flightTime; float progress = elapsedTime / flightTime;
if (progress >= 0.55) {
smoke.setParticlesPerSec(30);
}
if (progress >= 0.7) {
smoke.setParticlesPerSec(0);
}
if (progress >= 0.95f) { if (progress >= 0.95f) {
explosion.trigger(); explosion.trigger();
} }
if (progress >= 1) { if (progress >= 1) {
explosion.trigger(); explosion.trigger();
missileNode.detachChild(missileModel);
rootNode.detachChild(missileModel);
this.spatial.removeControl(this);
return;
} }
Vector3f currentPosition = computeParabolicPath(start, target, progress); Vector3f currentPosition = computeParabolicPath(start, target, progress);
missileModel.setLocalTranslation(currentPosition); missileNode.setLocalTranslation(currentPosition);
Vector3f direction = computeParabolicPath(start, target, progress + 0.01f) Vector3f direction = computeParabolicPath(start, target, progress + 0.01f)
.subtract(currentPosition) .subtract(currentPosition)
@@ -122,6 +162,10 @@ protected void controlRender(RenderManager rm, ViewPort vp) {
}); });
} }
private void endAnim(){
actionAfter.run();
}
/** /**
* Computes a position along a parabolic path at a given progress value {@code t}. * Computes a position along a parabolic path at a given progress value {@code t}.
* *

View File

@@ -35,6 +35,7 @@ public Smoke(MdgaApp app, Node rootNode, Vector3f location) {
this.location = location; this.location = location;
this.mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md"); this.mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
mat.setTexture("Texture", app.getAssetManager().loadTexture("Images/particle/vapor_cloud.png"));
} }
/** /**
@@ -46,10 +47,10 @@ private void initializeEmitter() {
fire.setMaterial(mat); fire.setMaterial(mat);
fire.setStartColor(ColorRGBA.DarkGray); fire.setStartColor(ColorRGBA.DarkGray);
fire.setEndColor(ColorRGBA.DarkGray); fire.setEndColor(ColorRGBA.DarkGray);
fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f,0.2f,8f)); fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0.2f,0.2f,4f));
fire.getParticleInfluencer().setVelocityVariation(0.4f); fire.getParticleInfluencer().setVelocityVariation(0.4f);
fire.setStartSize(0.1f); fire.setStartSize(0.7f);
fire.setEndSize(0.8f); fire.setEndSize(3.8f);
fire.setGravity(0, 0, -0.1f); fire.setGravity(0, 0, -0.1f);
fire.setLowLife(0.5f); fire.setLowLife(0.5f);
fire.setHighLife(1.2f); fire.setHighLife(1.2f);
@@ -65,8 +66,8 @@ private void initializeEmitter() {
smoke.setEndColor(new ColorRGBA(0.05f, 0.05f, 0.05f, 1)); smoke.setEndColor(new ColorRGBA(0.05f, 0.05f, 0.05f, 1));
smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f,0.0f,2f)); smoke.getParticleInfluencer().setInitialVelocity(new Vector3f(0.0f,0.0f,2f));
smoke.getParticleInfluencer().setVelocityVariation(0.5f); smoke.getParticleInfluencer().setVelocityVariation(0.5f);
smoke.setStartSize(0.2f); smoke.setStartSize(0.5f);
smoke.setEndSize(0.5f); smoke.setEndSize(1.5f);
smoke.setGravity(0, 0, -0.3f); smoke.setGravity(0, 0, -0.3f);
smoke.setLowLife(1.2f); smoke.setLowLife(1.2f);
smoke.setHighLife(2.5f); smoke.setHighLife(2.5f);

View File

@@ -53,6 +53,7 @@ public class BoardHandler {
// Flags and lists for handling piece selection and movement // Flags and lists for handling piece selection and movement
private List<PieceControl> selectableOwnPieces; private List<PieceControl> selectableOwnPieces;
private List<PieceControl> selectableEnemyPieces; private List<PieceControl> selectableEnemyPieces;
private Map<PieceControl, NodeControl> selectedPieceNodeMap;
private List<NodeControl> outlineNodes; private List<NodeControl> outlineNodes;
private PieceControl selectedOwnPiece; private PieceControl selectedOwnPiece;
private PieceControl selectedEnemyPiece; private PieceControl selectedEnemyPiece;
@@ -87,6 +88,7 @@ public void init() {
isInitialised = true; isInitialised = true;
selectableOwnPieces = new ArrayList<>(); selectableOwnPieces = new ArrayList<>();
selectableEnemyPieces = new ArrayList<>(); selectableEnemyPieces = new ArrayList<>();
selectedPieceNodeMap = new HashMap<>();
outlineNodes = new ArrayList<>(); outlineNodes = new ArrayList<>();
selectedOwnPiece = null; selectedOwnPiece = null;
selectedEnemyPiece = null; selectedEnemyPiece = null;
@@ -603,6 +605,7 @@ public void outlineMove(List<UUID> pieces, List<Integer> moveIndexe, List<Boolea
pieceControl.setSelectable(true); pieceControl.setSelectable(true);
outlineNodes.add(nodeControl); outlineNodes.add(nodeControl);
selectableOwnPieces.add(pieceControl); selectableOwnPieces.add(pieceControl);
selectedPieceNodeMap.put(pieceControl, nodeControl);
} }
} }
@@ -668,10 +671,12 @@ public void pieceSelect(PieceControl pieceSelected) {
} }
if (!isSelected) { if (!isSelected) {
pieceSelected.select(); pieceSelected.select();
selectedPieceNodeMap.get(pieceSelected).select();
selectedOwnPiece = pieceSelected; selectedOwnPiece = pieceSelected;
} }
else { else {
pieceSelected.unSelect(); pieceSelected.unSelect();
selectedPieceNodeMap.get(pieceSelected).highlight();
selectedOwnPiece = null; selectedOwnPiece = null;
} }
} }
@@ -701,11 +706,13 @@ public void clearSelectable(){
p.unSelect(); p.unSelect();
p.unHighlight(); p.unHighlight();
p.setSelectable(false); p.setSelectable(false);
p.setHoverable(false);
} }
for(PieceControl p : selectableOwnPieces) { for(PieceControl p : selectableOwnPieces) {
p.unSelect(); p.unSelect();
p.unHighlight(); p.unHighlight();
p.setSelectable(false); p.setSelectable(false);
p.setHoverable(false);
} }
for(NodeControl n : outlineNodes){ for(NodeControl n : outlineNodes){
n.deOutline(); n.deOutline();
@@ -713,6 +720,7 @@ public void clearSelectable(){
outlineNodes.clear(); outlineNodes.clear();
selectableEnemyPieces.clear(); selectableEnemyPieces.clear();
selectableOwnPieces.clear(); selectableOwnPieces.clear();
selectedPieceNodeMap.clear();
selectedEnemyPiece = null; selectedEnemyPiece = null;
selectedOwnPiece = null; selectedOwnPiece = null;
} }
@@ -800,7 +808,7 @@ public void throwPieceAnim(UUID uuid){
public void throwPiece(UUID uuid, Color throwColor){ public void throwPiece(UUID uuid, Color throwColor){
switch(throwColor){ switch(throwColor){
case ARMY -> throwShell(uuid); case ARMY -> throwShell(uuid);
case NAVY -> throwMissle(uuid); case NAVY -> throwMissile(uuid);
case CYBER -> throwMatrix(uuid); case CYBER -> throwMatrix(uuid);
case AIRFORCE -> throwBomb(uuid); case AIRFORCE -> throwBomb(uuid);
default -> throw new RuntimeException("invalid color"); default -> throw new RuntimeException("invalid color");
@@ -815,7 +823,7 @@ public void throwPiece(UUID uuid, Color throwColor){
private void throwBomb(UUID uuid) { private void throwBomb(UUID uuid) {
Vector3f targetPoint = pieces.get(uuid).getLocation(); Vector3f targetPoint = pieces.get(uuid).getLocation();
JetAnimation anim = new JetAnimation(app, rootNode, uuid, targetPoint, 40, 6, ()->throwPieceAnim(uuid)); JetAnimation anim = new JetAnimation(app, rootNode, targetPoint, 40, 6, ()->throwPieceAnim(uuid));
anim.start(); anim.start();
} }
@@ -832,10 +840,10 @@ private void throwMatrix(UUID uuid) {
})); }));
} }
private void throwMissle(UUID uuid) { private void throwMissile(UUID uuid) {
Vector3f targetPoint = pieces.get(uuid).getLocation(); Vector3f targetPoint = pieces.get(uuid).getLocation();
MissileAnimation anim = new MissileAnimation(app, rootNode, uuid, targetPoint, 2); MissileAnimation anim = new MissileAnimation(app, rootNode, targetPoint, 2f, ()->throwPieceAnim(uuid));
anim.start(); anim.start();
} }

View File

@@ -102,15 +102,18 @@ public void init(Color ownColor) {
* and resets the camera position and rotation to its default state. * and resets the camera position and rotation to its default state.
*/ */
public void shutdown() { public void shutdown() {
app.getRootNode().removeLight(sun); init = false;
app.getRootNode().removeLight(ambient); fpp.removeFilter(fxaaFilter);
fpp.removeFilter(ssaoFilter);
fpp.removeFilter(dlsf);
app.getRootNode().detachChild(sky); app.getRootNode().detachChild(sky);
app.getRootNode().removeLight(ambient);
app.getRootNode().removeLight(sun);
// Reset the camera to its default state // Reset the camera to its default state
app.getCamera().setLocation(defaultCameraPosition); app.getCamera().setLocation(defaultCameraPosition);
app.getCamera().setRotation(defaultCameraRotation); app.getCamera().setRotation(defaultCameraRotation);
fpp.removeFilter(dlsf);
} }
/** /**

View File

@@ -16,6 +16,8 @@ public class NodeControl extends OutlineControl {
private static final ColorRGBA OUTLINE_HIGHLIGHT_COLOR = ColorRGBA.White; private static final ColorRGBA OUTLINE_HIGHLIGHT_COLOR = ColorRGBA.White;
private static final int OUTLINE_HIGHLIGHT_WIDTH = 6; private static final int OUTLINE_HIGHLIGHT_WIDTH = 6;
private static final ColorRGBA OUTLINE_SELECT_COLOR = ColorRGBA.Cyan;
private static final int OUTLINE_SELECT_WIDTH = 6;
/** /**
* Constructs a {@link NodeControl} with the specified application and post processor. * Constructs a {@link NodeControl} with the specified application and post processor.
@@ -45,4 +47,8 @@ public Vector3f getLocation(){
public void highlight() { public void highlight() {
super.outline(OUTLINE_HIGHLIGHT_COLOR, OUTLINE_HIGHLIGHT_WIDTH); super.outline(OUTLINE_HIGHLIGHT_COLOR, OUTLINE_HIGHLIGHT_WIDTH);
} }
public void select() {
super.outline(OUTLINE_SELECT_COLOR, OUTLINE_SELECT_WIDTH);
}
} }

View File

@@ -8,6 +8,7 @@
import com.jme3.math.Vector3f; import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor; import com.jme3.post.FilterPostProcessor;
import com.jme3.post.filters.ComposeFilter; import com.jme3.post.filters.ComposeFilter;
import com.jme3.post.filters.FXAAFilter;
import com.jme3.renderer.Camera; import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager; import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort; import com.jme3.renderer.ViewPort;
@@ -31,35 +32,46 @@ public class CardLayer extends AbstractAppState {
private List<Spatial> cardBuffer; private List<Spatial> cardBuffer;
private final FilterPostProcessor fpp; private final FilterPostProcessor fpp;
private final Camera overlayCam; private final Camera overlayCam;
Texture2D backTexture; private Texture2D backTexture;
private FXAAFilter fxaaFilter;
private ViewPort view;
private DirectionalLightShadowFilter dlsf;
DirectionalLight sun;
ComposeFilter compose;
public CardLayer(FilterPostProcessor fpp, Camera overlayCam, Texture2D backTexture) { public CardLayer(FilterPostProcessor fpp, Camera overlayCam, Texture2D backTexture) {
this.overlayCam = overlayCam; this.overlayCam = overlayCam;
this.fpp = fpp; this.fpp = fpp;
this.cardBuffer = new ArrayList<>();
init = false;
this.backTexture = backTexture; this.backTexture = backTexture;
cardBuffer = new ArrayList<>();
init = false;
fxaaFilter = new FXAAFilter();
view = null;
dlsf = null;
sun = new DirectionalLight();
sun.setColor(ColorRGBA.White);
sun.setDirection(new Vector3f(.5f, -.5f, -1));
compose = new ComposeFilter(backTexture);
root = new Node("Under gui viewport Root");
} }
@Override @Override
public void initialize(AppStateManager stateManager, Application app) { public void initialize(AppStateManager stateManager, Application app) {
this.app = app; this.app = app;
root = new Node("Under gui viewport Root");
ViewPort view = app.getRenderManager().createMainView("Under gui ViewPort", overlayCam); view = app.getRenderManager().createMainView("Under gui ViewPort", overlayCam);
view.setEnabled(true); view.setEnabled(true);
view.setClearFlags(true, true, true); view.setClearFlags(true, true, true);
view.attachScene(root); view.attachScene(root);
fpp.setFrameBufferFormat(Image.Format.RGBA8); fpp.setFrameBufferFormat(Image.Format.RGBA8);
fpp.addFilter(new ComposeFilter(backTexture)); fpp.addFilter(compose);
fpp.addFilter(fxaaFilter);
DirectionalLight sun = new DirectionalLight();
sun.setColor(ColorRGBA.White);
sun.setDirection(new Vector3f(.5f, -.5f, -1));
root.addLight(sun); root.addLight(sun);
DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(app.getAssetManager(), SHADOWMAP_SIZE, 3); dlsf = new DirectionalLightShadowFilter(app.getAssetManager(), SHADOWMAP_SIZE, 3);
dlsf.setLight(sun); dlsf.setLight(sun);
dlsf.setEnabled(true); dlsf.setEnabled(true);
dlsf.setEdgeFilteringMode(EdgeFilteringMode.PCFPOISSON); dlsf.setEdgeFilteringMode(EdgeFilteringMode.PCFPOISSON);
@@ -72,6 +84,15 @@ public void initialize(AppStateManager stateManager, Application app) {
} }
public void shutdown() { public void shutdown() {
// view.clearProcessors();
fpp.removeFilter(dlsf);
dlsf = null;
root.removeLight(sun);
fpp.removeFilter(fxaaFilter);
// fpp.removeFilter(compose);
view.detachScene(root);
// app.getRenderManager().removeMainView(view);
cardBuffer.clear(); cardBuffer.clear();
root.detachAllChildren(); root.detachAllChildren();
} }

View File

@@ -50,9 +50,10 @@ public void init() {
} }
public void shutdown() { public void shutdown() {
clearSelectableCards();
if (cardLayer != null) { if (cardLayer != null) {
cardLayer.shutdown(); cardLayer.shutdown();
clearSelectableCards(); app.getStateManager().detach(cardLayer);
} }
cardLayer = null; cardLayer = null;
} }

View File

@@ -39,14 +39,15 @@ public DiceControl(AssetManager assetManager){
@Override @Override
protected void controlUpdate(float tpf) { protected void controlUpdate(float tpf) {
float clampedTpf = Math.min(tpf, 0.05f); // Max 50 ms per frame
if (isRolling) { if (isRolling) {
if(!slerp) { if(!slerp) {
// Apply rotational velocity to the dice // Apply rotational velocity to the dice
spinWithAngularVelocity(tpf); spinWithAngularVelocity(clampedTpf);
// Gradually reduce rotational velocity (simulate deceleration) // Gradually reduce rotational velocity (simulate deceleration)
angularVelocity.subtractLocal( angularVelocity.subtractLocal(
angularVelocity.mult(deceleration * tpf) angularVelocity.mult(deceleration * clampedTpf)
); );
// Stop rolling when angular velocity is close to zero // Stop rolling when angular velocity is close to zero
@@ -55,7 +56,7 @@ protected void controlUpdate(float tpf) {
} }
} }
else { else {
timeElapsed += tpf * rollDuration; timeElapsed += clampedTpf * rollDuration;
if (timeElapsed > 1.0f) timeElapsed = 1.0f; if (timeElapsed > 1.0f) timeElapsed = 1.0f;
@@ -71,7 +72,7 @@ protected void controlUpdate(float tpf) {
} }
} }
}else if(spin){ }else if(spin){
spinWithAngularVelocity(tpf); spinWithAngularVelocity(clampedTpf);
} }
} }
@@ -95,6 +96,7 @@ public void rollDice(int diceNum, Runnable actionAfter) {
if (isRolling) return; if (isRolling) return;
spin = false; spin = false;
slerp = false; slerp = false;
timeElapsed = 0;
this.actionAfter = actionAfter; this.actionAfter = actionAfter;
angularVelocity.set( angularVelocity.set(
FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX), FastMath.nextRandomInt(ANGULAR_MIN,ANGULAR_MAX),

View File

@@ -141,10 +141,11 @@ public void addPlayer(Color color, String name, boolean own){
} }
public void setActivePlayer(Color color) { public void setActivePlayer(Color color) {
Color lastFirst = playerOrder.remove(0); if(playerOrder.get(0) == color) return;
Color oldFirst = playerOrder.remove(0);
playerOrder.remove(color); playerOrder.remove(color);
playerOrder.add(0, color); playerOrder.add(0, color);
playerOrder.add(lastFirst); playerOrder.add(oldFirst);
drawPlayers(); drawPlayers();
} }

View File

@@ -3,6 +3,7 @@
import com.jme3.asset.AssetManager; import com.jme3.asset.AssetManager;
import com.jme3.math.ColorRGBA; import com.jme3.math.ColorRGBA;
import com.jme3.post.FilterPostProcessor; import com.jme3.post.FilterPostProcessor;
import com.jme3.post.filters.FXAAFilter;
import com.jme3.renderer.Camera; import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager; import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort; import com.jme3.renderer.ViewPort;
@@ -54,7 +55,6 @@ public void select(Spatial model, ColorRGBA color, int width) {
} }
private void hideOutlineFilterEffect(Spatial model) { private void hideOutlineFilterEffect(Spatial model) {
// app.enqueue(() -> {
outlineFilter.setEnabled(false); outlineFilter.setEnabled(false);
outlineFilter.getOutlinePreFilter().setEnabled(false); outlineFilter.getOutlinePreFilter().setEnabled(false);
fpp.removeFilter(outlineFilter); fpp.removeFilter(outlineFilter);
@@ -62,18 +62,14 @@ private void hideOutlineFilterEffect(Spatial model) {
outlineViewport.clearProcessors(); outlineViewport.clearProcessors();
renderManager.removePreView(outlineViewport); renderManager.removePreView(outlineViewport);
outlineViewport = null; outlineViewport = null;
// return null;
// });
} }
private void showOutlineFilterEffect(Spatial model, int width, ColorRGBA color) { private void showOutlineFilterEffect(Spatial model, int width, ColorRGBA color) {
// app.enqueue(() -> {
outlineViewport = renderManager.createPreView("outlineViewport", cam); outlineViewport = renderManager.createPreView("outlineViewport", cam);
FilterPostProcessor outlineFpp = new FilterPostProcessor(assetManager); FilterPostProcessor outlineFpp = new FilterPostProcessor(assetManager);
OutlinePreFilter outlinePreFilter = new OutlinePreFilter(); OutlinePreFilter outlinePreFilter = new OutlinePreFilter();
outlineFpp.addFilter(outlinePreFilter); outlineFpp.addFilter(outlinePreFilter);
outlineViewport.attachScene(model); outlineViewport.attachScene(model);
outlineViewport.addProcessor(outlineFpp); outlineViewport.addProcessor(outlineFpp);
@@ -82,7 +78,5 @@ private void showOutlineFilterEffect(Spatial model, int width, ColorRGBA color)
outlineFilter.setOutlineWidth(width); outlineFilter.setOutlineWidth(width);
fpp.addFilter(outlineFilter); fpp.addFilter(outlineFilter);
// return null;
// });
} }
} }

View File

@@ -108,6 +108,7 @@ private void initializeSerializables() {
Serializer.registerClass(RequestPlayCardMessage.class); Serializer.registerClass(RequestPlayCardMessage.class);
Serializer.registerClass(SelectCardMessage.class); Serializer.registerClass(SelectCardMessage.class);
Serializer.registerClass(SelectedPiecesMessage.class); Serializer.registerClass(SelectedPiecesMessage.class);
Serializer.registerClass(SelectPieceMessage.class);
Serializer.registerClass(SelectTSKMessage.class); Serializer.registerClass(SelectTSKMessage.class);
Serializer.registerClass(ActivePlayerMessage.class); Serializer.registerClass(ActivePlayerMessage.class);
Serializer.registerClass(AnyPieceMessage.class); Serializer.registerClass(AnyPieceMessage.class);
@@ -204,7 +205,7 @@ public void messageReceived(HostedConnection source, Message message) {
* @param message as the received message as a Message object. * @param message as the received message as a Message object.
*/ */
private void messageReceived(HostedConnection source, ClientMessage message) { private void messageReceived(HostedConnection source, ClientMessage message) {
LOGGER.log(Level.INFO, "message received from {0}: {1}", source.getId(), message); //NON-NLS System.out.println("server received from: " + source.getId() + " " + message.getClass().getName());
pendingMessages.add(new ReceivedMessage(message, source.getId())); pendingMessages.add(new ReceivedMessage(message, source.getId()));
} }
@@ -279,10 +280,11 @@ public void send(int id, ServerMessage message) {
return; return;
} }
final HostedConnection connection = myServer.getConnection(id); final HostedConnection connection = myServer.getConnection(id);
if (connection != null) if (connection != null){
System.out.println("server sends to: " + id + " " + message.getClass().getName());
connection.send(message); connection.send(message);
else }
LOGGER.log(Level.ERROR, "there is no connection with id={0}", id); //NON-NLS else LOGGER.log(Level.ERROR, "there is no connection with id={0}", id); //NON-NLS
} }
/** /**

View File

@@ -1,554 +0,0 @@
# Blender 3.6.5
# www.blender.org
o tank_top
v 0.136104 -4.382030 2.447842
v 0.136104 -4.313100 2.681757
v -0.107755 -4.382030 2.447842
v -0.107755 -4.313100 2.681757
v 0.136104 -5.171963 2.680617
v 0.136104 -5.103033 2.914532
v -0.107755 -5.171963 2.680617
v -0.107755 -5.103033 2.914532
v 0.104217 -1.266581 1.563035
v 0.104217 -1.215678 1.735777
v -0.075869 -1.266581 1.563035
v -0.075869 -1.215678 1.735777
v 0.104218 -5.321341 2.757877
v 0.104218 -5.270438 2.930620
v -0.075868 -5.321341 2.757877
v -0.075868 -5.270438 2.930620
v 0.170290 -1.697908 1.621255
v 0.170290 -1.609653 1.920754
v -0.141942 -1.697908 1.621255
v -0.141942 -1.609653 1.920754
v 0.229706 -1.077489 1.376490
v 0.229706 -0.955645 1.789975
v -0.201358 -1.077489 1.376490
v -0.201358 -0.955645 1.789975
v 0.514900 0.276165 1.806222
v 0.514900 0.588869 2.433130
v -0.442998 0.276164 1.806222
v -0.442998 0.588869 2.433130
v 0.514900 0.342851 1.772958
v 0.514900 0.655556 2.399867
v -0.442998 0.342851 1.772958
v -0.442998 0.655556 2.399867
v -0.571633 -0.809063 1.704162
v -0.571633 -0.809063 2.393599
v -0.723737 -0.809063 1.704162
v -0.723737 -0.809063 2.393599
v -0.571633 -0.656959 1.704161
v -0.571633 -0.656959 2.393600
v -0.723737 -0.656959 1.704161
v -0.723737 -0.656959 2.393600
v -0.950927 -0.897974 2.389141
v -0.950927 -0.803313 2.389141
v -0.861627 -0.897974 2.604730
v -0.861627 -0.803313 2.604730
v -0.646038 -0.897974 2.694029
v -0.646038 -0.803313 2.694029
v -0.430449 -0.897974 2.604729
v -0.430449 -0.803313 2.604730
v -0.341149 -0.897974 2.389141
v -0.341149 -0.803313 2.389141
v -0.430449 -0.897974 2.173552
v -0.430449 -0.803313 2.173552
v -0.646038 -0.897974 2.084251
v -0.646038 -0.803313 2.084251
v -0.861627 -0.897974 2.173552
v -0.861627 -0.803313 2.173552
v -0.799948 -0.357073 2.051851
v -0.784767 0.368207 2.051851
v -0.423762 0.888095 2.051851
v 0.525389 0.907164 2.051851
v 0.864924 0.401350 2.051851
v 0.849742 -0.323930 2.051851
v 0.387428 -1.063397 2.051851
v -0.368214 -1.078578 2.051851
v -1.026731 -0.445682 1.384443
v -1.007409 0.477460 1.384443
v -0.547920 1.139177 1.384443
v 0.660166 1.163448 1.384443
v 1.092329 0.519645 1.384443
v 1.073006 -0.403497 1.384443
v 0.484569 -1.344695 1.384443
v -0.477218 -1.364018 1.384443
v -1.077985 -0.465708 1.887314
v -1.057726 0.502151 1.887314
v -0.575980 1.195922 1.887314
v 0.690626 1.221368 1.887314
v 1.143722 0.546380 1.887314
v 1.123464 -0.421479 1.887314
v 0.506523 -1.408269 1.887314
v -0.501853 -1.428528 1.887314
v -1.085964 0.516008 1.535923
v -0.591726 1.227766 1.535923
v 0.707720 1.253873 1.535923
v 1.172564 0.561383 1.535923
v 1.151780 -0.431571 1.535923
v 0.518844 -1.443946 1.535923
v -0.515678 -1.464730 1.535923
v -1.106748 -0.476946 1.535923
v 0.612842 -0.142856 2.090828
v 0.612842 0.599197 2.091472
v -0.540940 -0.142856 2.090828
v -0.540940 0.599197 2.091472
v 0.612842 -0.142788 2.011893
v 0.612842 0.599266 2.012537
v -0.540940 -0.142788 2.011893
v -0.540940 0.599265 2.012537
v 0.445467 -0.035209 2.095495
v 0.445467 0.491550 2.095952
v -0.373565 -0.035210 2.095495
v -0.373565 0.491550 2.095952
vn -0.0000 0.9592 -0.2827
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -0.9592 0.2827
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.2827 -0.9592
vn -0.0000 0.2827 0.9592
vn -0.9960 -0.0855 0.0252
vn 0.9960 -0.0855 0.0252
vn -0.0000 -0.3670 -0.9302
vn -0.0000 0.1961 0.9806
vn -0.0000 -0.8949 0.4464
vn -0.0000 0.8949 -0.4464
vn -0.0000 -0.4464 -0.8949
vn -0.0000 0.4464 0.8949
vn -0.0000 -1.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vn -0.0000 -0.0000 -1.0000
vn -0.0000 -0.0000 1.0000
vn -0.9239 -0.0000 0.3827
vn -0.3827 -0.0000 0.9239
vn 0.3827 -0.0000 0.9239
vn 0.9239 -0.0000 0.3827
vn 0.9239 -0.0000 -0.3827
vn 0.3827 -0.0000 -0.9239
vn -0.3827 -0.0000 -0.9239
vn -0.9239 -0.0000 -0.3827
vn -0.5124 0.0107 0.8587
vn -0.3944 0.2739 0.8772
vn -0.0094 0.4678 0.8838
vn 0.3870 0.2598 0.8847
vn 0.5124 -0.0107 0.8587
vn 0.4253 -0.2659 0.8651
vn 0.0086 -0.4282 0.9037
vn -0.4187 -0.2505 0.8729
vn -0.8549 -0.5116 0.0863
vn 0.0200 -0.9946 0.1017
vn 0.8450 -0.5283 0.0833
vn 0.9965 -0.0209 0.0809
vn 0.8268 0.5550 0.0916
vn -0.0200 0.9956 0.0911
vn -0.8182 0.5681 0.0882
vn -0.9965 0.0209 0.0809
vn -0.8856 0.0185 -0.4640
vn -0.7133 0.4953 -0.4959
vn -0.0173 0.8609 -0.5085
vn 0.7140 0.4793 -0.5103
vn 0.8856 -0.0185 -0.4640
vn 0.7463 -0.4666 -0.4746
vn 0.0168 -0.8346 -0.5506
vn -0.7489 -0.4482 -0.4881
vn -0.0000 -0.0009 1.0000
vn -0.0000 0.0009 -1.0000
vn -0.0000 -1.0000 -0.0009
vn -0.0000 1.0000 0.0009
vt 0.302708 0.924112
vt 0.288040 0.909443
vt 0.302708 0.909443
vt 0.693823 0.755933
vt 0.708491 0.805468
vt 0.693821 0.805468
vt 0.933974 0.202686
vt 0.919330 0.188017
vt 0.933973 0.188017
vt 0.651344 0.857452
vt 0.636674 0.807918
vt 0.651343 0.807918
vt 0.134278 0.805715
vt 0.119609 0.855249
vt 0.119609 0.805715
vt 0.708491 0.751615
vt 0.693871 0.702081
vt 0.708540 0.702096
vt 0.766441 0.570082
vt 0.755608 0.559249
vt 0.766441 0.559249
vt 0.537931 0.359392
vt 0.548757 0.613657
vt 0.537924 0.613657
vt 0.781573 0.570082
vt 0.770759 0.559250
vt 0.781572 0.559250
vt 0.579073 0.613652
vt 0.568233 0.359392
vt 0.579066 0.359392
vt 0.563915 0.359392
vt 0.553082 0.613655
vt 0.553082 0.359392
vt 0.437696 0.622253
vt 0.448781 0.368077
vt 0.448529 0.622264
vt 0.615148 0.975854
vt 0.633896 0.957072
vt 0.633897 0.975854
vt 0.948652 0.917591
vt 0.926304 0.957587
vt 0.929870 0.917591
vt 0.106854 0.798464
vt 0.132782 0.772534
vt 0.132782 0.798464
vt 0.952676 0.496495
vt 0.930312 0.536496
vt 0.926746 0.496495
vt 0.938021 0.614748
vt 0.960377 0.574830
vt 0.956803 0.614748
vt 0.948620 0.913273
vt 0.926304 0.873209
vt 0.952234 0.873235
vt 0.288040 0.924112
vt 0.708492 0.755933
vt 0.919331 0.202686
vt 0.636675 0.857452
vt 0.134278 0.855249
vt 0.693822 0.751601
vt 0.755609 0.570082
vt 0.548764 0.359392
vt 0.770759 0.570082
vt 0.568241 0.613652
vt 0.563915 0.613655
vt 0.437949 0.368066
vt 0.615148 0.957072
vt 0.952234 0.957587
vt 0.106853 0.772534
vt 0.949094 0.536496
vt 0.934447 0.574830
vt 0.929838 0.913255
vt 0.040925 0.927951
vt 0.002159 0.870340
vt 0.040923 0.870330
vt 0.834247 0.352865
vt 0.838729 0.310724
vt 0.838729 0.352865
vt 0.508750 0.936735
vt 0.546231 0.879133
vt 0.546232 0.936754
vt 0.843047 0.310724
vt 0.847530 0.352865
vt 0.843047 0.352865
vt 0.697810 0.640142
vt 0.693822 0.697763
vt 0.693822 0.640142
vt 0.323097 0.582179
vt 0.319198 0.524554
vt 0.323154 0.524558
vt 0.768084 0.828693
vt 0.777234 0.870091
vt 0.768084 0.870092
vt 0.499788 0.814544
vt 0.508937 0.856016
vt 0.499788 0.856016
vt 0.218712 0.819723
vt 0.227862 0.861192
vt 0.218712 0.861192
vt 0.420031 0.812900
vt 0.429180 0.854372
vt 0.420031 0.854372
vt 0.785891 0.559250
vt 0.795040 0.568399
vt 0.785891 0.568399
vt 0.537924 0.700847
vt 0.547080 0.691706
vt 0.547071 0.700856
vt 0.966064 0.285237
vt 0.971814 0.298192
vt 0.966120 0.298192
vt 0.453257 0.607137
vt 0.458792 0.620111
vt 0.453099 0.620105
vt 0.453125 0.594168
vt 0.458949 0.607142
vt 0.961680 0.298192
vt 0.956052 0.285237
vt 0.961746 0.285237
vt 0.961746 0.311174
vt 0.955987 0.298192
vt 0.578003 0.963076
vt 0.583636 0.950107
vt 0.583697 0.963076
vt 0.713986 0.956996
vt 0.737947 0.947070
vt 0.747872 0.971032
vt 0.578003 0.937139
vt 0.577943 0.950107
vt 0.971758 0.311174
vt 0.966064 0.311174
vt 0.307851 0.954728
vt 0.317762 0.944793
vt 0.331777 0.978655
vt 0.921986 0.878344
vt 0.905406 0.827575
vt 0.921986 0.820132
vt 0.884350 0.795866
vt 0.893886 0.777817
vt 0.827291 0.793524
vt 0.817744 0.774692
vt 0.789645 0.814701
vt 0.806235 0.823505
vt 0.789645 0.872913
vt 0.833108 0.912166
vt 0.825506 0.933015
vt 0.878533 0.914030
vt 0.886125 0.935503
vt 0.036904 0.863435
vt 0.057955 0.805815
vt 0.058039 0.865604
vt 0.893784 0.134399
vt 0.914942 0.195798
vt 0.893712 0.196631
vt 0.011369 0.804651
vt 0.032412 0.863875
vt 0.011276 0.866012
vt 0.032503 0.745834
vt 0.011370 0.744910
vt 0.032435 0.705568
vt 0.011300 0.703600
vt 0.297104 0.788044
vt 0.318245 0.865182
vt 0.297086 0.866212
vt 0.057959 0.746102
vt 0.036897 0.705526
vt 0.058032 0.703600
vt 0.036826 0.746953
vt 0.067083 0.748470
vt 0.067078 0.803985
vt 0.067151 0.708957
vt 0.288040 0.863346
vt 0.288056 0.790674
vt 0.002181 0.709075
vt 0.002246 0.747480
vt 0.002245 0.803021
vt 0.002159 0.860067
vt 0.884977 0.194314
vt 0.885044 0.136458
vt 0.067157 0.859570
vt 0.709979 0.282916
vt 0.754532 0.352364
vt 0.709910 0.352320
vt 0.702128 0.640146
vt 0.706914 0.684776
vt 0.702166 0.684781
vt 0.415360 0.813107
vt 0.370725 0.882511
vt 0.370725 0.813107
vt 0.427272 0.808484
vt 0.432057 0.763854
vt 0.432020 0.808488
vt 0.542664 0.617975
vt 0.537927 0.687379
vt 0.537924 0.617975
vt 0.457848 0.589850
vt 0.453099 0.520446
vt 0.457847 0.520446
vt 0.919379 0.134399
vt 0.951006 0.183699
vt 0.919330 0.183667
vt 0.002161 0.927961
vt 0.834247 0.310724
vt 0.508749 0.879113
vt 0.847530 0.310724
vt 0.697810 0.697763
vt 0.319140 0.582175
vt 0.777234 0.828693
vt 0.508937 0.814544
vt 0.227862 0.819722
vt 0.429180 0.812900
vt 0.795040 0.559250
vt 0.537933 0.691697
vt 0.971758 0.285237
vt 0.458817 0.594174
vt 0.956052 0.311174
vt 0.723911 0.980958
vt 0.713986 0.971033
vt 0.723911 0.947070
vt 0.747872 0.956995
vt 0.737947 0.980958
vt 0.583697 0.937139
vt 0.331777 0.944776
vt 0.341688 0.954686
vt 0.341688 0.968720
vt 0.317762 0.978673
vt 0.307851 0.968762
vt 0.905406 0.871198
vt 0.806235 0.867128
vt 0.036821 0.805157
vt 0.915012 0.135139
vt 0.032502 0.804065
vt 0.318263 0.788989
vt 0.754601 0.282960
vt 0.706876 0.640142
vt 0.415360 0.882511
vt 0.427309 0.763850
vt 0.542666 0.687379
vt 0.453100 0.589850
vt 0.951055 0.134431
s 1
f 3/1/1 2/2/1 1/3/1
f 7/4/2 4/5/2 3/6/2
f 5/7/3 8/8/3 7/9/3
f 1/10/4 6/11/4 5/12/4
f 1/13/5 7/14/5 3/15/5
f 8/16/6 2/17/6 4/18/6
f 11/19/1 10/20/1 9/21/1
f 15/22/2 12/23/2 11/24/2
f 13/25/3 16/26/3 15/27/3
f 9/28/4 14/29/4 13/30/4
f 9/31/5 15/32/5 11/33/5
f 14/34/6 12/35/6 16/36/6
f 18/37/3 19/38/3 17/39/3
f 20/40/7 23/41/7 19/42/7
f 24/43/1 21/44/1 23/45/1
f 22/46/8 17/47/8 21/48/8
f 19/49/9 21/50/9 17/51/9
f 20/52/10 22/53/10 24/54/10
f 3/1/1 4/55/1 2/2/1
f 7/4/2 8/56/2 4/5/2
f 5/7/3 6/57/3 8/8/3
f 1/10/4 2/58/4 6/11/4
f 1/13/5 5/59/5 7/14/5
f 8/16/6 6/60/6 2/17/6
f 11/19/1 12/61/1 10/20/1
f 15/22/2 16/62/2 12/23/2
f 13/25/3 14/63/3 16/26/3
f 9/28/4 10/64/4 14/29/4
f 9/31/5 13/65/5 15/32/5
f 14/34/6 10/66/6 12/35/6
f 18/37/3 20/67/3 19/38/3
f 20/40/7 24/68/7 23/41/7
f 24/43/1 22/69/1 21/44/1
f 22/46/8 18/70/8 17/47/8
f 19/49/9 23/71/9 21/50/9
f 20/52/10 18/72/10 22/53/10
f 25/73/11 28/74/11 27/75/11
f 27/76/2 32/77/2 31/78/2
f 32/79/12 29/80/12 31/81/12
f 30/82/4 25/83/4 29/84/4
f 31/85/13 25/86/13 27/87/13
f 32/88/14 26/89/14 30/90/14
f 34/91/15 35/92/15 33/93/15
f 36/94/2 39/95/2 35/96/2
f 40/97/16 37/98/16 39/99/16
f 38/100/4 33/101/4 37/102/4
f 35/103/17 37/104/17 33/105/17
f 36/106/18 38/107/18 40/108/18
f 43/109/19 42/110/19 41/111/19
f 45/112/20 44/113/20 43/114/20
f 47/115/21 46/116/21 45/112/21
f 49/117/22 48/118/22 47/119/22
f 51/120/23 50/121/23 49/117/23
f 51/122/24 54/123/24 52/124/24
f 46/125/16 50/126/16 54/127/16
f 55/128/25 54/123/25 53/129/25
f 41/111/26 56/130/26 55/131/26
f 45/132/15 43/133/15 51/134/15
f 73/135/27 58/136/27 74/137/27
f 74/137/28 59/138/28 75/139/28
f 75/139/29 60/140/29 76/141/29
f 60/140/30 77/142/30 76/141/30
f 61/143/31 78/144/31 77/142/31
f 78/144/32 63/145/32 79/146/32
f 61/143/18 60/140/18 59/138/18
f 79/146/33 64/147/33 80/148/33
f 64/147/34 73/135/34 80/148/34
f 80/149/35 88/150/35 87/151/35
f 86/152/36 80/153/36 87/154/36
f 85/155/37 79/156/37 86/157/37
f 77/158/38 85/155/38 84/159/38
f 76/160/39 84/159/39 83/161/39
f 82/162/40 76/163/40 83/164/40
f 81/165/41 75/166/41 82/167/41
f 88/150/42 74/168/42 81/165/42
f 88/150/43 66/169/43 65/170/43
f 81/165/44 67/171/44 66/169/44
f 82/162/45 68/172/45 67/173/45
f 68/174/46 84/159/46 69/175/46
f 69/175/47 85/155/47 70/176/47
f 85/155/48 71/177/48 70/176/48
f 86/152/49 72/178/49 71/179/49
f 72/180/50 88/150/50 65/170/50
f 89/181/51 92/182/51 91/183/51
f 92/184/2 95/185/2 91/186/2
f 96/187/52 93/188/52 95/189/52
f 93/190/4 90/191/4 89/192/4
f 95/193/53 89/194/53 91/195/53
f 96/196/54 90/197/54 94/198/54
f 97/199/51 100/200/51 99/201/51
f 25/73/11 26/202/11 28/74/11
f 27/76/2 28/203/2 32/77/2
f 32/79/12 30/204/12 29/80/12
f 30/82/4 26/205/4 25/83/4
f 31/85/13 29/206/13 25/86/13
f 32/88/14 28/207/14 26/89/14
f 34/91/15 36/208/15 35/92/15
f 36/94/2 40/209/2 39/95/2
f 40/97/16 38/210/16 37/98/16
f 38/100/4 34/211/4 33/101/4
f 35/103/17 39/212/17 37/104/17
f 36/106/18 34/213/18 38/107/18
f 43/109/19 44/214/19 42/110/19
f 45/112/20 46/116/20 44/113/20
f 47/115/21 48/215/21 46/116/21
f 49/117/22 50/121/22 48/118/22
f 51/120/23 52/216/23 50/121/23
f 51/122/24 53/129/24 54/123/24
f 42/217/16 44/218/16 46/125/16
f 46/125/16 48/219/16 50/126/16
f 50/126/16 52/220/16 54/127/16
f 54/127/16 56/221/16 42/217/16
f 42/217/16 46/125/16 54/127/16
f 55/128/25 56/222/25 54/123/25
f 41/111/26 42/110/26 56/130/26
f 43/133/15 41/223/15 51/134/15
f 41/223/15 55/224/15 51/134/15
f 55/224/15 53/225/15 51/134/15
f 51/134/15 49/226/15 47/227/15
f 47/227/15 45/132/15 51/134/15
f 73/135/27 57/228/27 58/136/27
f 74/137/28 58/136/28 59/138/28
f 75/139/29 59/138/29 60/140/29
f 60/140/30 61/143/30 77/142/30
f 61/143/31 62/229/31 78/144/31
f 78/144/32 62/229/32 63/145/32
f 59/138/18 58/136/18 61/143/18
f 58/136/18 57/228/18 62/229/18
f 61/143/18 58/136/18 62/229/18
f 57/228/18 64/147/18 63/145/18
f 63/145/18 62/229/18 57/228/18
f 79/146/33 63/145/33 64/147/33
f 64/147/34 57/228/34 73/135/34
f 80/149/35 73/230/35 88/150/35
f 86/152/36 79/231/36 80/153/36
f 85/155/37 78/232/37 79/156/37
f 77/158/38 78/232/38 85/155/38
f 76/160/39 77/158/39 84/159/39
f 82/162/40 75/233/40 76/163/40
f 81/165/41 74/168/41 75/166/41
f 88/150/42 73/230/42 74/168/42
f 88/150/43 81/165/43 66/169/43
f 81/165/44 82/167/44 67/171/44
f 82/162/45 83/164/45 68/172/45
f 68/174/46 83/161/46 84/159/46
f 69/175/47 84/159/47 85/155/47
f 85/155/48 86/157/48 71/177/48
f 86/152/49 87/154/49 72/178/49
f 72/180/50 87/151/50 88/150/50
f 89/181/51 90/234/51 92/182/51
f 92/184/2 96/235/2 95/185/2
f 96/187/52 94/236/52 93/188/52
f 93/190/4 94/237/4 90/191/4
f 95/193/53 93/238/53 89/194/53
f 96/196/54 92/239/54 90/197/54
f 97/199/51 98/240/51 100/200/51

View File

@@ -56,6 +56,7 @@ public void setState(GameStates newState){
if(this.state != null){ if(this.state != null){
this.state.exit(); this.state.exit();
} }
System.out.println("CLIENT STATE old:" + this.state + " new:" + newState);
newState.enter(); newState.enter();
state = newState; state = newState;
} }

View File

@@ -68,19 +68,27 @@ public void received(ActivePlayerMessage msg) {
@Override @Override
public void received(MoveMessage msg) { public void received(MoveMessage msg) {
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()); Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant(); //logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant();
if (msg.isHomeMove()) { if (msg.isHomeMove()) {
logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex())); logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant();
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece); logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
} else { } else {
int i = logic.getGame().getBoard().getInfieldIndexOfPiece(piece); int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
this.LOGGER.log(System.Logger.Level.INFO, "Received MoveMessage with start index: " + i);
logic.addNotification(new MovePieceNotification(msg.getPiece().getUuid(), logic.getGame().getBoard().getInfieldIndexOfPiece(piece), msg.getTargetIndex())); Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].moveOccupant(piece); //logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].moveOccupant(piece);
if (occ != null){ if (occ != null) {
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ); //TODO: MoveThrowNotification
logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor())); logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor()));
//set occ to waiting
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
} }
logic.addNotification(new MovePieceNotification(msg.getPiece().getUuid(), oldIndex, msg.getTargetIndex()));
//clear old node
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant();
//set new node
logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].setOccupant(piece);
} }
parent.setState(parent.getAnimation()); parent.setState(parent.getAnimation());
} }

View File

@@ -48,21 +48,30 @@ public void selectPiece(Piece piece) {
@Override @Override
public void received(MoveMessage msg) { public void received(MoveMessage msg) {
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()); Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant(); //logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant();
if (msg.isHomeMove()) { if (msg.isHomeMove()) {
logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex())); logic.addNotification(new HomeMoveNotification(piece.getUuid(), msg.getTargetIndex()));
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant();
logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece); logic.getGame().getPlayerByColor(piece.getColor()).setPieceInHome(msg.getTargetIndex(), piece);
} else { } else {
int i = logic.getGame().getBoard().getInfieldIndexOfPiece(piece); int oldIndex = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
LOGGER.log(System.Logger.Level.INFO, "Received MoveMessage with start index: " + i);
logic.addNotification(new MovePieceNotification(msg.getPiece().getUuid(), logic.getGame().getBoard().getInfieldIndexOfPiece(piece), msg.getTargetIndex())); Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].getOccupant();
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].moveOccupant(piece); //logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].moveOccupant(piece);
if (occ != null){ if (occ != null) {
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ); //TODO: MoveThrowNotification
logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor())); logic.addNotification(new ThrowPieceNotification(occ.getUuid(), piece.getColor()));
//set occ to waiting
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);
} }
parent.getParent().setState(parent.getParent().getMovePiece()); logic.addNotification(new MovePieceNotification(msg.getPiece().getUuid(), oldIndex, msg.getTargetIndex()));
//clear old node
logic.getGame().getBoard().getInfield()[logic.getGame().getBoard().getInfieldIndexOfPiece(piece)].clearOccupant();
//set new node
logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].setOccupant(piece);
} }
parent.getParent().setState(parent.getParent().getMovePiece()); parent.getParent().setState(parent.getParent().getMovePiece());
} }
} }

View File

@@ -51,7 +51,7 @@ public void received(MoveMessage msg){
Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid()); Piece piece = logic.getGame().getPieceThroughUUID(msg.getPiece().getUuid());
int i = logic.getGame().getBoard().getInfieldIndexOfPiece(piece); int i = logic.getGame().getBoard().getInfieldIndexOfPiece(piece);
LOGGER.log(System.Logger.Level.INFO, "Received MoveMessage with start index: " + i); LOGGER.log(System.Logger.Level.INFO, "Received MoveMessage with start index: " + i);
logic.addNotification(new MovePieceNotification(msg.getPiece().getUuid(), logic.getGame().getBoard().getInfieldIndexOfPiece(piece), msg.getTargetIndex())); logic.addNotification(new MovePieceNotification(msg.getPiece().getUuid(), i, msg.getTargetIndex()));
Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].moveOccupant(piece); Piece occ = logic.getGame().getBoard().getInfield()[msg.getTargetIndex()].moveOccupant(piece);
if (occ != null){ if (occ != null){
logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ); logic.getGame().getPlayerByColor(occ.getColor()).addWaitingPiece(occ);

View File

@@ -79,7 +79,6 @@ private StartNode createStartNode(int i) {
*/ */
public int getInfieldIndexOfPiece(Piece piece) { public int getInfieldIndexOfPiece(Piece piece) {
for (int i = 0; i < infield.length; i++) { for (int i = 0; i < infield.length; i++) {
System.out.println(infield[i].getOccupant());
if(infield[i].isOccupied()) { if(infield[i].isOccupied()) {
if (infield[i].getOccupant().equals(piece)) { if (infield[i].getOccupant().equals(piece)) {
return i; return i;

View File

@@ -161,8 +161,7 @@ public boolean equals(Object obj) {
Piece piece = (Piece) obj; Piece piece = (Piece) obj;
System.out.println("own UUID: " + this.uuid + ". Other UUID: " + piece.uuid); System.out.println("own UUID: " + this.uuid + ". Other UUID: " + piece.uuid);
return Objects.equals(this.uuid.toString(), piece.uuid.toString()); return uuid.toString().equals(piece.uuid.toString());
} }
return false; return false;

View File

@@ -207,6 +207,8 @@ public CeremonyState getCeremonyState() {
* @param state as the new currentState attribute as a ServerState object. * @param state as the new currentState attribute as a ServerState object.
*/ */
public void setCurrentState(ServerState state) { public void setCurrentState(ServerState state) {
System.out.println("SERVER STATE old:" + this.currentState + " new:" + state);
if (this.currentState != null) { if (this.currentState != null) {
this.currentState.exit(); this.currentState.exit();
} }