Commit 98b141b6 authored by Unicorn369's avatar Unicorn369 Committed by fallenstardust

按场景切换音乐

parent 13b883d5
...@@ -445,7 +445,10 @@ bool Game::Initialize() { ...@@ -445,7 +445,10 @@ bool Game::Initialize() {
scrMusicVolume->setPos(gameConf.music_volume); scrMusicVolume->setPos(gameConf.music_volume);
scrMusicVolume->setLargeStep(1); scrMusicVolume->setLargeStep(1);
scrMusicVolume->setSmallStep(1); scrMusicVolume->setSmallStep(1);
elmTabHelperLast = chkEnableMusic; posY += 60;
chkMusicMode = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabHelper, -1, dataManager.GetSysString(1284));
chkMusicMode->setChecked(gameConf.music_mode != 0);
elmTabHelperLast = chkMusicMode;
//show scroll //show scroll
s32 tabHelperLastY = elmTabHelperLast->getRelativePosition().LowerRightCorner.Y; s32 tabHelperLastY = elmTabHelperLast->getRelativePosition().LowerRightCorner.Y;
s32 tabHelperHeight = 300 * yScale; s32 tabHelperHeight = 300 * yScale;
...@@ -968,6 +971,8 @@ bool Game::Initialize() { ...@@ -968,6 +971,8 @@ bool Game::Initialize() {
chkEnableMusic->setVisible(false); chkEnableMusic->setVisible(false);
scrSoundVolume->setVisible(false); scrSoundVolume->setVisible(false);
scrMusicVolume->setVisible(false); scrMusicVolume->setVisible(false);
chkMusicMode->setEnabled(false);
chkMusicMode->setVisible(false);
} }
#endif #endif
//leave/surrender/exit //leave/surrender/exit
...@@ -1482,6 +1487,7 @@ void Game::LoadConfig() { ...@@ -1482,6 +1487,7 @@ void Game::LoadConfig() {
gameConf.sound_volume = android::getIntSetting(appMain, "sound_volume", 50); gameConf.sound_volume = android::getIntSetting(appMain, "sound_volume", 50);
gameConf.enable_music = android::getIntSetting(appMain, "enable_music", 1); gameConf.enable_music = android::getIntSetting(appMain, "enable_music", 1);
gameConf.music_volume = android::getIntSetting(appMain, "music_volume", 50); gameConf.music_volume = android::getIntSetting(appMain, "music_volume", 50);
gameConf.music_mode = android::getIntSetting(appMain, "music_mode", 1);
//defult Setting without checked //defult Setting without checked
gameConf.hide_setname = 0; gameConf.hide_setname = 0;
gameConf.hide_hint_button = 0; gameConf.hide_hint_button = 0;
...@@ -1525,6 +1531,8 @@ void Game::SaveConfig() { ...@@ -1525,6 +1531,8 @@ void Game::SaveConfig() {
android::saveIntSetting(appMain, "enable_sound", gameConf.enable_sound); android::saveIntSetting(appMain, "enable_sound", gameConf.enable_sound);
gameConf.enable_music = chkEnableMusic->isChecked() ? 1 : 0; gameConf.enable_music = chkEnableMusic->isChecked() ? 1 : 0;
android::saveIntSetting(appMain, "enable_music", gameConf.enable_music); android::saveIntSetting(appMain, "enable_music", gameConf.enable_music);
gameConf.music_mode = chkMusicMode->isChecked() ? 1 : 0;
android::saveIntSetting(appMain, "music_mode", gameConf.music_mode);
gameConf.sound_volume = (double)scrSoundVolume->getPos(); gameConf.sound_volume = (double)scrSoundVolume->getPos();
android::saveIntSetting(appMain, "sound_volume", gameConf.sound_volume); android::saveIntSetting(appMain, "sound_volume", gameConf.sound_volume);
......
...@@ -51,10 +51,12 @@ struct Config { ...@@ -51,10 +51,12 @@ struct Config {
int quick_animation; int quick_animation;
int auto_save_replay; int auto_save_replay;
int prefer_expansion_script; int prefer_expansion_script;
//sound
bool enable_sound; bool enable_sound;
bool enable_music; bool enable_music;
double sound_volume; double sound_volume;
double music_volume; double music_volume;
double music_mode;
}; };
struct DuelInfo { struct DuelInfo {
...@@ -275,10 +277,12 @@ public: ...@@ -275,10 +277,12 @@ public:
irr::gui::IGUICheckBox* chkAutoSearch; irr::gui::IGUICheckBox* chkAutoSearch;
irr::gui::IGUICheckBox* chkMultiKeywords; irr::gui::IGUICheckBox* chkMultiKeywords;
irr::gui::IGUICheckBox* chkPreferExpansionScript; irr::gui::IGUICheckBox* chkPreferExpansionScript;
//sound
irr::gui::IGUICheckBox* chkEnableSound; irr::gui::IGUICheckBox* chkEnableSound;
irr::gui::IGUICheckBox* chkEnableMusic; irr::gui::IGUICheckBox* chkEnableMusic;
irr::gui::IGUIScrollBar* scrSoundVolume; irr::gui::IGUIScrollBar* scrSoundVolume;
irr::gui::IGUIScrollBar* scrMusicVolume; irr::gui::IGUIScrollBar* scrMusicVolume;
irr::gui::IGUICheckBox* chkMusicMode;
//main menu //main menu
irr::gui::IGUIWindow* wMainMenu; irr::gui::IGUIWindow* wMainMenu;
irr::gui::IGUIButton* btnLanMode; irr::gui::IGUIButton* btnLanMode;
......
...@@ -121,6 +121,8 @@ void SoundManager::PlayMusic(const std::string& song, bool loop) { ...@@ -121,6 +121,8 @@ void SoundManager::PlayMusic(const std::string& song, bool loop) {
if (bgm) bgmCurrent = bgm->play(song, loop); if (bgm) bgmCurrent = bgm->play(song, loop);
} }
void SoundManager::PlayBGM(BGM scene) { void SoundManager::PlayBGM(BGM scene) {
if(!mainGame->chkMusicMode->isChecked())
scene = BGM::ALL;
auto& list = BGMList[scene]; auto& list = BGMList[scene];
int count = list.size(); int count = list.size();
if (musicEnabled && (scene != bgm_scene || !bgm->exists(bgmCurrent)) && count > 0) { if (musicEnabled && (scene != bgm_scene || !bgm->exists(bgmCurrent)) && count > 0) {
......
...@@ -325,6 +325,7 @@ ...@@ -325,6 +325,7 @@
!system 1281 提取卡组 !system 1281 提取卡组
!system 1282 开启音效 !system 1282 开启音效
!system 1283 开启音乐 !system 1283 开启音乐
!system 1284 按场景切换音乐
!system 1290 停用聊天功能 !system 1290 停用聊天功能
!system 1291 忽略观战者发言 !system 1291 忽略观战者发言
!system 1292 □忽略时点 !system 1292 □忽略时点
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment