mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Fixed Issue#125: Show source/reason of triggering abilites
This commit is contained in:
parent
8597952af2
commit
7f6d730975
7 changed files with 83 additions and 13 deletions
|
|
@ -50,9 +50,10 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
|
||||
private UUID playerId;
|
||||
private UUID gameId;
|
||||
private boolean smallMode = false;
|
||||
|
||||
private static final int PANEL_HEIGHT = 242;
|
||||
private static final int PANEL_HEIGHT_SMALL = 190;
|
||||
public static final int PANEL_HEIGHT = 242;
|
||||
public static final int PANEL_HEIGHT_SMALL = 190;
|
||||
|
||||
/** Creates new form PlayAreaPanel */
|
||||
public PlayAreaPanel() {
|
||||
|
|
@ -161,6 +162,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
|
||||
public void sizePlayer(boolean smallMode) {
|
||||
this.playerPanel.sizePlayerPanel(smallMode);
|
||||
this.smallMode = smallMode;
|
||||
if (smallMode) {
|
||||
this.playerPanel.setPreferredSize(new Dimension(92, PANEL_HEIGHT_SMALL));
|
||||
//this.jScrollPane1.setPreferredSize(new Dimension(160, 160));
|
||||
|
|
@ -177,6 +179,9 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
|||
MageFrame.getSession().cheat(gameId, playerId, DeckImporterUtil.importDeck("cheat.dck"));
|
||||
}
|
||||
|
||||
public boolean isSmallMode() {
|
||||
return smallMode;
|
||||
}
|
||||
|
||||
private mage.client.game.BattlefieldPanel battlefieldPanel;
|
||||
private javax.swing.JButton btnCheat;
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
|
||||
}
|
||||
|
||||
public void sizePlayerPanel(boolean smallMode) {
|
||||
protected void sizePlayerPanel(boolean smallMode) {
|
||||
if (smallMode) {
|
||||
avatar.setVisible(false);
|
||||
btnPlayer.setVisible(true);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ import mage.components.CardInfoPane;
|
|||
import mage.remote.Session;
|
||||
import mage.utils.ThreadUtils;
|
||||
import mage.view.CardView;
|
||||
import mage.view.PlayerView;
|
||||
import mage.view.SimpleCardsView;
|
||||
import org.jdesktop.swingx.JXPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
|
|
@ -153,8 +155,11 @@ public class MageActionCallback implements ActionCallback {
|
|||
me.translate(-parentPoint.x, -parentPoint.y);
|
||||
for (UUID uuid : targets) {
|
||||
|
||||
boolean found = false;
|
||||
|
||||
PlayAreaPanel p = MageFrame.getGame(data.gameId).getPlayers().get(uuid);
|
||||
if (p != null) {
|
||||
found = true;
|
||||
Point target = p.getLocationOnScreen();
|
||||
target.translate(-parentPoint.x, -parentPoint.y);
|
||||
ArrowBuilder.getBuilder().addArrow(data.gameId,(int) me.getX() + 35, (int) me.getY(), (int) target.getX() + 40, (int) target.getY() - 40, Color.red, ArrowBuilder.Type.TARGET);
|
||||
|
|
@ -162,12 +167,33 @@ public class MageActionCallback implements ActionCallback {
|
|||
for (PlayAreaPanel pa : MageFrame.getGame(data.gameId).getPlayers().values()) {
|
||||
MagePermanent permanent = pa.getBattlefieldPanel().getPermanents().get(uuid);
|
||||
if (permanent != null) {
|
||||
found = true;
|
||||
Point target = permanent.getLocationOnScreen();
|
||||
target.translate(-parentPoint.x, -parentPoint.y);
|
||||
ArrowBuilder.getBuilder().addArrow(data.gameId, (int) me.getX() + 35, (int) me.getY(), (int) target.getX() + 40, (int) target.getY() + 10, Color.red, ArrowBuilder.Type.TARGET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
for (PlayAreaPanel panel : MageFrame.getGame(data.gameId).getPlayers().values()) {
|
||||
PlayerView view = panel.getPlayerPanel().getPlayer();
|
||||
if (view != null) {
|
||||
SimpleCardsView graveyard = view.getGraveyard();
|
||||
if (graveyard.containsKey(uuid)) {
|
||||
found = true;
|
||||
p = MageFrame.getGame(data.gameId).getPlayers().get(view.getPlayerId());
|
||||
if (p != null) {
|
||||
Point target = p.getLocationOnScreen();
|
||||
target.translate(-parentPoint.x, -parentPoint.y);
|
||||
int y_offset = p.isSmallMode() ? (PlayAreaPanel.PANEL_HEIGHT - PlayAreaPanel.PANEL_HEIGHT_SMALL) : 0;
|
||||
ArrowBuilder.getBuilder().addArrow(data.gameId,(int) me.getX() + 35, (int) me.getY(), (int) target.getX() + 15, (int) target.getY() + 145 - y_offset, Color.red, ArrowBuilder.Type.TARGET);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue