Commit b3eb9985 authored by mercury233's avatar mercury233

add PlayDialogSound

parent bd8b1f92
...@@ -1019,7 +1019,6 @@ bool ClientField::ShowSelectSum(bool panelmode) { ...@@ -1019,7 +1019,6 @@ bool ClientField::ShowSelectSum(bool panelmode) {
BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256); BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256);
mainGame->stQMessage->setText(wbuf); mainGame->stQMessage->setText(wbuf);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
} }
} else { } else {
select_ready = false; select_ready = false;
...@@ -1041,7 +1040,6 @@ bool ClientField::ShowSelectSum(bool panelmode) { ...@@ -1041,7 +1040,6 @@ bool ClientField::ShowSelectSum(bool panelmode) {
BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256); BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256);
mainGame->stQMessage->setText(wbuf); mainGame->stQMessage->setText(wbuf);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
} }
} else } else
select_ready = false; select_ready = false;
......
...@@ -128,7 +128,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -128,7 +128,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1339)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1339));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
break; break;
...@@ -185,7 +184,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -185,7 +184,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
myswprintf(textBuffer, L"%ls\n%ls", mainGame->cbDBDecks->getItem(sel), dataManager.GetSysString(1337)); myswprintf(textBuffer, L"%ls\n%ls", mainGame->cbDBDecks->getItem(sel), dataManager.GetSysString(1337));
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)textBuffer); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)textBuffer);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
break; break;
...@@ -195,7 +193,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -195,7 +193,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
break; break;
...@@ -359,7 +356,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -359,7 +356,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
break; break;
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include "materials.h" #include "materials.h"
#include "image_manager.h" #include "image_manager.h"
#include "deck_manager.h" #include "deck_manager.h"
#include "sound_manager.h"
#include "duelclient.h" #include "duelclient.h"
#include "../ocgcore/field.h" #include "../ocgcore/field.h"
...@@ -1008,6 +1009,7 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) { ...@@ -1008,6 +1009,7 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) {
fadingList.push_back(fu); fadingList.push_back(fu);
} }
void Game::PopupElement(irr::gui::IGUIElement * element, int hideframe) { void Game::PopupElement(irr::gui::IGUIElement * element, int hideframe) {
soundManager.PlayDialogSound(element);
element->getParent()->bringToFront(element); element->getParent()->bringToFront(element);
if(!mainGame->is_building) if(!mainGame->is_building)
dField.panel = element; dField.panel = element;
......
...@@ -590,7 +590,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -590,7 +590,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnCancelOrFinish->setVisible(false); mainGame->btnCancelOrFinish->setVisible(false);
mainGame->stMessage->setText(dataManager.GetSysString(1500)); mainGame->stMessage->setText(dataManager.GetSysString(1500));
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
...@@ -633,7 +632,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -633,7 +632,6 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mbstowcs(timetext, timebuf, size); mbstowcs(timetext, timebuf, size);
mainGame->ebRSName->setText(timetext); mainGame->ebRSName->setText(timetext);
mainGame->PopupElement(mainGame->wReplaySave); mainGame->PopupElement(mainGame->wReplaySave);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->replaySignal.Reset(); mainGame->replaySignal.Reset();
mainGame->replaySignal.Wait(); mainGame->replaySignal.Wait();
...@@ -820,7 +818,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -820,7 +818,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->stMessage->setText(L"Error occurs."); mainGame->stMessage->setText(L"Error occurs.");
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
...@@ -857,7 +854,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -857,7 +854,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->stMessage->setText(dataManager.GetDesc(data)); mainGame->stMessage->setText(dataManager.GetDesc(data));
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
...@@ -1241,7 +1237,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1241,7 +1237,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, textBuffer); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, textBuffer);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
return false; return false;
} }
...@@ -1252,7 +1247,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1252,7 +1247,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetDesc(desc)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetDesc(desc));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
return false; return false;
} }
...@@ -1276,7 +1270,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1276,7 +1270,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
select_hint = 0; select_hint = 0;
mainGame->wOptions->setText(textBuffer); mainGame->wOptions->setText(textBuffer);
mainGame->PopupElement(mainGame->wOptions); mainGame->PopupElement(mainGame->wOptions);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
return false; return false;
} }
...@@ -1421,7 +1414,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1421,7 +1414,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(textBuffer, L"%ls\n%ls", event_string, dataManager.GetSysString(203)); myswprintf(textBuffer, L"%ls\n%ls", event_string, dataManager.GetSysString(203));
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)textBuffer); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)textBuffer);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
} }
} }
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
...@@ -3143,7 +3135,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3143,7 +3135,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->wANRace->setText(textBuffer); mainGame->wANRace->setText(textBuffer);
mainGame->PopupElement(mainGame->wANRace); mainGame->PopupElement(mainGame->wANRace);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
return false; return false;
} }
...@@ -3164,7 +3155,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3164,7 +3155,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->wANAttribute->setText(textBuffer); mainGame->wANAttribute->setText(textBuffer);
mainGame->PopupElement(mainGame->wANAttribute); mainGame->PopupElement(mainGame->wANAttribute);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
return false; return false;
} }
...@@ -3181,7 +3171,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3181,7 +3171,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->wANCard->setText(textBuffer); mainGame->wANCard->setText(textBuffer);
mainGame->dField.UpdateDeclarableCode(true); mainGame->dField.UpdateDeclarableCode(true);
mainGame->PopupElement(mainGame->wANCard); mainGame->PopupElement(mainGame->wANCard);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
return false; return false;
} }
...@@ -3202,7 +3191,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3202,7 +3191,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
select_hint = 0; select_hint = 0;
mainGame->wANNumber->setText(textBuffer); mainGame->wANNumber->setText(textBuffer);
mainGame->PopupElement(mainGame->wANNumber); mainGame->PopupElement(mainGame->wANNumber);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
return false; return false;
} }
...@@ -3222,7 +3210,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3222,7 +3210,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->wANCard->setText(textBuffer); mainGame->wANCard->setText(textBuffer);
mainGame->dField.UpdateDeclarableCode(true); mainGame->dField.UpdateDeclarableCode(true);
mainGame->PopupElement(mainGame->wANCard); mainGame->PopupElement(mainGame->wANCard);
soundManager.PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
return false; return false;
} }
......
...@@ -278,7 +278,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -278,7 +278,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
else { else {
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
ShowCancelOrFinishButton(0); ShowCancelOrFinishButton(0);
} }
if (mainGame->wOptions->isVisible()) { if (mainGame->wOptions->isVisible()) {
...@@ -1452,7 +1451,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1452,7 +1451,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256); BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256);
mainGame->stQMessage->setText(wbuf); mainGame->stQMessage->setText(wbuf);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
} }
} }
} else { } else {
...@@ -1628,7 +1626,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1628,7 +1626,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
} else { } else {
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
soundManager.PlaySoundEffect(SOUND_QUESTION);
ShowCancelOrFinishButton(0); ShowCancelOrFinishButton(0);
} }
if(mainGame->wOptions->isVisible()) { if(mainGame->wOptions->isVisible()) {
......
...@@ -314,7 +314,6 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -314,7 +314,6 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->stMessage->setText(L"Error occurs."); mainGame->stMessage->setText(L"Error occurs.");
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
......
...@@ -180,7 +180,6 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -180,7 +180,6 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->stMessage->setText(L"Error occurs."); mainGame->stMessage->setText(L"Error occurs.");
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
...@@ -787,7 +786,6 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -787,7 +786,6 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->textFont, msg); mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->textFont, msg);
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
......
...@@ -195,6 +195,25 @@ void SoundManager::PlaySoundEffect(int sound) { ...@@ -195,6 +195,25 @@ void SoundManager::PlaySoundEffect(int sound) {
engineSound->setSoundVolume(mainGame->gameConf.sound_volume); engineSound->setSoundVolume(mainGame->gameConf.sound_volume);
#endif #endif
} }
void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
if(element == mainGame->wMessage) {
PlaySoundEffect(SOUND_INFO);
} else if(element == mainGame->wQuery) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wOptions) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wANAttribute) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wANCard) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wANNumber) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wANRace) {
PlaySoundEffect(SOUND_QUESTION);
} else if(element == mainGame->wReplaySave) {
PlaySoundEffect(SOUND_QUESTION);
}
}
void SoundManager::PlayMusic(char* song, bool loop) { void SoundManager::PlayMusic(char* song, bool loop) {
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
if(!mainGame->chkEnableMusic->isChecked()) if(!mainGame->chkEnableMusic->isChecked())
......
...@@ -27,6 +27,7 @@ public: ...@@ -27,6 +27,7 @@ public:
bool Init(); bool Init();
void RefreshBGMList(); void RefreshBGMList();
void PlaySoundEffect(int sound); void PlaySoundEffect(int sound);
void PlayDialogSound(irr::gui::IGUIElement * element);
void PlayMusic(char* song, bool loop); void PlayMusic(char* song, bool loop);
void PlayBGM(int scene); void PlayBGM(int scene);
void StopBGM(); void StopBGM();
......
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