Commit cb8715a6 authored by Unicorn369's avatar Unicorn369 Committed by fallenstardust

update

parent 5e1e0cb4
...@@ -1844,6 +1844,16 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1844,6 +1844,16 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
case CHECKBOX_ENABLE_SOUND: {
mainGame->soundManager->EnableSounds(mainGame->chkEnableSound->isChecked());
return true;
break;
}
case CHECKBOX_ENABLE_MUSIC: {
mainGame->soundManager->EnableMusic(mainGame->chkEnableMusic->isChecked());
return true;
break;
}
} }
break; break;
} }
...@@ -1885,6 +1895,14 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1885,6 +1895,14 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
case SCROLL_VOLUME: {
mainGame->gameConf.sound_volume = (double)mainGame->scrSoundVolume->getPos() / 100;
mainGame->gameConf.music_volume = (double)mainGame->scrMusicVolume->getPos() / 100;
mainGame->soundManager->SetSoundVolume(mainGame->gameConf.sound_volume);
mainGame->soundManager->SetMusicVolume(mainGame->gameConf.music_volume);
return true;
break;
}
case SCROLL_TAB_HELPER: { case SCROLL_TAB_HELPER: {
rect<s32> pos = mainGame->tabHelper->getRelativePosition(); rect<s32> pos = mainGame->tabHelper->getRelativePosition();
mainGame->tabHelper->setRelativePosition(recti(0, mainGame->scrTabHelper->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y)); mainGame->tabHelper->setRelativePosition(recti(0, mainGame->scrTabHelper->getPos() * -1, pos.LowerRightCorner.X, pos.LowerRightCorner.Y));
......
...@@ -427,7 +427,25 @@ bool Game::Initialize() { ...@@ -427,7 +427,25 @@ bool Game::Initialize() {
posY += 60; posY += 60;
chkWaitChain = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabHelper, -1, dataManager.GetSysString(1277)); chkWaitChain = env->addCheckBox(false, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabHelper, -1, dataManager.GetSysString(1277));
chkWaitChain->setChecked(gameConf.chkWaitChain != 0); chkWaitChain->setChecked(gameConf.chkWaitChain != 0);
elmTabHelperLast = chkWaitChain; posY += 60;
chkEnableSound = env->addCheckBox(gameConf.enable_sound, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabHelper, CHECKBOX_ENABLE_SOUND, dataManager.GetSysString(1282));
chkEnableSound->setChecked(gameConf.enable_sound);
scrSoundVolume = env->addScrollBar(true, rect<s32>(posX + 110 * xScale, posY, posX + 250 * xScale, posY + 30 * yScale), tabHelper, SCROLL_VOLUME);
scrSoundVolume->setMax(100);
scrSoundVolume->setMin(0);
scrSoundVolume->setPos(gameConf.sound_volume * 100);
scrSoundVolume->setLargeStep(1);
scrSoundVolume->setSmallStep(1);
posY += 60;
chkEnableMusic = env->addCheckBox(gameConf.enable_music, rect<s32>(posX, posY, posX + 260 * xScale, posY + 30 * yScale), tabHelper, CHECKBOX_ENABLE_MUSIC, dataManager.GetSysString(1283));
chkEnableMusic->setChecked(gameConf.enable_music);
scrMusicVolume = env->addScrollBar(true, rect<s32>(posX + 110 * xScale, posY, posX + 250 * xScale, posY + 30 * yScale), tabHelper, SCROLL_VOLUME);
scrMusicVolume->setMax(100);
scrMusicVolume->setMin(0);
scrMusicVolume->setPos(gameConf.music_volume * 100);
scrMusicVolume->setLargeStep(1);
scrMusicVolume->setSmallStep(1);
elmTabHelperLast = chkEnableMusic;
//show scroll //show scroll
s32 tabHelperLastY = elmTabHelperLast->getRelativePosition().LowerRightCorner.Y; s32 tabHelperLastY = elmTabHelperLast->getRelativePosition().LowerRightCorner.Y;
s32 tabHelperHeight = 300 * yScale; s32 tabHelperHeight = 300 * yScale;
...@@ -941,9 +959,7 @@ bool Game::Initialize() { ...@@ -941,9 +959,7 @@ bool Game::Initialize() {
btnCancelOrFinish = env->addButton(rect<s32>(205 * xScale, 220 * yScale, 305 * xScale, 275 * yScale), 0, BUTTON_CANCEL_OR_FINISH, dataManager.GetSysString(1295)); btnCancelOrFinish = env->addButton(rect<s32>(205 * xScale, 220 * yScale, 305 * xScale, 275 * yScale), 0, BUTTON_CANCEL_OR_FINISH, dataManager.GetSysString(1295));
btnCancelOrFinish->setVisible(false); btnCancelOrFinish->setVisible(false);
soundManager = Utils::make_unique<SoundManager>(); soundManager = Utils::make_unique<SoundManager>();
soundManager->Init(50, 50, true, true, nullptr);//临时设置 if(!soundManager->Init(gameConf.sound_volume, gameConf.music_volume, gameConf.enable_sound, gameConf.enable_music, nullptr)) {
/* 建设中......
if(!soundManager->Init(gameConf.soundVolume, gameConf.musicVolume, gameConf.enablesound, gameConf.enablemusic, nullptr)) {
chkEnableSound->setChecked(false); chkEnableSound->setChecked(false);
chkEnableSound->setEnabled(false); chkEnableSound->setEnabled(false);
chkEnableSound->setVisible(false); chkEnableSound->setVisible(false);
...@@ -952,10 +968,7 @@ bool Game::Initialize() { ...@@ -952,10 +968,7 @@ 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
btnLeaveGame = env->addButton(rect<s32>(205 * xScale, 1 * yScale, 305 * xScale, 80 * yScale), 0, BUTTON_LEAVE_GAME, L""); btnLeaveGame = env->addButton(rect<s32>(205 * xScale, 1 * yScale, 305 * xScale, 80 * yScale), 0, BUTTON_LEAVE_GAME, L"");
...@@ -1465,6 +1478,10 @@ void Game::LoadConfig() { ...@@ -1465,6 +1478,10 @@ void Game::LoadConfig() {
gameConf.auto_save_replay = android::getIntSetting(appMain, "auto_save_replay", 0); gameConf.auto_save_replay = android::getIntSetting(appMain, "auto_save_replay", 0);
gameConf.quick_animation = android::getIntSetting(appMain, "quick_animation", 0); gameConf.quick_animation = android::getIntSetting(appMain, "quick_animation", 0);
gameConf.prefer_expansion_script = android::getIntSetting(appMain, "prefer_expansion_script", 0); gameConf.prefer_expansion_script = android::getIntSetting(appMain, "prefer_expansion_script", 0);
gameConf.enable_sound = android::getIntSetting(appMain, "enable_sound", 0);
gameConf.sound_volume = android::getIntSetting(appMain, "sound_volume", 0);
gameConf.enable_music = android::getIntSetting(appMain, "enable_music", 0);
gameConf.music_volume = android::getIntSetting(appMain, "music_volume", 0);
//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;
...@@ -1504,6 +1521,15 @@ void Game::SaveConfig() { ...@@ -1504,6 +1521,15 @@ void Game::SaveConfig() {
android::saveIntSetting(appMain, "quick_animation", gameConf.quick_animation); android::saveIntSetting(appMain, "quick_animation", gameConf.quick_animation);
gameConf.prefer_expansion_script = chkPreferExpansionScript->isChecked() ? 1 : 0; gameConf.prefer_expansion_script = chkPreferExpansionScript->isChecked() ? 1 : 0;
android::saveIntSetting(appMain, "prefer_expansion_script", gameConf.prefer_expansion_script); android::saveIntSetting(appMain, "prefer_expansion_script", gameConf.prefer_expansion_script);
gameConf.enable_sound = chkEnableSound->isChecked() ? 1 : 0;
android::saveIntSetting(appMain, "enable_sound", gameConf.enable_sound);
gameConf.enable_music = chkEnableMusic->isChecked() ? 1 : 0;
android::saveIntSetting(appMain, "enable_music", gameConf.enable_music);
//gameConf.sound_volume =
// android::saveIntSetting(appMain, "sound_volume", gameConf.sound_volume);
//gameConf.music_volume =
// android::saveIntSetting(appMain, "music_volume", gameConf.music_volume);
//gameConf.control_mode = control_mode->isChecked()?1:0; //gameConf.control_mode = control_mode->isChecked()?1:0;
// android::saveIntSetting(appMain, "control_mode", gameConf.control_mode); // android::saveIntSetting(appMain, "control_mode", gameConf.control_mode);
......
...@@ -51,6 +51,10 @@ struct Config { ...@@ -51,6 +51,10 @@ struct Config {
int quick_animation; int quick_animation;
int auto_save_replay; int auto_save_replay;
int prefer_expansion_script; int prefer_expansion_script;
bool enable_sound;
bool enable_music;
double sound_volume;
double music_volume;
}; };
struct DuelInfo { struct DuelInfo {
...@@ -271,6 +275,10 @@ public: ...@@ -271,6 +275,10 @@ 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;
irr::gui::IGUICheckBox* chkEnableSound;
irr::gui::IGUICheckBox* chkEnableMusic;
irr::gui::IGUIScrollBar* scrSoundVolume;
irr::gui::IGUIScrollBar* scrMusicVolume;
//main menu //main menu
irr::gui::IGUIWindow* wMainMenu; irr::gui::IGUIWindow* wMainMenu;
irr::gui::IGUIButton* btnLanMode; irr::gui::IGUIButton* btnLanMode;
...@@ -767,6 +775,11 @@ private: ...@@ -767,6 +775,11 @@ private:
#define CHECKBOX_MULTI_KEYWORDS 372 #define CHECKBOX_MULTI_KEYWORDS 372
#define CHECKBOX_PREFER_EXPANSION 373 #define CHECKBOX_PREFER_EXPANSION 373
#define CHECKBOX_DISABLE_CHAT 364 #define CHECKBOX_DISABLE_CHAT 364
#define SCROLL_VOLUME 365
#define CHECKBOX_ENABLE_SOUND 366
#define CHECKBOX_ENABLE_MUSIC 367
#define CHECKBOX_QUICK_ANIMATION 369 #define CHECKBOX_QUICK_ANIMATION 369
#define SCROLL_TAB_HELPER 370 #define SCROLL_TAB_HELPER 370
#define SCROLL_TAB_SYSTEM 371 #define SCROLL_TAB_SYSTEM 371
......
...@@ -323,6 +323,8 @@ ...@@ -323,6 +323,8 @@
!system 1279 显示场地背景 !system 1279 显示场地背景
!system 1280 重命名成功后请重新选择卡组 !system 1280 重命名成功后请重新选择卡组
!system 1281 提取卡组 !system 1281 提取卡组
!system 1282 开启音效
!system 1283 开启音乐
!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