Merge branch 'development' into dev/client_beck
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
|
<option name="WORKING_DIRECTORY" value="$MODULE_WORKING_DIR$" />
|
||||||
<extension name="coverage">
|
<extension name="coverage">
|
||||||
<pattern>
|
<pattern>
|
||||||
<option name="PATTERN" value="pp.mdga.client.board.Outline.*" />
|
<option name="PATTERN" value="pp.mdga.client.board.outline.*" />
|
||||||
<option name="ENABLED" value="true" />
|
<option name="ENABLED" value="true" />
|
||||||
</pattern>
|
</pattern>
|
||||||
</extension>
|
</extension>
|
||||||
@@ -14,4 +14,4 @@
|
|||||||
<option name="Make" enabled="true" />
|
<option name="Make" enabled="true" />
|
||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -44,13 +44,13 @@ public enum Asset {
|
|||||||
private final String modelPath;
|
private final String modelPath;
|
||||||
private final String diffPath;
|
private final String diffPath;
|
||||||
private final float size;
|
private final float size;
|
||||||
private static final String root = "Models/";
|
private static final String ROOT = "Models/";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. Initializes modelPath and diffPath based on the enum name and sets default size to 1.0.
|
* Default constructor. Initializes modelPath and diffPath based on the enum name and sets default size to 1.0.
|
||||||
*/
|
*/
|
||||||
Asset() {
|
Asset() {
|
||||||
String folderFileName = "./" + root + name() + "/" + name();
|
String folderFileName = "./" + ROOT + name() + "/" + name();
|
||||||
this.modelPath = folderFileName + ".j3o";
|
this.modelPath = folderFileName + ".j3o";
|
||||||
this.diffPath = folderFileName + "_diff.png";
|
this.diffPath = folderFileName + "_diff.png";
|
||||||
this.size = 1f;
|
this.size = 1f;
|
||||||
@@ -74,7 +74,7 @@ public enum Asset {
|
|||||||
* @param modelPath Path to the 3D model file.
|
* @param modelPath Path to the 3D model file.
|
||||||
*/
|
*/
|
||||||
Asset(String modelPath) {
|
Asset(String modelPath) {
|
||||||
String folderFileName = "./" + root + name() + "/" + name();
|
String folderFileName = "./" + ROOT + name() + "/" + name();
|
||||||
this.modelPath = modelPath;
|
this.modelPath = modelPath;
|
||||||
this.diffPath = folderFileName + "_diff.png";;
|
this.diffPath = folderFileName + "_diff.png";;
|
||||||
this.size = 1f;
|
this.size = 1f;
|
||||||
@@ -86,7 +86,7 @@ public enum Asset {
|
|||||||
* @param size Scaling factor for the asset.
|
* @param size Scaling factor for the asset.
|
||||||
*/
|
*/
|
||||||
Asset(float size) {
|
Asset(float size) {
|
||||||
String folderFileName = "./" + root + name() + "/" + name();
|
String folderFileName = "./" + ROOT + name() + "/" + name();
|
||||||
this.modelPath = folderFileName + ".j3o";
|
this.modelPath = folderFileName + ".j3o";
|
||||||
this.diffPath = folderFileName + "_diff.png";
|
this.diffPath = folderFileName + "_diff.png";
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
|||||||
@@ -130,9 +130,7 @@ public void setJoin(String ip, int port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void leave() {
|
public void leave() {
|
||||||
LOGGER.log(Level.INFO, "leave");
|
app.getGameLogic().selectLeave();
|
||||||
app.getAcousticHandler().playSound(MdgaSound.LEAVE);
|
|
||||||
enter(MdgaState.MAIN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enter(MdgaState state) {
|
public void enter(MdgaState state) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ enum MusicAsset {
|
|||||||
private final String path;
|
private final String path;
|
||||||
private final boolean loop;
|
private final boolean loop;
|
||||||
private final float subVolume;
|
private final float subVolume;
|
||||||
private static final String root = "Music/";
|
private static final String ROOT = "Music/";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new MusicAsset object with the specified name and sub-volume.
|
* Constructs a new MusicAsset object with the specified name and sub-volume.
|
||||||
@@ -30,7 +30,7 @@ enum MusicAsset {
|
|||||||
* @param subVolume A relative volume that modifies the base volume of the track (typically a percentage).
|
* @param subVolume A relative volume that modifies the base volume of the track (typically a percentage).
|
||||||
*/
|
*/
|
||||||
MusicAsset(String name, float subVolume) {
|
MusicAsset(String name, float subVolume) {
|
||||||
this.path = root + name;
|
this.path = ROOT + name;
|
||||||
this.loop = false;
|
this.loop = false;
|
||||||
this.subVolume = subVolume;
|
this.subVolume = subVolume;
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ enum MusicAsset {
|
|||||||
* @param subVolume A relative volume that modifies the base volume of the track (typically a percentage).
|
* @param subVolume A relative volume that modifies the base volume of the track (typically a percentage).
|
||||||
*/
|
*/
|
||||||
MusicAsset(String name, boolean loop, float subVolume) {
|
MusicAsset(String name, boolean loop, float subVolume) {
|
||||||
this.path = root + name;
|
this.path = ROOT + name;
|
||||||
this.loop = loop;
|
this.loop = loop;
|
||||||
this.subVolume = subVolume;
|
this.subVolume = subVolume;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
package pp.mdga.client.board.Outline;
|
|
||||||
|
|
||||||
import com.jme3.asset.AssetManager;
|
|
||||||
import com.jme3.material.Material;
|
|
||||||
import com.jme3.material.MaterialDef;
|
|
||||||
import com.jme3.math.ColorRGBA;
|
|
||||||
import com.jme3.math.Vector2f;
|
|
||||||
import com.jme3.post.Filter;
|
|
||||||
import com.jme3.renderer.RenderManager;
|
|
||||||
import com.jme3.renderer.ViewPort;
|
|
||||||
import com.jme3.texture.FrameBuffer;
|
|
||||||
|
|
||||||
|
|
||||||
public class OutlineFilter extends Filter {
|
|
||||||
|
|
||||||
private OutlinePreFilter outlinePreFilter;
|
|
||||||
private ColorRGBA outlineColor = new ColorRGBA(0, 1, 0, 1);
|
|
||||||
private float outlineWidth = 1;
|
|
||||||
|
|
||||||
public OutlineFilter(OutlinePreFilter outlinePreFilter) {
|
|
||||||
super("OutlineFilter");
|
|
||||||
this.outlinePreFilter = outlinePreFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initFilter(AssetManager assetManager, RenderManager renderManager, ViewPort vp, int w, int h) {
|
|
||||||
MaterialDef matDef = (MaterialDef) assetManager.loadAsset("MatDefs/SelectObjectOutliner/Outline.j3md");
|
|
||||||
material = new Material(matDef);
|
|
||||||
material.setVector2("Resolution", new Vector2f(w, h));
|
|
||||||
material.setColor("OutlineColor", outlineColor);
|
|
||||||
material.setFloat("OutlineWidth", outlineWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void preFrame(float tpf) {
|
|
||||||
super.preFrame(tpf);
|
|
||||||
material.setTexture("OutlineDepthTexture", outlinePreFilter.getOutlineTexture());
|
|
||||||
// System.out.println("OutlineFilter.preFrame()");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
|
|
||||||
super.postFrame(renderManager, viewPort, prevFilterBuffer, sceneBuffer);
|
|
||||||
// material.setTexture("OutlineDepthTexture", outlinePreFilter.getDefaultPassDepthTexture());
|
|
||||||
// System.out.println("OutlineFilter.postFrame()");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Material getMaterial() {
|
|
||||||
return material;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColorRGBA getOutlineColor() {
|
|
||||||
return outlineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutlineColor(ColorRGBA outlineColor) {
|
|
||||||
this.outlineColor = outlineColor;
|
|
||||||
if (material != null) {
|
|
||||||
material.setColor("OutlineColor", outlineColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getOutlineWidth() {
|
|
||||||
return outlineWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutlineWidth(float outlineWidth) {
|
|
||||||
this.outlineWidth = outlineWidth;
|
|
||||||
if (material != null) {
|
|
||||||
material.setFloat("OutlineWidth", outlineWidth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public OutlinePreFilter getOutlinePreFilter() {
|
|
||||||
return outlinePreFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
package pp.mdga.client.board.Outline;
|
|
||||||
|
|
||||||
import com.jme3.asset.AssetManager;
|
|
||||||
import com.jme3.material.Material;
|
|
||||||
import com.jme3.post.Filter;
|
|
||||||
import com.jme3.renderer.RenderManager;
|
|
||||||
import com.jme3.renderer.Renderer;
|
|
||||||
import com.jme3.renderer.ViewPort;
|
|
||||||
import com.jme3.renderer.queue.RenderQueue;
|
|
||||||
import com.jme3.texture.FrameBuffer;
|
|
||||||
import com.jme3.texture.Image.Format;
|
|
||||||
import com.jme3.texture.Texture;
|
|
||||||
|
|
||||||
|
|
||||||
public class OutlinePreFilter extends Filter {
|
|
||||||
|
|
||||||
private Pass normalPass;
|
|
||||||
private RenderManager renderManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a OutlinePreFilter
|
|
||||||
*/
|
|
||||||
public OutlinePreFilter() {
|
|
||||||
super("OutlinePreFilter");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean isRequiresDepthTexture() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void postQueue(RenderQueue queue) {
|
|
||||||
Renderer r = renderManager.getRenderer();
|
|
||||||
r.setFrameBuffer(normalPass.getRenderFrameBuffer());
|
|
||||||
renderManager.getRenderer().clearBuffers(true, true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
|
|
||||||
super.postFrame(renderManager, viewPort, prevFilterBuffer, sceneBuffer);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Material getMaterial() {
|
|
||||||
return material;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Texture getOutlineTexture() {
|
|
||||||
return normalPass.getRenderedTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
|
|
||||||
this.renderManager = renderManager;
|
|
||||||
normalPass = new Pass();
|
|
||||||
normalPass.init(renderManager.getRenderer(), w, h, Format.RGBA8, Format.Depth);
|
|
||||||
material = new Material(manager, "MatDefs/SelectObjectOutliner/OutlinePre.j3md");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void cleanUpFilter(Renderer r) {
|
|
||||||
normalPass.cleanup(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
package pp.mdga.client.board.Outline;
|
|
||||||
|
|
||||||
import com.jme3.asset.AssetManager;
|
|
||||||
import com.jme3.material.Material;
|
|
||||||
import com.jme3.material.MaterialDef;
|
|
||||||
import com.jme3.math.ColorRGBA;
|
|
||||||
import com.jme3.math.Vector2f;
|
|
||||||
import com.jme3.post.Filter;
|
|
||||||
import com.jme3.renderer.RenderManager;
|
|
||||||
import com.jme3.renderer.ViewPort;
|
|
||||||
import com.jme3.texture.FrameBuffer;
|
|
||||||
|
|
||||||
public class OutlineProFilter extends Filter {
|
|
||||||
|
|
||||||
private OutlinePreFilter outlinePreFilter;
|
|
||||||
private ColorRGBA outlineColor = new ColorRGBA(0, 1, 0, 1);
|
|
||||||
private float outlineWidth = 1;
|
|
||||||
|
|
||||||
public OutlineProFilter(OutlinePreFilter outlinePreFilter) {
|
|
||||||
super("OutlineFilter");
|
|
||||||
this.outlinePreFilter = outlinePreFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initFilter(AssetManager assetManager, RenderManager renderManager, ViewPort vp, int w, int h) {
|
|
||||||
MaterialDef matDef = (MaterialDef) assetManager.loadAsset("MatDefs/SelectObjectOutliner/OutlinePro.j3md");
|
|
||||||
material = new Material(matDef);
|
|
||||||
material.setVector2("Resolution", new Vector2f(w, h));
|
|
||||||
material.setColor("OutlineColor", outlineColor);
|
|
||||||
material.setFloat("OutlineWidth", outlineWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void preFrame(float tpf) {
|
|
||||||
super.preFrame(tpf);
|
|
||||||
material.setTexture("OutlineDepthTexture", outlinePreFilter.getOutlineTexture());
|
|
||||||
// System.out.println("OutlineFilter.preFrame()");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
|
|
||||||
super.postFrame(renderManager, viewPort, prevFilterBuffer, sceneBuffer);
|
|
||||||
// material.setTexture("OutlineDepthTexture", outlinePreFilter.getDefaultPassDepthTexture());
|
|
||||||
// System.out.println("OutlineFilter.postFrame()");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Material getMaterial() {
|
|
||||||
return material;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColorRGBA getOutlineColor() {
|
|
||||||
return outlineColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutlineColor(ColorRGBA outlineColor) {
|
|
||||||
this.outlineColor = outlineColor;
|
|
||||||
if (material != null) {
|
|
||||||
material.setColor("OutlineColor", outlineColor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getOutlineWidth() {
|
|
||||||
return outlineWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOutlineWidth(float outlineWidth) {
|
|
||||||
this.outlineWidth = outlineWidth;
|
|
||||||
if (material != null) {
|
|
||||||
material.setFloat("OutlineWidth", outlineWidth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public OutlinePreFilter getOutlinePreFilter() {
|
|
||||||
return outlinePreFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
package pp.mdga.client.board.Outline;
|
|
||||||
|
|
||||||
import com.jme3.asset.AssetManager;
|
|
||||||
import com.jme3.math.ColorRGBA;
|
|
||||||
import com.jme3.post.FilterPostProcessor;
|
|
||||||
import com.jme3.renderer.Camera;
|
|
||||||
import com.jme3.renderer.RenderManager;
|
|
||||||
import com.jme3.renderer.ViewPort;
|
|
||||||
import com.jme3.scene.Spatial;
|
|
||||||
import pp.mdga.client.MdgaApp;
|
|
||||||
|
|
||||||
public class SelectObjectOutliner {
|
|
||||||
|
|
||||||
private final FilterPostProcessor fpp;
|
|
||||||
private final RenderManager renderManager;
|
|
||||||
private final AssetManager assetManager;
|
|
||||||
private final Camera cam;
|
|
||||||
private final int width;
|
|
||||||
private boolean selected;
|
|
||||||
private ViewPort outlineViewport = null;
|
|
||||||
// private OutlineFilter outlineFilter = null;
|
|
||||||
private OutlineProFilter outlineFilter = null;
|
|
||||||
private final MdgaApp app;
|
|
||||||
|
|
||||||
public SelectObjectOutliner(int width, FilterPostProcessor fpp, RenderManager renderManager, AssetManager assetManager, Camera cam, MdgaApp app) {
|
|
||||||
this.selected = false;
|
|
||||||
this.fpp = fpp;
|
|
||||||
this.renderManager = renderManager;
|
|
||||||
this.assetManager = assetManager;
|
|
||||||
this.cam = cam;
|
|
||||||
this.width = width;
|
|
||||||
this.app = app;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deselect(Spatial model) {
|
|
||||||
if(selected){
|
|
||||||
selected = false;
|
|
||||||
hideOutlineFilterEffect(model);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void select(Spatial model, ColorRGBA color) {
|
|
||||||
if(!selected){
|
|
||||||
selected = true;
|
|
||||||
showOutlineFilterEffect(model, width, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void select(Spatial model, ColorRGBA color, int width) {
|
|
||||||
if(!selected){
|
|
||||||
selected = true;
|
|
||||||
showOutlineFilterEffect(model, width, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void hideOutlineFilterEffect(Spatial model) {
|
|
||||||
// app.enqueue(() -> {
|
|
||||||
outlineFilter.setEnabled(false);
|
|
||||||
outlineFilter.getOutlinePreFilter().setEnabled(false);
|
|
||||||
fpp.removeFilter(outlineFilter);
|
|
||||||
outlineViewport.detachScene(model);
|
|
||||||
outlineViewport.clearProcessors();
|
|
||||||
renderManager.removePreView(outlineViewport);
|
|
||||||
outlineViewport = null;
|
|
||||||
// return null;
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showOutlineFilterEffect(Spatial model, int width, ColorRGBA color) {
|
|
||||||
// app.enqueue(() -> {
|
|
||||||
outlineViewport = renderManager.createPreView("outlineViewport", cam);
|
|
||||||
FilterPostProcessor outlineFpp = new FilterPostProcessor(assetManager);
|
|
||||||
|
|
||||||
OutlinePreFilter outlinePreFilter = new OutlinePreFilter();
|
|
||||||
outlineFpp.addFilter(outlinePreFilter);
|
|
||||||
|
|
||||||
outlineViewport.attachScene(model);
|
|
||||||
outlineViewport.addProcessor(outlineFpp);
|
|
||||||
|
|
||||||
outlineFilter = new OutlineProFilter(outlinePreFilter);
|
|
||||||
outlineFilter.setOutlineColor(color);
|
|
||||||
outlineFilter.setOutlineWidth(width);
|
|
||||||
|
|
||||||
fpp.addFilter(outlineFilter);
|
|
||||||
// return null;
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,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.MdgaApp;
|
import pp.mdga.client.MdgaApp;
|
||||||
import pp.mdga.client.board.Outline.SelectObjectOutliner;
|
import pp.mdga.client.board.outline.SelectObjectOutliner;
|
||||||
|
|
||||||
public class OutlineControl extends AbstractControl {
|
public class OutlineControl extends AbstractControl {
|
||||||
private static final int THICKNESS_DEFAULT = 6;
|
private static final int THICKNESS_DEFAULT = 6;
|
||||||
|
|||||||
@@ -197,14 +197,14 @@ protected void setImageRelative(Picture picture) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final float LARGER = 10;
|
final float larger = 10;
|
||||||
|
|
||||||
picture.setWidth(instance.getPreferredSize().x + LARGER);
|
picture.setWidth(instance.getPreferredSize().x + larger);
|
||||||
picture.setHeight(instance.getPreferredSize().y + LARGER);
|
picture.setHeight(instance.getPreferredSize().y + larger);
|
||||||
|
|
||||||
picture.setLocalTranslation(
|
picture.setLocalTranslation(
|
||||||
instance.getLocalTranslation().x - LARGER / 2,
|
instance.getLocalTranslation().x - larger / 2,
|
||||||
(instance.getLocalTranslation().y - picture.getHeight()) + LARGER / 2,
|
(instance.getLocalTranslation().y - picture.getHeight()) + larger / 2,
|
||||||
instance.getLocalTranslation().z + 0.01f
|
instance.getLocalTranslation().z + 0.01f
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,5 +28,6 @@ public void hide() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void onShow();
|
protected abstract void onShow();
|
||||||
protected abstract void onHide ();
|
|
||||||
|
protected abstract void onHide();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public void update(float delta) {
|
|||||||
try {
|
try {
|
||||||
this.connectionFuture.get();
|
this.connectionFuture.get();
|
||||||
} catch (ExecutionException ignored) {
|
} catch (ExecutionException ignored) {
|
||||||
|
// todo: implement
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
import com.jme3.app.state.AbstractAppState;
|
import com.jme3.app.state.AbstractAppState;
|
||||||
import com.jme3.app.state.AppStateManager;
|
import com.jme3.app.state.AppStateManager;
|
||||||
import com.jme3.light.DirectionalLight;
|
import com.jme3.light.DirectionalLight;
|
||||||
import com.jme3.material.Material;
|
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
import com.jme3.post.FilterPostProcessor;
|
import com.jme3.post.FilterPostProcessor;
|
||||||
@@ -15,16 +14,16 @@
|
|||||||
import com.jme3.scene.Node;
|
import com.jme3.scene.Node;
|
||||||
import com.jme3.scene.Spatial;
|
import com.jme3.scene.Spatial;
|
||||||
import com.jme3.shadow.DirectionalLightShadowFilter;
|
import com.jme3.shadow.DirectionalLightShadowFilter;
|
||||||
import com.jme3.shadow.DirectionalLightShadowRenderer;
|
|
||||||
import com.jme3.shadow.EdgeFilteringMode;
|
import com.jme3.shadow.EdgeFilteringMode;
|
||||||
import com.jme3.texture.Image;
|
import com.jme3.texture.Image;
|
||||||
import com.jme3.texture.Texture2D;
|
import com.jme3.texture.Texture2D;
|
||||||
import pp.mdga.client.Asset;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class CardLayer extends AbstractAppState {
|
public class CardLayer extends AbstractAppState {
|
||||||
|
|
||||||
|
public static final int SHADOWMAP_SIZE = 1024 * 8;
|
||||||
|
|
||||||
private Node root;
|
private Node root;
|
||||||
private Application app;
|
private Application app;
|
||||||
private boolean init;
|
private boolean init;
|
||||||
@@ -43,7 +42,7 @@ public CardLayer(FilterPostProcessor fpp, Camera overlayCam, Texture2D backTextu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@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");
|
root = new Node("Under gui viewport Root");
|
||||||
|
|
||||||
@@ -57,11 +56,9 @@ public void initialize(AppStateManager stateManager, Application app ) {
|
|||||||
|
|
||||||
DirectionalLight sun = new DirectionalLight();
|
DirectionalLight sun = new DirectionalLight();
|
||||||
sun.setColor(ColorRGBA.White);
|
sun.setColor(ColorRGBA.White);
|
||||||
sun.setDirection(new Vector3f(.5f,-.5f,-1));
|
sun.setDirection(new Vector3f(.5f, -.5f, -1));
|
||||||
root.addLight(sun);
|
root.addLight(sun);
|
||||||
|
|
||||||
final int SHADOWMAP_SIZE=1024*8;
|
|
||||||
|
|
||||||
DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(app.getAssetManager(), SHADOWMAP_SIZE, 3);
|
DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(app.getAssetManager(), SHADOWMAP_SIZE, 3);
|
||||||
dlsf.setLight(sun);
|
dlsf.setLight(sun);
|
||||||
dlsf.setEnabled(true);
|
dlsf.setEnabled(true);
|
||||||
@@ -71,25 +68,24 @@ public void initialize(AppStateManager stateManager, Application app ) {
|
|||||||
|
|
||||||
view.addProcessor(fpp);
|
view.addProcessor(fpp);
|
||||||
|
|
||||||
if(!init) init = true;
|
if (!init) init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shutdown(){
|
public void shutdown() {
|
||||||
cardBuffer.clear();
|
cardBuffer.clear();
|
||||||
root.detachAllChildren();
|
root.detachAllChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(RenderManager rm) {
|
public void render(RenderManager rm) {
|
||||||
root.updateGeometricState();
|
root.updateGeometricState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update( float tpf ) {
|
public void update(float tpf) {
|
||||||
if (init && !cardBuffer.isEmpty()) {
|
if (init && !cardBuffer.isEmpty()) {
|
||||||
for(Spatial spatial : cardBuffer){
|
for (Spatial spatial : cardBuffer) {
|
||||||
root.attachChild(spatial);
|
root.attachChild(spatial);
|
||||||
}
|
}
|
||||||
cardBuffer.clear();
|
cardBuffer.clear();
|
||||||
@@ -97,19 +93,19 @@ public void update( float tpf ) {
|
|||||||
root.updateLogicalState(tpf);
|
root.updateLogicalState(tpf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSpatial(Spatial card){
|
public void addSpatial(Spatial card) {
|
||||||
cardBuffer.add(card);
|
cardBuffer.add(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteSpatial(Spatial spatial){
|
public void deleteSpatial(Spatial spatial) {
|
||||||
root.detachChild(spatial);
|
root.detachChild(spatial);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Camera getOverlayCam(){
|
public Camera getOverlayCam() {
|
||||||
return overlayCam;
|
return overlayCam;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Node getRootNode(){
|
public Node getRootNode() {
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,14 +16,13 @@ public class SymbolControl extends AbstractControl {
|
|||||||
private BonusCard state;
|
private BonusCard state;
|
||||||
private float rotationSpeed = 0.8f;
|
private float rotationSpeed = 0.8f;
|
||||||
private Quaternion initialRotation = null;
|
private Quaternion initialRotation = null;
|
||||||
private float Y = 5;
|
private float y = 5;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void controlUpdate(float tpf) {
|
protected void controlUpdate(float tpf) {
|
||||||
if(state == null) return;
|
if (state == null) return;
|
||||||
switch (state){
|
switch (state) {
|
||||||
case SHIELD -> shieldUpdate(tpf);
|
case SHIELD -> shieldUpdate(tpf);
|
||||||
case SWAP -> swapUpdate(tpf);
|
case SWAP -> swapUpdate(tpf);
|
||||||
case TURBO -> turboUpdate(tpf);
|
case TURBO -> turboUpdate(tpf);
|
||||||
@@ -36,7 +35,7 @@ protected void controlRender(RenderManager rm, ViewPort vp) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shieldUpdate(float tpf){
|
private void shieldUpdate(float tpf) {
|
||||||
if (zoomingIn) {
|
if (zoomingIn) {
|
||||||
progress += tpf * zoomSpeed;
|
progress += tpf * zoomSpeed;
|
||||||
if (progress > 1) progress = 1;
|
if (progress > 1) progress = 1;
|
||||||
@@ -58,13 +57,13 @@ private void shieldUpdate(float tpf){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void swapUpdate(float tpf){
|
private void swapUpdate(float tpf) {
|
||||||
if (initialRotation == null) {
|
if (initialRotation == null) {
|
||||||
initialRotation = spatial.getLocalRotation().clone();
|
initialRotation = spatial.getLocalRotation().clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
progress += tpf*rotationSpeed;
|
progress += tpf * rotationSpeed;
|
||||||
if(progress < 0) return;
|
if (progress < 0) return;
|
||||||
|
|
||||||
float angle = lerp(0, 360, easeInOut(progress));
|
float angle = lerp(0, 360, easeInOut(progress));
|
||||||
|
|
||||||
@@ -80,12 +79,13 @@ private void swapUpdate(float tpf){
|
|||||||
spatial.removeFromParent();
|
spatial.removeFromParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void turboUpdate(float tpf){
|
|
||||||
|
private void turboUpdate(float tpf) {
|
||||||
if (zoomingIn) {
|
if (zoomingIn) {
|
||||||
progress += tpf * zoomSpeed;
|
progress += tpf * zoomSpeed;
|
||||||
if (progress > 1) progress = 1;
|
if (progress > 1) progress = 1;
|
||||||
float y = lerp(-Y,0, easeOut(progress));
|
float y = lerp(-this.y, 0, easeOut(progress));
|
||||||
spatial.setLocalTranslation(0,y,0);
|
spatial.setLocalTranslation(0, y, 0);
|
||||||
if (progress >= 1) {
|
if (progress >= 1) {
|
||||||
zoomingIn = false;
|
zoomingIn = false;
|
||||||
zoomingOut = true;
|
zoomingOut = true;
|
||||||
@@ -93,8 +93,8 @@ private void turboUpdate(float tpf){
|
|||||||
}
|
}
|
||||||
} else if (zoomingOut) {
|
} else if (zoomingOut) {
|
||||||
progress += tpf * zoomSpeed;
|
progress += tpf * zoomSpeed;
|
||||||
float y = lerp(0,Y, easeIn(progress));
|
float y = lerp(0, this.y, easeIn(progress));
|
||||||
spatial.setLocalTranslation(0,y,0);
|
spatial.setLocalTranslation(0, y, 0);
|
||||||
if (progress > 1) {
|
if (progress > 1) {
|
||||||
zoomingIn = false;
|
zoomingIn = false;
|
||||||
spatial.removeFromParent();
|
spatial.removeFromParent();
|
||||||
@@ -103,8 +103,8 @@ private void turboUpdate(float tpf){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void shield(){
|
public void shield() {
|
||||||
if(state != null) throw new RuntimeException("another state is avtive");
|
if (state != null) throw new RuntimeException("another state is avtive");
|
||||||
state = BonusCard.SHIELD;
|
state = BonusCard.SHIELD;
|
||||||
zoomingIn = true;
|
zoomingIn = true;
|
||||||
zoomingOut = false;
|
zoomingOut = false;
|
||||||
@@ -112,15 +112,15 @@ public void shield(){
|
|||||||
spatial.setLocalScale(1f);
|
spatial.setLocalScale(1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void swap(){
|
public void swap() {
|
||||||
if(state != null) throw new RuntimeException("another state is avtive");
|
if (state != null) throw new RuntimeException("another state is avtive");
|
||||||
spatial.setLocalScale(3);
|
spatial.setLocalScale(3);
|
||||||
state = BonusCard.SWAP;
|
state = BonusCard.SWAP;
|
||||||
progress = -0.2f;
|
progress = -0.2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void turbo(){
|
public void turbo() {
|
||||||
if(state != null) throw new RuntimeException("another state is avtive");
|
if (state != null) throw new RuntimeException("another state is avtive");
|
||||||
spatial.setLocalScale(2);
|
spatial.setLocalScale(2);
|
||||||
state = BonusCard.TURBO;
|
state = BonusCard.TURBO;
|
||||||
zoomingIn = true;
|
zoomingIn = true;
|
||||||
@@ -137,7 +137,7 @@ private static float easeOut(float t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float easeInOut(float t) {
|
private float easeInOut(float t) {
|
||||||
if(t>1) t=1;
|
if (t > 1) t = 1;
|
||||||
return (float) -(Math.cos(Math.PI * t) - 1) / 2;
|
return (float) -(Math.cos(Math.PI * t) - 1) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,15 +12,16 @@ public class ZoomControl extends AbstractControl {
|
|||||||
private float zoomSpeed = 1f;
|
private float zoomSpeed = 1f;
|
||||||
private float zoomFactor = 1f;
|
private float zoomFactor = 1f;
|
||||||
|
|
||||||
public ZoomControl(){}
|
public ZoomControl() {
|
||||||
|
}
|
||||||
|
|
||||||
public ZoomControl(float speed) {
|
public ZoomControl(float speed) {
|
||||||
zoomSpeed = speed;
|
zoomSpeed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSpatial(Spatial spatial){
|
public void setSpatial(Spatial spatial) {
|
||||||
if(this.spatial == null && spatial != null){
|
if (this.spatial == null && spatial != null) {
|
||||||
super.setSpatial(spatial);
|
super.setSpatial(spatial);
|
||||||
initSpatial();
|
initSpatial();
|
||||||
}
|
}
|
||||||
@@ -51,7 +52,7 @@ protected void controlUpdate(float tpf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void end(){
|
private void end() {
|
||||||
spatial.removeFromParent();
|
spatial.removeFromParent();
|
||||||
spatial.removeControl(this);
|
spatial.removeControl(this);
|
||||||
}
|
}
|
||||||
@@ -65,14 +66,15 @@ private static float lerp(float start, float end, float t) {
|
|||||||
return (1 - t) * start + t * end;
|
return (1 - t) * start + t * end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static float easeOut(float t) {
|
// private static float easeOut(float t) {
|
||||||
// return (float) Math.sqrt(1 - Math.pow(t - 1, 2));
|
// return (float) Math.sqrt(1 - Math.pow(t - 1, 2));
|
||||||
// }
|
// }
|
||||||
private float easeOut(float x) {
|
private float easeOut(float x) {
|
||||||
return x == 1 ? 1 : (float) (1 - Math.pow(2, -10 * x));
|
return x == 1 ? 1 : (float) (1 - Math.pow(2, -10 * x));
|
||||||
|
|
||||||
}
|
}
|
||||||
// private float easeIn(float t) {
|
|
||||||
|
// private float easeIn(float t) {
|
||||||
// return t * t * t * t;
|
// return t * t * t * t;
|
||||||
// }
|
// }
|
||||||
private float easeIn(float x) {
|
private float easeIn(float x) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.System.Logger;
|
import java.lang.System.Logger;
|
||||||
import java.lang.System.Logger.Level;
|
import java.lang.System.Logger.Level;
|
||||||
|
import java.net.InetAddress;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.BlockingQueue;
|
import java.util.concurrent.BlockingQueue;
|
||||||
@@ -52,6 +53,7 @@ public MdgaServer(int port) {
|
|||||||
LOGGER.log(Level.INFO, "Creating MdgaServer"); //NON-NLS
|
LOGGER.log(Level.INFO, "Creating MdgaServer"); //NON-NLS
|
||||||
logic = new ServerGameLogic(this, new Game());
|
logic = new ServerGameLogic(this, new Game());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -67,13 +69,13 @@ public void run() {
|
|||||||
private void startServer() {
|
private void startServer() {
|
||||||
try {
|
try {
|
||||||
LOGGER.log(Level.INFO, "Starting server..."); //NON-NLS
|
LOGGER.log(Level.INFO, "Starting server..."); //NON-NLS
|
||||||
|
|
||||||
myServer = Network.createServer(port);
|
myServer = Network.createServer(port);
|
||||||
initializeSerializables();
|
initializeSerializables();
|
||||||
myServer.start();
|
myServer.start();
|
||||||
registerListeners();
|
registerListeners();
|
||||||
LOGGER.log(Level.INFO, "Server started: {0}", myServer.isRunning()); //NON-NLS
|
LOGGER.log(Level.INFO, "Server started: {0}", myServer.isRunning()); //NON-NLS
|
||||||
}
|
} catch (IOException e) {
|
||||||
catch (IOException e) {
|
|
||||||
LOGGER.log(Level.ERROR, "Couldn't start server: {0}", e.getMessage()); //NON-NLS
|
LOGGER.log(Level.ERROR, "Couldn't start server: {0}", e.getMessage()); //NON-NLS
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -190,6 +192,7 @@ private void messageReceived(HostedConnection source, ClientMessage message) {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connectionAdded(Server server, HostedConnection hostedConnection) {
|
public void connectionAdded(Server server, HostedConnection hostedConnection) {
|
||||||
|
System.out.println("new connection " + hostedConnection); //NON-NLS
|
||||||
LOGGER.log(Level.DEBUG, "new connection {0}", hostedConnection); //NON-NLS
|
LOGGER.log(Level.DEBUG, "new connection {0}", hostedConnection); //NON-NLS
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +253,7 @@ public void send(int id, ServerMessage message) {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void broadcast(ServerMessage message) {
|
public void broadcast(ServerMessage message) {
|
||||||
for (Map.Entry<Integer, Player> entry: this.logic.getGame().getPlayers().entrySet()) {
|
for (Map.Entry<Integer, Player> entry : this.logic.getGame().getPlayers().entrySet()) {
|
||||||
this.send(entry.getKey(), message);
|
this.send(entry.getKey(), message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,25 +102,23 @@ private void tryHost() {
|
|||||||
|
|
||||||
if(port >= 1 && port <= 65535) {
|
if(port >= 1 && port <= 65535) {
|
||||||
app.getModelSynchronize().setName(startDialog.getName());
|
app.getModelSynchronize().setName(startDialog.getName());
|
||||||
hostDialog.setHostname(Inet4Address.getLocalHost().getHostAddress());
|
|
||||||
hostDialog.hostServer();
|
hostDialog.hostServer();
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException ignored) {
|
} catch (InterruptedException ignored) {
|
||||||
|
// todo: implement
|
||||||
}
|
}
|
||||||
hostDialog.connectServerAsClient();
|
hostDialog.connectServerAsClient();
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException ignored) {
|
} catch (InterruptedException ignored) {
|
||||||
|
// todo: implement
|
||||||
}
|
}
|
||||||
app.getModelSynchronize().setHost(port);
|
app.getModelSynchronize().setHost(port);
|
||||||
//app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
//app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException ignored) {
|
||||||
//nothing
|
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hostDialog.resetPort();
|
hostDialog.resetPort();
|
||||||
@@ -130,7 +128,7 @@ private void tryHost() {
|
|||||||
private void tryJoin() {
|
private void tryJoin() {
|
||||||
int port = 0;
|
int port = 0;
|
||||||
String ip = joinDialog.getIpt();
|
String ip = joinDialog.getIpt();
|
||||||
String portText = hostDialog.getPort();
|
String portText = joinDialog.getPort();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Validate the port
|
// Validate the port
|
||||||
@@ -138,19 +136,24 @@ private void tryJoin() {
|
|||||||
if (port < 1 || port > 65535) {
|
if (port < 1 || port > 65535) {
|
||||||
throw new IllegalArgumentException("Invalid port");
|
throw new IllegalArgumentException("Invalid port");
|
||||||
}
|
}
|
||||||
|
joinDialog.setPortNumber(port);
|
||||||
// Validate the IP address
|
// Validate the IP address
|
||||||
if (isValidIpAddress(ip)) {
|
if (isValidIpAddress(ip)) {
|
||||||
app.getModelSynchronize().setName(startDialog.getName());
|
app.getModelSynchronize().setName(startDialog.getName());
|
||||||
app.getModelSynchronize().setJoin(ip, port);
|
joinDialog.setHostname(ip);
|
||||||
joinDialog.connectToServer();
|
joinDialog.connectToServer();
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
|
app.getModelSynchronize().setJoin(ip, port);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// Invalid input, fall through to reset
|
// Invalid input, fall through to reset
|
||||||
}
|
}
|
||||||
|
|
||||||
hostDialog.resetPort();
|
joinDialog.resetPort();
|
||||||
joinDialog.resetIp();
|
joinDialog.resetIp();
|
||||||
app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,10 +84,14 @@ public void update(float tpf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void onEnter();
|
protected abstract void onEnter();
|
||||||
|
|
||||||
protected abstract void onLeave();
|
protected abstract void onLeave();
|
||||||
protected void onUpdate(float tpf) {}
|
|
||||||
|
protected void onUpdate(float tpf) {
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract void onEnterOverlay(Overlay overlay);
|
protected abstract void onEnterOverlay(Overlay overlay);
|
||||||
|
|
||||||
protected abstract void onLeaveOverlay(Overlay overlay);
|
protected abstract void onLeaveOverlay(Overlay overlay);
|
||||||
|
|
||||||
protected Geometry createBackground(String texturePath) {
|
protected Geometry createBackground(String texturePath) {
|
||||||
@@ -162,9 +166,9 @@ private void leaveAdvanced() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void pressEscape() {
|
public void pressEscape() {
|
||||||
if(settingsDepth == 0) {
|
if (settingsDepth == 0) {
|
||||||
enterSettings();
|
enterSettings();
|
||||||
} else if(settingsDepth == 1) {
|
} else if (settingsDepth == 1) {
|
||||||
leaveSettings();
|
leaveSettings();
|
||||||
} else {
|
} else {
|
||||||
leaveAdvanced();
|
leaveAdvanced();
|
||||||
@@ -172,20 +176,20 @@ public void pressEscape() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void pressForward() {
|
public void pressForward() {
|
||||||
if(this instanceof MainView mainView) {
|
if (this instanceof MainView mainView) {
|
||||||
mainView.forward(false);
|
mainView.forward(false);
|
||||||
app.getAcousticHandler().playSound(MdgaSound.BUTTON_PRESSED);
|
app.getAcousticHandler().playSound(MdgaSound.BUTTON_PRESSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this instanceof LobbyView lobbyView) {
|
if (this instanceof LobbyView lobbyView) {
|
||||||
lobbyView.ready();
|
lobbyView.ready();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this instanceof GameView gameView) {
|
if (this instanceof GameView gameView) {
|
||||||
app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
app.getAcousticHandler().playSound(MdgaSound.WRONG_INPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this instanceof CeremonyView ceremonyView) {
|
if (this instanceof CeremonyView ceremonyView) {
|
||||||
ceremonyView.forward();
|
ceremonyView.forward();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,9 +174,9 @@ public LobbyState getLobbyState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be used to return gameState attribute of ServerGameLogic class.
|
* This method will be used to return gamestate attribute of ServerGameLogic class.
|
||||||
*
|
*
|
||||||
* @return gameState as a GameState object.
|
* @return gamestate as a GameState object.
|
||||||
*/
|
*/
|
||||||
public GameState getGameState() {
|
public GameState getGameState() {
|
||||||
return this.gameState;
|
return this.gameState;
|
||||||
@@ -192,9 +192,9 @@ public InterruptState getInterruptState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be used to return ceremonyState attribute of ServerGameLogic class.
|
* This method will be used to return ceremonystate attribute of ServerGameLogic class.
|
||||||
*
|
*
|
||||||
* @return ceremonyState as a CeremonyState object.
|
* @return ceremonystate as a CeremonyState object.
|
||||||
*/
|
*/
|
||||||
public CeremonyState getCeremonyState() {
|
public CeremonyState getCeremonyState() {
|
||||||
return this.ceremonyState;
|
return this.ceremonyState;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public void exit() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be called whenever the server received a JoinedLobbyMessage message.
|
* This method will be called whenever the server received a JoinedLobbyMessage message.
|
||||||
* It will also get the client id of the player who send this messag
|
* It will also get the client id of the player who send this message
|
||||||
*
|
*
|
||||||
* @param msg as the message which was sent by the player as a JoinedLobbyMessage object.
|
* @param msg as the message which was sent by the player as a JoinedLobbyMessage object.
|
||||||
* @param from as the client id of the player as an Integer.
|
* @param from as the client id of the player as an Integer.
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package pp.mdga.server.automaton.game.turn.rolldice;
|
||||||
|
|
||||||
|
import pp.mdga.server.ServerGameLogic;
|
||||||
|
import pp.mdga.server.automaton.game.turn.RollDiceState;
|
||||||
|
|
||||||
|
public class FirstRollState extends RollDiceAutomatonState {
|
||||||
|
/**
|
||||||
|
* Create FirstRollState constants.
|
||||||
|
*/
|
||||||
|
private static final System.Logger LOGGER = System.getLogger(FirstRollState.class.getName());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a server state of the specified game logic.
|
||||||
|
*
|
||||||
|
* @param rollDiceAutomaton as the automaton of the roll dice state as a RollDiceState object.
|
||||||
|
* @param logic the game logic
|
||||||
|
*/
|
||||||
|
public FirstRollState(RollDiceState rollDiceAutomaton, ServerGameLogic logic) {
|
||||||
|
super(rollDiceAutomaton, logic);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Entered FirstRollState state.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exit() {
|
||||||
|
LOGGER.log(System.Logger.Level.DEBUG, "Exited FirstRollStatte state.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package pp.mdga.server.automaton.game.turn.rolldice;
|
|
||||||
|
|
||||||
import pp.mdga.server.ServerGameLogic;
|
|
||||||
import pp.mdga.server.automaton.game.turn.RollDiceState;
|
|
||||||
|
|
||||||
public class FirstRollStateState {
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user