Search in sources :

Example 6 with TablePlayerPanel

use of mage.client.table.TablePlayerPanel in project mage by magefree.

the class NewTableDialog method onSaveSettings.

private void onSaveSettings(int version, MatchOptions options, String deckFile) {
    String versionStr = "";
    switch(version) {
        case 1:
            versionStr = "1";
            break;
        case 2:
            versionStr = "2";
            break;
        default:
            versionStr = "";
            break;
    }
    PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NAME + versionStr, options.getName());
    PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_PASSWORD + versionStr, options.getPassword());
    PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_TYPE + versionStr, options.getDeckType());
    PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_TIME_LIMIT + versionStr, Integer.toString(options.getPriorityTime()));
    PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_GAME_TYPE + versionStr, options.getGameType());
    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()));
    StringBuilder playerTypesString = new StringBuilder();
    for (Object player : players) {
        if (playerTypesString.length() > 0) {
            playerTypesString.append(',');
        }
        TablePlayerPanel tpp = (TablePlayerPanel) player;
        playerTypesString.append(tpp.getPlayerType());
    }
    PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_PLAYER_TYPES + versionStr, playerTypesString.toString());
}
Also used : TablePlayerPanel(mage.client.table.TablePlayerPanel)

Aggregations

TablePlayerPanel (mage.client.table.TablePlayerPanel)6 MatchOptions (mage.game.match.MatchOptions)3 IOException (java.io.IOException)2 GameTypeView (mage.view.GameTypeView)2 FileNotFoundException (java.io.FileNotFoundException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 UUID (java.util.UUID)1 javax.swing (javax.swing)1 DeckImporter (mage.cards.decks.importer.DeckImporter)1 MageFrame (mage.client.MageFrame)1 SessionHandler (mage.client.SessionHandler)1 MageComponents (mage.client.components.MageComponents)1 Event (mage.client.util.Event)1 IgnoreList (mage.client.util.IgnoreList)1 Listener (mage.client.util.Listener)1 MatchTimeLimit (mage.constants.MatchTimeLimit)1 MultiplayerAttackOption (mage.constants.MultiplayerAttackOption)1 RangeOfInfluence (mage.constants.RangeOfInfluence)1 SkillLevel (mage.constants.SkillLevel)1