merge dev into test #28

Merged
j23f0712 merged 29 commits from development into dev/test 2024-12-01 23:11:24 +01:00
7 changed files with 60 additions and 43 deletions
Showing only changes of commit 2732a89da6 - Show all commits

View File

@@ -66,7 +66,6 @@ private void handleLobby(Notification notification) {
//lobbyView.setReady(lobbyReadyNotification.getColor(), lobbyReadyNotification.isReady()): //lobbyView.setReady(lobbyReadyNotification.getColor(), lobbyReadyNotification.isReady()):
} else if (notification instanceof GameNotification n) { } else if (notification instanceof GameNotification n) {
app.enter(MdgaState.GAME); app.enter(MdgaState.GAME);
((GameView) app.getView()).setOwnColor(n.getOwnColor());
} else { } else {
throw new RuntimeException("notification not expected: " + notification.toString()); throw new RuntimeException("notification not expected: " + notification.toString());
} }
@@ -77,8 +76,8 @@ private void handleGame(Notification notification) {
GuiHandler guiHandler = gameView.getGuiHandler(); GuiHandler guiHandler = gameView.getGuiHandler();
BoardHandler boardHandler = gameView.getBoardHandler(); BoardHandler boardHandler = gameView.getBoardHandler();
if (notification instanceof AcquireCardNotification) { if (notification instanceof AcquireCardNotification n) {
// Handle AcquireCardNotification guiHandler.addCard(n.getBonusCard());
} else if (notification instanceof ActivePlayerNotification n) { } else if (notification instanceof ActivePlayerNotification n) {
gameView.getGuiHandler().setActivePlayer(n.getColor()); gameView.getGuiHandler().setActivePlayer(n.getColor());
} else if (notification instanceof CeremonyNotification ceremonyNotification) { } else if (notification instanceof CeremonyNotification ceremonyNotification) {

View File

@@ -7,6 +7,7 @@
import com.jme3.renderer.RenderManager; import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort; import com.jme3.renderer.ViewPort;
import com.jme3.scene.Spatial; import com.jme3.scene.Spatial;
import pp.mdga.client.MdgaApp;
public class SelectObjectOutliner { public class SelectObjectOutliner {
@@ -19,14 +20,16 @@ public class SelectObjectOutliner {
private ViewPort outlineViewport = null; private ViewPort outlineViewport = null;
// private OutlineFilter outlineFilter = null; // private OutlineFilter outlineFilter = null;
private OutlineProFilter outlineFilter = null; private OutlineProFilter outlineFilter = null;
private final MdgaApp app;
public SelectObjectOutliner(int width, FilterPostProcessor fpp, RenderManager renderManager, AssetManager assetManager, Camera cam) { public SelectObjectOutliner(int width, FilterPostProcessor fpp, RenderManager renderManager, AssetManager assetManager, Camera cam, MdgaApp app) {
this.selected = false; this.selected = false;
this.fpp = fpp; this.fpp = fpp;
this.renderManager = renderManager; this.renderManager = renderManager;
this.assetManager = assetManager; this.assetManager = assetManager;
this.cam = cam; this.cam = cam;
this.width = width; this.width = width;
this.app = app;
} }
public void deselect(Spatial model) { public void deselect(Spatial model) {
@@ -51,6 +54,7 @@ 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);
@@ -58,9 +62,12 @@ 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);
@@ -70,11 +77,12 @@ private void showOutlineFilterEffect(Spatial model, int width, ColorRGBA color)
outlineViewport.attachScene(model); outlineViewport.attachScene(model);
outlineViewport.addProcessor(outlineFpp); outlineViewport.addProcessor(outlineFpp);
// outlineFilter = new OutlineFilter(outlinePreFilter);
outlineFilter = new OutlineProFilter(outlinePreFilter); outlineFilter = new OutlineProFilter(outlinePreFilter);
outlineFilter.setOutlineColor(color); outlineFilter.setOutlineColor(color);
outlineFilter.setOutlineWidth(width); outlineFilter.setOutlineWidth(width);
fpp.addFilter(outlineFilter); fpp.addFilter(outlineFilter);
return null;
});
} }
} }

View File

