-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PlayerHandZoneView subclass, you can now play cards from your h…
…and by clicking on them
- Loading branch information
Showing
4 changed files
with
77 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
cardshifter-fx/src/main/java/com/cardshifter/client/PlayerHandZoneView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.cardshifter.client; | ||
|
||
import com.cardshifter.server.outgoing.UseableActionMessage; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import javafx.scene.layout.Pane; | ||
|
||
public class PlayerHandZoneView extends ZoneView { | ||
|
||
private final Map<Integer, CardHandDocumentController> cardMap = new HashMap<>(); | ||
|
||
public PlayerHandZoneView(int cardId, Pane pane) { | ||
super(cardId, pane); | ||
} | ||
|
||
public void addCardHandController(int cardId, CardHandDocumentController controller) { | ||
this.cardMap.put(cardId, controller); | ||
super.addPane(cardId, controller.getRootPane()); | ||
} | ||
|
||
public void removeCardHandDocumentController(int cardId) { | ||
super.removePane(cardId); | ||
this.cardMap.remove(cardId); | ||
} | ||
|
||
public CardHandDocumentController getCardHandController(int cardId) { | ||
return this.cardMap.get(cardId); | ||
} | ||
|
||
@Override | ||
public int getSize() { | ||
return this.cardMap.size(); | ||
} | ||
|
||
@Override | ||
public Set getAllIds() { | ||
return this.cardMap.keySet(); | ||
} | ||
|
||
public void highlightCard(int cardId, UseableActionMessage message) { | ||
CardHandDocumentController card = this.cardMap.get(cardId); | ||
card.setCardActive(message); | ||
super.removePane(cardId); | ||
super.addPane(cardId, card.getRootPane()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters