mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
make DefaulActionCallback an enum and remove unused parameter
This commit is contained in:
parent
ce26e5c8dd
commit
0528555075
3 changed files with 6 additions and 14 deletions
|
@ -68,7 +68,6 @@ import static mage.client.constants.Constants.*;
|
|||
@SuppressWarnings("serial")
|
||||
public class Card extends MagePermanent implements MouseMotionListener, MouseListener, FocusListener, ComponentListener {
|
||||
|
||||
protected static final DefaultActionCallback callback = DefaultActionCallback.getInstance();
|
||||
|
||||
protected Point p;
|
||||
protected final CardDimensions dimension;
|
||||
|
@ -367,7 +366,7 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
|||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
requestFocusInWindow();
|
||||
callback.mouseClicked(e, gameId, card);
|
||||
DefaultActionCallback.instance.mouseClicked(gameId, card);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -67,7 +67,6 @@ public class MageActionCallback implements ActionCallback {
|
|||
private Popup tooltipPopup;
|
||||
private JPopupMenu jPopupMenu;
|
||||
private BigCard bigCard;
|
||||
protected static final DefaultActionCallback defaultCallback = DefaultActionCallback.getInstance();
|
||||
|
||||
private CardView tooltipCard;
|
||||
private TransferData popupData;
|
||||
|
@ -236,14 +235,14 @@ public class MageActionCallback implements ActionCallback {
|
|||
this.startedDragging = false;
|
||||
if (maxXOffset < MIN_X_OFFSET_REQUIRED) { // we need this for protection from small card movements
|
||||
transferData.component.requestFocusInWindow();
|
||||
defaultCallback.mouseClicked(e, transferData.gameId, transferData.card);
|
||||
DefaultActionCallback.instance.mouseClicked(transferData.gameId, transferData.card);
|
||||
// Closes popup & enlarged view if a card/Permanent is selected
|
||||
hideTooltipPopup();
|
||||
}
|
||||
e.consume();
|
||||
} else {
|
||||
transferData.component.requestFocusInWindow();
|
||||
defaultCallback.mouseClicked(e, transferData.gameId, transferData.card);
|
||||
DefaultActionCallback.instance.mouseClicked(transferData.gameId, transferData.card);
|
||||
// Closes popup & enlarged view if a card/Permanent is selected
|
||||
hideTooltipPopup();
|
||||
e.consume();
|
||||
|
|
|
@ -7,17 +7,11 @@ import mage.client.SessionHandler;
|
|||
import mage.view.CardView;
|
||||
|
||||
|
||||
public class DefaultActionCallback {
|
||||
public enum DefaultActionCallback {
|
||||
|
||||
private static final DefaultActionCallback INSTANCE = new DefaultActionCallback();
|
||||
instance;
|
||||
|
||||
private DefaultActionCallback() {}
|
||||
|
||||
public static DefaultActionCallback getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent e, UUID gameId, CardView card) {
|
||||
public void mouseClicked(UUID gameId, CardView card) {
|
||||
if (gameId != null) {
|
||||
if (card.isAbility() && card.getAbility() != null) {
|
||||
SessionHandler.sendPlayerUUID(gameId, card.getAbility().getId());
|
||||
|
|
Loading…
Reference in a new issue