mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
change client messages to enum rather than string
This commit is contained in:
parent
a110b54d91
commit
9cbc2b7ea2
14 changed files with 233 additions and 331 deletions
|
@ -27,20 +27,9 @@
|
|||
*/
|
||||
package mage.client.cards;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JScrollPane;
|
||||
import mage.cards.MageCard;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.ClientEventType;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.Listener;
|
||||
|
@ -50,6 +39,13 @@ import mage.view.CardsView;
|
|||
import mage.view.SimpleCardView;
|
||||
import org.mage.card.arcane.CardPanel;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class CardArea extends JPanel implements MouseListener {
|
||||
|
||||
protected final CardEventSource cardEventSource = new CardEventSource();
|
||||
|
@ -240,15 +236,15 @@ public class CardArea extends JPanel implements MouseListener {
|
|||
e.consume();
|
||||
if (obj instanceof Card) {
|
||||
if (e.isAltDown()) {
|
||||
cardEventSource.altDoubleClick(((Card) obj).getOriginal(), "alt-double-click");
|
||||
cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
|
||||
} else {
|
||||
cardEventSource.doubleClick(((Card) obj).getOriginal(), "double-click");
|
||||
cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.DOUBLE_CLICK);
|
||||
}
|
||||
} else if (obj instanceof MageCard) {
|
||||
if (e.isAltDown()) {
|
||||
cardEventSource.altDoubleClick(((MageCard) obj).getOriginal(), "alt-double-click");
|
||||
cardEventSource.fireEvent(((MageCard) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
|
||||
} else {
|
||||
cardEventSource.doubleClick(((MageCard) obj).getOriginal(), "double-click");
|
||||
cardEventSource.fireEvent(((MageCard) obj).getOriginal(),ClientEventType.DOUBLE_CLICK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -270,14 +266,14 @@ public class CardArea extends JPanel implements MouseListener {
|
|||
checkMenu(e, null);
|
||||
}
|
||||
} else {
|
||||
cardEventSource.actionConsumedEvent("action-consumed");
|
||||
cardEventSource.fireEvent(ClientEventType.ACTION_CONSUMED);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkMenu(MouseEvent Me, SimpleCardView card) {
|
||||
if (Me.isPopupTrigger()) {
|
||||
Me.consume();
|
||||
cardEventSource.showPopupMenuEvent(card, Me.getComponent(), Me.getX(), Me.getY(), "show-popup-menu");
|
||||
cardEventSource.fireEvent(card, Me.getComponent(), Me.getX(), Me.getY(), ClientEventType.SHOW_POP_UP_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,14 +27,13 @@
|
|||
*/
|
||||
package mage.client.cards;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.io.Serializable;
|
||||
import mage.client.util.*;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.EventDispatcher;
|
||||
import mage.client.util.EventSource;
|
||||
import mage.client.util.Listener;
|
||||
import mage.view.SimpleCardView;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -49,42 +48,22 @@ public class CardEventSource implements EventSource<Event>, Serializable {
|
|||
dispatcher.addListener(listener);
|
||||
}
|
||||
|
||||
public void setNumber(SimpleCardView card, String message, int number) {
|
||||
dispatcher.fireEvent(new Event(card, message, number));
|
||||
public void fireEvent(SimpleCardView card, ClientEventType eventType, int number){
|
||||
dispatcher.fireEvent(new Event(card, eventType, number));
|
||||
}
|
||||
|
||||
public void removeSpecificCard(SimpleCardView card, String message) {
|
||||
dispatcher.fireEvent(new Event(card, message));
|
||||
public void fireEvent(ClientEventType eventType){
|
||||
dispatcher.fireEvent(new Event(null, eventType));
|
||||
}
|
||||
|
||||
public void addSpecificCard(SimpleCardView card, String message) {
|
||||
dispatcher.fireEvent(new Event(card, message));
|
||||
public void fireEvent(SimpleCardView card, ClientEventType eventType){
|
||||
dispatcher.fireEvent(new Event(card, eventType));
|
||||
}
|
||||
|
||||
public void doubleClick(SimpleCardView card, String message) {
|
||||
dispatcher.fireEvent(new Event(card, message));
|
||||
}
|
||||
|
||||
public void altDoubleClick(SimpleCardView card, String message) {
|
||||
dispatcher.fireEvent(new Event(card, message));
|
||||
}
|
||||
|
||||
public void removeFromMainEvent(String message) {
|
||||
dispatcher.fireEvent(new Event(null, message));
|
||||
}
|
||||
|
||||
public void removeFromSideboardEvent(String message) {
|
||||
dispatcher.fireEvent(new Event(null, message));
|
||||
}
|
||||
|
||||
public void showPopupMenuEvent(SimpleCardView card, Component component, int x, int y, String message) {
|
||||
public void fireEvent(SimpleCardView card, Component component, int x, int y, ClientEventType message) {
|
||||
dispatcher.fireEvent(new Event(card, message, x, y, component));
|
||||
}
|
||||
|
||||
public void actionConsumedEvent(String message) {
|
||||
dispatcher.fireEvent(new Event(null, message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearListeners() {
|
||||
dispatcher.clearListeners();
|
||||
|
|
|
@ -33,22 +33,10 @@
|
|||
*/
|
||||
package mage.client.cards;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import mage.cards.MageCard;
|
||||
import mage.client.deckeditor.SortSetting;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.ClientEventType;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.Listener;
|
||||
|
@ -57,6 +45,13 @@ import mage.view.CardView;
|
|||
import mage.view.CardsView;
|
||||
import org.mage.card.arcane.CardPanel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -321,15 +316,15 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
Object obj = e.getSource();
|
||||
if (obj instanceof Card) {
|
||||
if (e.isAltDown()) {
|
||||
cardEventSource.altDoubleClick(((Card) obj).getOriginal(), "alt-double-click");
|
||||
cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
|
||||
} else {
|
||||
cardEventSource.doubleClick(((Card) obj).getOriginal(), "double-click");
|
||||
cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.DOUBLE_CLICK);
|
||||
}
|
||||
} else if (obj instanceof MageCard) {
|
||||
if (e.isAltDown()) {
|
||||
cardEventSource.altDoubleClick(((MageCard) obj).getOriginal(), "alt-double-click");
|
||||
cardEventSource.fireEvent(((MageCard) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
|
||||
} else {
|
||||
cardEventSource.doubleClick(((MageCard) obj).getOriginal(), "double-click");
|
||||
cardEventSource.fireEvent(((MageCard) obj).getOriginal(), ClientEventType.DOUBLE_CLICK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,6 @@ import java.util.*;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class CardsList extends javax.swing.JPanel implements MouseListener, ICardGrid {
|
||||
|
@ -475,9 +474,9 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
|
||||
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
|
||||
setMinimumSize(new java.awt.Dimension(30, 30));
|
||||
setPreferredSize((!Beans.isDesignTime())?
|
||||
(GUISizeHelper.editorCardDimension)
|
||||
:(new Dimension(600, 600)));
|
||||
setPreferredSize((!Beans.isDesignTime()) ?
|
||||
(GUISizeHelper.editorCardDimension)
|
||||
: (new Dimension(600, 600)));
|
||||
setRequestFocusEnabled(false);
|
||||
|
||||
panelControl.setMaximumSize(new java.awt.Dimension(32767, 23));
|
||||
|
@ -522,7 +521,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
chkPiles.setMargin(new java.awt.Insets(3, 2, 2, 2));
|
||||
chkPiles.addActionListener(evt -> chkPilesActionPerformed(evt));
|
||||
|
||||
cbSortBy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "SortBy" }));
|
||||
cbSortBy.setModel(new javax.swing.DefaultComboBoxModel(new String[]{"SortBy"}));
|
||||
cbSortBy.setToolTipText("Sort the cards if card view is active.");
|
||||
cbSortBy.setMaximumSize(new java.awt.Dimension(120, 20));
|
||||
cbSortBy.setMinimumSize(new java.awt.Dimension(120, 20));
|
||||
|
@ -553,36 +552,36 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
javax.swing.GroupLayout panelControlLayout = new javax.swing.GroupLayout(panelControl);
|
||||
panelControl.setLayout(panelControlLayout);
|
||||
panelControlLayout.setHorizontalGroup(
|
||||
panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelControlLayout.createSequentialGroup()
|
||||
.addComponent(lblCount)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblLandCount)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblCreatureCount)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkPiles)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(cbSortBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jToggleListView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jToggleCardView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelControlLayout.createSequentialGroup()
|
||||
.addComponent(lblCount)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblLandCount)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblCreatureCount)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkPiles)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(cbSortBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jToggleListView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jToggleCardView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
panelControlLayout.setVerticalGroup(
|
||||
panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelControlLayout.createSequentialGroup()
|
||||
.addGroup(panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblCount)
|
||||
.addComponent(lblLandCount)
|
||||
.addComponent(lblCreatureCount)
|
||||
.addComponent(chkPiles))
|
||||
.addComponent(cbSortBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jToggleListView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jToggleCardView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(0, 0, 0))
|
||||
panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelControlLayout.createSequentialGroup()
|
||||
.addGroup(panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelControlLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblCount)
|
||||
.addComponent(lblLandCount)
|
||||
.addComponent(lblCreatureCount)
|
||||
.addComponent(chkPiles))
|
||||
.addComponent(cbSortBy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jToggleListView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jToggleCardView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(0, 0, 0))
|
||||
);
|
||||
|
||||
jToggleListView.getAccessibleContext().setAccessibleDescription("Switch between image and table view.");
|
||||
|
@ -593,16 +592,16 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(panelControl, javax.swing.GroupLayout.PREFERRED_SIZE, 467, Short.MAX_VALUE)
|
||||
.addComponent(panelCardArea)
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(panelControl, javax.swing.GroupLayout.PREFERRED_SIZE, 467, Short.MAX_VALUE)
|
||||
.addComponent(panelCardArea)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(panelControl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2, 2, 2)
|
||||
.addComponent(panelCardArea, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE))
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(panelControl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2, 2, 2)
|
||||
.addComponent(panelCardArea, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
@ -660,15 +659,15 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
e.consume();
|
||||
if (obj instanceof Card) {
|
||||
if (e.isAltDown()) {
|
||||
cardEventSource.altDoubleClick(((Card) obj).getOriginal(), "alt-double-click");
|
||||
cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
|
||||
} else {
|
||||
cardEventSource.doubleClick(((Card) obj).getOriginal(), "double-click");
|
||||
cardEventSource.fireEvent(((Card) obj).getOriginal(), ClientEventType.DOUBLE_CLICK);
|
||||
}
|
||||
} else if (obj instanceof MageCard) {
|
||||
if (e.isAltDown()) {
|
||||
cardEventSource.altDoubleClick(((MageCard) obj).getOriginal(), "alt-double-click");
|
||||
cardEventSource.fireEvent(((MageCard) obj).getOriginal(), ClientEventType.ALT_DOUBLE_CLICK);
|
||||
} else {
|
||||
cardEventSource.doubleClick(((MageCard) obj).getOriginal(), "double-click");
|
||||
cardEventSource.fireEvent(((MageCard) obj).getOriginal(), ClientEventType.DOUBLE_CLICK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -695,7 +694,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
private void checkMenu(MouseEvent Me, SimpleCardView card) {
|
||||
if (Me.isPopupTrigger()) {
|
||||
Me.consume();
|
||||
cardEventSource.showPopupMenuEvent(card, Me.getComponent(), Me.getX(), Me.getY(), "show-popup-menu");
|
||||
cardEventSource.fireEvent(card, Me.getComponent(), Me.getX(), Me.getY(), ClientEventType.SHOW_POP_UP_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,17 +34,11 @@
|
|||
|
||||
package mage.client.cards;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mage.cards.CardDimensions;
|
||||
import mage.cards.MageCard;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.CardViewRarityComparator;
|
||||
import mage.client.util.ClientEventType;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.Listener;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
|
@ -53,6 +47,12 @@ import mage.view.CardView;
|
|||
import mage.view.CardsView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -186,7 +186,7 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
|
|||
if (e.getButton() == MouseEvent.BUTTON1) {
|
||||
Object obj = e.getSource();
|
||||
if (obj instanceof MageCard) {
|
||||
this.cardEventSource.doubleClick(((MageCard)obj).getOriginal(), "pick-a-card");
|
||||
this.cardEventSource.fireEvent(((MageCard)obj).getOriginal(), ClientEventType.PICK_A_CARD);
|
||||
this.hidePopup();
|
||||
AudioManager.playOnDraftSelect();
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
|
|||
if (this.markedCard != null) {
|
||||
markedCard.setSelected(false);
|
||||
}
|
||||
this.cardEventSource.doubleClick(((MageCard)obj).getOriginal(), "mark-a-card");
|
||||
this.cardEventSource.fireEvent(((MageCard)obj).getOriginal(), ClientEventType.MARK_A_CARD);
|
||||
markedCard = ((MageCard)obj);
|
||||
markedCard.setSelected(true);
|
||||
repaint();
|
||||
|
|
|
@ -70,7 +70,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
if (card.isSelected()) {
|
||||
stack.set(i, null);
|
||||
removeCardView(card);
|
||||
eventSource.removeSpecificCard(card, "remove-specific-card");
|
||||
eventSource.fireEvent(card, ClientEventType.REMOVE_SPECIFIC_CARD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
for (CardView card : cards) {
|
||||
card.setSelected(true);
|
||||
addCardView(card, false);
|
||||
eventSource.addSpecificCard(card, "add-specific-card");
|
||||
eventSource.fireEvent(card, ClientEventType.ADD_SPECIFIC_CARD);
|
||||
}
|
||||
layoutGrid();
|
||||
cardContent.repaint();
|
||||
|
@ -381,7 +381,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
for (int i = 0; i < stack.size(); ++i) {
|
||||
CardView card = stack.get(i);
|
||||
if (card.isSelected()) {
|
||||
eventSource.removeSpecificCard(card, "remove-specific-card");
|
||||
eventSource.fireEvent(card, ClientEventType.REMOVE_SPECIFIC_CARD);
|
||||
stack.set(i, null);
|
||||
removeCardView(card);
|
||||
}
|
||||
|
@ -1497,7 +1497,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
if (acard.getName().equals(card.getName())) {
|
||||
CardView pimpedCard = new CardView(acard);
|
||||
addCardView(pimpedCard, false);
|
||||
eventSource.addSpecificCard(pimpedCard, "add-specific-card");
|
||||
eventSource.fireEvent(pimpedCard, ClientEventType.ADD_SPECIFIC_CARD);
|
||||
pimpedCards.put(pimpedCard, 1);
|
||||
didModify = true;
|
||||
}
|
||||
|
@ -1748,9 +1748,9 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
if (e.getClickCount() == 1) {
|
||||
cardClicked(card, e);
|
||||
} else if (e.isAltDown()) {
|
||||
eventSource.altDoubleClick(card, "alt-double-click");
|
||||
eventSource.fireEvent(card, ClientEventType.ALT_DOUBLE_CLICK);
|
||||
} else {
|
||||
eventSource.doubleClick(card, "double-click");
|
||||
eventSource.fireEvent(card, ClientEventType.DOUBLE_CLICK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1776,7 +1776,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
|||
|
||||
if (duplicated) {
|
||||
sortIntoGrid(card);
|
||||
eventSource.addSpecificCard(card, "add-specific-card");
|
||||
eventSource.fireEvent(card, ClientEventType.ADD_SPECIFIC_CARD);
|
||||
// Update layout
|
||||
layoutGrid();
|
||||
// Update draw
|
||||
|
|
|
@ -32,10 +32,6 @@
|
|||
*/
|
||||
package mage.client.deckeditor;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.swing.*;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckCardLayout;
|
||||
|
@ -43,12 +39,18 @@ import mage.client.cards.BigCard;
|
|||
import mage.client.cards.CardEventSource;
|
||||
import mage.client.cards.DragCardGrid;
|
||||
import mage.client.constants.Constants.DeckEditorMode;
|
||||
import mage.client.util.ClientEventType;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.Listener;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CardsView;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -124,8 +126,8 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
// Add to hidden and move to sideboard
|
||||
for (CardView card : cards) {
|
||||
hiddenCards.add(card.getId());
|
||||
maindeckVirtualEvent.removeSpecificCard(card, "remove-specific-card");
|
||||
sideboardVirtualEvent.addSpecificCard(card, "add-specific-card");
|
||||
maindeckVirtualEvent.fireEvent(card, ClientEventType.REMOVE_SPECIFIC_CARD);
|
||||
sideboardVirtualEvent.fireEvent(card, ClientEventType.ADD_SPECIFIC_CARD);
|
||||
}
|
||||
loadDeck(lastDeck, lastBigCard);
|
||||
}
|
||||
|
|
|
@ -27,23 +27,6 @@
|
|||
*/
|
||||
package mage.client.deckeditor;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.swing.*;
|
||||
import javax.swing.Timer;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Sets;
|
||||
import mage.cards.decks.Deck;
|
||||
|
@ -72,6 +55,18 @@ import mage.view.CardView;
|
|||
import mage.view.SimpleCardView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.Timer;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
@ -280,11 +275,11 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
component.clearCardEventListeners();
|
||||
component.addCardEventListener(
|
||||
(Listener<Event>) event -> {
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
switch (event.getEventType()) {
|
||||
case DOUBLE_CLICK:
|
||||
moveSelectorCardToDeck(event);
|
||||
break;
|
||||
case "alt-double-click":
|
||||
case ALT_DOUBLE_CLICK:
|
||||
if (mode == DeckEditorMode.FREE_BUILDING) {
|
||||
moveSelectorCardToSideboard(event);
|
||||
} else {
|
||||
|
@ -292,10 +287,10 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
moveSelectorCardToDeck(event);
|
||||
}
|
||||
break;
|
||||
case "remove-main":
|
||||
case REMOVE_MAIN:
|
||||
DeckEditorPanel.this.deckArea.getDeckList().removeSelection();
|
||||
break;
|
||||
case "remove-sideboard":
|
||||
case REMOVE_SIDEBOARD:
|
||||
DeckEditorPanel.this.deckArea.getSideboardList().removeSelection();
|
||||
break;
|
||||
}
|
||||
|
@ -306,8 +301,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
this.deckArea.addDeckEventListener(
|
||||
(Listener<Event>) event -> {
|
||||
if (mode == DeckEditorMode.FREE_BUILDING) {
|
||||
switch (event.getEventName()) {
|
||||
case "double-click": {
|
||||
switch (event.getEventType()) {
|
||||
case DOUBLE_CLICK: {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
|
@ -319,7 +314,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
refreshDeck();
|
||||
break;
|
||||
}
|
||||
case "alt-double-click": {
|
||||
case ALT_DOUBLE_CLICK: {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
|
@ -332,11 +327,11 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
refreshDeck();
|
||||
break;
|
||||
}
|
||||
case "set-number": {
|
||||
case SET_NUMBER: {
|
||||
setCardNumberToCardsList(event, deck.getCards());
|
||||
break;
|
||||
}
|
||||
case "remove-specific-card": {
|
||||
case REMOVE_SPECIFIC_CARD: {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
|
@ -347,7 +342,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case "add-specific-card": {
|
||||
case ADD_SPECIFIC_CARD: {
|
||||
SimpleCardView cardView = (CardView) event.getSource();
|
||||
deck.getCards().add(retrieveTemporaryCard(cardView));
|
||||
break;
|
||||
|
@ -355,9 +350,9 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
}
|
||||
} else {
|
||||
// constructing phase or sideboarding during match -> card goes always to sideboard
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
case "alt-double-click": {
|
||||
switch (event.getEventType()) {
|
||||
case DOUBLE_CLICK:
|
||||
case ALT_DOUBLE_CLICK: {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
|
@ -371,7 +366,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
refreshDeck();
|
||||
break;
|
||||
}
|
||||
case "remove-specific-card": {
|
||||
case REMOVE_SPECIFIC_CARD: {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
|
@ -382,7 +377,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case "add-specific-card": {
|
||||
case ADD_SPECIFIC_CARD: {
|
||||
SimpleCardView cardView = (CardView) event.getSource();
|
||||
deck.getCards().add(retrieveTemporaryCard(cardView));
|
||||
break;
|
||||
|
@ -395,8 +390,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
(Listener<Event>) event -> {
|
||||
if (mode == DeckEditorMode.FREE_BUILDING) {
|
||||
// normal edit mode
|
||||
switch (event.getEventName()) {
|
||||
case "double-click":
|
||||
switch (event.getEventType()) {
|
||||
case DOUBLE_CLICK:
|
||||
// remove card from sideboard (don't add it to deck)
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
|
@ -408,7 +403,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
hidePopup();
|
||||
refreshDeck();
|
||||
break;
|
||||
case "alt-double-click":
|
||||
case ALT_DOUBLE_CLICK:
|
||||
// remove card from sideboard
|
||||
cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
|
@ -421,11 +416,11 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
hidePopup();
|
||||
refreshDeck();
|
||||
break;
|
||||
case "set-number": {
|
||||
case SET_NUMBER: {
|
||||
setCardNumberToCardsList(event, deck.getSideboard());
|
||||
break;
|
||||
}
|
||||
case "remove-specific-card": {
|
||||
case REMOVE_SPECIFIC_CARD: {
|
||||
cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
|
@ -436,7 +431,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case "add-specific-card": {
|
||||
case ADD_SPECIFIC_CARD: {
|
||||
cardView = (CardView) event.getSource();
|
||||
deck.getSideboard().add(retrieveTemporaryCard(cardView));
|
||||
break;
|
||||
|
@ -444,8 +439,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
}
|
||||
} else {
|
||||
// construct phase or sideboarding during match
|
||||
switch (event.getEventName()) {
|
||||
case "remove-specific-card": {
|
||||
switch (event.getEventType()) {
|
||||
case REMOVE_SPECIFIC_CARD: {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
|
@ -456,13 +451,13 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case "add-specific-card": {
|
||||
case ADD_SPECIFIC_CARD: {
|
||||
SimpleCardView cardView = (CardView) event.getSource();
|
||||
deck.getSideboard().add(retrieveTemporaryCard(cardView));
|
||||
break;
|
||||
}
|
||||
case "double-click":
|
||||
case "alt-double-click":
|
||||
case DOUBLE_CLICK:
|
||||
case ALT_DOUBLE_CLICK:
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
|
|
|
@ -33,6 +33,7 @@ import mage.client.cards.CardEventSource;
|
|||
import mage.client.cards.ICardGrid;
|
||||
import mage.client.deckeditor.SortSetting;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.ClientEventType;
|
||||
import mage.client.util.Config;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.Listener;
|
||||
|
@ -146,7 +147,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
}
|
||||
|
||||
// no easy logic for merge :)
|
||||
for (Iterator<Entry<UUID, CardView>> i = cards.entrySet().iterator(); i.hasNext();) {
|
||||
for (Iterator<Entry<UUID, CardView>> i = cards.entrySet().iterator(); i.hasNext(); ) {
|
||||
Entry<UUID, CardView> entry = i.next();
|
||||
if (!showCards.containsKey(entry.getKey())) {
|
||||
i.remove();
|
||||
|
@ -306,25 +307,25 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
|
||||
public void setNumber(int index, int number) {
|
||||
CardView card = view.get(index);
|
||||
cardEventSource.setNumber(card, "set-number", number);
|
||||
cardEventSource.fireEvent(card, ClientEventType.SET_NUMBER, number);
|
||||
}
|
||||
|
||||
public void doubleClick(int index) {
|
||||
CardView card = view.get(index);
|
||||
cardEventSource.doubleClick(card, "double-click");
|
||||
cardEventSource.fireEvent(card, ClientEventType.DOUBLE_CLICK);
|
||||
}
|
||||
|
||||
public void altDoubleClick(int index) {
|
||||
CardView card = view.get(index);
|
||||
cardEventSource.altDoubleClick(card, "alt-double-click");
|
||||
cardEventSource.fireEvent(card, ClientEventType.ALT_DOUBLE_CLICK);
|
||||
}
|
||||
|
||||
public void removeFromMainEvent(int index) {
|
||||
cardEventSource.removeFromMainEvent("remove-main");
|
||||
cardEventSource.fireEvent(ClientEventType.REMOVE_MAIN);
|
||||
}
|
||||
|
||||
public void removeFromSideEvent(int index) {
|
||||
cardEventSource.removeFromSideboardEvent("remove-sideboard");
|
||||
cardEventSource.fireEvent(ClientEventType.REMOVE_SIDEBOARD);
|
||||
}
|
||||
|
||||
public void addListeners(final JTable table) {
|
||||
|
|
|
@ -33,9 +33,25 @@
|
|||
*/
|
||||
package mage.client.draft;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Image;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.client.components.tray.MageTray;
|
||||
import mage.client.deckeditor.SortSettingDraft;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.*;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.view.*;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.Timer;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
@ -46,43 +62,7 @@ import java.nio.file.Files;
|
|||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.Timer;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.SessionHandler;
|
||||
import mage.client.components.tray.MageTray;
|
||||
import mage.client.deckeditor.SortSettingDraft;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.CardsViewUtil;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.ImageHelper;
|
||||
import mage.client.util.Listener;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.gui.BufferedImageBuilder;
|
||||
import mage.constants.PlayerAction;
|
||||
import mage.view.CardsView;
|
||||
import mage.view.DraftPickView;
|
||||
import mage.view.DraftView;
|
||||
import mage.view.SimpleCardView;
|
||||
import mage.view.SimpleCardsView;
|
||||
import mage.view.UserRequestMessage;
|
||||
import org.apache.log4j.Logger;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -304,7 +284,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
|
||||
this.draftPicks.clearCardEventListeners();
|
||||
this.draftPicks.addCardEventListener((Listener<Event>) event -> {
|
||||
if (event.getEventName().equals("show-popup-menu")) {
|
||||
if (event.getEventType() == ClientEventType.SHOW_POP_UP_MENU) {
|
||||
if (event.getSource() != null) {
|
||||
// Popup Menu Card
|
||||
cardIdPopupMenu = ((SimpleCardView) event.getSource()).getId();
|
||||
|
@ -322,7 +302,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
this.draftBooster.clearCardEventListeners();
|
||||
this.draftBooster.addCardEventListener(
|
||||
(Listener<Event>) event -> {
|
||||
if (event.getEventName().equals("pick-a-card")) {
|
||||
if (event.getEventType() == ClientEventType.PICK_A_CARD) {
|
||||
SimpleCardView source = (SimpleCardView) event.getSource();
|
||||
DraftPickView view = SessionHandler.sendCardPick(draftId, source.getId(), cardsHidden);
|
||||
if (view != null) {
|
||||
|
@ -332,7 +312,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
setMessage("Waiting for other players");
|
||||
}
|
||||
}
|
||||
if (event.getEventName().equals("mark-a-card")) {
|
||||
if (event.getEventType() == ClientEventType.MARK_A_CARD) {
|
||||
SimpleCardView source = (SimpleCardView) event.getSource();
|
||||
SessionHandler.sendCardMark(draftId, source.getId());
|
||||
}
|
||||
|
|
|
@ -27,61 +27,6 @@
|
|||
*/
|
||||
package mage.client.game;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import static java.awt.Component.LEFT_ALIGNMENT;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.KeyStroke;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.Timer;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.plaf.basic.BasicSplitPaneDivider;
|
||||
import javax.swing.plaf.basic.BasicSplitPaneUI;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.choices.Choice;
|
||||
|
@ -95,51 +40,43 @@ import mage.client.components.KeyboundButton;
|
|||
import mage.client.components.MageComponents;
|
||||
import mage.client.components.ext.dlg.DialogManager;
|
||||
import mage.client.components.layout.RelativeLayout;
|
||||
import mage.client.dialog.CardInfoWindowDialog;
|
||||
import mage.client.dialog.*;
|
||||
import mage.client.dialog.CardInfoWindowDialog.ShowType;
|
||||
import mage.client.dialog.PickChoiceDialog;
|
||||
import mage.client.dialog.PickNumberDialog;
|
||||
import mage.client.dialog.PickPileDialog;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import static mage.client.dialog.PreferencesDialog.*;
|
||||
import mage.client.dialog.ShowCardsDialog;
|
||||
import mage.client.game.FeedbackPanel.FeedbackMode;
|
||||
import mage.client.plugins.adapters.MageActionCallback;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.CardsViewUtil;
|
||||
import mage.client.util.*;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.GUISizeHelper;
|
||||
import mage.client.util.GameManager;
|
||||
import mage.client.util.Listener;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.client.util.gui.MageDialogState;
|
||||
import mage.constants.Constants;
|
||||
import mage.constants.EnlargeMode;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.PlayerAction;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_ABILITY_FIRST;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_ABILITY_LAST;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_NAME_FIRST;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_NAME_LAST;
|
||||
import static mage.constants.PlayerAction.TRIGGER_AUTO_ORDER_RESET_ALL;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.events.PlayerQueryEvent;
|
||||
import mage.view.AbilityPickerView;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CardsView;
|
||||
import mage.view.ExileView;
|
||||
import mage.view.GameView;
|
||||
import mage.view.LookedAtView;
|
||||
import mage.view.MatchView;
|
||||
import mage.view.PlayerView;
|
||||
import mage.view.RevealedView;
|
||||
import mage.view.SimpleCardsView;
|
||||
import mage.view.UserRequestMessage;
|
||||
import mage.view.*;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.CardPanel;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.Timer;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.LineBorder;
|
||||
import javax.swing.plaf.basic.BasicSplitPaneDivider;
|
||||
import javax.swing.plaf.basic.BasicSplitPaneUI;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static mage.client.dialog.PreferencesDialog.*;
|
||||
import static mage.constants.PlayerAction.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com, nantuko8
|
||||
*/
|
||||
|
@ -2251,7 +2188,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
// Event listener for the ShowCardsDialog
|
||||
private Listener<Event> getShowCardsEventListener(final ShowCardsDialog dialog) {
|
||||
return (Listener<Event>) event -> {
|
||||
if (event.getEventName().equals("show-popup-menu")) {
|
||||
if (event.getEventType() == ClientEventType.SHOW_POP_UP_MENU) {
|
||||
if (event.getComponent() != null && event.getComponent() instanceof CardPanel) {
|
||||
JPopupMenu menu = ((CardPanel) event.getComponent()).getPopupMenu();
|
||||
if (menu != null) {
|
||||
|
@ -2260,7 +2197,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (event.getEventName().equals("action-consumed")) {
|
||||
if (event.getEventType() == ClientEventType.ACTION_CONSUMED) {
|
||||
dialog.removeDialog();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -28,11 +28,9 @@
|
|||
|
||||
package mage.client.table;
|
||||
|
||||
import mage.client.util.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.EventDispatcher;
|
||||
import mage.client.util.EventSource;
|
||||
import mage.client.util.Listener;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -48,7 +46,7 @@ public class PlayerTypeEventSource implements EventSource<Event>, Serializable {
|
|||
}
|
||||
|
||||
public void playerTypeChanged() {
|
||||
dispatcher.fireEvent(new Event(null, "playerTypeChanged"));
|
||||
dispatcher.fireEvent(new Event(null, ClientEventType.PLAYER_TYPE_CHANGED));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package mage.client.util;
|
||||
|
||||
public enum ClientEventType {
|
||||
SET_NUMBER,
|
||||
ACTION_CONSUMED,
|
||||
DOUBLE_CLICK,
|
||||
ALT_DOUBLE_CLICK,
|
||||
REMOVE_MAIN,
|
||||
REMOVE_SIDEBOARD,
|
||||
SHOW_POP_UP_MENU,
|
||||
REMOVE_SPECIFIC_CARD,
|
||||
ADD_SPECIFIC_CARD,
|
||||
PICK_A_CARD,
|
||||
MARK_A_CARD,
|
||||
PLAYER_TYPE_CHANGED
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -38,27 +38,27 @@ import java.io.Serializable;
|
|||
public class Event implements Serializable {
|
||||
private final Object source;
|
||||
private final Component component;
|
||||
private final String eventName;
|
||||
private final ClientEventType eventType;
|
||||
private final int number;
|
||||
private final int xPos;
|
||||
private final int yPos;
|
||||
|
||||
public Event(Object source, String eventName) {
|
||||
this(source, eventName, 0);
|
||||
public Event(Object source, ClientEventType eventType) {
|
||||
this(source, eventType, 0);
|
||||
}
|
||||
|
||||
public Event(Object source, String eventName, int number) {
|
||||
public Event(Object source, ClientEventType eventType, int number) {
|
||||
this.source = source;
|
||||
this.eventName = eventName;
|
||||
this.eventType = eventType;
|
||||
this.number = number;
|
||||
this.xPos = 0;
|
||||
this.yPos = 0;
|
||||
this.component = null;
|
||||
}
|
||||
|
||||
public Event(Object source, String eventName, int xPos, int yPos, Component component) {
|
||||
public Event(Object source, ClientEventType eventType, int xPos, int yPos, Component component) {
|
||||
this.source = source;
|
||||
this.eventName = eventName;
|
||||
this.eventType = eventType;
|
||||
this.number =0;
|
||||
this.xPos = xPos;
|
||||
this.yPos = yPos;
|
||||
|
@ -69,8 +69,8 @@ public class Event implements Serializable {
|
|||
return source;
|
||||
}
|
||||
|
||||
public String getEventName() {
|
||||
return eventName;
|
||||
public ClientEventType getEventType() {
|
||||
return eventType;
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
|
|
Loading…
Reference in a new issue