added selectNode when right piece is selected
This commit is contained in:
@@ -53,6 +53,7 @@ public class BoardHandler {
|
||||
// Flags and lists for handling piece selection and movement
|
||||
private List<PieceControl> selectableOwnPieces;
|
||||
private List<PieceControl> selectableEnemyPieces;
|
||||
private Map<PieceControl, NodeControl> selectedPieceNodeMap;
|
||||
private List<NodeControl> outlineNodes;
|
||||
private PieceControl selectedOwnPiece;
|
||||
private PieceControl selectedEnemyPiece;
|
||||
@@ -87,6 +88,7 @@ public void init() {
|
||||
isInitialised = true;
|
||||
selectableOwnPieces = new ArrayList<>();
|
||||
selectableEnemyPieces = new ArrayList<>();
|
||||
selectedPieceNodeMap = new HashMap<>();
|
||||
outlineNodes = new ArrayList<>();
|
||||
selectedOwnPiece = null;
|
||||
selectedEnemyPiece = null;
|
||||
@@ -603,6 +605,7 @@ public void outlineMove(List<UUID> pieces, List<Integer> moveIndexe, List<Boolea
|
||||
pieceControl.setSelectable(true);
|
||||
outlineNodes.add(nodeControl);
|
||||
selectableOwnPieces.add(pieceControl);
|
||||
selectedPieceNodeMap.put(pieceControl, nodeControl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,6 +671,7 @@ public void pieceSelect(PieceControl pieceSelected) {
|
||||
}
|
||||
if (!isSelected) {
|
||||
pieceSelected.select();
|
||||
selectedPieceNodeMap.get(pieceSelected).select();
|
||||
selectedOwnPiece = pieceSelected;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -16,6 +16,8 @@ public class NodeControl extends OutlineControl {
|
||||
|
||||
private static final ColorRGBA OUTLINE_HIGHLIGHT_COLOR = ColorRGBA.White;
|
||||
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.
|
||||
@@ -45,4 +47,8 @@ public Vector3f getLocation(){
|
||||
public void highlight() {
|
||||
super.outline(OUTLINE_HIGHLIGHT_COLOR, OUTLINE_HIGHLIGHT_WIDTH);
|
||||
}
|
||||
|
||||
public void select() {
|
||||
super.outline(OUTLINE_SELECT_COLOR, OUTLINE_SELECT_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user