mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
update adventure BGM..
This commit is contained in:
@@ -312,6 +312,8 @@ public class Forge implements ApplicationListener {
|
||||
GuiBase.setIsAdventureMode(false);
|
||||
openHomeScreen(-1, null); //default for startup
|
||||
isMobileAdventureMode = false;
|
||||
MusicPlaylist.invalidateMusicPlaylist();
|
||||
SoundSystem.instance.setBackgroundMusic(MusicPlaylist.MENUS);
|
||||
if (isLandscapeMode()) { //open preferred new game screen by default if landscape mode
|
||||
NewGameMenu.getPreferredScreen().open();
|
||||
}
|
||||
@@ -338,8 +340,11 @@ public class Forge implements ApplicationListener {
|
||||
try {
|
||||
Config.instance().loadResources();
|
||||
SpellSmithScene.instance().loadEditions();
|
||||
if (startScene)
|
||||
if (startScene) {
|
||||
MusicPlaylist.invalidateMusicPlaylist();
|
||||
SoundSystem.instance.setBackgroundMusic(MusicPlaylist.MENUS);
|
||||
switchScene(StartScene.instance());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -404,8 +409,6 @@ public class Forge implements ApplicationListener {
|
||||
clearSplashScreen();
|
||||
}
|
||||
}
|
||||
//start background music
|
||||
SoundSystem.instance.setBackgroundMusic(MusicPlaylist.MENUS);
|
||||
safeToClose = true;
|
||||
clearTransitionScreen();
|
||||
}, takeScreenshot(), false, false, true, false));
|
||||
|
||||
@@ -327,12 +327,12 @@ public class ArenaScene extends UIScene implements IAfterMatch {
|
||||
pane.clear();
|
||||
arenaTable.clear();
|
||||
if (Forge.isLandscapeMode()) {
|
||||
arenaTable.add(Controls.newTextraLabel("[;][%150]" + GameScene.instance().getAdventurePlayerLocation(true) + " Arena")).top();
|
||||
arenaTable.add(Controls.newTextraLabel("[;][%150]" + GameScene.instance().getAdventurePlayerLocation(true, true) + " Arena")).top();
|
||||
arenaTable.row();
|
||||
arenaTable.add(arenaPlane).width(arenaPlane.getWidth()).height(arenaPlane.getHeight());
|
||||
pane.setActor(arenaTable);
|
||||
} else {
|
||||
arenaTable.add(Controls.newTextraLabel("[;][%150]" + GameScene.instance().getAdventurePlayerLocation(true) + " Arena")).colspan(3).top();
|
||||
arenaTable.add(Controls.newTextraLabel("[;][%150]" + GameScene.instance().getAdventurePlayerLocation(true, true) + " Arena")).colspan(3).top();
|
||||
arenaTable.row();
|
||||
int size = fighters.size;
|
||||
int pv = 0;
|
||||
|
||||
@@ -24,6 +24,7 @@ public class GameScene extends HudScene {
|
||||
}
|
||||
|
||||
private static GameScene object;
|
||||
private String location = "";
|
||||
|
||||
public static GameScene instance() {
|
||||
if (object == null)
|
||||
@@ -57,27 +58,31 @@ public class GameScene extends HudScene {
|
||||
WorldStage.getInstance().handlePointsOfInterestCollision();
|
||||
}
|
||||
|
||||
public String getAdventurePlayerLocation(boolean forHeader) {
|
||||
String location = "";
|
||||
public String getAdventurePlayerLocation(boolean forHeader, boolean skipRoads) {
|
||||
if (MapStage.getInstance().isInMap()) {
|
||||
location = forHeader ? TileMapScene.instance().rootPoint.getData().name : TileMapScene.instance().rootPoint.getData().type;
|
||||
} else {
|
||||
World world = Current.world();
|
||||
int currentBiome = World.highestBiome(world.getBiome((int) Current.player().getWorldPosX() / world.getTileSize(), (int) Current.player().getWorldPosY() / world.getTileSize()));
|
||||
//this gets the name of the layer... this shoud be based on boundaries...
|
||||
int currentBiome = World.highestBiome(world.getBiome((int) stage.getPlayerSprite().getX() / world.getTileSize(), (int) stage.getPlayerSprite().getY() / world.getTileSize()));
|
||||
List<BiomeData> biomeData = world.getData().GetBiomes();
|
||||
try {
|
||||
if (biomeData.size() <= currentBiome) //on roads....
|
||||
if (skipRoads) {
|
||||
location = forHeader ? "Waste Map" : "waste";
|
||||
} else {
|
||||
//should load while walking on "road"
|
||||
location = "";
|
||||
}
|
||||
else {
|
||||
BiomeData data = biomeData.get(currentBiome);
|
||||
location = forHeader ? TextUtil.capitalize(data.name) + " Map" : data.name;
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
location = forHeader ? "Waste Map" : "waste";
|
||||
}
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
public boolean isNotInWorldMap() {
|
||||
String location = getAdventurePlayerLocation(false);
|
||||
String location = getAdventurePlayerLocation(false, true);
|
||||
Set<String> locationTypes = Sets.newHashSet("capital", "castle", "cave", "dungeon", "town");
|
||||
return locationTypes.contains(location);
|
||||
}
|
||||
|
||||
@@ -27,10 +27,12 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
public void connected(final Controller controller) {
|
||||
hud.ui.controllerConnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected(final Controller controller) {
|
||||
hud.ui.controllerDisconnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean leave() {
|
||||
stage.leave();
|
||||
@@ -51,18 +53,16 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void act(float delta)
|
||||
{
|
||||
public void act(float delta) {
|
||||
stage.act(delta);
|
||||
hud.act(delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
stage.draw();
|
||||
hud.draw();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,38 +72,38 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
}
|
||||
if (hud.keyDown(keycode))
|
||||
return true;
|
||||
if(isInHudOnlyMode())
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
return stage.keyDown(keycode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyUp(int keycode) {
|
||||
|
||||
if (MapStage.getInstance().isDialogOnlyInput()) {
|
||||
return true;
|
||||
}
|
||||
if (hud.keyUp(keycode))
|
||||
return true;
|
||||
if(isInHudOnlyMode())
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
return stage.keyUp(keycode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonDown(Controller var1, int var2) {
|
||||
return keyDown(KeyBinding.controllerButtonToKey(var1,var2));
|
||||
return keyDown(KeyBinding.controllerButtonToKey(var1, var2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean buttonUp(Controller var1, int var2) {
|
||||
return keyUp(KeyBinding.controllerButtonToKey(var1,var2));
|
||||
return keyUp(KeyBinding.controllerButtonToKey(var1, var2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(char character) {
|
||||
|
||||
if (hud.keyTyped(character))
|
||||
return true;
|
||||
if(isInHudOnlyMode())
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
return stage.keyTyped(character);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
|
||||
if (hud.touchDown(screenX, screenY, pointer, button))
|
||||
return true;
|
||||
if(isInHudOnlyMode())
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
return stage.touchDown(screenX, screenY, pointer, button);
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
|
||||
if (hud.touchUp(screenX, screenY, pointer, button))
|
||||
return true;
|
||||
if(isInHudOnlyMode())
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
return stage.touchUp(screenX, screenY, pointer, button);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
public boolean touchDragged(int screenX, int screenY, int pointer) {
|
||||
if (hud.touchDragged(screenX, screenY, pointer))
|
||||
return true;
|
||||
if(isInHudOnlyMode())
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
return stage.touchDragged(screenX, screenY, pointer);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
public boolean mouseMoved(int screenX, int screenY) {
|
||||
if (hud.mouseMoved(screenX, screenY))
|
||||
return true;
|
||||
if(isInHudOnlyMode())
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
return stage.mouseMoved(screenX, screenY);
|
||||
}
|
||||
@@ -148,22 +148,22 @@ public abstract class HudScene extends Scene implements InputProcessor, IAfterMa
|
||||
public boolean scrolled(float amountX, float amountY) {
|
||||
if (hud.scrolled(amountX, amountY))
|
||||
return true;
|
||||
if(isInHudOnlyMode())
|
||||
if (isInHudOnlyMode())
|
||||
return false;
|
||||
return stage.scrolled(amountX, amountY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean axisMoved(Controller controller, int axisIndex, float value) {
|
||||
|
||||
return stage.axisMoved(controller, axisIndex, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWinner(boolean winner) {
|
||||
stage.setWinner(winner);
|
||||
}
|
||||
public boolean isInHudOnlyMode()
|
||||
{
|
||||
|
||||
public boolean isInHudOnlyMode() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -218,6 +218,7 @@ public class InventoryScene extends UIScene {
|
||||
clearSelectable();
|
||||
inventoryButtons.clear();
|
||||
inventory.clear();
|
||||
Current.player().getItems().sort();
|
||||
for (int i = 0; i < Current.player().getItems().size; i++) {
|
||||
|
||||
if (i % columns == 0)
|
||||
|
||||
@@ -250,7 +250,7 @@ public class SaveLoadScene extends UIScene {
|
||||
|
||||
|
||||
public void save() {
|
||||
if (WorldSave.getCurrentSave().save(textInput.getText() + ASCII_179 + GameScene.instance().getAdventurePlayerLocation(true), currentSlot)) {
|
||||
if (WorldSave.getCurrentSave().save(textInput.getText() + ASCII_179 + GameScene.instance().getAdventurePlayerLocation(true, true), currentSlot)) {
|
||||
updateFiles();
|
||||
//ensure the dialog is hidden before switching
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ import forge.adventure.world.WorldSave;
|
||||
import forge.deck.Deck;
|
||||
import forge.gui.FThreads;
|
||||
import forge.gui.GuiBase;
|
||||
import forge.sound.MusicPlaylist;
|
||||
import forge.sound.SoundSystem;
|
||||
|
||||
/**
|
||||
* Stage to handle everything rendered in the HUD
|
||||
@@ -238,7 +240,6 @@ public class GameHUD extends Stage {
|
||||
return super.touchDown(screenX, screenY, pointer, button);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
updatelife = false;
|
||||
@@ -274,6 +275,7 @@ public class GameHUD extends Stage {
|
||||
updatelife = false;
|
||||
lifePoints.setText("[%95][+Life]" + lifepointsTextColor + " " + AdventurePlayer.current().getLife() + "/" + AdventurePlayer.current().getMaxLife());
|
||||
}
|
||||
updateMusic();
|
||||
}
|
||||
|
||||
Texture miniMapTexture;
|
||||
@@ -299,6 +301,7 @@ public class GameHUD extends Stage {
|
||||
} else {
|
||||
deckActor.setColor(menuActor.getColor());
|
||||
}
|
||||
updateMusic();
|
||||
}
|
||||
|
||||
private void openDeck() {
|
||||
@@ -326,7 +329,6 @@ public class GameHUD extends Stage {
|
||||
dialog.getContentTable().add(L).width(120f);
|
||||
dialog.setKeepWithinStage(true);
|
||||
showDialog();
|
||||
|
||||
}
|
||||
|
||||
private void exitDungeonCallback() {
|
||||
@@ -475,7 +477,6 @@ public class GameHUD extends Stage {
|
||||
}
|
||||
|
||||
private void showDialog() {
|
||||
|
||||
dialogButtonMap.clear();
|
||||
for (int i = 0; i < dialog.getButtonTable().getCells().size; i++) {
|
||||
dialogButtonMap.add((TextraButton) dialog.getButtonTable().getCells().get(i).getActor());
|
||||
@@ -560,7 +561,47 @@ public class GameHUD extends Stage {
|
||||
if (count > 1)
|
||||
showButtons();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateMusic() {
|
||||
switch (GameScene.instance().getAdventurePlayerLocation(false, false)) {
|
||||
case "green":
|
||||
changeBGM(MusicPlaylist.GREEN);
|
||||
break;
|
||||
case "red":
|
||||
changeBGM(MusicPlaylist.RED);
|
||||
break;
|
||||
case "blue":
|
||||
changeBGM(MusicPlaylist.BLUE);
|
||||
break;
|
||||
case "black":
|
||||
changeBGM(MusicPlaylist.BLACK);
|
||||
break;
|
||||
case "white":
|
||||
changeBGM(MusicPlaylist.WHITE);
|
||||
break;
|
||||
case "capital":
|
||||
case "town":
|
||||
changeBGM(MusicPlaylist.TOWN);
|
||||
break;
|
||||
case "cave":
|
||||
changeBGM(MusicPlaylist.CAVE);
|
||||
break;
|
||||
case "castle":
|
||||
changeBGM(MusicPlaylist.CASTLE);
|
||||
break;
|
||||
case "waste":
|
||||
changeBGM(MusicPlaylist.MENUS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
float fade = 1f;
|
||||
|
||||
void changeBGM(MusicPlaylist playlist) {
|
||||
if (!playlist.equals(SoundSystem.instance.getCurrentPlaylist())) {
|
||||
SoundSystem.instance.setBackgroundMusic(playlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -818,7 +818,7 @@ public class MatchScreen extends FScreen {
|
||||
|
||||
FSkinTexture getBG() {
|
||||
if (Forge.isMobileAdventureMode) {
|
||||
switch (GameScene.instance().getAdventurePlayerLocation(false)) {
|
||||
switch (GameScene.instance().getAdventurePlayerLocation(false, true)) {
|
||||
case "green":
|
||||
return FSkinTexture.ADV_BG_FOREST;
|
||||
case "black":
|
||||
|
||||
BIN
forge-gui/res/adventure/music/black/black1.mp3
Normal file
BIN
forge-gui/res/adventure/music/black/black1.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/adventure/music/blue/blue1.mp3
Normal file
BIN
forge-gui/res/adventure/music/blue/blue1.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/adventure/music/cave/cave1.mp3
Normal file
BIN
forge-gui/res/adventure/music/cave/cave1.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/adventure/music/green/green1.mp3
Normal file
BIN
forge-gui/res/adventure/music/green/green1.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/adventure/music/match/match1.mp3
Normal file
BIN
forge-gui/res/adventure/music/match/match1.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/adventure/music/match/match2.mp3
Normal file
BIN
forge-gui/res/adventure/music/match/match2.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/adventure/music/match/match3.mp3
Normal file
BIN
forge-gui/res/adventure/music/match/match3.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/adventure/music/menus/menu1.mp3
Normal file
BIN
forge-gui/res/adventure/music/menus/menu1.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/adventure/music/red/red1.mp3
Normal file
BIN
forge-gui/res/adventure/music/red/red1.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/adventure/music/town/town1.mp3
Normal file
BIN
forge-gui/res/adventure/music/town/town1.mp3
Normal file
Binary file not shown.
BIN
forge-gui/res/adventure/music/white/white1.mp3
Normal file
BIN
forge-gui/res/adventure/music/white/white1.mp3
Normal file
Binary file not shown.
@@ -84,6 +84,7 @@ public final class ForgeConstants {
|
||||
public static final String AI_PROFILE_DIR = RES_DIR + "ai" + PATH_SEPARATOR;
|
||||
public static final String SOUND_DIR = RES_DIR + "sound" + PATH_SEPARATOR;
|
||||
public static final String MUSIC_DIR = RES_DIR + "music" + PATH_SEPARATOR;
|
||||
public static final String ADVENTURE_MUSIC_DIR = ADVENTURE_DIR + "music" + PATH_SEPARATOR;
|
||||
public static final String LANG_DIR = RES_DIR + "languages" + PATH_SEPARATOR;
|
||||
public static final String EFFECTS_DIR = RES_DIR + "effects" + PATH_SEPARATOR;
|
||||
public static final String PUZZLE_DIR = RES_DIR + "puzzle" + PATH_SEPARATOR;
|
||||
|
||||
@@ -6,8 +6,16 @@ import java.io.FilenameFilter;
|
||||
import forge.util.MyRandom;
|
||||
|
||||
public enum MusicPlaylist {
|
||||
MENUS("menus/"),
|
||||
MATCH("match/");
|
||||
BLACK ("black/"),
|
||||
BLUE ("blue/"),
|
||||
RED ("red/"),
|
||||
GREEN ("green/"),
|
||||
WHITE ("white/"),
|
||||
CASTLE ("castle/"),
|
||||
CAVE ("cave/"),
|
||||
TOWN ("town/"),
|
||||
MENUS ("menus/"),
|
||||
MATCH ("match/");
|
||||
|
||||
private final String subDir;
|
||||
private int mostRecentTrackIdx = -1;
|
||||
|
||||
@@ -192,6 +192,10 @@ public class SoundSystem {
|
||||
changeBackgroundTrack();
|
||||
}
|
||||
|
||||
public MusicPlaylist getCurrentPlaylist() {
|
||||
return currentPlaylist;
|
||||
}
|
||||
|
||||
public void changeBackgroundTrack() {
|
||||
//ensure old track stopped and disposed of if needed
|
||||
if (currentTrack != null) {
|
||||
@@ -300,6 +304,8 @@ public class SoundSystem {
|
||||
}
|
||||
|
||||
public String getMusicDirectory() {
|
||||
if (GuiBase.isAdventureMode())
|
||||
return ForgeConstants.ADVENTURE_MUSIC_DIR;
|
||||
String profileName = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_CURRENT_MUSIC_SET);
|
||||
if (profileName.equals("Default")) {
|
||||
return ForgeConstants.MUSIC_DIR;
|
||||
|
||||
Reference in New Issue
Block a user