Commit 1227e78f authored by mercury233's avatar mercury233 Committed by GitHub

add fail hint (#2472)

* add deck not selected hint

* add create host fail hint
parent 022914dc
...@@ -126,10 +126,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -126,10 +126,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case BUTTON_HOST_CONFIRM: { case BUTTON_HOST_CONFIRM: {
bot_mode = false; bot_mode = false;
BufferIO::CopyWStr(mainGame->ebServerName->getText(), mainGame->gameConf.gamename, 20); BufferIO::CopyWStr(mainGame->ebServerName->getText(), mainGame->gameConf.gamename, 20);
if(!NetServer::StartServer(mainGame->gameConf.serverport)) if(!NetServer::StartServer(mainGame->gameConf.serverport)) {
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
}
if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) { if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) {
NetServer::StopServer(); NetServer::StopServer();
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
} }
mainGame->btnHostConfirm->setEnabled(false); mainGame->btnHostConfirm->setEnabled(false);
...@@ -169,6 +174,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -169,6 +174,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case BUTTON_HP_READY: { case BUTTON_HP_READY: {
if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 || if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 ||
!deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) { !deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) {
mainGame->gMutex.lock();
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1406));
mainGame->gMutex.unlock();
break; break;
} }
UpdateDeck(); UpdateDeck();
...@@ -323,10 +332,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -323,10 +332,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
bot_mode = true; bot_mode = true;
#ifdef _WIN32 #ifdef _WIN32
if(!NetServer::StartServer(mainGame->gameConf.serverport)) if(!NetServer::StartServer(mainGame->gameConf.serverport)) {
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
}
if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) { if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) {
NetServer::StopServer(); NetServer::StopServer();
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
} }
STARTUPINFOW si; STARTUPINFOW si;
...@@ -373,10 +387,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -373,10 +387,15 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
execl("./bot", "bot", arg1, arg2, arg3, NULL); execl("./bot", "bot", arg1, arg2, arg3, NULL);
exit(0); exit(0);
} else { } else {
if(!NetServer::StartServer(mainGame->gameConf.serverport)) if(!NetServer::StartServer(mainGame->gameConf.serverport)) {
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
}
if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) { if(!DuelClient::StartClient(0x7f000001, mainGame->gameConf.serverport)) {
NetServer::StopServer(); NetServer::StopServer();
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
break; break;
} }
} }
...@@ -607,7 +626,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -607,7 +626,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
if(static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) { if(static_cast<irr::gui::IGUICheckBox*>(caller)->isChecked()) {
if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 || if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 ||
!deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) { !deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) {
mainGame->gMutex.lock();
static_cast<irr::gui::IGUICheckBox*>(caller)->setChecked(false); static_cast<irr::gui::IGUICheckBox*>(caller)->setChecked(false);
soundManager.PlaySoundEffect(SOUND_INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1406));
mainGame->gMutex.unlock();
break; break;
} }
UpdateDeck(); UpdateDeck();
......
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