mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Saved table spectator setting to preferences.
This commit is contained in:
parent
8bc3efff07
commit
9c0d0a0153
2 changed files with 36 additions and 30 deletions
|
|
@ -27,6 +27,12 @@
|
||||||
*/
|
*/
|
||||||
package mage.client.dialog;
|
package mage.client.dialog;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import javax.swing.*;
|
||||||
import mage.cards.decks.importer.DeckImporterUtil;
|
import mage.cards.decks.importer.DeckImporterUtil;
|
||||||
import mage.client.MageFrame;
|
import mage.client.MageFrame;
|
||||||
import mage.client.SessionHandler;
|
import mage.client.SessionHandler;
|
||||||
|
|
@ -45,13 +51,6 @@ import mage.view.GameTypeView;
|
||||||
import mage.view.TableView;
|
import mage.view.TableView;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
|
@ -623,17 +622,22 @@ public class NewTableDialog extends MageDialog {
|
||||||
* set the table settings from java prefs
|
* set the table settings from java prefs
|
||||||
*/
|
*/
|
||||||
int currentSettingVersion = 0;
|
int currentSettingVersion = 0;
|
||||||
|
|
||||||
private void setGameSettingsFromPrefs(int version) {
|
private void setGameSettingsFromPrefs(int version) {
|
||||||
currentSettingVersion = version;
|
currentSettingVersion = version;
|
||||||
String versionStr = "";
|
String versionStr = "";
|
||||||
if (currentSettingVersion == 1) {
|
switch (currentSettingVersion) {
|
||||||
|
case 1:
|
||||||
versionStr = "1";
|
versionStr = "1";
|
||||||
btnPreviousConfiguration1.requestFocus();
|
btnPreviousConfiguration1.requestFocus();
|
||||||
} else if (currentSettingVersion == 2) {
|
break;
|
||||||
|
case 2:
|
||||||
versionStr = "2";
|
versionStr = "2";
|
||||||
btnPreviousConfiguration2.requestFocus();
|
btnPreviousConfiguration2.requestFocus();
|
||||||
} else {
|
break;
|
||||||
|
default:
|
||||||
btnPreviousConfiguration2.getParent().requestFocus();
|
btnPreviousConfiguration2.getParent().requestFocus();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
txtName.setText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NAME + versionStr, "Game"));
|
txtName.setText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NAME + versionStr, "Game"));
|
||||||
txtPassword.setText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_PASSWORD + versionStr, ""));
|
txtPassword.setText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_PASSWORD + versionStr, ""));
|
||||||
|
|
@ -724,6 +728,7 @@ public class NewTableDialog extends MageDialog {
|
||||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_RANGE + versionStr, Integer.toString(options.getRange().getRange()));
|
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_ATTACK_OPTION + versionStr, options.getAttackOption().toString());
|
||||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_SKILL_LEVEL + versionStr, options.getSkillLevel().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_QUIT_RATIO + versionStr, Integer.toString(options.getQuitRatio()));
|
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO + versionStr, Integer.toString(options.getQuitRatio()));
|
||||||
StringBuilder playerTypesString = new StringBuilder();
|
StringBuilder playerTypesString = new StringBuilder();
|
||||||
for (Object player : players) {
|
for (Object player : players) {
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,13 @@ package mage.client.dialog;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
import mage.cards.decks.importer.DeckImporterUtil;
|
import mage.cards.decks.importer.DeckImporterUtil;
|
||||||
import mage.cards.repository.ExpansionInfo;
|
import mage.cards.repository.ExpansionInfo;
|
||||||
|
|
@ -764,7 +766,6 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
this.spnNumPlayers.setModel(new SpinnerNumberModel(numPlayers, tournamentType.getMinPlayers(), tournamentType.getMaxPlayers(), 1));
|
this.spnNumPlayers.setModel(new SpinnerNumberModel(numPlayers, tournamentType.getMinPlayers(), tournamentType.getMaxPlayers(), 1));
|
||||||
this.spnNumPlayers.setEnabled(tournamentType.getMinPlayers() != tournamentType.getMaxPlayers());
|
this.spnNumPlayers.setEnabled(tournamentType.getMinPlayers() != tournamentType.getMaxPlayers());
|
||||||
createPlayers((Integer) spnNumPlayers.getValue() - 1);
|
createPlayers((Integer) spnNumPlayers.getValue() - 1);
|
||||||
|
|
||||||
this.spnNumSeats.setModel(new SpinnerNumberModel(2, 2, tournamentType.getMaxPlayers(), 1));
|
this.spnNumSeats.setModel(new SpinnerNumberModel(2, 2, tournamentType.getMaxPlayers(), 1));
|
||||||
|
|
||||||
if (tournamentType.isLimited()) {
|
if (tournamentType.isLimited()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue