mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-28 22:29:43 +01:00
add bgmusic
This commit is contained in:
parent
68e252e174
commit
f27ec36d2b
@ -7,6 +7,15 @@
|
|||||||
|
|
||||||
package pp.battleship.client;
|
package pp.battleship.client;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.lang.System.Logger;
|
||||||
|
import java.lang.System.Logger.Level;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.logging.LogManager;
|
||||||
|
|
||||||
import com.jme3.app.DebugKeysAppState;
|
import com.jme3.app.DebugKeysAppState;
|
||||||
import com.jme3.app.SimpleApplication;
|
import com.jme3.app.SimpleApplication;
|
||||||
import com.jme3.app.StatsAppState;
|
import com.jme3.app.StatsAppState;
|
||||||
@ -20,7 +29,10 @@ import com.jme3.input.controls.MouseButtonTrigger;
|
|||||||
import com.jme3.system.AppSettings;
|
import com.jme3.system.AppSettings;
|
||||||
import com.simsilica.lemur.GuiGlobals;
|
import com.simsilica.lemur.GuiGlobals;
|
||||||
import com.simsilica.lemur.style.BaseStyles;
|
import com.simsilica.lemur.style.BaseStyles;
|
||||||
|
|
||||||
|
import static pp.battleship.Resources.lookup;
|
||||||
import pp.battleship.client.gui.BattleAppState;
|
import pp.battleship.client.gui.BattleAppState;
|
||||||
|
import pp.battleship.client.gui.BgMusic;
|
||||||
import pp.battleship.client.gui.EditorAppState;
|
import pp.battleship.client.gui.EditorAppState;
|
||||||
import pp.battleship.client.gui.SeaAppState;
|
import pp.battleship.client.gui.SeaAppState;
|
||||||
import pp.battleship.game.client.BattleshipClient;
|
import pp.battleship.game.client.BattleshipClient;
|
||||||
@ -35,17 +47,6 @@ import pp.dialog.DialogBuilder;
|
|||||||
import pp.dialog.DialogManager;
|
import pp.dialog.DialogManager;
|
||||||
import pp.graphics.Draw;
|
import pp.graphics.Draw;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.System.Logger;
|
|
||||||
import java.lang.System.Logger.Level;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.logging.LogManager;
|
|
||||||
|
|
||||||
import static pp.battleship.Resources.lookup;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main class for the Battleship client application.
|
* The main class for the Battleship client application.
|
||||||
* It manages the initialization, input setup, GUI setup, and game states for the client.
|
* It manages the initialization, input setup, GUI setup, and game states for the client.
|
||||||
@ -268,6 +269,7 @@ public class BattleshipApp extends SimpleApplication implements BattleshipClient
|
|||||||
|
|
||||||
attachGameSound();
|
attachGameSound();
|
||||||
stateManager.attachAll(new EditorAppState(), new BattleAppState(), new SeaAppState());
|
stateManager.attachAll(new EditorAppState(), new BattleAppState(), new SeaAppState());
|
||||||
|
attachBgMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -279,6 +281,12 @@ public class BattleshipApp extends SimpleApplication implements BattleshipClient
|
|||||||
gameSound.setEnabled(GameSound.enabledInPreferences());
|
gameSound.setEnabled(GameSound.enabledInPreferences());
|
||||||
stateManager.attach(gameSound);
|
stateManager.attach(gameSound);
|
||||||
}
|
}
|
||||||
|
private void attachBgMusic() {
|
||||||
|
final BgMusic gameSound = new BgMusic();
|
||||||
|
gameSound.setEnabled(BgMusic.enabledInPreferences());
|
||||||
|
stateManager.attach(gameSound);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the application state every frame.
|
* Updates the application state every frame.
|
||||||
|
Loading…
Reference in New Issue
Block a user