mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
revert 20668
set Morphs visible to player flippable on CPicture and CDetail If you mouse over a card with SHIFT pressed, MatchUI will attempt to show you the other side of a card.
This commit is contained in:
@@ -8427,14 +8427,6 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
return this.getCharacteristics().getImageKey();
|
return this.getCharacteristics().getImageKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String getImageKey(CardCharacteristicName state) {
|
|
||||||
CardCharacteristics characteristics = characteristicsMap.get(state);
|
|
||||||
if (null == characteristics) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return characteristics.getImageKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Setter for the field <code>evoked</code>.
|
* Setter for the field <code>evoked</code>.
|
||||||
|
|||||||
@@ -99,29 +99,21 @@ public class ImageCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retrieve an image from the cache. returns a default image if the image is not found in the cache
|
* retrieve an image from the cache. returns null if the image is not found in the cache
|
||||||
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
|
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
|
||||||
*/
|
*/
|
||||||
public static BufferedImage getImage(Card card, int width, int height) {
|
public static BufferedImage getImage(Card card, int width, int height) {
|
||||||
return getImage(card, width, height, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* retrieve an image from the cache. returns a default image if the image is not found in the cache
|
|
||||||
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
|
|
||||||
*/
|
|
||||||
public static BufferedImage getImage(Card card, int width, int height, boolean ignoreFaceDown) {
|
|
||||||
final String key;
|
final String key;
|
||||||
if (!card.canBeShownTo(Singletons.getControl().getPlayer()) || (!ignoreFaceDown && card.isFaceDown())) {
|
if (!card.canBeShownTo(Singletons.getControl().getPlayer()) || card.isFaceDown()) {
|
||||||
key = TOKEN_PREFIX + NewConstants.CACHE_MORPH_IMAGE_FILE;
|
key = TOKEN_PREFIX + NewConstants.CACHE_MORPH_IMAGE_FILE;
|
||||||
} else {
|
} else {
|
||||||
key = ignoreFaceDown ? card.getImageKey(CardCharacteristicName.Original) : card.getImageKey();
|
key = card.getImageKey();
|
||||||
}
|
}
|
||||||
return scaleImage(key, width, height, true);
|
return scaleImage(key, width, height, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* retrieve an image from the cache. returns a default image if the image is not found in the cache
|
* retrieve an image from the cache. returns null if the image is not found in the cache
|
||||||
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
|
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.
|
||||||
*/
|
*/
|
||||||
public static BufferedImage getImage(InventoryItem ii, int width, int height) {
|
public static BufferedImage getImage(InventoryItem ii, int width, int height) {
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ import forge.card.spellability.Target;
|
|||||||
import forge.card.trigger.Trigger;
|
import forge.card.trigger.Trigger;
|
||||||
import forge.card.trigger.TriggerHandler;
|
import forge.card.trigger.TriggerHandler;
|
||||||
import forge.card.trigger.TriggerType;
|
import forge.card.trigger.TriggerType;
|
||||||
import forge.control.input.InputBase;
|
|
||||||
import forge.control.input.InputSelectCards;
|
import forge.control.input.InputSelectCards;
|
||||||
import forge.control.input.InputSelectCardsFromList;
|
import forge.control.input.InputSelectCardsFromList;
|
||||||
import forge.game.GameState;
|
import forge.game.GameState;
|
||||||
@@ -78,9 +77,7 @@ import forge.game.zone.PlayerZone;
|
|||||||
import forge.game.zone.Zone;
|
import forge.game.zone.Zone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.GuiChoose;
|
import forge.gui.GuiChoose;
|
||||||
import forge.gui.match.CMatchUI;
|
|
||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
import forge.view.ButtonUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ public final class CardPicturePanel extends JPanel {
|
|||||||
image = ImageCache.getImage((InventoryItem)this.displayed, this.getWidth() - i.left - i.right, this.getHeight()
|
image = ImageCache.getImage((InventoryItem)this.displayed, this.getWidth() - i.left - i.right, this.getHeight()
|
||||||
- i.top - i.bottom);
|
- i.top - i.bottom);
|
||||||
} else if ( displayed instanceof Card ) {
|
} else if ( displayed instanceof Card ) {
|
||||||
image = ImageCache.getImage((Card)this.displayed,
|
image = ImageCache.getImage((Card)this.displayed, this.getWidth() - i.left - i.right - 2, this.getHeight() - i.top
|
||||||
this.getWidth() - i.left - i.right - 2, this.getHeight() - i.top - i.bottom - 2, true);
|
- i.bottom - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image != this.currentImage) {
|
if (image != this.currentImage) {
|
||||||
|
|||||||
@@ -236,8 +236,12 @@ public enum CMatchUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setCard(final Card c) {
|
public void setCard(final Card c) {
|
||||||
|
setCard(c, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCard(final Card c, final boolean showFlipped ) {
|
||||||
CDetail.SINGLETON_INSTANCE.showCard(c);
|
CDetail.SINGLETON_INSTANCE.showCard(c);
|
||||||
CPicture.SINGLETON_INSTANCE.showCard(c);
|
CPicture.SINGLETON_INSTANCE.showCard(c, showFlipped);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCard(final InventoryItem c) {
|
public void setCard(final InventoryItem c) {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import java.awt.event.MouseEvent;
|
|||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
|
import forge.Singletons;
|
||||||
import forge.gui.framework.ICDoc;
|
import forge.gui.framework.ICDoc;
|
||||||
import forge.gui.match.views.VDetail;
|
import forge.gui.match.views.VDetail;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
@@ -44,7 +45,7 @@ public enum CDetail implements ICDoc {
|
|||||||
* @param c   Card object
|
* @param c   Card object
|
||||||
*/
|
*/
|
||||||
public void showCard(final Card c) {
|
public void showCard(final Card c) {
|
||||||
view.getLblFlipcard().setVisible(c != null && (c.isDoubleFaced() || c.isFlipCard()));
|
view.getLblFlipcard().setVisible(c != null && (c.isDoubleFaced() || c.isFlipCard() || c.isFaceDown() && c.canBeShownTo(Singletons.getControl().getPlayer())));
|
||||||
view.getPnlDetail().setCard(c);
|
view.getPnlDetail().setCard(c);
|
||||||
view.getParentCell().repaintSelf();
|
view.getParentCell().repaintSelf();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import java.awt.event.MouseEvent;
|
|||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.CardCharacteristicName;
|
import forge.CardCharacteristicName;
|
||||||
import forge.Command;
|
import forge.Command;
|
||||||
|
import forge.Singletons;
|
||||||
import forge.gui.framework.ICDoc;
|
import forge.gui.framework.ICDoc;
|
||||||
import forge.gui.match.views.VPicture;
|
import forge.gui.match.views.VPicture;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
@@ -38,6 +39,7 @@ public enum CPicture implements ICDoc {
|
|||||||
private Card currentCard = null;
|
private Card currentCard = null;
|
||||||
private boolean flipped = false;
|
private boolean flipped = false;
|
||||||
private boolean canFlip = false;
|
private boolean canFlip = false;
|
||||||
|
private boolean cameFaceDown = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows card details and/or picture in sidebar cardview tabber.
|
* Shows card details and/or picture in sidebar cardview tabber.
|
||||||
@@ -45,18 +47,22 @@ public enum CPicture implements ICDoc {
|
|||||||
* @param c
|
* @param c
|
||||||
*   Card object
|
*   Card object
|
||||||
*/
|
*/
|
||||||
public void showCard(final Card c) {
|
public void showCard(final Card c, boolean showFlipped) {
|
||||||
canFlip = c != null && (c.isDoubleFaced() || c.isFlipCard());
|
cameFaceDown = c.isFaceDown() && c.canBeShownTo(Singletons.getControl().getPlayer());
|
||||||
|
canFlip = c != null && (c.isDoubleFaced() || c.isFlipCard() || cameFaceDown);
|
||||||
currentCard = c;
|
currentCard = c;
|
||||||
flipped = canFlip && (c.getCurState() == CardCharacteristicName.Transformed ||
|
flipped = canFlip && (c.getCurState() == CardCharacteristicName.Transformed ||
|
||||||
c.getCurState() == CardCharacteristicName.Flipped);
|
c.getCurState() == CardCharacteristicName.Flipped || c.getCurState() == CardCharacteristicName.FaceDown);
|
||||||
VPicture.SINGLETON_INSTANCE.getLblFlipcard().setVisible(canFlip);
|
VPicture.SINGLETON_INSTANCE.getLblFlipcard().setVisible(canFlip);
|
||||||
VPicture.SINGLETON_INSTANCE.getPnlPicture().setCard(c);
|
VPicture.SINGLETON_INSTANCE.getPnlPicture().setCard(c);
|
||||||
|
|
||||||
|
if ( showFlipped && canFlip )
|
||||||
|
flipCard();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showCard(final InventoryItem item) {
|
public void showCard(final InventoryItem item) {
|
||||||
if (item instanceof IPaperCard) {
|
if (item instanceof IPaperCard) {
|
||||||
showCard(((IPaperCard)item).getMatchingForgeCard());
|
showCard(((IPaperCard)item).getMatchingForgeCard(), false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,6 +107,8 @@ public enum CPicture implements ICDoc {
|
|||||||
newState = CardCharacteristicName.Transformed;
|
newState = CardCharacteristicName.Transformed;
|
||||||
} else if (currentCard.isFlipCard()) {
|
} else if (currentCard.isFlipCard()) {
|
||||||
newState = CardCharacteristicName.Flipped;
|
newState = CardCharacteristicName.Flipped;
|
||||||
|
} else if ( cameFaceDown ) {
|
||||||
|
newState = CardCharacteristicName.FaceDown;
|
||||||
} else {
|
} else {
|
||||||
// if this is hit, then then showCard has been modified to handle additional types, but
|
// if this is hit, then then showCard has been modified to handle additional types, but
|
||||||
// this function is missing an else if statement above
|
// this function is missing an else if statement above
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package forge.gui.match.nonsingleton;
|
package forge.gui.match.nonsingleton;
|
||||||
|
|
||||||
|
import java.awt.Event;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
@@ -99,9 +100,10 @@ public class CCommand implements ICDoc {
|
|||||||
|
|
||||||
/** */
|
/** */
|
||||||
private void cardoverAction(MouseEvent e) {
|
private void cardoverAction(MouseEvent e) {
|
||||||
|
boolean isShiftDown = (e.getModifiers() & Event.SHIFT_MASK) != 0;
|
||||||
final Card c = CCommand.this.view.getTabletop().getHoveredCard(e);
|
final Card c = CCommand.this.view.getTabletop().getHoveredCard(e);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
CMatchUI.SINGLETON_INSTANCE.setCard(c);
|
CMatchUI.SINGLETON_INSTANCE.setCard(c, isShiftDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package forge.gui.match.nonsingleton;
|
package forge.gui.match.nonsingleton;
|
||||||
|
|
||||||
|
import java.awt.Event;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
@@ -375,9 +376,10 @@ public class CField implements ICDoc {
|
|||||||
|
|
||||||
/** */
|
/** */
|
||||||
private void cardoverAction(MouseEvent e) {
|
private void cardoverAction(MouseEvent e) {
|
||||||
|
boolean isShiftDown = (e.getModifiers() & Event.SHIFT_MASK) != 0;
|
||||||
final Card c = CField.this.view.getTabletop().getHoveredCard(e);
|
final Card c = CField.this.view.getTabletop().getHoveredCard(e);
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
CMatchUI.SINGLETON_INSTANCE.setCard(c);
|
CMatchUI.SINGLETON_INSTANCE.setCard(c, isShiftDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user