mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Support playing background music for mobile game
This commit is contained in:
28
.gitattributes
vendored
28
.gitattributes
vendored
@@ -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/quest-pet-token-images.txt svneol=native#text/plain
|
||||||
forge-gui/res/lists/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/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_l1.txt -text
|
||||||
forge-gui/res/quest/bazaar/ape_pet_l2.txt -text
|
forge-gui/res/quest/bazaar/ape_pet_l2.txt -text
|
||||||
forge-gui/res/quest/bazaar/ape_pet_l3.txt -text
|
forge-gui/res/quest/bazaar/ape_pet_l3.txt -text
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import forge.screens.FScreen;
|
|||||||
import forge.screens.SplashScreen;
|
import forge.screens.SplashScreen;
|
||||||
import forge.screens.home.HomeScreen;
|
import forge.screens.home.HomeScreen;
|
||||||
import forge.screens.match.FControl;
|
import forge.screens.match.FControl;
|
||||||
|
import forge.sound.MusicPlayer;
|
||||||
import forge.sound.SoundSystem;
|
import forge.sound.SoundSystem;
|
||||||
import forge.toolbox.FContainer;
|
import forge.toolbox.FContainer;
|
||||||
import forge.toolbox.FDisplayObject;
|
import forge.toolbox.FDisplayObject;
|
||||||
@@ -45,6 +46,7 @@ public class Forge implements ApplicationListener {
|
|||||||
private static FScreen currentScreen;
|
private static FScreen currentScreen;
|
||||||
private static SplashScreen splashScreen;
|
private static SplashScreen splashScreen;
|
||||||
private static KeyInputAdapter keyInputAdapter;
|
private static KeyInputAdapter keyInputAdapter;
|
||||||
|
private static MusicPlayer musicPlayer;
|
||||||
private static final SoundSystem soundSystem = new SoundSystem();
|
private static final SoundSystem soundSystem = new SoundSystem();
|
||||||
private static final Stack<FScreen> screens = new Stack<FScreen>();
|
private static final Stack<FScreen> screens = new Stack<FScreen>();
|
||||||
|
|
||||||
@@ -67,6 +69,7 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
graphics = new Graphics();
|
graphics = new Graphics();
|
||||||
splashScreen = new SplashScreen();
|
splashScreen = new SplashScreen();
|
||||||
|
musicPlayer = new MusicPlayer(ForgeConstants.MUSIC_DIR + "menus");
|
||||||
|
|
||||||
String skinName;
|
String skinName;
|
||||||
if (FileUtil.doesFileExist(ForgeConstants.MAIN_PREFS_FILE)) {
|
if (FileUtil.doesFileExist(ForgeConstants.MAIN_PREFS_FILE)) {
|
||||||
@@ -106,6 +109,8 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
FSkin.loadFull(splashScreen);
|
FSkin.loadFull(splashScreen);
|
||||||
|
|
||||||
|
musicPlayer.play(); //start background music
|
||||||
|
|
||||||
Gdx.input.setInputProcessor(new MainInputProcessor());
|
Gdx.input.setInputProcessor(new MainInputProcessor());
|
||||||
Gdx.input.setCatchBackKey(true);
|
Gdx.input.setCatchBackKey(true);
|
||||||
Gdx.input.setCatchMenuKey(true);
|
Gdx.input.setCatchMenuKey(true);
|
||||||
@@ -195,6 +200,10 @@ public class Forge implements ApplicationListener {
|
|||||||
return soundSystem;
|
return soundSystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MusicPlayer getMusicPlayer() {
|
||||||
|
return musicPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render() {
|
public void render() {
|
||||||
try {
|
try {
|
||||||
@@ -249,10 +258,11 @@ public class Forge implements ApplicationListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resume() {
|
public void resume() {
|
||||||
|
FControl.resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose () {
|
public void dispose() {
|
||||||
if (currentScreen != null) {
|
if (currentScreen != null) {
|
||||||
FOverlay overlay = FOverlay.getTopOverlay();
|
FOverlay overlay = FOverlay.getTopOverlay();
|
||||||
while (overlay != null) {
|
while (overlay != null) {
|
||||||
@@ -264,6 +274,8 @@ public class Forge implements ApplicationListener {
|
|||||||
}
|
}
|
||||||
screens.clear();
|
screens.clear();
|
||||||
graphics.dispose();
|
graphics.dispose();
|
||||||
|
musicPlayer.dispose();
|
||||||
|
FControl.dispose();
|
||||||
|
|
||||||
if (onExit != null) {
|
if (onExit != null) {
|
||||||
onExit.run();
|
onExit.run();
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import forge.match.input.InputProxy;
|
|||||||
import forge.match.input.InputQueue;
|
import forge.match.input.InputQueue;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.player.LobbyPlayerHuman;
|
import forge.player.LobbyPlayerHuman;
|
||||||
|
import forge.properties.ForgeConstants;
|
||||||
import forge.properties.ForgePreferences;
|
import forge.properties.ForgePreferences;
|
||||||
import forge.properties.ForgePreferences.FPref;
|
import forge.properties.ForgePreferences.FPref;
|
||||||
import forge.quest.QuestController;
|
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;
|
||||||
import forge.screens.match.views.VPhaseIndicator.PhaseLabel;
|
import forge.screens.match.views.VPhaseIndicator.PhaseLabel;
|
||||||
import forge.screens.match.views.VPlayerPanel;
|
import forge.screens.match.views.VPlayerPanel;
|
||||||
|
import forge.sound.MusicPlayer;
|
||||||
import forge.toolbox.FCardPanel;
|
import forge.toolbox.FCardPanel;
|
||||||
import forge.toolbox.FDisplayObject;
|
import forge.toolbox.FDisplayObject;
|
||||||
import forge.toolbox.FOptionPane;
|
import forge.toolbox.FOptionPane;
|
||||||
@@ -85,6 +87,7 @@ public class FControl {
|
|||||||
private static List<Player> sortedPlayers;
|
private static List<Player> sortedPlayers;
|
||||||
private static final EventBus uiEvents;
|
private static final EventBus uiEvents;
|
||||||
private static boolean gameHasHumanPlayer;
|
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 MatchUiEventVisitor visitor = new MatchUiEventVisitor();
|
||||||
private static final FControlGameEventHandler fcVisitor = new FControlGameEventHandler();
|
private static final FControlGameEventHandler fcVisitor = new FControlGameEventHandler();
|
||||||
private static final FControlGamePlayback playbackControl = new FControlGamePlayback();
|
private static final FControlGamePlayback playbackControl = new FControlGamePlayback();
|
||||||
@@ -119,6 +122,9 @@ public class FControl {
|
|||||||
public static void startGame(final Match match) {
|
public static void startGame(final Match match) {
|
||||||
CardAreaPanel.resetForNewGame(); //ensure card panels reset between games
|
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();
|
game = match.createGame();
|
||||||
|
|
||||||
if (game.getRules().getGameType() == GameType.Quest) {
|
if (game.getRules().getGameType() == GameType.Quest) {
|
||||||
@@ -567,12 +573,23 @@ public class FControl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void pause() {
|
public static void pause() {
|
||||||
|
Forge.getMusicPlayer().pause();
|
||||||
|
matchMusicPlayer.pause();
|
||||||
//pause playback if needed
|
//pause playback if needed
|
||||||
if (inputQueue != null && inputQueue.getInput() instanceof InputPlaybackControl) {
|
if (inputQueue != null && inputQueue.getInput() instanceof InputPlaybackControl) {
|
||||||
((InputPlaybackControl)inputQueue.getInput()).pause();
|
((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;
|
private final static boolean LOG_UIEVENTS = false;
|
||||||
|
|
||||||
// UI-related events should arrive here
|
// UI-related events should arrive here
|
||||||
@@ -776,6 +793,13 @@ public class FControl {
|
|||||||
return cl;
|
return cl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void onViewClosed() {
|
||||||
|
matchMusicPlayer.stop();
|
||||||
|
Forge.getMusicPlayer().changeTrack(); //switch back to random menu screen music
|
||||||
|
|
||||||
|
writeMatchPreferences();
|
||||||
|
}
|
||||||
|
|
||||||
public static void writeMatchPreferences() {
|
public static void writeMatchPreferences() {
|
||||||
ForgePreferences prefs = FModel.getPreferences();
|
ForgePreferences prefs = FModel.getPreferences();
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public class MatchScreen extends FScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose(Callback<Boolean> canCloseCallback) {
|
public void onClose(Callback<Boolean> canCloseCallback) {
|
||||||
FControl.writeMatchPreferences();
|
FControl.onViewClosed();
|
||||||
super.onClose(canCloseCallback);
|
super.onClose(canCloseCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
5
forge-gui/res/music/Credit.txt
Normal file
5
forge-gui/res/music/Credit.txt
Normal file
@@ -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/
|
||||||
BIN
forge-gui/res/music/match/8bit Dungeon Boss.mp3
Normal file
BIN
forge-gui/res/music/match/8bit Dungeon Boss.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Dama-May.mp3
Normal file
BIN
forge-gui/res/music/match/Dama-May.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Dangerous.mp3
Normal file
BIN
forge-gui/res/music/match/Dangerous.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Exciting Trailer.mp3
Normal file
BIN
forge-gui/res/music/match/Exciting Trailer.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Faceoff.mp3
Normal file
BIN
forge-gui/res/music/match/Faceoff.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Failing Defense.mp3
Normal file
BIN
forge-gui/res/music/match/Failing Defense.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Five Armies.mp3
Normal file
BIN
forge-gui/res/music/match/Five Armies.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Hitman.mp3
Normal file
BIN
forge-gui/res/music/match/Hitman.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Machinations.mp3
Normal file
BIN
forge-gui/res/music/match/Machinations.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Movement Proposition.mp3
Normal file
BIN
forge-gui/res/music/match/Movement Proposition.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Prelude and Action.mp3
Normal file
BIN
forge-gui/res/music/match/Prelude and Action.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Round Drums.mp3
Normal file
BIN
forge-gui/res/music/match/Round Drums.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/The Complex.mp3
Normal file
BIN
forge-gui/res/music/match/The Complex.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/The Descent.mp3
Normal file
BIN
forge-gui/res/music/match/The Descent.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/match/Truth of the Legend.mp3
Normal file
BIN
forge-gui/res/music/match/Truth of the Legend.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/Angevin.mp3
Normal file
BIN
forge-gui/res/music/menus/Angevin.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/At Launch.mp3
Normal file
BIN
forge-gui/res/music/menus/At Launch.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/Enchanted Valley.mp3
Normal file
BIN
forge-gui/res/music/menus/Enchanted Valley.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/Evil March.mp3
Normal file
BIN
forge-gui/res/music/menus/Evil March.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/Heroic Age.mp3
Normal file
BIN
forge-gui/res/music/menus/Heroic Age.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/Ignosi.mp3
Normal file
BIN
forge-gui/res/music/menus/Ignosi.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/Lord of the Land.mp3
Normal file
BIN
forge-gui/res/music/menus/Lord of the Land.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/Majestic Hills.mp3
Normal file
BIN
forge-gui/res/music/menus/Majestic Hills.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/Mighty and Meek.mp3
Normal file
BIN
forge-gui/res/music/menus/Mighty and Meek.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/Myst.mp3
Normal file
BIN
forge-gui/res/music/menus/Myst.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/The Pyre.mp3
Normal file
BIN
forge-gui/res/music/menus/The Pyre.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/music/menus/Willow and the Light.mp3
Normal file
BIN
forge-gui/res/music/menus/Willow and the Light.mp3
Normal file
Binary file not shown.
@@ -55,6 +55,7 @@ public final class ForgeConstants {
|
|||||||
public static final String DECK_CUBE_DIR = RES_DIR + "cube/";
|
public static final String DECK_CUBE_DIR = RES_DIR + "cube/";
|
||||||
public static final String AI_PROFILE_DIR = RES_DIR + "ai/";
|
public static final String AI_PROFILE_DIR = RES_DIR + "ai/";
|
||||||
public static final String SOUND_DIR = RES_DIR + "sound/";
|
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/";
|
private static final String QUEST_DIR = RES_DIR + "quest/";
|
||||||
public static final String QUEST_WORLD_DIR = QUEST_DIR + "world/";
|
public static final String QUEST_WORLD_DIR = QUEST_DIR + "world/";
|
||||||
|
|||||||
Reference in New Issue
Block a user