mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Improve targeting overlays
This commit is contained in:
@@ -45,7 +45,7 @@ public class TargetingOverlay {
|
|||||||
// TODO - this is called every repaint, regardless if card
|
// TODO - this is called every repaint, regardless if card
|
||||||
// positions have changed or not. Could perform better if
|
// positions have changed or not. Could perform better if
|
||||||
// it checked for a state change.
|
// it checked for a state change.
|
||||||
private void assembleArcs(Combat combat) {
|
private void assembleArcs() {
|
||||||
//List<VField> fields = VMatchUI.SINGLETON_INSTANCE.getFieldViews();
|
//List<VField> fields = VMatchUI.SINGLETON_INSTANCE.getFieldViews();
|
||||||
arcsCombat.clear();
|
arcsCombat.clear();
|
||||||
arcsOther.clear();
|
arcsOther.clear();
|
||||||
@@ -53,7 +53,7 @@ public class TargetingOverlay {
|
|||||||
|
|
||||||
for (VPlayerPanel pnl : FControl.getView().getPlayerPanels().values()) {
|
for (VPlayerPanel pnl : FControl.getView().getPlayerPanels().values()) {
|
||||||
for (CardAreaPanel cardPanel : pnl.getField().getCardPanels()) {
|
for (CardAreaPanel cardPanel : pnl.getField().getCardPanels()) {
|
||||||
cardPanels.add(cardPanel);
|
cardPanel.buildCardPanelList(cardPanels);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +67,8 @@ public class TargetingOverlay {
|
|||||||
cardScreenPos.y + c.getHeight() / 2));
|
cardScreenPos.y + c.getHeight() / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Combat combat = FControl.getGame().getCombat();
|
||||||
|
|
||||||
// Work with all card panels currently visible
|
// Work with all card panels currently visible
|
||||||
List<Card> visualized = new ArrayList<Card>();
|
List<Card> visualized = new ArrayList<Card>();
|
||||||
for (FCardPanel c : cardPanels) {
|
for (FCardPanel c : cardPanels) {
|
||||||
@@ -254,10 +256,7 @@ public class TargetingOverlay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void draw(final Graphics g) {
|
public void draw(final Graphics g) {
|
||||||
final Combat combat = FControl.getGame().getCombat();
|
assembleArcs();
|
||||||
|
|
||||||
// Arc drawing
|
|
||||||
assembleArcs(combat);
|
|
||||||
|
|
||||||
if (arcsCombat.isEmpty() && arcsOther.isEmpty()) { return; }
|
if (arcsCombat.isEmpty() && arcsOther.isEmpty()) { return; }
|
||||||
|
|
||||||
|
|||||||
@@ -260,5 +260,19 @@ public abstract class VCardDisplayArea extends VDisplayArea {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void buildCardPanelList(List<? super FCardPanel> list) {
|
||||||
|
if (!attachedPanels.isEmpty()) {
|
||||||
|
for (int i = attachedPanels.size() - 1; i >= 0; i--) {
|
||||||
|
attachedPanels.get(i).buildCardPanelList(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list.add(this);
|
||||||
|
|
||||||
|
if (nextPanelInStack != null) {
|
||||||
|
nextPanelInStack.buildCardPanelList(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user