mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
fixed Issue 52
This commit is contained in:
parent
aad92334aa
commit
4862053a25
4 changed files with 41 additions and 4 deletions
|
|
@ -52,6 +52,10 @@ public class CardEventSource implements EventSource<Event>, Serializable {
|
|||
dispatcher.fireEvent(new Event(cardId, message));
|
||||
}
|
||||
|
||||
public void shiftDoubleClick(UUID cardId, String message) {
|
||||
dispatcher.fireEvent(new Event(cardId, message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearListeners() {
|
||||
dispatcher.clearListeners();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" pref="636" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" pref="325" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
<Group type="102" attributes="0">
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="366" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="23" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
|
|||
|
|
@ -314,9 +314,15 @@ public class CardsList extends javax.swing.JPanel implements MouseListener {
|
|||
e.consume();
|
||||
Object obj = e.getSource();
|
||||
if (obj instanceof Card) {
|
||||
cardEventSource.doubleClick(((Card)obj).getCardId(), "double-click");
|
||||
if (e.isShiftDown())
|
||||
cardEventSource.shiftDoubleClick(((Card)obj).getCardId(), "shift-double-click");
|
||||
else
|
||||
cardEventSource.doubleClick(((Card)obj).getCardId(), "double-click");
|
||||
} else if (obj instanceof MageCard) {
|
||||
cardEventSource.doubleClick(((MageCard)obj).getOriginal().getId(), "double-click");
|
||||
if (e.isShiftDown())
|
||||
cardEventSource.shiftDoubleClick(((MageCard)obj).getOriginal().getId(), "shift-double-click");
|
||||
else
|
||||
cardEventSource.doubleClick(((MageCard)obj).getOriginal().getId(), "double-click");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,6 +187,33 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
}
|
||||
refreshDeck();
|
||||
}
|
||||
else if (event.getEventName().equals("shift-double-click") && mode == DeckEditorMode.Constructed) {
|
||||
for (Card card: deck.getCards()) {
|
||||
if (card.getId().equals((UUID)event.getSource())) {
|
||||
deck.getCards().remove(card);
|
||||
deck.getSideboard().add(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
refreshDeck();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
this.deckArea.addSideboardEventListener(
|
||||
new Listener<Event> () {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("double-click")) {
|
||||
for (Card card: deck.getSideboard()) {
|
||||
if (card.getId().equals((UUID)event.getSource())) {
|
||||
deck.getSideboard().remove(card);
|
||||
deck.getCards().add(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
refreshDeck();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue