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

按场景切换音乐

parent 13b883d5
......@@ -445,7 +445,10 @@ bool Game::Initialize() {
scrMusicVolume->setPos(gameConf.music_volume);
scrMusicVolume->setLargeStep(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
s32 tabHelperLastY = elmTabHelperLast->getRelativePosition().LowerRightCorner.Y;
s32 tabHelperHeight = 300 * yScale;
......@@ -968,6 +971,8 @@ bool Game::Initialize() {
chkEnableMusic->setVisible(false);
scrSoundVolume->setVisible(false);
scrMusicVolume->setVisible(false);
chkMusicMode->setEnabled(false);
chkMusicMode->setVisible(false);
}
#endif
//leave/surrender/exit
......@@ -1482,6 +1487,7 @@ void Game::LoadConfig() {
gameConf.sound_volume = android::getIntSetting(appMain, "sound_volume", 50);
gameConf.enable_music = android::getIntSetting(appMain, "enable_music", 1);
gameConf.music_volume = android::getIntSetting(appMain, "music_volume", 50);
gameConf.music_mode = android::getIntSetting(appMain, "music_mode", 1);
//defult Setting without checked
gameConf.hide_setname = 0;
gameConf.hide_hint_button = 0;
......@@ -1525,6 +1531,8 @@ void Game::SaveConfig() {
android::saveIntSetting(appMain, "enable_sound", gameConf.enable_sound);
gameConf.enable_music = chkEnableMusic->isChecked() ? 1 : 0;
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();
android::saveIntSetting(appMain, "sound_volume", gameConf.sound_volume);
......
......@@ -51,10 +51,12 @@ struct Config {
int quick_animation;
int auto_save_replay;
int prefer_expansion_script;
//sound
bool enable_sound;
bool enable_music;
double sound_volume;
double music_volume;
double music_mode;
};
struct DuelInfo {
......@@ -275,10 +277,12 @@ public:
irr::gui::IGUICheckBox* chkAutoSearch;
irr::gui::IGUICheckBox* chkMultiKeywords;
irr::gui::IGUICheckBox* chkPreferExpansionScript;
//sound
irr::gui::IGUICheckBox* chkEnableSound;
irr::gui::IGUICheckBox* chkEnableMusic;
irr::gui::IGUIScrollBar* scrSoundVolume;
irr::gui::IGUIScrollBar* scrMusicVolume;
irr::gui::IGUICheckBox* chkMusicMode;
//main menu
irr::gui::IGUIWindow* wMainMenu;
irr::gui::IGUIButton* btnLanMode;
......
......@@ -121,6 +121,8 @@ void SoundManager::PlayMusic(const std::string& song, bool loop) {
if (bgm) bgmCurrent = bgm->play(song, loop);
}
void SoundManager::PlayBGM(BGM scene) {
if(!mainGame->chkMusicMode->isChecked())
scene = BGM::ALL;
auto& list = BGMList[scene];
int count = list.size();
if (musicEnabled && (scene != bgm_scene || !bgm->exists(bgmCurrent)) && count > 0) {
......
......@@ -325,6 +325,7 @@
!system 1281 提取卡组
!system 1282 开启音效
!system 1283 开启音乐
!system 1284 按场景切换音乐
!system 1290 停用聊天功能
!system 1291 忽略观战者发言
!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