mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Merge
This commit is contained in:
commit
955e1c76b6
67 changed files with 2519 additions and 2658 deletions
|
|
@ -47,7 +47,6 @@ import mage.client.deckeditor.collection.viewer.CollectionViewerPane;
|
|||
import mage.client.dialog.*;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.EDTExceptionHandler;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.components.ImagePanel;
|
||||
|
||||
|
|
@ -109,7 +108,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private static Preferences prefs = Preferences.userNodeForPackage(MageFrame.class);
|
||||
private JLabel title;
|
||||
private Rectangle titleRectangle;
|
||||
private final static MageVersion version = new MageVersion(0, 7, 4, "");
|
||||
private final static MageVersion version = new MageVersion(0, 8, 0, "");
|
||||
private UUID clientId;
|
||||
private static MagePane activeFrame;
|
||||
private static boolean liteMode = false;
|
||||
|
|
@ -174,7 +173,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
|
||||
initComponents();
|
||||
setSize(1024, 768);
|
||||
SettingsManager.getInstance().setScreenWidthAndHeight(1024, 768);
|
||||
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||
|
||||
session = new Session(this);
|
||||
|
|
@ -201,6 +199,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
addMageLabel();
|
||||
setAppIcon();
|
||||
|
||||
//PlayerPanelNew n = new PlayerPanelNew();
|
||||
//n.setBounds(100,100,100,300);
|
||||
//n.setVisible(true);
|
||||
//backgroundPane.add(n);
|
||||
|
||||
desktopPane.add(ArrowBuilder.getArrowsPanel(), JLayeredPane.DRAG_LAYER);
|
||||
|
||||
desktopPane.addComponentListener(new ComponentAdapter() {
|
||||
|
|
@ -208,13 +211,12 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
public void componentResized(ComponentEvent e) {
|
||||
int width = ((JComponent) e.getSource()).getWidth();
|
||||
int height = ((JComponent) e.getSource()).getHeight();
|
||||
SettingsManager.getInstance().setScreenWidthAndHeight(width, height);
|
||||
if (!liteMode) {
|
||||
if (!liteMode)
|
||||
backgroundPane.setSize(width, height);
|
||||
}
|
||||
JPanel arrowsPanel = ArrowBuilder.getArrowsPanelRef();
|
||||
if (arrowsPanel != null) arrowsPanel.setSize(width, height);
|
||||
if (title != null) {
|
||||
//title.setBorder(BorderFactory.createLineBorder(Color.red));
|
||||
title.setBounds((int) (width - titleRectangle.getWidth()) / 2, (int) (height - titleRectangle.getHeight()) / 2, titleRectangle.width, titleRectangle.height);
|
||||
}
|
||||
}
|
||||
|
|
@ -759,8 +761,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}//GEN-LAST:event_btnCollectionViewerActionPerformed
|
||||
|
||||
private void btnPreferencesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPreferencesActionPerformed
|
||||
//PhasesDialog.main(new String[]{});
|
||||
PreferencesDialog.main(new String[]{});
|
||||
PhasesDialog.main(new String[]{});
|
||||
}//GEN-LAST:event_btnPreferencesActionPerformed
|
||||
|
||||
public void exitApp() {
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
if (cardInfoPane instanceof CardInfoPane) {
|
||||
((CardInfoPane)cardInfoPane).setCard(new CardView(card));
|
||||
}
|
||||
hidePopup();
|
||||
}
|
||||
|
||||
} else if (event.getEventName().equals("shift-double-click") && mode == DeckEditorMode.Constructed) {
|
||||
|
|
@ -182,7 +181,6 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
if (cardInfoPane instanceof CardInfoPane) {
|
||||
((CardInfoPane)cardInfoPane).setCard(new CardView(card));
|
||||
}
|
||||
hidePopup();
|
||||
}
|
||||
refreshDeck();
|
||||
}
|
||||
|
|
@ -196,7 +194,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
public void event(Event event) {
|
||||
if (event.getEventName().equals("double-click")) {
|
||||
for (Card card: deck.getCards()) {
|
||||
if (card.getId().equals(event.getSource())) {
|
||||
if (card.getId().equals((UUID)event.getSource())) {
|
||||
deck.getCards().remove(card);
|
||||
if (mode == DeckEditorMode.Limited || mode == DeckEditorMode.Sideboard) {
|
||||
deck.getSideboard().add(card);
|
||||
|
|
@ -205,18 +203,16 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
}
|
||||
else if (event.getEventName().equals("shift-double-click") && mode == DeckEditorMode.Constructed) {
|
||||
for (Card card: deck.getCards()) {
|
||||
if (card.getId().equals(event.getSource())) {
|
||||
if (card.getId().equals((UUID)event.getSource())) {
|
||||
deck.getCards().remove(card);
|
||||
deck.getSideboard().add(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
}
|
||||
}
|
||||
|
|
@ -227,14 +223,16 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("double-click")) {
|
||||
//boolean isListView = cardSelector.getCardsList() instanceof TableModel;
|
||||
for (Card card: deck.getSideboard()) {
|
||||
if (card.getId().equals(event.getSource())) {
|
||||
if (card.getId().equals((UUID)event.getSource())) {
|
||||
deck.getSideboard().remove(card);
|
||||
//if (!isListView) {
|
||||
deck.getCards().add(card);
|
||||
//}
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
}
|
||||
}
|
||||
|
|
@ -245,10 +243,6 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
this.repaint();
|
||||
}
|
||||
|
||||
private void hidePopup() {
|
||||
Plugins.getInstance().getActionCallback().mouseExited(null, null);
|
||||
}
|
||||
|
||||
public void hideDeckEditor() {
|
||||
Component c = this.getParent();
|
||||
while (c != null && !(c instanceof DeckEditorPane)) {
|
||||
|
|
@ -585,26 +579,27 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
int ret = fcImportDeck.showOpenDialog(this);
|
||||
if (ret == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fcImportDeck.getSelectedFile();
|
||||
try {
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
DeckImporter importer = getDeckImporter(file.getPath());
|
||||
if (importer != null) {
|
||||
deck = Deck.load(importer.importDeck(file.getPath()));
|
||||
if (file != null) {
|
||||
try {
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
DeckImporter importer = getDeckImporter(file.getPath());
|
||||
if (importer != null) {
|
||||
deck = Deck.load(importer.importDeck(file.getPath()));
|
||||
}
|
||||
else {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Unknown deck format", "Error importing deck", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(DeckEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
else {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Unknown deck format", "Error importing deck", JOptionPane.ERROR_MESSAGE);
|
||||
finally {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(DeckEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
finally {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
refreshDeck();
|
||||
try {
|
||||
if (file != null)
|
||||
refreshDeck();
|
||||
try {
|
||||
MageFrame.getPreferences().put("lastImportFolder", file.getCanonicalPath());
|
||||
} catch (IOException ex) { }
|
||||
} catch (IOException ex) { }
|
||||
}
|
||||
}
|
||||
fcImportDeck.setSelectedFile(null);
|
||||
}//GEN-LAST:event_btnImportActionPerformed
|
||||
|
|
|
|||
|
|
@ -80,9 +80,6 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
public void run() {
|
||||
try {
|
||||
logger.info(callback.getMessageId() + " -- " + callback.getMethod());
|
||||
if (callback.getMethod() == null) { // may happen on disconnect
|
||||
return;
|
||||
}
|
||||
if (callback.getMethod().equals("startGame")) {
|
||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||
GameManager.getInstance().setCurrentPlayerUUID(message.getPlayerId());
|
||||
|
|
@ -247,7 +244,10 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
}
|
||||
}
|
||||
else if (callback.getMethod().equals("draftInit")) {
|
||||
|
||||
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
||||
DraftPanel panel = frame.getDraft(callback.getObjectId());
|
||||
if (panel != null)
|
||||
panel.loadBooster(message.getDraftPickView());
|
||||
}
|
||||
else if (callback.getMethod().equals("tournamentInit")) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue