forked from External/mage
Create new "custom options" button/dialog, consolidate game-modifying options there (#10768)
* create CustomOptionsDialog; update NewTournamentDialog to use it * add custom options button to new table/tournament dialogs * fix buffer time in new table dialog * further UI improvements - move multiplayer options back out to NewTableDialog - hide multiplayer options when all are disabled - rearrange other options for consistency * update button label to show number of active custom options * remove commented-out code
This commit is contained in:
parent
00340a3bda
commit
722627baa2
6 changed files with 943 additions and 661 deletions
|
|
@ -23,6 +23,7 @@ import org.apache.log4j.Logger;
|
|||
import javax.swing.*;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ public class NewTableDialog extends MageDialog {
|
|||
|
||||
private static final Logger logger = Logger.getLogger(NewTableDialog.class);
|
||||
|
||||
private CustomOptionsDialog customOptions;
|
||||
private TableView table;
|
||||
private UUID playerId;
|
||||
private UUID roomId;
|
||||
|
|
@ -50,9 +52,10 @@ public class NewTableDialog extends MageDialog {
|
|||
public NewTableDialog() {
|
||||
lastSessionId = "";
|
||||
initComponents();
|
||||
this.customOptions = new CustomOptionsDialog(CustomOptionsDialog.SaveLoadKeys.TABLE, btnCustomOptions);
|
||||
MageFrame.getDesktop().add(customOptions, JLayeredPane.MODAL_LAYER);
|
||||
player1Panel.showLevel(false);
|
||||
this.spnNumWins.setModel(new SpinnerNumberModel(1, 1, 5, 1));
|
||||
this.spnFreeMulligans.setModel(new SpinnerNumberModel(0, 0, 5, 1));
|
||||
this.spnQuitRatio.setModel(new SpinnerNumberModel(100, 0, 100, 5));
|
||||
this.spnMinimumRating.setModel(new SpinnerNumberModel(0, 0, 3000, 10));
|
||||
this.spnEdhPowerLevel.setModel(new SpinnerNumberModel(100, 0, 100, 5));
|
||||
|
|
@ -91,16 +94,9 @@ public class NewTableDialog extends MageDialog {
|
|||
lblGameType = new javax.swing.JLabel();
|
||||
cbGameType = new javax.swing.JComboBox();
|
||||
chkRollbackTurnsAllowed = new javax.swing.JCheckBox();
|
||||
lblFreeMulligans = new javax.swing.JLabel();
|
||||
chkSpectatorsAllowed = new javax.swing.JCheckBox();
|
||||
chkPlaneChase = new javax.swing.JCheckBox();
|
||||
spnFreeMulligans = new javax.swing.JSpinner();
|
||||
lblNumPlayers = new javax.swing.JLabel();
|
||||
spnNumPlayers = new javax.swing.JSpinner();
|
||||
lblRange = new javax.swing.JLabel();
|
||||
cbRange = new javax.swing.JComboBox();
|
||||
lblAttack = new javax.swing.JLabel();
|
||||
cbAttackOption = new javax.swing.JComboBox();
|
||||
lblSkillLevel = new javax.swing.JLabel();
|
||||
cbSkillLevel = new javax.swing.JComboBox();
|
||||
lblNumWins = new javax.swing.JLabel();
|
||||
|
|
@ -118,14 +114,17 @@ public class NewTableDialog extends MageDialog {
|
|||
spnQuitRatio = new javax.swing.JSpinner();
|
||||
lblEdhPowerLevel = new javax.swing.JLabel();
|
||||
spnEdhPowerLevel = new javax.swing.JSpinner();
|
||||
cbMulligan = new javax.swing.JComboBox<>();
|
||||
lblMullgian = new javax.swing.JLabel();
|
||||
lblMinimumRating = new javax.swing.JLabel();
|
||||
spnMinimumRating = new javax.swing.JSpinner();
|
||||
chkRated = new javax.swing.JCheckBox();
|
||||
btnSettingsLoad = new javax.swing.JButton();
|
||||
btnSettingsSave = new javax.swing.JButton();
|
||||
lblSettings = new javax.swing.JLabel();
|
||||
btnCustomOptions = new javax.swing.JButton();
|
||||
lblRange = new javax.swing.JLabel();
|
||||
cbRange = new javax.swing.JComboBox();
|
||||
lblAttack = new javax.swing.JLabel();
|
||||
cbAttackOption = new javax.swing.JComboBox();
|
||||
|
||||
menuSaveSettings1.setText("Save to config 1");
|
||||
menuSaveSettings1.addActionListener(new java.awt.event.ActionListener() {
|
||||
|
|
@ -209,16 +208,9 @@ public class NewTableDialog extends MageDialog {
|
|||
chkRollbackTurnsAllowed.setText("Rollbacks");
|
||||
chkRollbackTurnsAllowed.setToolTipText("<HTML>Allow to rollback to the start of previous turns<br>\nif all players agree.\n");
|
||||
|
||||
lblFreeMulligans.setLabelFor(spnFreeMulligans);
|
||||
lblFreeMulligans.setText("Free Mulligans:");
|
||||
lblFreeMulligans.setToolTipText("The number of mulligans a player can use without decreasing the number of drawn cards.");
|
||||
|
||||
chkSpectatorsAllowed.setText("Spectators allowed");
|
||||
chkSpectatorsAllowed.setToolTipText("Allow spectators to view your game.");
|
||||
|
||||
chkPlaneChase.setText("PlaneChase");
|
||||
chkPlaneChase.setToolTipText("Use the PlaneChase variant for your game.");
|
||||
|
||||
lblNumPlayers.setLabelFor(spnNumPlayers);
|
||||
lblNumPlayers.setText("Players:");
|
||||
|
||||
|
|
@ -228,17 +220,6 @@ public class NewTableDialog extends MageDialog {
|
|||
}
|
||||
});
|
||||
|
||||
lblRange.setLabelFor(cbRange);
|
||||
lblRange.setText("Range of Influence:");
|
||||
|
||||
cbRange.setToolTipText("<HTML>An option for multiplayer games.\nA player's range of influence is the maximum distance from that player, measured in player seats,<br>\nthat the player can affect. Players within that many seats of the player are within that player's range<br>\nof influence. Objects controlled by players within a player's range of influence are also within that<br>\nplayer's range of influence. Range of influence covers spells, abilities, effects, damage dealing, attacking,<nr>\nmaking choices, and winning the game.");
|
||||
|
||||
lblAttack.setLabelFor(cbAttackOption);
|
||||
lblAttack.setText("Attack Option:");
|
||||
|
||||
cbAttackOption.setToolTipText("<HTML>An option for multiplayer games that defines<br>\nwhich opponents can be attacked from a player.");
|
||||
|
||||
lblSkillLevel.setLabelFor(cbAttackOption);
|
||||
lblSkillLevel.setText("Skill Level:");
|
||||
lblSkillLevel.setToolTipText("");
|
||||
|
||||
|
|
@ -274,12 +255,6 @@ public class NewTableDialog extends MageDialog {
|
|||
|
||||
lblEdhPowerLevel.setText("EDH power level:");
|
||||
|
||||
cbMulligan.setToolTipText("Selections the type of mulligan for games.");
|
||||
|
||||
lblMullgian.setLabelFor(cbMulligan);
|
||||
lblMullgian.setText("Mulligan type:");
|
||||
lblMullgian.setToolTipText("What style of mulligan?");
|
||||
|
||||
lblMinimumRating.setLabelFor(spnMinimumRating);
|
||||
lblMinimumRating.setText("Minimum rating:");
|
||||
lblMinimumRating.setToolTipText("Players with rating less than this value can't join this table");
|
||||
|
|
@ -305,6 +280,21 @@ public class NewTableDialog extends MageDialog {
|
|||
|
||||
lblSettings.setText("Settings");
|
||||
|
||||
btnCustomOptions.setText("Custom Options...");
|
||||
btnCustomOptions.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnCustomOptionsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
lblRange.setText("Range of Influence:");
|
||||
|
||||
cbRange.setToolTipText("<HTML>An option for multiplayer games.\nA player's range of influence is the maximum distance from that player, measured in player seats,<br>\nthat the player can affect. Players within that many seats of the player are within that player's range<br>\nof influence. Objects controlled by players within a player's range of influence are also within that<br>\nplayer's range of influence. Range of influence covers spells, abilities, effects, damage dealing, attacking,<nr>\nmaking choices, and winning the game.");
|
||||
|
||||
lblAttack.setText("Attack Option:");
|
||||
|
||||
cbAttackOption.setToolTipText("<HTML>An option for multiplayer games that defines<br>\nwhich opponents can be attacked from a player.");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
|
|
@ -323,113 +313,108 @@ public class NewTableDialog extends MageDialog {
|
|||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(jSeparator2)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 863, Short.MAX_VALUE)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblName)
|
||||
.addComponent(lbDeckType)
|
||||
.addComponent(lblGameType))
|
||||
.addGap(6, 6, 6)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblName)
|
||||
.addComponent(lbDeckType)
|
||||
.addComponent(lblGameType))
|
||||
.addGap(6, 6, 6)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lbTimeLimit)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lbBufferTime)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbBufferTime, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblNumWins)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(8, 8, 8)
|
||||
.addComponent(chkRollbackTurnsAllowed)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkSpectatorsAllowed))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(cbDeckType, 0, 255, Short.MAX_VALUE)
|
||||
.addComponent(cbGameType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(btnCustomOptions)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lbTimeLimit)
|
||||
.addComponent(lblSkillLevel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lbBufferTime)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbBufferTime, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPassword)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkSpectatorsAllowed))
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(cbDeckType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(cbGameType, 0, 270, Short.MAX_VALUE))
|
||||
.addComponent(chkRated)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(chkRollbackTurnsAllowed)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(chkRated)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblMinimumRating)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnMinimumRating, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblEdhPowerLevel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnEdhPowerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))))))
|
||||
.addComponent(lblMinimumRating)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnMinimumRating, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblEdhPowerLevel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnEdhPowerLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE))))))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblNumPlayers)
|
||||
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lblNumPlayers)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblRange)
|
||||
.addComponent(cbRange, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(8, 8, 8)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cbAttackOption, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblAttack))
|
||||
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblSkillLevel))
|
||||
.addGap(4, 4, 4)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblNumWins))
|
||||
.addComponent(lblRange)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblMullgian)
|
||||
.addComponent(cbMulligan, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(cbRange, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkPlaneChase))
|
||||
.addComponent(lblFreeMulligans))))
|
||||
.addComponent(lblAttack)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cbAttackOption, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 863, Short.MAX_VALUE)
|
||||
.addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 933, Short.MAX_VALUE)
|
||||
.addContainerGap()))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(3, 3, 3)
|
||||
.addGap(2, 2, 2)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(txtName)
|
||||
.addComponent(lblName))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lbBufferTime)
|
||||
.addComponent(cbBufferTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblNumWins)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chkRollbackTurnsAllowed)
|
||||
.addComponent(chkSpectatorsAllowed))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbTimeLimit)
|
||||
.addComponent(lbTimeLimit)
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(txtPassword)
|
||||
.addComponent(chkSpectatorsAllowed)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lbBufferTime)
|
||||
.addComponent(cbBufferTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addComponent(lbTimeLimit)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
|
|
@ -442,43 +427,28 @@ public class NewTableDialog extends MageDialog {
|
|||
.addComponent(spnMinimumRating, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chkRated))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblGameType)
|
||||
.addComponent(chkRollbackTurnsAllowed))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblRange)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(cbRange, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblNumPlayers)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblAttack)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(cbAttackOption, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(txtPassword)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblSkillLevel)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblNumWins)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblMullgian)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(cbMulligan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addGap(0, 0, 0)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chkPlaneChase))))
|
||||
.addGap(14, 14, 14)
|
||||
.addComponent(btnCustomOptions))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblGameType)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbAttackOption, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblAttack))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbRange, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblRange))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblNumPlayers)
|
||||
.addComponent(spnNumPlayers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel1)
|
||||
|
|
@ -487,7 +457,7 @@ public class NewTableDialog extends MageDialog {
|
|||
.addGap(16, 16, 16)
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
|
||||
.addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
|
||||
.addGap(9, 9, 9)
|
||||
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
|
@ -505,8 +475,6 @@ public class NewTableDialog extends MageDialog {
|
|||
.addContainerGap(180, Short.MAX_VALUE)))
|
||||
);
|
||||
|
||||
lblMullgian.getAccessibleContext().setAccessibleName("Mullgian");
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
|
@ -609,6 +577,10 @@ public class NewTableDialog extends MageDialog {
|
|||
onLoadSettings(-1);
|
||||
}//GEN-LAST:event_menuLoadSettingsDefaultActionPerformed
|
||||
|
||||
private void btnCustomOptionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCustomOptionsActionPerformed
|
||||
customOptions.showDialog();
|
||||
}//GEN-LAST:event_btnCustomOptionsActionPerformed
|
||||
|
||||
private MatchOptions getMatchOptions() {
|
||||
// current settings
|
||||
GameTypeView gameType = (GameTypeView) cbGameType.getSelectedItem();
|
||||
|
|
@ -626,14 +598,11 @@ public class NewTableDialog extends MageDialog {
|
|||
options.setWinsNeeded((Integer) this.spnNumWins.getValue());
|
||||
options.setRollbackTurnsAllowed(chkRollbackTurnsAllowed.isSelected());
|
||||
options.setSpectatorsAllowed(chkSpectatorsAllowed.isSelected());
|
||||
options.setPlaneChase(chkPlaneChase.isSelected());
|
||||
options.setRated(chkRated.isSelected());
|
||||
options.setFreeMulligans((Integer) this.spnFreeMulligans.getValue());
|
||||
options.setPassword(this.txtPassword.getText());
|
||||
options.setQuitRatio((Integer) this.spnQuitRatio.getValue());
|
||||
options.setMinimumRating((Integer) this.spnMinimumRating.getValue());
|
||||
options.setEdhPowerLevel((Integer) this.spnEdhPowerLevel.getValue());
|
||||
options.setMullgianType((MulliganType) this.cbMulligan.getSelectedItem());
|
||||
String serverAddress = SessionHandler.getSession().getServerHostname().orElse("");
|
||||
options.setBannedUsers(IgnoreList.getIgnoredUsers(serverAddress));
|
||||
options.setLimited(options.getDeckType().startsWith("Limited"));
|
||||
|
|
@ -641,6 +610,8 @@ public class NewTableDialog extends MageDialog {
|
|||
options.setLimited(true); // limited-style sideboarding with unlimited basics enabled for Freeform Unlimited Commander
|
||||
}
|
||||
|
||||
customOptions.writeMatchOptionsTo(options);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
|
@ -765,6 +736,19 @@ public class NewTableDialog extends MageDialog {
|
|||
}
|
||||
this.cbAttackOption.setEnabled(gameType.isUseAttackOption());
|
||||
this.cbRange.setEnabled(gameType.isUseRange());
|
||||
// hide multiplayer options row if none are editable, otherwise show it
|
||||
JComponent[] multiplayerOptions = {
|
||||
lblNumPlayers,
|
||||
spnNumPlayers,
|
||||
lblRange,
|
||||
cbRange,
|
||||
lblAttack,
|
||||
cbAttackOption,
|
||||
};
|
||||
boolean showMultiplayerOptions = Arrays.stream(multiplayerOptions).anyMatch(c -> !(c instanceof JLabel) && c.isEnabled());
|
||||
for (JComponent component : multiplayerOptions) {
|
||||
component.setVisible(showMultiplayerOptions);
|
||||
}
|
||||
createPlayers((Integer) spnNumPlayers.getValue() - 1);
|
||||
}
|
||||
|
||||
|
|
@ -821,7 +805,6 @@ public class NewTableDialog extends MageDialog {
|
|||
cbRange.setModel(new DefaultComboBoxModel(RangeOfInfluence.values()));
|
||||
cbAttackOption.setModel(new DefaultComboBoxModel(MultiplayerAttackOption.values()));
|
||||
cbSkillLevel.setModel(new DefaultComboBoxModel(SkillLevel.values()));
|
||||
cbMulligan.setModel(new DefaultComboBoxModel(MulliganType.values()));
|
||||
// Update the existing player panels (neccessary if server was changes = new session)
|
||||
int i = 2;
|
||||
for (TablePlayerPanel tablePlayerPanel : players) {
|
||||
|
|
@ -914,10 +897,7 @@ public class NewTableDialog extends MageDialog {
|
|||
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS + versionStr, "2")));
|
||||
this.chkRollbackTurnsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED + versionStr, "Yes").equals("Yes"));
|
||||
this.chkSpectatorsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_SPECTATORS_ALLOWED + versionStr, "Yes").equals("Yes"));
|
||||
this.chkPlaneChase.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_PLANECHASE + versionStr, "No").equals("Yes"));
|
||||
this.chkRated.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_RATED + versionStr, "No").equals("Yes"));
|
||||
this.spnFreeMulligans.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS + versionStr, "0")));
|
||||
this.cbMulligan.setSelectedItem(MulliganType.valueByName(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_MULLIGAN_TYPE + versionStr, MulliganType.GAME_DEFAULT.toString())));
|
||||
|
||||
int range = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_RANGE + versionStr, "0"));
|
||||
for (RangeOfInfluence roi : RangeOfInfluence.values()) {
|
||||
|
|
@ -944,6 +924,8 @@ public class NewTableDialog extends MageDialog {
|
|||
this.spnQuitRatio.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO + versionStr, "100")));
|
||||
this.spnMinimumRating.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_MINIMUM_RATING + versionStr, "0")));
|
||||
this.spnEdhPowerLevel.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_EDH_POWER_LEVEL + versionStr, "0")));
|
||||
|
||||
this.customOptions.onLoadSettings(version);
|
||||
}
|
||||
|
||||
private void onSaveSettings(int version) {
|
||||
|
|
@ -975,15 +957,10 @@ public class NewTableDialog extends MageDialog {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS + versionStr, Integer.toString(options.getWinsNeeded()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED + versionStr, options.isRollbackTurnsAllowed() ? "Yes" : "No");
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_RATED + versionStr, options.isRated() ? "Yes" : "No");
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS + versionStr, Integer.toString(options.getFreeMulligans()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_MULLIGAN_TYPE + versionStr, options.getMulliganType().toString());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_FILE + versionStr, deckFile);
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_PLAYERS + versionStr, spnNumPlayers.getValue().toString());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_RANGE + versionStr, Integer.toString(options.getRange().getRange()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_ATTACK_OPTION + versionStr, options.getAttackOption().toString());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_SKILL_LEVEL + versionStr, options.getSkillLevel().toString());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_SPECTATORS_ALLOWED + versionStr, options.isSpectatorsAllowed() ? "Yes" : "No");
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_PLANECHASE + versionStr, options.isPlaneChase() ? "Yes" : "No");
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO + versionStr, Integer.toString(options.getQuitRatio()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_MINIMUM_RATING + versionStr, Integer.toString(options.getMinimumRating()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_EDH_POWER_LEVEL + versionStr, Integer.toString(options.getEdhPowerLevel()));
|
||||
|
|
@ -997,10 +974,13 @@ public class NewTableDialog extends MageDialog {
|
|||
playerTypesString.append(tpp.getPlayerType());
|
||||
}
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_PLAYER_TYPES + versionStr, playerTypesString.toString());
|
||||
|
||||
customOptions.onSaveSettings(version, options);
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnCancel;
|
||||
private javax.swing.JButton btnCustomOptions;
|
||||
private javax.swing.JButton btnOK;
|
||||
private javax.swing.JButton btnSettingsLoad;
|
||||
private javax.swing.JButton btnSettingsSave;
|
||||
|
|
@ -1008,11 +988,9 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JComboBox cbBufferTime;
|
||||
private javax.swing.JComboBox cbDeckType;
|
||||
private javax.swing.JComboBox cbGameType;
|
||||
private javax.swing.JComboBox<String> cbMulligan;
|
||||
private javax.swing.JComboBox cbRange;
|
||||
private javax.swing.JComboBox cbSkillLevel;
|
||||
private javax.swing.JComboBox cbTimeLimit;
|
||||
private javax.swing.JCheckBox chkPlaneChase;
|
||||
private javax.swing.JCheckBox chkRated;
|
||||
private javax.swing.JCheckBox chkRollbackTurnsAllowed;
|
||||
private javax.swing.JCheckBox chkSpectatorsAllowed;
|
||||
|
|
@ -1026,10 +1004,8 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JLabel lbTimeLimit;
|
||||
private javax.swing.JLabel lblAttack;
|
||||
private javax.swing.JLabel lblEdhPowerLevel;
|
||||
private javax.swing.JLabel lblFreeMulligans;
|
||||
private javax.swing.JLabel lblGameType;
|
||||
private javax.swing.JLabel lblMinimumRating;
|
||||
private javax.swing.JLabel lblMullgian;
|
||||
private javax.swing.JLabel lblName;
|
||||
private javax.swing.JLabel lblNumPlayers;
|
||||
private javax.swing.JLabel lblNumWins;
|
||||
|
|
@ -1051,7 +1027,6 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JPopupMenu.Separator separator1;
|
||||
private javax.swing.JPopupMenu.Separator separator2;
|
||||
private javax.swing.JSpinner spnEdhPowerLevel;
|
||||
private javax.swing.JSpinner spnFreeMulligans;
|
||||
private javax.swing.JSpinner spnMinimumRating;
|
||||
private javax.swing.JSpinner spnNumPlayers;
|
||||
private javax.swing.JSpinner spnNumWins;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue