diff --git a/.gitattributes b/.gitattributes index d1f8b450fe5..87a390a3b5b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15282,6 +15282,34 @@ forge-gui/res/lists/quest-pet-shop-icons.txt svneol=native#text/plain forge-gui/res/lists/quest-pet-token-images.txt svneol=native#text/plain forge-gui/res/lists/token-images.txt svneol=native#text/plain forge-gui/res/lists/tournamentpack-images.txt svneol=native#text/plain +forge-gui/res/music/Credit.txt -text +forge-gui/res/music/match/8bit[!!-~]Dungeon[!!-~]Boss.mp3 -text +forge-gui/res/music/match/Dama-May.mp3 -text +forge-gui/res/music/match/Dangerous.mp3 -text +forge-gui/res/music/match/Exciting[!!-~]Trailer.mp3 -text +forge-gui/res/music/match/Faceoff.mp3 -text +forge-gui/res/music/match/Failing[!!-~]Defense.mp3 -text +forge-gui/res/music/match/Five[!!-~]Armies.mp3 -text +forge-gui/res/music/match/Hitman.mp3 -text +forge-gui/res/music/match/Machinations.mp3 -text +forge-gui/res/music/match/Movement[!!-~]Proposition.mp3 -text +forge-gui/res/music/match/Prelude[!!-~]and[!!-~]Action.mp3 -text +forge-gui/res/music/match/Round[!!-~]Drums.mp3 -text +forge-gui/res/music/match/The[!!-~]Complex.mp3 -text +forge-gui/res/music/match/The[!!-~]Descent.mp3 -text +forge-gui/res/music/match/Truth[!!-~]of[!!-~]the[!!-~]Legend.mp3 -text +forge-gui/res/music/menus/Angevin.mp3 -text +forge-gui/res/music/menus/At[!!-~]Launch.mp3 -text +forge-gui/res/music/menus/Enchanted[!!-~]Valley.mp3 -text +forge-gui/res/music/menus/Evil[!!-~]March.mp3 -text +forge-gui/res/music/menus/Heroic[!!-~]Age.mp3 -text +forge-gui/res/music/menus/Ignosi.mp3 -text +forge-gui/res/music/menus/Lord[!!-~]of[!!-~]the[!!-~]Land.mp3 -text +forge-gui/res/music/menus/Majestic[!!-~]Hills.mp3 -text +forge-gui/res/music/menus/Mighty[!!-~]and[!!-~]Meek.mp3 -text +forge-gui/res/music/menus/Myst.mp3 -text +forge-gui/res/music/menus/The[!!-~]Pyre.mp3 -text +forge-gui/res/music/menus/Willow[!!-~]and[!!-~]the[!!-~]Light.mp3 -text forge-gui/res/quest/bazaar/ape_pet_l1.txt -text forge-gui/res/quest/bazaar/ape_pet_l2.txt -text forge-gui/res/quest/bazaar/ape_pet_l3.txt -text diff --git a/forge-gui-mobile/src/forge/Forge.java b/forge-gui-mobile/src/forge/Forge.java index 915367f721f..8f48661bc72 100644 --- a/forge-gui-mobile/src/forge/Forge.java +++ b/forge-gui-mobile/src/forge/Forge.java @@ -23,6 +23,7 @@ import forge.screens.FScreen; import forge.screens.SplashScreen; import forge.screens.home.HomeScreen; import forge.screens.match.FControl; +import forge.sound.MusicPlayer; import forge.sound.SoundSystem; import forge.toolbox.FContainer; import forge.toolbox.FDisplayObject; @@ -45,6 +46,7 @@ public class Forge implements ApplicationListener { private static FScreen currentScreen; private static SplashScreen splashScreen; private static KeyInputAdapter keyInputAdapter; + private static MusicPlayer musicPlayer; private static final SoundSystem soundSystem = new SoundSystem(); private static final Stack screens = new Stack(); @@ -67,6 +69,7 @@ public class Forge implements ApplicationListener { graphics = new Graphics(); splashScreen = new SplashScreen(); + musicPlayer = new MusicPlayer(ForgeConstants.MUSIC_DIR + "menus"); String skinName; if (FileUtil.doesFileExist(ForgeConstants.MAIN_PREFS_FILE)) { @@ -106,6 +109,8 @@ public class Forge implements ApplicationListener { FSkin.loadFull(splashScreen); + musicPlayer.play(); //start background music + Gdx.input.setInputProcessor(new MainInputProcessor()); Gdx.input.setCatchBackKey(true); Gdx.input.setCatchMenuKey(true); @@ -195,6 +200,10 @@ public class Forge implements ApplicationListener { return soundSystem; } + public static MusicPlayer getMusicPlayer() { + return musicPlayer; + } + @Override public void render() { try { @@ -249,10 +258,11 @@ public class Forge implements ApplicationListener { @Override public void resume() { + FControl.resume(); } @Override - public void dispose () { + public void dispose() { if (currentScreen != null) { FOverlay overlay = FOverlay.getTopOverlay(); while (overlay != null) { @@ -264,6 +274,8 @@ public class Forge implements ApplicationListener { } screens.clear(); graphics.dispose(); + musicPlayer.dispose(); + FControl.dispose(); if (onExit != null) { onExit.run(); diff --git a/forge-gui-mobile/src/forge/screens/match/FControl.java b/forge-gui-mobile/src/forge/screens/match/FControl.java index 2cc3c989b22..35ccb9f171f 100644 --- a/forge-gui-mobile/src/forge/screens/match/FControl.java +++ b/forge-gui-mobile/src/forge/screens/match/FControl.java @@ -57,6 +57,7 @@ import forge.match.input.InputProxy; import forge.match.input.InputQueue; import forge.model.FModel; import forge.player.LobbyPlayerHuman; +import forge.properties.ForgeConstants; import forge.properties.ForgePreferences; import forge.properties.ForgePreferences.FPref; import forge.quest.QuestController; @@ -66,6 +67,7 @@ import forge.screens.match.views.VCardDisplayArea.CardAreaPanel; import forge.screens.match.views.VPhaseIndicator; import forge.screens.match.views.VPhaseIndicator.PhaseLabel; import forge.screens.match.views.VPlayerPanel; +import forge.sound.MusicPlayer; import forge.toolbox.FCardPanel; import forge.toolbox.FDisplayObject; import forge.toolbox.FOptionPane; @@ -85,6 +87,7 @@ public class FControl { private static List sortedPlayers; private static final EventBus uiEvents; private static boolean gameHasHumanPlayer; + private static final MusicPlayer matchMusicPlayer = new MusicPlayer(ForgeConstants.MUSIC_DIR + "match"); private static final MatchUiEventVisitor visitor = new MatchUiEventVisitor(); private static final FControlGameEventHandler fcVisitor = new FControlGameEventHandler(); private static final FControlGamePlayback playbackControl = new FControlGamePlayback(); @@ -119,6 +122,9 @@ public class FControl { public static void startGame(final Match match) { CardAreaPanel.resetForNewGame(); //ensure card panels reset between games + Forge.getMusicPlayer().stop(); //switch out menu music for random match screen track + matchMusicPlayer.changeTrack(); + game = match.createGame(); if (game.getRules().getGameType() == GameType.Quest) { @@ -567,12 +573,23 @@ public class FControl { } public static void pause() { + Forge.getMusicPlayer().pause(); + matchMusicPlayer.pause(); //pause playback if needed if (inputQueue != null && inputQueue.getInput() instanceof InputPlaybackControl) { ((InputPlaybackControl)inputQueue.getInput()).pause(); } } + public static void resume() { + Forge.getMusicPlayer().resume(); + matchMusicPlayer.resume(); + } + + public static void dispose() { + matchMusicPlayer.dispose(); + } + private final static boolean LOG_UIEVENTS = false; // UI-related events should arrive here @@ -776,6 +793,13 @@ public class FControl { return cl; } + public static void onViewClosed() { + matchMusicPlayer.stop(); + Forge.getMusicPlayer().changeTrack(); //switch back to random menu screen music + + writeMatchPreferences(); + } + public static void writeMatchPreferences() { ForgePreferences prefs = FModel.getPreferences(); diff --git a/forge-gui-mobile/src/forge/screens/match/MatchScreen.java b/forge-gui-mobile/src/forge/screens/match/MatchScreen.java index ca318a0e435..c9624632d59 100644 --- a/forge-gui-mobile/src/forge/screens/match/MatchScreen.java +++ b/forge-gui-mobile/src/forge/screens/match/MatchScreen.java @@ -122,7 +122,7 @@ public class MatchScreen extends FScreen { @Override public void onClose(Callback canCloseCallback) { - FControl.writeMatchPreferences(); + FControl.onViewClosed(); super.onClose(canCloseCallback); } diff --git a/forge-gui/res/music/Credit.txt b/forge-gui/res/music/Credit.txt new file mode 100644 index 00000000000..cc49b988201 --- /dev/null +++ b/forge-gui/res/music/Credit.txt @@ -0,0 +1,5 @@ +Music contained within this folder is credited to: + +Kevin MacLeod (incompetech.com) +Licensed under Creative Commons: By Attribution 3.0 +http://creativecommons.org/licenses/by/3.0/ \ No newline at end of file diff --git a/forge-gui/res/music/match/8bit Dungeon Boss.mp3 b/forge-gui/res/music/match/8bit Dungeon Boss.mp3 new file mode 100644 index 00000000000..04660eda7d7 Binary files /dev/null and b/forge-gui/res/music/match/8bit Dungeon Boss.mp3 differ diff --git a/forge-gui/res/music/match/Dama-May.mp3 b/forge-gui/res/music/match/Dama-May.mp3 new file mode 100644 index 00000000000..a581f6567bd Binary files /dev/null and b/forge-gui/res/music/match/Dama-May.mp3 differ diff --git a/forge-gui/res/music/match/Dangerous.mp3 b/forge-gui/res/music/match/Dangerous.mp3 new file mode 100644 index 00000000000..f12fcadd598 Binary files /dev/null and b/forge-gui/res/music/match/Dangerous.mp3 differ diff --git a/forge-gui/res/music/match/Exciting Trailer.mp3 b/forge-gui/res/music/match/Exciting Trailer.mp3 new file mode 100644 index 00000000000..71152ba7c88 Binary files /dev/null and b/forge-gui/res/music/match/Exciting Trailer.mp3 differ diff --git a/forge-gui/res/music/match/Faceoff.mp3 b/forge-gui/res/music/match/Faceoff.mp3 new file mode 100644 index 00000000000..8ad8e2a8bab Binary files /dev/null and b/forge-gui/res/music/match/Faceoff.mp3 differ diff --git a/forge-gui/res/music/match/Failing Defense.mp3 b/forge-gui/res/music/match/Failing Defense.mp3 new file mode 100644 index 00000000000..be721a0c5f6 Binary files /dev/null and b/forge-gui/res/music/match/Failing Defense.mp3 differ diff --git a/forge-gui/res/music/match/Five Armies.mp3 b/forge-gui/res/music/match/Five Armies.mp3 new file mode 100644 index 00000000000..a732acbed98 Binary files /dev/null and b/forge-gui/res/music/match/Five Armies.mp3 differ diff --git a/forge-gui/res/music/match/Hitman.mp3 b/forge-gui/res/music/match/Hitman.mp3 new file mode 100644 index 00000000000..daf834e4aa6 Binary files /dev/null and b/forge-gui/res/music/match/Hitman.mp3 differ diff --git a/forge-gui/res/music/match/Machinations.mp3 b/forge-gui/res/music/match/Machinations.mp3 new file mode 100644 index 00000000000..f322ef5fc51 Binary files /dev/null and b/forge-gui/res/music/match/Machinations.mp3 differ diff --git a/forge-gui/res/music/match/Movement Proposition.mp3 b/forge-gui/res/music/match/Movement Proposition.mp3 new file mode 100644 index 00000000000..63ca0303c6c Binary files /dev/null and b/forge-gui/res/music/match/Movement Proposition.mp3 differ diff --git a/forge-gui/res/music/match/Prelude and Action.mp3 b/forge-gui/res/music/match/Prelude and Action.mp3 new file mode 100644 index 00000000000..5c70da935e9 Binary files /dev/null and b/forge-gui/res/music/match/Prelude and Action.mp3 differ diff --git a/forge-gui/res/music/match/Round Drums.mp3 b/forge-gui/res/music/match/Round Drums.mp3 new file mode 100644 index 00000000000..27806c0b0f2 Binary files /dev/null and b/forge-gui/res/music/match/Round Drums.mp3 differ diff --git a/forge-gui/res/music/match/The Complex.mp3 b/forge-gui/res/music/match/The Complex.mp3 new file mode 100644 index 00000000000..d04aac4f73b Binary files /dev/null and b/forge-gui/res/music/match/The Complex.mp3 differ diff --git a/forge-gui/res/music/match/The Descent.mp3 b/forge-gui/res/music/match/The Descent.mp3 new file mode 100644 index 00000000000..7777be0071d Binary files /dev/null and b/forge-gui/res/music/match/The Descent.mp3 differ diff --git a/forge-gui/res/music/match/Truth of the Legend.mp3 b/forge-gui/res/music/match/Truth of the Legend.mp3 new file mode 100644 index 00000000000..35d79d46be5 Binary files /dev/null and b/forge-gui/res/music/match/Truth of the Legend.mp3 differ diff --git a/forge-gui/res/music/menus/Angevin.mp3 b/forge-gui/res/music/menus/Angevin.mp3 new file mode 100644 index 00000000000..197aa2e3253 Binary files /dev/null and b/forge-gui/res/music/menus/Angevin.mp3 differ diff --git a/forge-gui/res/music/menus/At Launch.mp3 b/forge-gui/res/music/menus/At Launch.mp3 new file mode 100644 index 00000000000..3935e0d3900 Binary files /dev/null and b/forge-gui/res/music/menus/At Launch.mp3 differ diff --git a/forge-gui/res/music/menus/Enchanted Valley.mp3 b/forge-gui/res/music/menus/Enchanted Valley.mp3 new file mode 100644 index 00000000000..494ca847be5 Binary files /dev/null and b/forge-gui/res/music/menus/Enchanted Valley.mp3 differ diff --git a/forge-gui/res/music/menus/Evil March.mp3 b/forge-gui/res/music/menus/Evil March.mp3 new file mode 100644 index 00000000000..3a084f699e1 Binary files /dev/null and b/forge-gui/res/music/menus/Evil March.mp3 differ diff --git a/forge-gui/res/music/menus/Heroic Age.mp3 b/forge-gui/res/music/menus/Heroic Age.mp3 new file mode 100644 index 00000000000..b26161c88b9 Binary files /dev/null and b/forge-gui/res/music/menus/Heroic Age.mp3 differ diff --git a/forge-gui/res/music/menus/Ignosi.mp3 b/forge-gui/res/music/menus/Ignosi.mp3 new file mode 100644 index 00000000000..ca563dc7a9d Binary files /dev/null and b/forge-gui/res/music/menus/Ignosi.mp3 differ diff --git a/forge-gui/res/music/menus/Lord of the Land.mp3 b/forge-gui/res/music/menus/Lord of the Land.mp3 new file mode 100644 index 00000000000..26b82eb4e31 Binary files /dev/null and b/forge-gui/res/music/menus/Lord of the Land.mp3 differ diff --git a/forge-gui/res/music/menus/Majestic Hills.mp3 b/forge-gui/res/music/menus/Majestic Hills.mp3 new file mode 100644 index 00000000000..707e812f954 Binary files /dev/null and b/forge-gui/res/music/menus/Majestic Hills.mp3 differ diff --git a/forge-gui/res/music/menus/Mighty and Meek.mp3 b/forge-gui/res/music/menus/Mighty and Meek.mp3 new file mode 100644 index 00000000000..dc1ed43bce5 Binary files /dev/null and b/forge-gui/res/music/menus/Mighty and Meek.mp3 differ diff --git a/forge-gui/res/music/menus/Myst.mp3 b/forge-gui/res/music/menus/Myst.mp3 new file mode 100644 index 00000000000..9171ecd7ef5 Binary files /dev/null and b/forge-gui/res/music/menus/Myst.mp3 differ diff --git a/forge-gui/res/music/menus/The Pyre.mp3 b/forge-gui/res/music/menus/The Pyre.mp3 new file mode 100644 index 00000000000..c7b306d5851 Binary files /dev/null and b/forge-gui/res/music/menus/The Pyre.mp3 differ diff --git a/forge-gui/res/music/menus/Willow and the Light.mp3 b/forge-gui/res/music/menus/Willow and the Light.mp3 new file mode 100644 index 00000000000..32c2b4e4d92 Binary files /dev/null and b/forge-gui/res/music/menus/Willow and the Light.mp3 differ diff --git a/forge-gui/src/main/java/forge/properties/ForgeConstants.java b/forge-gui/src/main/java/forge/properties/ForgeConstants.java index ddf9bb6359b..7b6b1741bc7 100644 --- a/forge-gui/src/main/java/forge/properties/ForgeConstants.java +++ b/forge-gui/src/main/java/forge/properties/ForgeConstants.java @@ -55,6 +55,7 @@ public final class ForgeConstants { public static final String DECK_CUBE_DIR = RES_DIR + "cube/"; public static final String AI_PROFILE_DIR = RES_DIR + "ai/"; public static final String SOUND_DIR = RES_DIR + "sound/"; + public static final String MUSIC_DIR = RES_DIR + "music/"; private static final String QUEST_DIR = RES_DIR + "quest/"; public static final String QUEST_WORLD_DIR = QUEST_DIR + "world/";