Merge pull request #4879 from spjspj/master

Add planechase to new tournament window as well.
This commit is contained in:
spjspj 2018-05-02 18:31:59 +10:00 committed by GitHub
commit 4b4d7989cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 7 deletions

View file

@ -57,6 +57,8 @@
<Component id="spnNumRounds" min="-2" pref="50" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cbAllowSpectators" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cbPlaneChase" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
@ -186,6 +188,7 @@
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="103" alignment="1" groupAlignment="3" attributes="0">
<Component id="cbAllowSpectators" alignment="3" max="32767" attributes="0"/>
<Component id="cbPlaneChase" alignment="3" max="32767" attributes="0"/>
<Component id="spnNumRounds" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblNumRounds" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
@ -454,6 +457,13 @@
<Property name="toolTipText" type="java.lang.String" value="Allow other players to watch the games of this table."/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="cbPlaneChase">
<Properties>
<Property name="text" type="java.lang.String" value="Plane Chase"/>
<Property name="toolTipText" type="java.lang.String" value="Use Plane Chase for the tournament."/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblPlayer1">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">

View file

@ -123,6 +123,7 @@ public class NewTournamentDialog extends MageDialog {
tournamentPlayerPanel.init(i++);
}
cbAllowSpectators.setSelected(true);
cbPlaneChase.setSelected(false);
this.setModal(true);
this.setLocation(150, 100);
}
@ -173,6 +174,7 @@ public class NewTournamentDialog extends MageDialog {
jLabel6 = new javax.swing.JLabel();
cbDraftTiming = new javax.swing.JComboBox();
cbAllowSpectators = new javax.swing.JCheckBox();
cbPlaneChase = new javax.swing.JCheckBox();
lblPlayer1 = new javax.swing.JLabel();
lblConstructionTime = new javax.swing.JLabel();
chkRollbackTurnsAllowed = new javax.swing.JCheckBox();
@ -286,6 +288,9 @@ public class NewTournamentDialog extends MageDialog {
cbAllowSpectators.setText("Allow spectators");
cbAllowSpectators.setToolTipText("Allow other players to watch the games of this table.");
cbPlaneChase.setText("Use Plane Chase");
cbPlaneChase.setToolTipText("Use Plane Chase variant for the tournament.");
lblPlayer1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
lblPlayer1.setText("Player 1 (You)");
@ -379,7 +384,9 @@ public class NewTournamentDialog extends MageDialog {
.addGroup(layout.createSequentialGroup()
.addComponent(spnNumRounds, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbAllowSpectators))))
.addComponent(cbAllowSpectators)
.addComponent(cbPlaneChase)
)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -491,6 +498,7 @@ public class NewTournamentDialog extends MageDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbAllowSpectators, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cbPlaneChase, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(spnNumRounds, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblNumRounds))
.addComponent(lblNbrPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
@ -537,6 +545,7 @@ public class NewTournamentDialog extends MageDialog {
tOptions.setPassword(txtPassword.getText());
tOptions.getPlayerTypes().add(PlayerType.HUMAN);
tOptions.setWatchingAllowed(cbAllowSpectators.isSelected());
tOptions.setPlaneChase(cbPlaneChase.isSelected());
tOptions.setQuitRatio((Integer) spnQuitRatio.getValue());
for (TournamentPlayerPanel player : players) {
tOptions.getPlayerTypes().add((PlayerType) player.getPlayerType().getSelectedItem());
@ -1106,6 +1115,7 @@ public class NewTournamentDialog extends MageDialog {
}
}
this.cbAllowSpectators.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS + versionStr, "Yes").equals("Yes"));
this.cbPlaneChase.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLANE_CHASE + versionStr, "No").equals("Yes"));
this.chkRollbackTurnsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS + versionStr, "Yes").equals("Yes"));
this.chkRated.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_RATED + versionStr, "No").equals("Yes"));
}
@ -1191,6 +1201,7 @@ public class NewTournamentDialog extends MageDialog {
}
}
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS + versionStr, (tOptions.isWatchingAllowed() ? "Yes" : "No"));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLANE_CHASE + versionStr, (tOptions.isPlaneChase() ? "Yes" : "No"));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS + versionStr, (tOptions.getMatchOptions().isRollbackTurnsAllowed() ? "Yes" : "No"));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_RATED + versionStr, (tOptions.getMatchOptions().isRated() ? "Yes" : "No"));
}
@ -1205,6 +1216,7 @@ public class NewTournamentDialog extends MageDialog {
private javax.swing.JButton btnSavedConfiguration1;
private javax.swing.JButton btnSavedConfiguration2;
private javax.swing.JCheckBox cbAllowSpectators;
private javax.swing.JCheckBox cbPlaneChase;
private javax.swing.JComboBox cbDeckType;
private javax.swing.JComboBox cbDraftCube;
private javax.swing.JComboBox cbDraftTiming;

View file

@ -264,6 +264,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
public static final String KEY_NEW_TOURNAMENT_PLAYERS_DRAFT = "newTournamentPlayersDraft";
public static final String KEY_NEW_TOURNAMENT_DRAFT_TIMING = "newTournamentDraftTiming";
public static final String KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS = "newTournamentAllowSpectators";
public static final String KEY_NEW_TOURNAMENT_PLANE_CHASE = "newTournamentPlaneChase";
public static final String KEY_NEW_TOURNAMENT_ALLOW_ROLLBACKS = "newTournamentAllowRollbacks";
public static final String KEY_NEW_TOURNAMENT_DECK_FILE = "newTournamentDeckFile";
public static final String KEY_NEW_TOURNAMENT_QUIT_RATIO = "newTournamentQuitRatio";