mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Improve handling of targeting arrows for cards that leave the battlefield or are in a non-visible zone
This commit is contained in:
@@ -5,6 +5,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import forge.FThreads;
|
||||
import forge.Graphics;
|
||||
import forge.card.CardZoom;
|
||||
@@ -278,5 +280,32 @@ public abstract class VCardDisplayArea extends VDisplayArea {
|
||||
nextPanelInStack.buildCardPanelList(list);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector2 getTargetingArrowOrigin() {
|
||||
//don't show targeting arrow unless in display area that's visible
|
||||
if (displayArea == null || !displayArea.isVisible()) { return null; }
|
||||
|
||||
Vector2 origin = new Vector2(getScreenPosition());
|
||||
|
||||
float left = PADDING;
|
||||
float top = PADDING;
|
||||
float w = getWidth() - 2 * PADDING;
|
||||
float h = getHeight() - 2 * PADDING;
|
||||
if (w == h) { //adjust width if needed to make room for tapping
|
||||
w = h / ASPECT_RATIO;
|
||||
}
|
||||
|
||||
if (isTapped()) { //rotate box if tapped
|
||||
top += h - w;
|
||||
float temp = w;
|
||||
w = h;
|
||||
h = temp;
|
||||
}
|
||||
|
||||
origin.x += left + w * TARGET_ORIGIN_FACTOR_X;
|
||||
origin.y += top + h * TARGET_ORIGIN_FACTOR_Y;
|
||||
|
||||
return origin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,10 @@ public class VPlayerPanel extends FContainer {
|
||||
return selectedTab;
|
||||
}
|
||||
|
||||
public InfoTab getZoneTab(ZoneType zoneType) {
|
||||
return zoneTabs.get(zoneType);
|
||||
}
|
||||
|
||||
public void setSelectedZone(ZoneType zoneType) {
|
||||
setSelectedTab(zoneTabs.get(zoneType));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package forge.toolbox;
|
||||
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
|
||||
import forge.Graphics;
|
||||
import forge.card.CardRenderer;
|
||||
import forge.game.card.Card;
|
||||
@@ -77,30 +75,6 @@ public class FCardPanel extends FDisplayObject {
|
||||
return PADDING;
|
||||
}
|
||||
|
||||
public Vector2 getTargetingArrowOrigin() {
|
||||
Vector2 origin = new Vector2(getScreenPosition());
|
||||
|
||||
float left = PADDING;
|
||||
float top = PADDING;
|
||||
float w = getWidth() - 2 * PADDING;
|
||||
float h = getHeight() - 2 * PADDING;
|
||||
if (w == h) { //adjust width if needed to make room for tapping
|
||||
w = h / ASPECT_RATIO;
|
||||
}
|
||||
|
||||
if (tapped) { //rotate box if tapped
|
||||
top += h - w;
|
||||
float temp = w;
|
||||
w = h;
|
||||
h = temp;
|
||||
}
|
||||
|
||||
origin.x += left + w * TARGET_ORIGIN_FACTOR_X;
|
||||
origin.y += top + h * TARGET_ORIGIN_FACTOR_Y;
|
||||
|
||||
return origin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Graphics g) {
|
||||
if (card == null) { return; }
|
||||
|
||||
Reference in New Issue
Block a user