Merge commit
This commit is contained in:
@@ -722,8 +722,8 @@ public void clearSelectable(){
|
||||
p.unHighlight();
|
||||
p.setSelectable(false);
|
||||
p.setHoverable(false);
|
||||
selectedPieceNodeMap.get(p).unSelect();
|
||||
selectedPieceNodeMap.get(p).unHighlight();
|
||||
if(selectedPieceNodeMap.get(p) != null) selectedPieceNodeMap.get(p).unSelect();
|
||||
if(selectedPieceNodeMap.get(p) != null) selectedPieceNodeMap.get(p).unHighlight();
|
||||
}
|
||||
for(PieceControl p : selectableOwnPieces) {
|
||||
p.unSelect();
|
||||
|
||||
@@ -29,6 +29,7 @@ public class CardLayerHandler {
|
||||
private DiceControl diceControl;
|
||||
|
||||
private final Map<BonusCard, CardControl> bonusCardControlMap = new HashMap<>();
|
||||
private final List<BonusCard> cardOrder = new ArrayList<>();
|
||||
private final Map<BonusCard, Integer> bonusCardIntegerMap = new HashMap<>();
|
||||
private final Set<CardControl> selectableCards = new HashSet<>();
|
||||
|
||||
@@ -80,14 +81,13 @@ public void addCard(BonusCard card) {
|
||||
if (card == BonusCard.HIDDEN) throw new RuntimeException("Can't add hidden card to GUI");
|
||||
|
||||
if (!bonusCardControlMap.containsKey(card)) {
|
||||
CardControl control = createCard(bonusToAsset(card), nextPos());
|
||||
bonusCardControlMap.put(card, control);
|
||||
cardLayer.addSpatial(control.getRoot());
|
||||
cardOrder.add(card);
|
||||
}
|
||||
|
||||
int newNum = bonusCardIntegerMap.getOrDefault(card, 0) + 1;
|
||||
bonusCardIntegerMap.put(card, newNum);
|
||||
bonusCardControlMap.get(card).setNumCard(newNum);
|
||||
|
||||
updateCard();
|
||||
}
|
||||
|
||||
public void removeCard(BonusCard card){
|
||||
@@ -95,12 +95,11 @@ public void removeCard(BonusCard card){
|
||||
bonusCardIntegerMap.put(card, bonusCardIntegerMap.get(card) - 1);
|
||||
|
||||
if(bonusCardIntegerMap.get(card) <= 0){
|
||||
cardLayer.deleteSpatial(bonusCardControlMap.get(card).getRoot());
|
||||
bonusCardIntegerMap.remove(card);
|
||||
bonusCardControlMap.remove(card);
|
||||
cardOrder.remove(card);
|
||||
}
|
||||
|
||||
}
|
||||
updateCard();
|
||||
} else throw new RuntimeException("card is not in bonusCardControlMap");
|
||||
}
|
||||
|
||||
public void clearSelectableCards() {
|
||||
@@ -114,6 +113,22 @@ public void clearSelectableCards() {
|
||||
cardSelect = null;
|
||||
}
|
||||
|
||||
private void updateCard(){
|
||||
for(BonusCard card : bonusCardControlMap.keySet()){
|
||||
CardControl control = bonusCardControlMap.get(card);
|
||||
cardLayer.deleteSpatial(control.getRoot());
|
||||
}
|
||||
bonusCardControlMap.clear();
|
||||
|
||||
for(int i = 0; i < cardOrder.size(); i++){
|
||||
BonusCard card = cardOrder.get(i);
|
||||
CardControl control = createCard(bonusToAsset(card), nextPos(i));
|
||||
control.setNumCard(bonusCardIntegerMap.get(card));
|
||||
cardLayer.addSpatial(control.getRoot());
|
||||
bonusCardControlMap.put(card, control);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelectableCards(List<BonusCard> select) {
|
||||
for (BonusCard card : select) {
|
||||
selectableCards.add(bonusCardControlMap.get(card));
|
||||
@@ -171,8 +186,8 @@ private Asset bonusToAsset(BonusCard card) {
|
||||
};
|
||||
}
|
||||
|
||||
private Vector3f nextPos() {
|
||||
return START.add(MARGIN.mult(bonusCardControlMap.size()));
|
||||
private Vector3f nextPos(int i) {
|
||||
return START.add(MARGIN.mult(i));
|
||||
}
|
||||
|
||||
private Camera createOverlayCam() {
|
||||
|
||||
@@ -28,7 +28,7 @@ public void enter() {
|
||||
extraAnimationCounter++;
|
||||
}
|
||||
|
||||
logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor() , playCardMessage.getCard().getCard()));
|
||||
logic.addNotification(new PlayCardNotification(logic.getGame().getActiveColor(), playCardMessage.getCard().getCard()));
|
||||
logic.getGame().getActivePlayer().removeHandCard(playCardMessage.getCard());
|
||||
handlePowerCard(playCardMessage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user