mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Added junit test that starts Mage.Client and starts 10 games in a row. Minor fixes. Client is maximized now.
This commit is contained in:
parent
9c3ff863e8
commit
8b77a67574
9 changed files with 46 additions and 10 deletions
|
|
@ -62,6 +62,13 @@
|
|||
<artifactId>jetlang</artifactId>
|
||||
<version>0.2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<type>jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -35,10 +35,13 @@
|
|||
package mage.client;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
|
@ -48,6 +51,7 @@ import java.util.prefs.Preferences;
|
|||
import javax.swing.Box;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDesktopPane;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JLayeredPane;
|
||||
import javax.swing.JOptionPane;
|
||||
|
|
@ -58,6 +62,7 @@ import javax.swing.plaf.synth.SynthLookAndFeel;
|
|||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.components.MageSynthStyleFactory;
|
||||
import mage.client.dialog.AboutDialog;
|
||||
import mage.client.dialog.CombatDialog;
|
||||
|
|
@ -115,8 +120,8 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
|
||||
try {
|
||||
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
|
||||
MageSynthStyleFactory f = new MageSynthStyleFactory(SynthLookAndFeel.getStyleFactory());
|
||||
SynthLookAndFeel.setStyleFactory(f);
|
||||
//MageSynthStyleFactory f = new MageSynthStyleFactory(SynthLookAndFeel.getStyleFactory());
|
||||
//SynthLookAndFeel.setStyleFactory(f);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
|
@ -124,6 +129,8 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
Plugins.getInstance().loadPlugins();
|
||||
|
||||
initComponents();
|
||||
setSize(1024,768);
|
||||
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||
|
||||
session = new Session(this);
|
||||
connectDialog = new ConnectDialog();
|
||||
|
|
@ -179,6 +186,8 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
label.setForeground(Color.white);
|
||||
label.setBounds(0, 0, 180, 30);
|
||||
}
|
||||
|
||||
session.getUI().addButton(MageComponents.TABLES_MENU_BUTTON, btnGames);
|
||||
}
|
||||
|
||||
private void btnImagesActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
|
@ -268,7 +277,7 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
lblStatus = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
setMinimumSize(new java.awt.Dimension(1024, 768));
|
||||
//setMinimumSize(new java.awt.Dimension(1024, 768));
|
||||
|
||||
desktopPane.setBackground(new java.awt.Color(204, 204, 204));
|
||||
tablesPane.setBounds(20, 10, 560, 440);
|
||||
|
|
@ -417,7 +426,7 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
aboutDialog.showDialog();
|
||||
}//GEN-LAST:event_btnAboutActionPerformed
|
||||
|
||||
private void exitApp() {
|
||||
public void exitApp() {
|
||||
session.disconnect();
|
||||
Plugins.getInstance().shutdown();
|
||||
dispose();
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import javax.swing.SpinnerNumberModel;
|
|||
import mage.Constants.MultiplayerAttackOption;
|
||||
import mage.Constants.RangeOfInfluence;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.remote.Session;
|
||||
import mage.client.table.TablePlayerPanel;
|
||||
import mage.client.util.Event;
|
||||
|
|
@ -371,6 +372,7 @@ public class NewTableDialog extends MageDialog {
|
|||
|
||||
public void showDialog(UUID roomId) {
|
||||
session = MageFrame.getSession();
|
||||
session.getUI().addButton(MageComponents.NEW_TABLE_OK_BUTTON, btnOK);
|
||||
this.player1Panel.setPlayerName(session.getUserName());
|
||||
cbGameType.setModel(new DefaultComboBoxModel(session.getGameTypes().toArray()));
|
||||
cbDeckType.setModel(new DefaultComboBoxModel(session.getDeckTypes()));
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import java.util.logging.Logger;
|
|||
import javax.swing.Timer;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import mage.Constants.TableState;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.remote.Session;
|
||||
import mage.util.Logging;
|
||||
import mage.view.SeatView;
|
||||
|
|
@ -72,6 +73,7 @@ public class TableWaitingDialog extends MageDialog implements Observer {
|
|||
initComponents();
|
||||
|
||||
tableSeats.createDefaultColumnsFromModel();
|
||||
session.getUI().addButton(MageComponents.TABLE_WAITING_START_BUTTON, btnStart);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -280,15 +280,20 @@ public class GamePanel extends javax.swing.JPanel {
|
|||
this.txtPriority.setText(game.getPriorityPlayerName());
|
||||
this.txtTurn.setText(Integer.toString(game.getTurn()));
|
||||
for (PlayerView player: game.getPlayers()) {
|
||||
if (player != null) {
|
||||
//if (player != null) {
|
||||
if (players.containsKey(player.getPlayerId())) {
|
||||
players.get(player.getPlayerId()).update(player);
|
||||
} else {
|
||||
logger.warning("Couldn't find player.");
|
||||
logger.warning(" uuid:" + player.getPlayerId());
|
||||
logger.warning(" players:");
|
||||
for (PlayAreaPanel p : players.values()) {
|
||||
logger.warning(""+p);
|
||||
}
|
||||
} else {
|
||||
logger.warning("Player object is null.");
|
||||
}
|
||||
//} else {
|
||||
//logger.warning("Player object is null.");
|
||||
//}
|
||||
}
|
||||
|
||||
this.stack.loadCards(game.getStack(), bigCard, gameId);
|
||||
|
|
|
|||
|
|
@ -68,11 +68,13 @@ public class Plugins implements MagePlugins {
|
|||
|
||||
@Override
|
||||
public void updateGamePanel(Map<String, JComponent> ui) {
|
||||
if (themePlugin == null) return;
|
||||
themePlugin.applyInGame(ui);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent updateTablePanel(Map<String, JComponent> ui) {
|
||||
if (themePlugin == null) return null;
|
||||
return themePlugin.updateTable(ui);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.client.remote;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.rmi.NotBoundException;
|
||||
import java.rmi.RemoteException;
|
||||
import java.rmi.registry.LocateRegistry;
|
||||
|
|
@ -45,6 +46,8 @@ import mage.Constants.RangeOfInfluence;
|
|||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.components.MageUI;
|
||||
import mage.client.game.GamePanel;
|
||||
import mage.client.util.Config;
|
||||
import mage.game.GameException;
|
||||
|
|
@ -73,6 +76,7 @@ public class Session {
|
|||
private Map<UUID, ChatPanel> chats = new HashMap<UUID, ChatPanel>();
|
||||
private GamePanel game;
|
||||
private CallbackClientDaemon callbackDaemon;
|
||||
private MageUI ui = new MageUI();
|
||||
|
||||
public Session(MageFrame frame) {
|
||||
this.frame = frame;
|
||||
|
|
@ -551,4 +555,7 @@ public class Session {
|
|||
return userName;
|
||||
}
|
||||
|
||||
public MageUI getUI() {
|
||||
return ui;
|
||||
}
|
||||
}
|
||||
|
|
@ -67,7 +67,6 @@ public class TablesPane extends MagePane {
|
|||
if (container != null) {
|
||||
initComponents(container);
|
||||
container.add(tablesPanel);
|
||||
//ui.get("jScrollPane1ViewPort").setBackground(new Color(20,20,20,50));
|
||||
container.setOpaque(false);
|
||||
initialized = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
package mage.client.table;
|
||||
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.dialog.NewTableDialog;
|
||||
import mage.client.dialog.JoinTableDialog;
|
||||
import mage.client.dialog.TableWaitingDialog;
|
||||
|
|
@ -184,6 +185,8 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
|||
else {
|
||||
hideTables();
|
||||
}
|
||||
|
||||
session.getUI().addButton(MageComponents.NEW_GAME_BUTTON, btnNewTable);
|
||||
}
|
||||
|
||||
public void hideTables() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue