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

查缺补漏

parent 4c8c139b
......@@ -703,7 +703,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_CLOSE_DECKMANAGER: {
mainGame->HideElement(mainGame->wDeckManage);
break;
}
......@@ -1143,7 +1142,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if(!is_draging) {
if(hovered_pos == 0 || hovered_seq == -1)
break;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::CARD_PICK);
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::CARD_DROP);
if(hovered_pos == 1) {
pop_main(hovered_seq);
} else if(hovered_pos == 2) {
......@@ -1160,6 +1159,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
push_side(pointer);
}
} else {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::CARD_PICK);
if(click_pos == 1) {
push_side(draging_pointer);
} else if(click_pos == 2) {
......
......@@ -2658,12 +2658,13 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_SET: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SET);
/*int code = */BufferIO::ReadInt32(pbuf);
/*int cc = mainGame->LocalPlayer*/(BufferIO::ReadInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf);
/*int cs = */BufferIO::ReadInt8(pbuf);
/*int cp = */BufferIO::ReadInt8(pbuf);
if(!mainGame->dInfo.isReplaySkiping)
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SET);
myswprintf(event_string, dataManager.GetSysString(1601));
return true;
}
......@@ -2716,9 +2717,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
/*int cl = */BufferIO::ReadInt8(pbuf);
/*int cs = */BufferIO::ReadInt8(pbuf);
/*int cp = */BufferIO::ReadInt8(pbuf);
if(!mainGame->soundManager->PlayChant(code))
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SUMMON);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
if(!mainGame->soundManager->PlayChant(code))
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SUMMON);
myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code));
mainGame->showcardcode = code;
mainGame->showcarddif = 0;
......@@ -2791,7 +2792,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_CHAINING: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::ACTIVATE);
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int pcl = BufferIO::ReadInt8(pbuf);
......@@ -2804,6 +2804,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
/*int ct = */BufferIO::ReadInt8(pbuf);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::ACTIVATE);
ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs);
if(pcard->code != code) {
pcard->code = code;
......@@ -2897,6 +2898,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
case MSG_CHAIN_DISABLED: {
int ct = BufferIO::ReadInt8(pbuf);
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::NEGATE);
mainGame->showcardcode = mainGame->dField.chains[ct - 1].code;
mainGame->showcarddif = 0;
mainGame->showcard = 3;
......@@ -3007,7 +3009,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_DAMAGE: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DAMAGE);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] - val;
......@@ -3018,6 +3019,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true;
}
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DAMAGE);
mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10;
if (player == 0)
myswprintf(event_string, dataManager.GetSysString(1613), val);
......@@ -3038,7 +3040,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_RECOVER: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::RECOVER);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] + val;
......@@ -3047,6 +3048,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true;
}
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::RECOVER);
mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10;
if (player == 0)
myswprintf(event_string, dataManager.GetSysString(1615), val);
......@@ -3192,7 +3194,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break;
}
case MSG_PAY_LPCOST: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DAMAGE);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cost = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] - cost;
......@@ -3203,6 +3204,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
myswprintf(mainGame->dInfo.strLP[player], L"%d", mainGame->dInfo.lp[player]);
return true;
}
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DAMAGE);
mainGame->lpd = (mainGame->dInfo.lp[player] - final) / 10;
mainGame->lpccolor = 0xff0000ff;
mainGame->lpplayer = player;
......@@ -3219,7 +3221,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_ADD_COUNTER: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COUNTER_ADD);
int type = BufferIO::ReadInt16(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf);
......@@ -3231,6 +3232,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else pc->counters[type] = count;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COUNTER_ADD);
myswprintf(textBuffer, dataManager.GetSysString(1617), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type));
pc->is_highlighting = true;
mainGame->gMutex.lock();
......@@ -3242,7 +3244,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_REMOVE_COUNTER: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COUNTER_REMOVE);
int type = BufferIO::ReadInt16(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf);
......@@ -3254,6 +3255,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc->counters.erase(type);
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COUNTER_REMOVE);
myswprintf(textBuffer, dataManager.GetSysString(1618), dataManager.GetName(pc->code), count, dataManager.GetCounterName(type));
pc->is_highlighting = true;
mainGame->gMutex.lock();
......@@ -3374,7 +3376,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_TOSS_COIN: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COIN);
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf);
wchar_t* pwbuf = textBuffer;
......@@ -3388,6 +3389,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
*pwbuf = 0;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COIN);
mainGame->gMutex.lock();
mainGame->AddLog(textBuffer);
mainGame->stACMessage->setText(textBuffer);
......@@ -3397,7 +3399,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true;
}
case MSG_TOSS_DICE: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DICE);
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf);
wchar_t* pwbuf = textBuffer;
......@@ -3411,6 +3412,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
*pwbuf = 0;
if(mainGame->dInfo.isReplay && mainGame->dInfo.isReplaySkiping)
return true;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DICE);
mainGame->gMutex.lock();
mainGame->AddLog(textBuffer);
mainGame->stACMessage->setText(textBuffer);
......
......@@ -57,9 +57,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_REPLAY_START: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay)
break;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->btnReplayStart->setVisible(false);
mainGame->btnReplayPause->setVisible(true);
mainGame->btnReplayStep->setVisible(false);
......@@ -68,9 +68,9 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_REPLAY_PAUSE: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay)
break;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->btnReplayStart->setVisible(true);
mainGame->btnReplayPause->setVisible(false);
mainGame->btnReplayStep->setVisible(true);
......@@ -79,16 +79,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_REPLAY_STEP: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay)
break;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
ReplayMode::Pause(false, true);
break;
}
case BUTTON_REPLAY_EXIT: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay)
break;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
ReplayMode::StopReplay();
break;
}
......@@ -101,16 +101,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_REPLAY_UNDO: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay)
break;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
ReplayMode::Undo();
break;
}
case BUTTON_REPLAY_SAVE: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(mainGame->ebRSName->getText()[0] == 0)
break;
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->actionParam = 1;
mainGame->HideElement(mainGame->wReplaySave);
mainGame->replaySignal.Set();
......@@ -124,7 +124,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_LEAVE_GAME: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::EQUIP);
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(mainGame->dInfo.isSingleMode) {
mainGame->singleSignal.SetNoWait(true);
SingleMode::StopPlay(false);
......@@ -272,25 +272,21 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_POS_AU: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEUP_ATTACK);
mainGame->HideElement(mainGame->wPosSelect, true);
break;
}
case BUTTON_POS_AD: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEDOWN_ATTACK);
mainGame->HideElement(mainGame->wPosSelect, true);
break;
}
case BUTTON_POS_DU: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEUP_DEFENSE);
mainGame->HideElement(mainGame->wPosSelect, true);
break;
}
case BUTTON_POS_DD: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEDOWN_DEFENSE);
mainGame->HideElement(mainGame->wPosSelect, true);
break;
......@@ -370,7 +366,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_CMD_SHUFFLE: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SHUFFLE);
mainGame->btnShuffle->setVisible(false);
DuelClient::SetResponseI(8);
DuelClient::SendResponse();
......@@ -568,7 +563,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_CMD_SHOWLIST: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->wCmdMenu->setVisible(false);
selectable_cards.clear();
wchar_t formatBuffer[2048];
......@@ -796,7 +790,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_CARD_SEL_OK: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->stCardListTip->setVisible(false);
if(mainGame->dInfo.isReplay) {
mainGame->HideElement(mainGame->wCardSelect);
......@@ -826,7 +819,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_CARD_DISP_OK: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->HideElement(mainGame->wCardDisplay);
break;
}
......@@ -1821,6 +1813,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
case irr::gui::EGET_BUTTON_CLICKED: {
switch(id) {
case BUTTON_CLEAR_LOG: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->lstLog->clear();
mainGame->logParam.clear();
return true;
......
......@@ -1163,6 +1163,7 @@ void Game::MainLoop() {
driver->enableMaterial2D(false);
#else
} else {
soundManager->PlayBGM(SoundManager::BGM::MENU);
DrawBackImage(imageManager.tBackGround_menu);
}
DrawGUI();
......@@ -1231,7 +1232,6 @@ void Game::MainLoop() {
usleep(500000);
#endif
SaveConfig();
//delete soundEffectPlayer;
usleep(500000);
// device->drop();
}
......
......@@ -56,7 +56,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: {
if(id < 110)
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::INFO);
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SOUND_MENU);
else
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
switch(id) {
......
......@@ -60,11 +60,7 @@ void SoundManager::RefreshChantsList() {
ChantsList[code] = Utils::ToUTF8IfNeeded(file);
}
catch (std::exception& e) {
char buf[1040];
auto fileName = Utils::ToUTF8IfNeeded(TEXT("./sound/chants/") + file);
sprintf(buf, "[文件名只能为卡片ID]: %s", fileName.c_str());
Utils::Deletefile(fileName);
mainGame->ErrorLog(buf);
Utils::Deletefile(Utils::ToUTF8IfNeeded(TEXT("./sound/chants/") + file));
}
}
}
......@@ -80,6 +76,7 @@ void SoundManager::PlaySoundEffect(SFX sound) {
{DESTROYED, "./sound/destroyed.wav"},
{BANISHED, "./sound/banished.wav"},
{TOKEN, "./sound/token.wav"},
{NEGATE, "./sound/negate.wav"},
{ATTACK, "./sound/attack.wav"},
{DIRECT_ATTACK, "./sound/directattack.wav"},
{DRAW, "./sound/draw.wav"},
......@@ -92,6 +89,7 @@ void SoundManager::PlaySoundEffect(SFX sound) {
{DICE, "./sound/diceroll.wav"},
{NEXT_TURN, "./sound/nextturn.wav"},
{PHASE, "./sound/phase.wav"},
{SOUND_MENU, "./sound/menu.wav"},
{BUTTON, "./sound/button.wav"},
{INFO, "./sound/info.wav"},
{QUESTION, "./sound/question.wav"},
......@@ -105,25 +103,25 @@ void SoundManager::PlaySoundEffect(SFX sound) {
}
void SoundManager::PlayDialogSound(irr::gui::IGUIElement * element) {
if(element == mainGame->wMessage) {
PlaySoundEffect(SoundManager::SFX::INFO);
PlaySoundEffect(INFO);
} else if(element == mainGame->wQuery) {
PlaySoundEffect(SoundManager::SFX::QUESTION);
PlaySoundEffect(QUESTION);
} else if(element == mainGame->wSurrender) {
PlaySoundEffect(SoundManager::SFX::QUESTION);
PlaySoundEffect(QUESTION);
} else if(element == mainGame->wOptions) {
PlaySoundEffect(SoundManager::SFX::QUESTION);
PlaySoundEffect(QUESTION);
} else if(element == mainGame->wANAttribute) {
PlaySoundEffect(SoundManager::SFX::QUESTION);
PlaySoundEffect(QUESTION);
} else if(element == mainGame->wANCard) {
PlaySoundEffect(SoundManager::SFX::QUESTION);
PlaySoundEffect(QUESTION);
} else if(element == mainGame->wANNumber) {
PlaySoundEffect(SoundManager::SFX::QUESTION);
PlaySoundEffect(QUESTION);
} else if(element == mainGame->wANRace) {
PlaySoundEffect(SoundManager::SFX::QUESTION);
PlaySoundEffect(QUESTION);
} else if(element == mainGame->wReplaySave) {
PlaySoundEffect(SoundManager::SFX::QUESTION);
PlaySoundEffect(QUESTION);
} else if(element == mainGame->wFTSelect) {
PlaySoundEffect(SoundManager::SFX::QUESTION);
PlaySoundEffect(QUESTION);
}
}
void SoundManager::PlayMusic(const std::string& song, bool loop) {
......
......@@ -20,6 +20,7 @@ public:
DESTROYED,
BANISHED,
TOKEN,
NEGATE,
ATTACK,
DIRECT_ATTACK,
DRAW,
......@@ -32,6 +33,7 @@ public:
DICE,
NEXT_TURN,
PHASE,
SOUND_MENU,
BUTTON,
INFO,
QUESTION,
......
......@@ -172,6 +172,7 @@ namespace ygo {
res.push_back(name.c_str());
}
});
std::sort(res.begin(), res.end());
return res;
}
void Utils::FindfolderFiles(IrrArchiveHelper& archive, const path_string& path, const std::function<bool(int, path_string, bool, void*)>& cb, void* payload) {
......
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