mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
commit
df6f43761e
4 changed files with 120 additions and 10 deletions
|
@ -80,7 +80,7 @@ public final class Constants {
|
|||
public static final String RESOURCE_PATH_SET = IO.imageBaseDir + "sets" + File.separator;
|
||||
public static final String RESOURCE_PATH_SET_SMALL = RESOURCE_PATH_SET + File.separator + "small" + File.separator;
|
||||
public static final String BASE_SOUND_PATH = "plugins" + File.separator + "sounds" + File.separator;
|
||||
public static final String BASE_MUSICS_PATH = "plugins" + File.separator + "sounds" + File.separator + "musics" + File.separator ;
|
||||
public static final String BASE_MUSICS_PATH = "plugins" + File.separator + "sounds" + File.separator + "music" + File.separator ;
|
||||
|
||||
public interface IO {
|
||||
String imageBaseDir = "plugins" + File.separator + "images" + File.separator;
|
||||
|
|
|
@ -712,10 +712,22 @@
|
|||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jEnableSounds" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jEnableMusics" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="MusicPath" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="18" max="32767" attributes="0"/>
|
||||
<Component id="BattlefieldIBGMPath" min="-2" pref="218" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="BattlefieldBGMButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jEnableSounds" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jEnableMusics" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="323" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
@ -726,7 +738,15 @@
|
|||
<Component id="jEnableSounds" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jEnableMusics" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="332" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="BattlefieldIBGMPath" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="BattlefieldBGMButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="MusicPath" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="291" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
@ -748,6 +768,24 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jEnableMusicsActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="BattlefieldIBGMPath">
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="BattlefieldIBGMPathActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="BattlefieldBGMButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Browse..."/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="BattlefieldBGMButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="java.awt.Label" name="MusicPath">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="BGM Path:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel6">
|
||||
|
|
|
@ -81,6 +81,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
public static final String KEY_SOUNDS_ON = "soundsOn";
|
||||
public static final String KEY_MUSICS_ON = "MusicsOn";
|
||||
public static final String KEY_MUSICS_PATH = "MusicPath";
|
||||
|
||||
public static final String KEY_BIG_CARD_TOGGLED = "bigCardToggled";
|
||||
|
||||
|
@ -251,6 +252,9 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
jPanel22 = new javax.swing.JPanel();
|
||||
jEnableSounds = new javax.swing.JCheckBox();
|
||||
jEnableMusics = new javax.swing.JCheckBox();
|
||||
BattlefieldIBGMPath = new javax.swing.JTextField();
|
||||
BattlefieldBGMButton = new javax.swing.JButton();
|
||||
MusicPath = new java.awt.Label();
|
||||
jPanel6 = new javax.swing.JPanel();
|
||||
lblProxyType = new javax.swing.JLabel();
|
||||
cbProxyType = new javax.swing.JComboBox();
|
||||
|
@ -717,6 +721,21 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
}
|
||||
});
|
||||
|
||||
BattlefieldIBGMPath.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
BattlefieldIBGMPathActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
BattlefieldBGMButton.setText("Browse...");
|
||||
BattlefieldBGMButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
BattlefieldBGMButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
MusicPath.setText("BGM Path:");
|
||||
|
||||
javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
|
||||
jPanel22.setLayout(jPanel22Layout);
|
||||
jPanel22Layout.setHorizontalGroup(
|
||||
|
@ -724,9 +743,18 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addGroup(jPanel22Layout.createSequentialGroup()
|
||||
.addGap(19, 19, 19)
|
||||
.addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jEnableSounds)
|
||||
.addComponent(jEnableMusics))
|
||||
.addContainerGap(323, Short.MAX_VALUE))
|
||||
.addGroup(jPanel22Layout.createSequentialGroup()
|
||||
.addComponent(MusicPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
|
||||
.addComponent(BattlefieldIBGMPath, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(BattlefieldBGMButton)
|
||||
.addGap(32, 32, 32))
|
||||
.addGroup(jPanel22Layout.createSequentialGroup()
|
||||
.addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jEnableSounds)
|
||||
.addComponent(jEnableMusics))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
||||
);
|
||||
jPanel22Layout.setVerticalGroup(
|
||||
jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
@ -735,7 +763,13 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
.addComponent(jEnableSounds)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jEnableMusics)
|
||||
.addContainerGap(332, Short.MAX_VALUE))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(BattlefieldIBGMPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(BattlefieldBGMButton))
|
||||
.addComponent(MusicPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(291, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab("Sounds", jPanel22);
|
||||
|
@ -1205,6 +1239,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
// sounds
|
||||
save(prefs, dialog.jEnableSounds, KEY_SOUNDS_ON, "true", "false", UPDATE_CACHE_POLICY);
|
||||
save(prefs, dialog.jEnableMusics, KEY_MUSICS_ON, "true", "false", UPDATE_CACHE_POLICY);
|
||||
saveSoundPath(prefs);
|
||||
// connection
|
||||
save(prefs, dialog.cbProxyType, KEY_PROXY_TYPE);
|
||||
save(prefs, dialog.txtProxyServer, KEY_PROXY_ADDRESS);
|
||||
|
@ -1302,6 +1337,16 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
|
||||
private void jEnableMusicsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jEnableMusicsActionPerformed
|
||||
// TODO add your handling code here:
|
||||
if(jEnableMusics.isSelected()){
|
||||
String path = cache.get(KEY_MUSICS_PATH);
|
||||
BattlefieldIBGMPath.setText(path);
|
||||
BattlefieldIBGMPath.setEnabled(true);
|
||||
BattlefieldBGMButton.setEnabled(true);
|
||||
}else{
|
||||
BattlefieldIBGMPath.setEnabled(false);
|
||||
BattlefieldBGMButton.setEnabled(false);
|
||||
BattlefieldIBGMPath.setText("");
|
||||
}
|
||||
}//GEN-LAST:event_jEnableMusicsActionPerformed
|
||||
|
||||
private void useDefaultBackgroundActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
|
@ -1398,6 +1443,19 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_BattlefieldImagePathActionPerformed
|
||||
|
||||
private void BattlefieldIBGMPathActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BattlefieldIBGMPathActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_BattlefieldIBGMPathActionPerformed
|
||||
|
||||
private void BattlefieldBGMButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BattlefieldBGMButtonActionPerformed
|
||||
// TODO add your handling code here:
|
||||
int returnVal = fc.showOpenDialog(PreferencesDialog.this);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fc.getSelectedFile();
|
||||
BattlefieldIBGMPath.setText(file.getAbsolutePath());
|
||||
}
|
||||
}//GEN-LAST:event_BattlefieldBGMButtonActionPerformed
|
||||
|
||||
private void showProxySettings() {
|
||||
if (cbProxyType.getSelectedItem() == Connection.ProxyType.SOCKS) {
|
||||
this.pnlProxy.setVisible(true);
|
||||
|
@ -1539,11 +1597,14 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
dialog.jEnableSounds.setSelected(false);
|
||||
}
|
||||
prop = prefs.get(KEY_MUSICS_ON, "true");
|
||||
String path = prefs.get(KEY_MUSICS_PATH, "");
|
||||
if (prop.equals("true")) {
|
||||
dialog.jEnableMusics.setSelected(true);
|
||||
dialog.BattlefieldIBGMPath.setText(path);
|
||||
} else {
|
||||
dialog.jEnableMusics.setSelected(false);
|
||||
}
|
||||
updateCache(KEY_MUSICS_PATH, path);
|
||||
}
|
||||
|
||||
private static void loadProxySettings(Preferences prefs) {
|
||||
|
@ -1605,6 +1666,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
updateCache(KEY_BATTLEFIELD_IMAGE, path);
|
||||
}
|
||||
}
|
||||
|
||||
private static void saveSoundPath(Preferences prefs){
|
||||
String path = dialog.BattlefieldIBGMPath.getText();
|
||||
prefs.put(KEY_MUSICS_PATH, path);
|
||||
updateCache(KEY_MUSICS_PATH, path);
|
||||
}
|
||||
|
||||
public static boolean isSaveImagesToZip() {
|
||||
return PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_SAVE_TO_ZIP, "false").equals("true");
|
||||
|
@ -1754,8 +1821,11 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
|||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton BackgroundBrowseButton;
|
||||
private javax.swing.JTextField BackgroundImagePath;
|
||||
private javax.swing.JButton BattlefieldBGMButton;
|
||||
private javax.swing.JButton BattlefieldBrowseButton;
|
||||
private javax.swing.JTextField BattlefieldIBGMPath;
|
||||
private javax.swing.JTextField BattlefieldImagePath;
|
||||
private java.awt.Label MusicPath;
|
||||
private javax.swing.JButton browseButton;
|
||||
private javax.swing.JComboBox cbProxyType;
|
||||
private javax.swing.JCheckBox checkBoxBeforeCOthers;
|
||||
|
|
|
@ -21,7 +21,9 @@ public class MusicPlayer {
|
|||
|
||||
//open file and add list
|
||||
private boolean open(){
|
||||
filepath = Constants.BASE_MUSICS_PATH;
|
||||
String path = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_MUSICS_PATH, "true");
|
||||
filepath = path + File.separator;
|
||||
if(path == null) filepath = Constants.BASE_MUSICS_PATH;
|
||||
filelist.removeAll();
|
||||
File filedir = new File(filepath);
|
||||
File[] fileread = filedir.listFiles();
|
||||
|
|
Loading…
Reference in a new issue