Skip to content

Commit

Permalink
active cards in hand highlight but it is buggy
Browse files Browse the repository at this point in the history
  • Loading branch information
bazola committed Sep 19, 2014
1 parent 7c865cf commit c94a523
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ private void addCardToPlayerHandPane(CardInfoMessage message) {
}

private void processUseableActionMessage(UseableActionMessage message) {
for (ZoneView zoneView : this.zoneViewMap.values()) {
if (zoneView.getAllIds().contains(message.getId())) {
zoneView.highlightCard(message.getId());
}
}

double paneHeight = actionBox.getHeight();
double paneWidth = actionBox.getWidth();

Expand Down Expand Up @@ -401,5 +407,8 @@ private void createOpponentHand(int size) {
ZoneChangeMessage [entity=50, sourceZone=45, destinationZone=46]
ZoneChangeMessage [entity=51, sourceZone=45, destinationZone=46]
ZoneChangeMessage [entity=52, sourceZone=45, destinationZone=46]
UseableActionMessage [id=5, action=Play, targetRequired=false, targetId=0]
UseableActionMessage [id=1, action=End Turn, targetRequired=false, targetId=0]
ZoneChangeMessage [entity=54, sourceZone=45, destinationZone=46]
*/

20 changes: 20 additions & 0 deletions cardshifter-fx/src/main/java/com/cardshifter/client/ZoneView.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package com.cardshifter.client;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javafx.scene.Node;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;

public class ZoneView {

Expand Down Expand Up @@ -42,4 +47,19 @@ public Pane getRootPane() {
return this.rootPane;
}

public Set getAllIds() {
return this.zoneMap.keySet();
}

public void highlightCard(int cardId) {
Pane pane = this.getPane(cardId);
List<Node> children = pane.getChildren();
for (Node node : children) {
if (node.getId().equals("backgroundRectangle")) {
Rectangle rectangle = (Rectangle)node;
rectangle.setFill(Color.YELLOW);
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<children>

<!-- Card Background -->
<Rectangle fx:id="background" arcHeight="5.0" arcWidth="5.0" height="188.0" stroke="BLACK" strokeType="INSIDE" width="129.0" />
<Rectangle id="backgroundRectangle" fx:id="background" arcHeight="5.0" arcWidth="5.0" height="188.0" stroke="BLACK" strokeType="INSIDE" width="129.0" />

<!-- Non Functional Card Layout Pieces -->
<Rectangle arcHeight="5.0" arcWidth="5.0" fill="#b90707" height="164.0" layoutX="12.0" layoutY="12.0" stroke="BLACK" strokeType="INSIDE" width="106.0" />
Expand Down

0 comments on commit c94a523

Please sign in to comment.