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