@@ -18,17 +18,17 @@ public class OutlineControl extends AbstractControl {
public OutlineControl(MdgaApp app, FilterPostProcessor fpp){ public OutlineControl(MdgaApp app, FilterPostProcessor fpp){
this.app = app; this.app = app;
outlineOwn = new SelectObjectOutliner(THICKNESS_DEFAULT, fpp, app.getRenderManager(), app.getAssetManager(), app.getCamera()); outlineOwn = new SelectObjectOutliner(THICKNESS_DEFAULT, fpp, app.getRenderManager(), app.getAssetManager(), app.getCamera(), app);
} }
public OutlineControl(MdgaApp app, FilterPostProcessor fpp, Camera cam){ public OutlineControl(MdgaApp app, FilterPostProcessor fpp, Camera cam){
this.app = app; this.app = app;
outlineOwn = new SelectObjectOutliner(THICKNESS_DEFAULT, fpp, app.getRenderManager(), app.getAssetManager(), cam); outlineOwn = new SelectObjectOutliner(THICKNESS_DEFAULT, fpp, app.getRenderManager(), app.getAssetManager(), cam, app);
} }
public OutlineControl(MdgaApp app, FilterPostProcessor fpp, Camera cam, int thickness){ public OutlineControl(MdgaApp app, FilterPostProcessor fpp, Camera cam, int thickness){
this.app = app; this.app = app;
outlineOwn = new SelectObjectOutliner(thickness, fpp, app.getRenderManager(), app.getAssetManager(), cam); outlineOwn = new SelectObjectOutliner(thickness, fpp, app.getRenderManager(), app.getAssetManager(), cam, app);
} }
public void outline(ColorRGBA color){ public void outline(ColorRGBA color){

View File

@@ -84,9 +84,6 @@ public Node getRoot() {
public void initSpatial(){ public void initSpatial(){
} }
public void outline(){ public void outline(){
super.outline(OUTLINE_COLOR); super.outline(OUTLINE_COLOR);
} }

View File

@@ -88,8 +88,6 @@ public void render(RenderManager rm) {
@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);

View File

@@ -9,9 +9,14 @@
import pp.mdga.client.button.ButtonLeft; import pp.mdga.client.button.ButtonLeft;
import pp.mdga.client.button.ButtonRight; import pp.mdga.client.button.ButtonRight;
import pp.mdga.client.gui.GuiHandler; import pp.mdga.client.gui.GuiHandler;
import pp.mdga.game.BonusCard;
import pp.mdga.game.Color; import pp.mdga.game.Color;
import pp.mdga.notification.AcquireCardNotification;
import pp.mdga.notification.GameNotification; import pp.mdga.notification.GameNotification;
import pp.mdga.notification.MovePieceNotification;
import pp.mdga.notification.PlayerInGameNotification; import pp.mdga.notification.PlayerInGameNotification;
import pp.mdga.notification.SelectableCardsNotification;
import pp.mdga.notification.SelectableMoveNotification;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -44,6 +49,27 @@ public GameView(MdgaApp app) {
this.boardHandler = new BoardHandler(app, rootNode, fpp); this.boardHandler = new BoardHandler(app, rootNode, fpp);
guiHandler = new GuiHandler(app, guiNode, ownColor); guiHandler = new GuiHandler(app, guiNode, ownColor);
//Test
setOwnColor(Color.AIRFORCE);
List<UUID> uuid1 = new ArrayList<>();
UUID p1 = UUID.randomUUID();
UUID p2 = UUID.randomUUID();
uuid1.add(p1);
uuid1.add(p2);
uuid1.add(UUID.randomUUID());
uuid1.add(UUID.randomUUID());
app.getNotificationSynchronizer().addTestNotification(new PlayerInGameNotification(Color.AIRFORCE, uuid1, "Cedric"));
app.getNotificationSynchronizer().addTestNotification(new MovePieceNotification(p1, 0, true));
app.getNotificationSynchronizer().addTestNotification(new SelectableMoveNotification(List.of(p1), List.of(4), List.of(false)));
app.getNotificationSynchronizer().addTestNotification(new AcquireCardNotification(BonusCard.SHIELD));
app.getNotificationSynchronizer().addTestNotification(new SelectableCardsNotification(List.of(BonusCard.SHIELD)));
} }
@Override @Override

View File

@@ -9,24 +9,13 @@
*/ */
public class AcquireCardNotification extends Notification{ public class AcquireCardNotification extends Notification{
private UUID cardId;
private BonusCard bonusCard; private BonusCard bonusCard;
/** /**
* Constructor. * Constructor.
* @param cardId The id of the card that was acquired.
*/ */
public AcquireCardNotification(BonusCard bonusCard, UUID cardId) { public AcquireCardNotification(BonusCard bonusCard) {
this.bonusCard = bonusCard; this.bonusCard = bonusCard;
this.cardId = cardId;
}
/**
* Get the id of the card that was acquired.
* @return The id of the card that was acquired.
*/
public UUID getCardId() {
return cardId;
} }
public BonusCard getBonusCard() { public BonusCard getBonusCard() {