Add a background music player to Mage Client. Music support .mp3 or .wav files. Put the audio files under plugins\sounds\music, random song will be played sequentially when GamePane is activited. the UI to adjust background music is add to preference dialog as well.

This commit is contained in:
Li REN 2013-06-12 22:55:25 -04:00
parent 7102d08637
commit 6bbaa9fda1
6 changed files with 78 additions and 20 deletions

View file

@ -66,6 +66,7 @@ import mage.client.tournament.TournamentPanel;
import mage.client.util.EDTExceptionHandler;
import mage.client.util.SettingsManager;
import mage.client.util.gui.ArrowBuilder;
import mage.client.util.MusicPlayer;
import mage.components.ImagePanel;
import mage.interfaces.Action;
import mage.interfaces.MageClient;
@ -540,10 +541,14 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
ArrowBuilder.getBuilder().hideAllPanels();
if (frame instanceof GamePane) {
ArrowBuilder.getBuilder().showPanel(((GamePane) frame).getGameId());
MusicPlayer.playBGM();
}else{
MusicPlayer.stopBGM();
}
}
public static void deactivate(MagePane frame) {
MusicPlayer.stopBGM();
frame.setVisible(false);
MagePane topmost = getTopMost(frame);
if (activeFrame != frame) {