mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 20:11:59 -08:00
Add allowed quit ratio option to match option and tourney option.
This commit is contained in:
parent
ef3fbffe11
commit
284c36b756
16 changed files with 292 additions and 74 deletions
|
|
@ -32,31 +32,33 @@
|
|||
<Component id="lblGameType" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="cbGameType" min="-2" pref="270" max="-2" attributes="1"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="chkRollbackTurnsAllowed" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="13" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
|
||||
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="txtName" max="32767" attributes="0"/>
|
||||
<Component id="cbDeckType" pref="332" max="32767" attributes="1"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lbTimeLimit" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblPassword" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="txtName" min="-2" pref="178" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtPassword" min="-2" pref="125" max="-2" attributes="0"/>
|
||||
<Component id="cbTimeLimit" min="-2" pref="126" max="-2" attributes="1"/>
|
||||
</Group>
|
||||
<Component id="lbTimeLimit" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cbTimeLimit" min="-2" pref="102" max="-2" attributes="1"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblPassword" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPassword" min="-2" pref="125" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="cbDeckType" min="-2" pref="332" max="-2" attributes="1"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblQuitRatio" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnQuitRatio" min="-2" pref="60" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
|
@ -107,7 +109,7 @@
|
|||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jSeparator3" pref="586" max="32767" attributes="0"/>
|
||||
<Component id="jSeparator3" pref="660" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
|
|
@ -122,13 +124,15 @@
|
|||
<Component id="lblName" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="txtPassword" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblPassword" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="cbDeckType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lbDeckType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lbTimeLimit" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblQuitRatio" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnQuitRatio" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
|
|
@ -378,5 +382,12 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblQuitRatio">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Allowed quit %"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnQuitRatio">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ public class NewTableDialog extends MageDialog {
|
|||
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));
|
||||
MageFrame.getUI().addButton(MageComponents.NEW_TABLE_OK_BUTTON, btnOK);
|
||||
}
|
||||
|
||||
|
|
@ -125,6 +126,8 @@ public class NewTableDialog extends MageDialog {
|
|||
jSeparator1 = new javax.swing.JSeparator();
|
||||
btnOK = new javax.swing.JButton();
|
||||
btnCancel = new javax.swing.JButton();
|
||||
lblQuitRatio = new javax.swing.JLabel();
|
||||
spnQuitRatio = new javax.swing.JSpinner();
|
||||
|
||||
setTitle("New Table");
|
||||
|
||||
|
|
@ -209,6 +212,10 @@ public class NewTableDialog extends MageDialog {
|
|||
}
|
||||
});
|
||||
|
||||
lblQuitRatio.setText("Allowed quit %");
|
||||
|
||||
spnQuitRatio.setToolTipText("Players with quit % more than this value can't join this table");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
|
|
@ -227,22 +234,26 @@ public class NewTableDialog extends MageDialog {
|
|||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(chkRollbackTurnsAllowed)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
|
||||
.addGap(13, 13, 13)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(txtName)
|
||||
.addComponent(cbDeckType, 0, 332, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lbTimeLimit, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblPassword, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.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(lblPassword)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, 332, 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))))
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
|
|
@ -280,7 +291,7 @@ public class NewTableDialog extends MageDialog {
|
|||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 586, Short.MAX_VALUE)
|
||||
.addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 660, Short.MAX_VALUE)
|
||||
.addContainerGap()))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
|
|
@ -291,13 +302,15 @@ public class NewTableDialog extends MageDialog {
|
|||
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblName)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPassword))
|
||||
.addComponent(lblPassword)
|
||||
.addComponent(lbTimeLimit)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.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)
|
||||
.addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lbDeckType)
|
||||
.addComponent(lbTimeLimit))
|
||||
.addComponent(lblQuitRatio)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
|
|
@ -376,6 +389,7 @@ public class NewTableDialog extends MageDialog {
|
|||
options.setRollbackTurnsAllowed(chkRollbackTurnsAllowed.isSelected());
|
||||
options.setFreeMulligans((Integer) this.spnFreeMulligans.getValue());
|
||||
options.setPassword(this.txtPassword.getText());
|
||||
options.setQuitRatio((Integer) this.spnQuitRatio.getValue());
|
||||
if (!checkMatchOptions(options)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -613,6 +627,7 @@ public class NewTableDialog extends MageDialog {
|
|||
}
|
||||
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_WINS, "2")));
|
||||
this.chkRollbackTurnsAllowed.setSelected(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_ROLLBACK_TURNS_ALLOWED, "Yes").equals("Yes"));
|
||||
this.spnFreeMulligans.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NUMBER_OF_FREE_MULLIGANS, "0")));
|
||||
|
||||
int range = Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_RANGE, "1"));
|
||||
for (RangeOfInfluence roi : RangeOfInfluence.values()) {
|
||||
|
|
@ -635,6 +650,8 @@ public class NewTableDialog extends MageDialog {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.spnQuitRatio.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO, "100")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -658,6 +675,7 @@ public class NewTableDialog extends MageDialog {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_RANGE, Integer.toString(options.getRange().getRange()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_ATTACK_OPTION, options.getAttackOption().toString());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_SKILL_LEVEL, options.getSkillLevel().toString());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO, Integer.toString(options.getQuitRatio()));
|
||||
StringBuilder playerTypesString = new StringBuilder();
|
||||
ListIterator iterator = players.listIterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
|
@ -694,6 +712,7 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JLabel lblNumPlayers;
|
||||
private javax.swing.JLabel lblNumWins;
|
||||
private javax.swing.JLabel lblPassword;
|
||||
private javax.swing.JLabel lblQuitRatio;
|
||||
private javax.swing.JLabel lblRange;
|
||||
private javax.swing.JLabel lblSkillLevel;
|
||||
private mage.client.table.NewPlayerPanel player1Panel;
|
||||
|
|
@ -701,6 +720,7 @@ public class NewTableDialog extends MageDialog {
|
|||
private javax.swing.JSpinner spnFreeMulligans;
|
||||
private javax.swing.JSpinner spnNumPlayers;
|
||||
private javax.swing.JSpinner spnNumWins;
|
||||
private javax.swing.JSpinner spnQuitRatio;
|
||||
private javax.swing.JTextField txtName;
|
||||
private javax.swing.JTextField txtPassword;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" alignment="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="lblDraftCube" max="-2" attributes="0"/>
|
||||
<Component id="lblTournamentType" min="-2" max="-2" attributes="0"/>
|
||||
|
|
@ -85,16 +85,16 @@
|
|||
<Component id="cbDeckType" alignment="0" min="-2" pref="290" max="-2" attributes="1"/>
|
||||
<Component id="cbGameType" min="-2" pref="290" max="-2" attributes="1"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="cbTournamentType" min="-2" pref="290" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
|
||||
<Component id="lblNumWins" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnNumWins" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblQuitRatio" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnQuitRatio" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="cbTournamentType" min="-2" pref="290" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
|
|
@ -114,6 +114,11 @@
|
|||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPassword" min="-2" pref="56" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblFreeMulligans" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" min="-2" pref="41" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
|
@ -140,14 +145,19 @@
|
|||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblTournamentType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cbTournamentType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnFreeMulligans" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblNumWins" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnNumWins" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblQuitRatio" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnQuitRatio" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="cbTournamentType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblTournamentType" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="cbDraftCube" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblDraftCube" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
|
|
@ -191,7 +201,7 @@
|
|||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="player1Panel" pref="61" max="32767" attributes="0"/>
|
||||
<Component id="player1Panel" min="-2" pref="62" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="pnlPlayers" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
|
|
@ -525,5 +535,15 @@
|
|||
<Property name="axis" type="int" value="1"/>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="lblQuitRatio">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Allow players with quit (%):"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnQuitRatio">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
this.spnFreeMulligans.setModel(new SpinnerNumberModel(0, 0, 5, 1));
|
||||
this.spnConstructTime.setModel(new SpinnerNumberModel(10, CONSTRUCTION_TIME_MIN, CONSTRUCTION_TIME_MAX, 2));
|
||||
this.spnNumRounds.setModel(new SpinnerNumberModel(2, 2, 10, 1));
|
||||
this.spnQuitRatio.setModel(new SpinnerNumberModel(100, 0, 100, 5));
|
||||
}
|
||||
|
||||
public void showDialog(UUID roomId) {
|
||||
|
|
@ -179,6 +180,8 @@ public class NewTournamentDialog extends MageDialog {
|
|||
btnOk = new javax.swing.JButton();
|
||||
btnCancel = new javax.swing.JButton();
|
||||
pnlRandomPacks = new javax.swing.JPanel();
|
||||
lblQuitRatio = new javax.swing.JLabel();
|
||||
spnQuitRatio = new javax.swing.JSpinner();
|
||||
|
||||
setTitle("New Tournament");
|
||||
|
||||
|
|
@ -345,6 +348,10 @@ public class NewTournamentDialog extends MageDialog {
|
|||
pnlRandomPacks.setToolTipText("");
|
||||
pnlRandomPacks.setLayout(new javax.swing.BoxLayout(pnlRandomPacks, javax.swing.BoxLayout.Y_AXIS));
|
||||
|
||||
lblQuitRatio.setText("Allowed quit %:");
|
||||
|
||||
spnQuitRatio.setToolTipText("Players with quit % more than this value can't join this table");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
|
|
@ -401,15 +408,15 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGap(28, 28, 28)
|
||||
.addComponent(lblNumWins)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||
.addComponent(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, 50, 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))
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblName)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
|
@ -425,7 +432,11 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPassword)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(pnlRandomPacks, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
|
|
@ -445,12 +456,16 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(cbSkillLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblTournamentType)
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblFreeMulligans)
|
||||
.addComponent(spnFreeMulligans, 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(spnNumWins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblQuitRatio)
|
||||
.addComponent(spnQuitRatio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbTournamentType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblTournamentType))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cbDraftCube, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
|
|
@ -487,7 +502,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
.addComponent(lblConstructionTime)
|
||||
.addComponent(chkRollbackTurnsAllowed)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE)
|
||||
.addComponent(player1Panel, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(pnlPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
|
@ -513,6 +528,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
tOptions.setPassword(txtPassword.getText());
|
||||
tOptions.getPlayerTypes().add("Human");
|
||||
tOptions.setWatchingAllowed(cbAllowSpectators.isSelected());
|
||||
tOptions.setQuitRatio((Integer)spnQuitRatio.getValue());
|
||||
for (TournamentPlayerPanel player: players) {
|
||||
tOptions.getPlayerTypes().add((String) player.getPlayerType().getSelectedItem());
|
||||
}
|
||||
|
|
@ -689,7 +705,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
|
||||
this.lblConstructionTime.setVisible(tournamentType.isLimited());
|
||||
this.spnConstructTime.setVisible(tournamentType.isLimited());
|
||||
|
||||
|
||||
this.lbDeckType.setVisible(!tournamentType.isLimited());
|
||||
this.cbDeckType.setVisible(!tournamentType.isLimited());
|
||||
this.lblGameType.setVisible(!tournamentType.isLimited());
|
||||
|
|
@ -914,7 +930,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
this.spnFreeMulligans.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_FREE_MULLIGANS, "0")));
|
||||
this.spnNumWins.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_WINS, "2")));
|
||||
|
||||
this.spnQuitRatio.setValue(Integer.parseInt(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TOURNAMENT_QUIT_RATIO, "100")));
|
||||
|
||||
TournamentTypeView tournamentType = (TournamentTypeView) cbTournamentType.getSelectedItem();
|
||||
activatePanelElements(tournamentType);
|
||||
|
|
@ -985,6 +1001,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_TYPE, tOptions.getTournamentType());
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_FREE_MULLIGANS, Integer.toString(tOptions.getMatchOptions().getFreeMulligans()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_NUMBER_OF_WINS, Integer.toString(tOptions.getMatchOptions().getWinsNeeded()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_QUIT_RATIO, Integer.toString(tOptions.getQuitRatio()));
|
||||
|
||||
if (tOptions.getTournamentType().startsWith("Sealed")) {
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_SEALED, tOptions.getLimitedOptions().getSetCodes().toString());
|
||||
|
|
@ -1050,6 +1067,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private javax.swing.JLabel lblPacks;
|
||||
private javax.swing.JLabel lblPassword;
|
||||
private javax.swing.JLabel lblPlayer1;
|
||||
private javax.swing.JLabel lblQuitRatio;
|
||||
private javax.swing.JLabel lblTournamentType;
|
||||
private mage.client.table.NewPlayerPanel player1Panel;
|
||||
private javax.swing.JPanel pnlDraftOptions;
|
||||
|
|
@ -1062,6 +1080,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
private javax.swing.JSpinner spnNumPlayers;
|
||||
private javax.swing.JSpinner spnNumRounds;
|
||||
private javax.swing.JSpinner spnNumWins;
|
||||
private javax.swing.JSpinner spnQuitRatio;
|
||||
private javax.swing.JTextField txtName;
|
||||
private javax.swing.JTextField txtPassword;
|
||||
private org.jdesktop.beansbinding.BindingGroup bindingGroup;
|
||||
|
|
|
|||
|
|
@ -194,6 +194,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_NEW_TABLE_SKILL_LEVEL = "newTableSkillLevel";
|
||||
public static final String KEY_NEW_TABLE_NUMBER_PLAYERS = "newTableNumberPlayers";
|
||||
public static final String KEY_NEW_TABLE_PLAYER_TYPES = "newTablePlayerTypes";
|
||||
public static final String KEY_NEW_TABLE_QUIT_RATIO = "newTableQuitRatio";
|
||||
|
||||
// pref setting for new tournament dialog
|
||||
public static final String KEY_NEW_TOURNAMENT_NAME = "newTournamentName";
|
||||
|
|
@ -212,6 +213,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
public static final String KEY_NEW_TOURNAMENT_ALLOW_SPECTATORS = "newTournamentAllowSpectators";
|
||||
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";
|
||||
|
||||
// pref setting for deck generator
|
||||
public static final String KEY_NEW_DECK_GENERATOR_DECK_SIZE = "newDeckGeneratorDeckSize";
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
|
||||
private final List<String> players = new ArrayList<>();
|
||||
private final UserTableModel userTableModel;
|
||||
private static final int[] DEFAULT_COLUMNS_WIDTH = {20, 100, 100, 100, 80, 80};
|
||||
private static final int[] DEFAULT_COLUMNS_WIDTH = {20, 100, 40, 100, 40, 100, 80, 80};
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -118,7 +118,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
|
||||
class UserTableModel extends AbstractTableModel {
|
||||
|
||||
private final String[] columnNames = new String[]{"Loc", "Players", "Matches", "Tourneys", "Games", "Connection"};
|
||||
private final String[] columnNames = new String[]{"Loc", "Players", "Matches", "MQ%", "Tourneys", "TQ%", "Games", "Connection"};
|
||||
private UsersView[] players = new UsersView[0];
|
||||
|
||||
public void loadData(Collection<RoomUsersView> roomUserInfoList) throws MageRemoteException {
|
||||
|
|
@ -128,7 +128,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
TableColumnModel tcm = th.getColumnModel();
|
||||
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ")");
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(4)).setHeaderValue(
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(6)).setHeaderValue(
|
||||
"Games " + roomUserInfo.getNumberActiveGames()
|
||||
+ (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads() : " (")
|
||||
+ " limit: " + roomUserInfo.getNumberMaxGames() + ")");
|
||||
|
|
@ -156,10 +156,14 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
|||
case 2:
|
||||
return players[arg0].getMatchHistory();
|
||||
case 3:
|
||||
return players[arg0].getTourneyHistory();
|
||||
return players[arg0].getMatchQuitRatio();
|
||||
case 4:
|
||||
return players[arg0].getInfoGames();
|
||||
return players[arg0].getTourneyHistory();
|
||||
case 5:
|
||||
return players[arg0].getTourneyQuitRatio();
|
||||
case 6:
|
||||
return players[arg0].getInfoGames();
|
||||
case 7:
|
||||
return players[arg0].getInfoPing();
|
||||
}
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
|
||||
JToggleButton[] filterButtons;
|
||||
|
||||
private static final int[] defaultColumnsWidth = {35, 150, 120, 180, 80, 120, 80, 60, 60};
|
||||
private static final int[] defaultColumnsWidth = {35, 150, 120, 180, 80, 120, 80, 60, 40, 60};
|
||||
|
||||
/**
|
||||
* Creates new form TablesPanel
|
||||
|
|
@ -1239,9 +1239,10 @@ class TableTableModel extends AbstractTableModel {
|
|||
public static final int COLUMN_INFO = 4;
|
||||
public static final int COLUMN_STATUS = 5;
|
||||
public static final int COLUMN_SKILL = 7;
|
||||
public static final int ACTION_COLUMN = 8; // column the action is located (starting with 0)
|
||||
public static final int COLUMN_QUIT_RATIO = 8;
|
||||
public static final int ACTION_COLUMN = 9; // column the action is located (starting with 0)
|
||||
|
||||
private final String[] columnNames = new String[]{"M/T", "Deck Type", "Owner / Players", "Game Type", "Info", "Status", "Created / Started", "Skill Level", "Action"};
|
||||
private final String[] columnNames = new String[]{"M/T", "Deck Type", "Owner / Players", "Game Type", "Info", "Status", "Created / Started", "Skill Level", "Quit %", "Action"};
|
||||
|
||||
private TableView[] tables = new TableView[0];
|
||||
private static final DateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss");
|
||||
|
|
@ -1288,6 +1289,8 @@ class TableTableModel extends AbstractTableModel {
|
|||
case 7:
|
||||
return tables[arg0].getSkillLevel();
|
||||
case 8:
|
||||
return tables[arg0].getQuitRatio();
|
||||
case 9:
|
||||
switch (tables[arg0].getTableState()) {
|
||||
|
||||
case WAITING:
|
||||
|
|
@ -1314,14 +1317,14 @@ class TableTableModel extends AbstractTableModel {
|
|||
default:
|
||||
return "";
|
||||
}
|
||||
case 9:
|
||||
return tables[arg0].isTournament();
|
||||
case 10:
|
||||
return tables[arg0].isTournament();
|
||||
case 11:
|
||||
if (!tables[arg0].getGames().isEmpty()) {
|
||||
return tables[arg0].getGames().get(0);
|
||||
}
|
||||
return null;
|
||||
case 11:
|
||||
case 12:
|
||||
return tables[arg0].getTableId();
|
||||
}
|
||||
return "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue