Commit 62674b86 authored by mercury233's avatar mercury233

add button for cancel or finish

parent e0d8cda7
...@@ -1131,6 +1131,7 @@ bool ClientField::ShowSelectSum(bool panelmode) { ...@@ -1131,6 +1131,7 @@ bool ClientField::ShowSelectSum(bool panelmode) {
if(CheckSelectSum()) { if(CheckSelectSum()) {
if(selectsum_cards.size() == 0 || selectable_cards.size() == 0) { if(selectsum_cards.size() == 0 || selectable_cards.size() == 0) {
SetResponseSelectedCards(); SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
if(mainGame->wCardSelect->isVisible()) if(mainGame->wCardSelect->isVisible())
mainGame->HideElement(mainGame->wCardSelect, true); mainGame->HideElement(mainGame->wCardSelect, true);
else { else {
...@@ -1151,6 +1152,7 @@ bool ClientField::ShowSelectSum(bool panelmode) { ...@@ -1151,6 +1152,7 @@ bool ClientField::ShowSelectSum(bool panelmode) {
if(CheckSelectSum()) { if(CheckSelectSum()) {
if(selectsum_cards.size() == 0 || selectable_cards.size() == 0) { if(selectsum_cards.size() == 0 || selectable_cards.size() == 0) {
SetResponseSelectedCards(); SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
DuelClient::SendResponse(); DuelClient::SendResponse();
return true; return true;
} else { } else {
...@@ -1165,6 +1167,11 @@ bool ClientField::ShowSelectSum(bool panelmode) { ...@@ -1165,6 +1167,11 @@ bool ClientField::ShowSelectSum(bool panelmode) {
} else } else
select_ready = false; select_ready = false;
} }
if (select_ready) {
ShowCancelOrFinishButton(1);
} else {
ShowCancelOrFinishButton(0);
}
return false; return false;
} }
bool ClientField::CheckSelectSum() { bool ClientField::CheckSelectSum() {
......
...@@ -127,6 +127,7 @@ public: ...@@ -127,6 +127,7 @@ public:
void GetHoverField(int x, int y); void GetHoverField(int x, int y);
void ShowMenu(int flag, int x, int y); void ShowMenu(int flag, int x, int y);
void UpdateChainButtons(); void UpdateChainButtons();
void ShowCancelOrFinishButton(int buttonOp);
void SetResponseSelectedCards() const; void SetResponseSelectedCards() const;
}; };
......
...@@ -288,6 +288,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -288,6 +288,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnChainIgnore->setVisible(false); mainGame->btnChainIgnore->setVisible(false);
mainGame->btnChainAlways->setVisible(false); mainGame->btnChainAlways->setVisible(false);
mainGame->btnChainWhenAvail->setVisible(false); mainGame->btnChainWhenAvail->setVisible(false);
mainGame->btnCancelOrFinish->setVisible(false);
mainGame->deckBuilder.result_string[0] = L'0'; mainGame->deckBuilder.result_string[0] = L'0';
mainGame->deckBuilder.result_string[1] = 0; mainGame->deckBuilder.result_string[1] = 0;
mainGame->deckBuilder.results.clear(); mainGame->deckBuilder.results.clear();
...@@ -510,6 +511,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -510,6 +511,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnChainIgnore->setVisible(false); mainGame->btnChainIgnore->setVisible(false);
mainGame->btnChainAlways->setVisible(false); mainGame->btnChainAlways->setVisible(false);
mainGame->btnChainWhenAvail->setVisible(false); mainGame->btnChainWhenAvail->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);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
...@@ -539,6 +541,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -539,6 +541,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnChainIgnore->setVisible(false); mainGame->btnChainIgnore->setVisible(false);
mainGame->btnChainAlways->setVisible(false); mainGame->btnChainAlways->setVisible(false);
mainGame->btnChainWhenAvail->setVisible(false); mainGame->btnChainWhenAvail->setVisible(false);
mainGame->btnCancelOrFinish->setVisible(false);
time_t nowtime = time(NULL); time_t nowtime = time(NULL);
struct tm *localedtime = localtime(&nowtime); struct tm *localedtime = localtime(&nowtime);
char timebuf[40]; char timebuf[40];
...@@ -1179,6 +1182,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1179,6 +1182,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->stHintMsg->setText(textBuffer); mainGame->stHintMsg->setText(textBuffer);
mainGame->stHintMsg->setVisible(true); mainGame->stHintMsg->setVisible(true);
} }
if (mainGame->dField.select_cancelable) {
mainGame->dField.ShowCancelOrFinishButton(1);
}
return false; return false;
} }
case MSG_SELECT_CHAIN: { case MSG_SELECT_CHAIN: {
...@@ -1412,6 +1418,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1412,6 +1418,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->stHintMsg->setText(textBuffer); mainGame->stHintMsg->setText(textBuffer);
mainGame->stHintMsg->setVisible(true); mainGame->stHintMsg->setVisible(true);
if (mainGame->dField.select_cancelable) {
mainGame->dField.ShowCancelOrFinishButton(1);
}
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
return false; return false;
} }
...@@ -1875,6 +1884,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1875,6 +1884,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->btnChainIgnore->setVisible(false); mainGame->btnChainIgnore->setVisible(false);
mainGame->btnChainAlways->setVisible(false); mainGame->btnChainAlways->setVisible(false);
mainGame->btnChainWhenAvail->setVisible(false); mainGame->btnChainWhenAvail->setVisible(false);
mainGame->btnCancelOrFinish->setVisible(false);
} }
} }
if(mainGame->dInfo.isTag && mainGame->dInfo.turn != 1) { if(mainGame->dInfo.isTag && mainGame->dInfo.turn != 1) {
......
...@@ -148,6 +148,137 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -148,6 +148,137 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
UpdateChainButtons(); UpdateChainButtons();
break; break;
} }
case BUTTON_CANCEL_OR_FINISH: {
switch (mainGame->dInfo.curMsg) {
case MSG_WAITING: {
if (mainGame->wCardSelect->isVisible()) {
mainGame->HideElement(mainGame->wCardSelect);
ShowCancelOrFinishButton(0);
}
break;
}
case MSG_SELECT_BATTLECMD: {
if (mainGame->wCardSelect->isVisible()) {
mainGame->HideElement(mainGame->wCardSelect);
ShowCancelOrFinishButton(0);
}
if (mainGame->wOptions->isVisible()) {
mainGame->HideElement(mainGame->wOptions);
ShowCancelOrFinishButton(0);
}
break;
}
case MSG_SELECT_IDLECMD: {
if (mainGame->wCardSelect->isVisible()) {
mainGame->HideElement(mainGame->wCardSelect);
ShowCancelOrFinishButton(0);
}
if (mainGame->wOptions->isVisible()) {
mainGame->HideElement(mainGame->wOptions);
ShowCancelOrFinishButton(0);
}
break;
}
case MSG_SELECT_YESNO:
case MSG_SELECT_EFFECTYN: {
if (highlighting_card)
highlighting_card->is_highlighting = false;
highlighting_card = 0;
DuelClient::SetResponseI(0);
mainGame->HideElement(mainGame->wQuery, true);
break;
}
case MSG_SELECT_CARD: {
if (selected_cards.size() == 0) {
if (select_cancelable) {
DuelClient::SetResponseI(-1);
ShowCancelOrFinishButton(0);
if (mainGame->wCardSelect->isVisible())
mainGame->HideElement(mainGame->wCardSelect, true);
else
DuelClient::SendResponse();
}
break;
}
if (mainGame->wQuery->isVisible()) {
SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wQuery, true);
break;
}
if (select_ready) {
SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
if (mainGame->wCardSelect->isVisible())
mainGame->HideElement(mainGame->wCardSelect, true);
else
DuelClient::SendResponse();
}
break;
}
case MSG_SELECT_TRIBUTE: {
if (selected_cards.size() == 0) {
if (select_cancelable) {
DuelClient::SetResponseI(-1);
if (mainGame->wCardSelect->isVisible())
mainGame->HideElement(mainGame->wCardSelect, true);
else
DuelClient::SendResponse();
}
break;
}
if (mainGame->wQuery->isVisible()) {
SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wQuery, true);
break;
}
break;
}
case MSG_SELECT_SUM: {
if (mainGame->wQuery->isVisible()) {
SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wQuery, true);
break;
}
break;
}
case MSG_SELECT_CHAIN: {
if (chain_forced)
break;
if (mainGame->wCardSelect->isVisible()) {
mainGame->HideElement(mainGame->wCardSelect);
ShowCancelOrFinishButton(0);
break;
}
if (mainGame->wQuery->isVisible()) {
DuelClient::SetResponseI(-1);
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wQuery, true);
}
else {
mainGame->PopupElement(mainGame->wQuery);
ShowCancelOrFinishButton(0);
}
if (mainGame->wOptions->isVisible()) {
DuelClient::SetResponseI(-1);
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wOptions);
}
break;
}
case MSG_SORT_CHAIN:
case MSG_SORT_CARD: {
if (mainGame->wCardSelect->isVisible()) {
DuelClient::SetResponseI(-1);
mainGame->HideElement(mainGame->wCardSelect, true);
}
break;
}
}
break;
}
case BUTTON_MSG_OK: { case BUTTON_MSG_OK: {
mainGame->HideElement(mainGame->wMessage); mainGame->HideElement(mainGame->wMessage);
mainGame->actionSignal.Set(); mainGame->actionSignal.Set();
...@@ -164,13 +295,19 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -164,13 +295,19 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
break; break;
} }
case MSG_SELECT_CHAIN:
case MSG_SELECT_CARD: case MSG_SELECT_CARD:
case MSG_SELECT_TRIBUTE: case MSG_SELECT_TRIBUTE:
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
mainGame->HideElement(mainGame->wQuery); mainGame->HideElement(mainGame->wQuery);
break; break;
} }
case MSG_SELECT_CHAIN: {
mainGame->HideElement(mainGame->wQuery);
if (!chain_forced) {
ShowCancelOrFinishButton(1);
}
break;
}
default: { default: {
mainGame->HideElement(mainGame->wQuery); mainGame->HideElement(mainGame->wQuery);
break; break;
...@@ -192,12 +329,14 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -192,12 +329,14 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case MSG_SELECT_CHAIN: { case MSG_SELECT_CHAIN: {
DuelClient::SetResponseI(-1); DuelClient::SetResponseI(-1);
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
ShowCancelOrFinishButton(0);
break; break;
} }
case MSG_SELECT_CARD: case MSG_SELECT_CARD:
case MSG_SELECT_TRIBUTE: case MSG_SELECT_TRIBUTE:
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
SetResponseSelectedCards(); SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
break; break;
} }
...@@ -285,6 +424,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -285,6 +424,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case BUTTON_CMD_ACTIVATE: case BUTTON_CMD_ACTIVATE:
case BUTTON_CMD_RESET: { case BUTTON_CMD_RESET: {
mainGame->wCmdMenu->setVisible(false); mainGame->wCmdMenu->setVisible(false);
ShowCancelOrFinishButton(0);
if(!list_command) { if(!list_command) {
int index = -1; int index = -1;
select_options.clear(); select_options.clear();
...@@ -412,6 +552,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -412,6 +552,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
list_command = COMMAND_SPSUMMON; list_command = COMMAND_SPSUMMON;
mainGame->wCardSelect->setText(dataManager.GetSysString(509)); mainGame->wCardSelect->setText(dataManager.GetSysString(509));
ShowSelectCard(); ShowSelectCard();
ShowCancelOrFinishButton(1);
} }
break; break;
} }
...@@ -607,13 +748,19 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -607,13 +748,19 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
int sel = selected_cards.size(); int sel = selected_cards.size();
if (sel >= select_max) { if (sel >= select_max) {
SetResponseSelectedCards(); SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wCardSelect, true); mainGame->HideElement(mainGame->wCardSelect, true);
} else if (sel >= select_min) { } else if (sel >= select_min) {
select_ready = true; select_ready = true;
mainGame->btnSelectOK->setVisible(true); mainGame->btnSelectOK->setVisible(true);
ShowCancelOrFinishButton(2);
} else { } else {
select_ready = false; select_ready = false;
mainGame->btnSelectOK->setVisible(false); mainGame->btnSelectOK->setVisible(false);
if (select_cancelable && sel == 0)
ShowCancelOrFinishButton(1);
else
ShowCancelOrFinishButton(0);
} }
break; break;
} }
...@@ -670,6 +817,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -670,6 +817,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(mainGame->dInfo.curMsg == MSG_SELECT_CARD || mainGame->dInfo.curMsg == MSG_SELECT_SUM) { if(mainGame->dInfo.curMsg == MSG_SELECT_CARD || mainGame->dInfo.curMsg == MSG_SELECT_SUM) {
if(select_ready) { if(select_ready) {
SetResponseSelectedCards(); SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wCardSelect, true); mainGame->HideElement(mainGame->wCardSelect, true);
} }
break; break;
...@@ -1253,13 +1401,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1253,13 +1401,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
if (min >= select_max) { if (min >= select_max) {
SetResponseSelectedCards(); SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
DuelClient::SendResponse(); DuelClient::SendResponse();
} else if (max >= select_min) { } else if (max >= select_min) {
if(selected_cards.size() == selectable_cards.size()) { if(selected_cards.size() == selectable_cards.size()) {
SetResponseSelectedCards(); SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
DuelClient::SendResponse(); DuelClient::SendResponse();
} else { } else {
select_ready = true; select_ready = true;
ShowCancelOrFinishButton(2);
if(mainGame->dInfo.curMsg == MSG_SELECT_TRIBUTE) { if(mainGame->dInfo.curMsg == MSG_SELECT_TRIBUTE) {
wchar_t wbuf[256], *pwbuf = wbuf; wchar_t wbuf[256], *pwbuf = wbuf;
BufferIO::CopyWStrRef(dataManager.GetSysString(209), pwbuf, 256); BufferIO::CopyWStrRef(dataManager.GetSysString(209), pwbuf, 256);
...@@ -1271,6 +1422,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1271,6 +1422,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
} else { } else {
select_ready = false; select_ready = false;
if (select_cancelable && min == 0)
ShowCancelOrFinishButton(1);
else
ShowCancelOrFinishButton(0);
} }
break; break;
} }
...@@ -1326,24 +1481,29 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1326,24 +1481,29 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case MSG_WAITING: { case MSG_WAITING: {
if(mainGame->wCardSelect->isVisible()) { if(mainGame->wCardSelect->isVisible()) {
mainGame->HideElement(mainGame->wCardSelect); mainGame->HideElement(mainGame->wCardSelect);
ShowCancelOrFinishButton(0);
} }
break; break;
} }
case MSG_SELECT_BATTLECMD: { case MSG_SELECT_BATTLECMD: {
if(mainGame->wCardSelect->isVisible()) { if(mainGame->wCardSelect->isVisible()) {
mainGame->HideElement(mainGame->wCardSelect); mainGame->HideElement(mainGame->wCardSelect);
ShowCancelOrFinishButton(0);
} }
if(mainGame->wOptions->isVisible()) { if(mainGame->wOptions->isVisible()) {
mainGame->HideElement(mainGame->wOptions); mainGame->HideElement(mainGame->wOptions);
ShowCancelOrFinishButton(0);
} }
break; break;
} }
case MSG_SELECT_IDLECMD: { case MSG_SELECT_IDLECMD: {
if(mainGame->wCardSelect->isVisible()) { if(mainGame->wCardSelect->isVisible()) {
mainGame->HideElement(mainGame->wCardSelect); mainGame->HideElement(mainGame->wCardSelect);
ShowCancelOrFinishButton(0);
} }
if(mainGame->wOptions->isVisible()) { if(mainGame->wOptions->isVisible()) {
mainGame->HideElement(mainGame->wOptions); mainGame->HideElement(mainGame->wOptions);
ShowCancelOrFinishButton(0);
} }
break; break;
} }
...@@ -1360,6 +1520,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1360,6 +1520,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(selected_cards.size() == 0) { if(selected_cards.size() == 0) {
if(select_cancelable) { if(select_cancelable) {
DuelClient::SetResponseI(-1); DuelClient::SetResponseI(-1);
ShowCancelOrFinishButton(0);
if(mainGame->wCardSelect->isVisible()) if(mainGame->wCardSelect->isVisible())
mainGame->HideElement(mainGame->wCardSelect, true); mainGame->HideElement(mainGame->wCardSelect, true);
else else
...@@ -1369,11 +1530,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1369,11 +1530,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
if(mainGame->wQuery->isVisible()) { if(mainGame->wQuery->isVisible()) {
SetResponseSelectedCards(); SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
break; break;
} }
if(select_ready) { if(select_ready) {
SetResponseSelectedCards(); SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
if(mainGame->wCardSelect->isVisible()) if(mainGame->wCardSelect->isVisible())
mainGame->HideElement(mainGame->wCardSelect, true); mainGame->HideElement(mainGame->wCardSelect, true);
else else
...@@ -1394,6 +1557,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1394,6 +1557,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
if(mainGame->wQuery->isVisible()) { if(mainGame->wQuery->isVisible()) {
SetResponseSelectedCards(); SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
break; break;
} }
...@@ -1402,6 +1566,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1402,6 +1566,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case MSG_SELECT_SUM: { case MSG_SELECT_SUM: {
if(mainGame->wQuery->isVisible()) { if(mainGame->wQuery->isVisible()) {
SetResponseSelectedCards(); SetResponseSelectedCards();
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
break; break;
} }
...@@ -1412,16 +1577,20 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1412,16 +1577,20 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
if(mainGame->wCardSelect->isVisible()) { if(mainGame->wCardSelect->isVisible()) {
mainGame->HideElement(mainGame->wCardSelect); mainGame->HideElement(mainGame->wCardSelect);
ShowCancelOrFinishButton(0);
break; break;
} }
if(mainGame->wQuery->isVisible()) { if(mainGame->wQuery->isVisible()) {
DuelClient::SetResponseI(-1); DuelClient::SetResponseI(-1);
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
} else { } else {
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
ShowCancelOrFinishButton(0);
} }
if(mainGame->wOptions->isVisible()) { if(mainGame->wOptions->isVisible()) {
DuelClient::SetResponseI(-1); DuelClient::SetResponseI(-1);
ShowCancelOrFinishButton(0);
mainGame->HideElement(mainGame->wOptions); mainGame->HideElement(mainGame->wOptions);
} }
break; break;
...@@ -2006,6 +2175,26 @@ void ClientField::UpdateChainButtons() { ...@@ -2006,6 +2175,26 @@ void ClientField::UpdateChainButtons() {
mainGame->btnChainWhenAvail->setPressed(mainGame->chain_when_avail); mainGame->btnChainWhenAvail->setPressed(mainGame->chain_when_avail);
} }
} }
void ClientField::ShowCancelOrFinishButton(int buttonOp) {
if (!mainGame->chkHideChainButton->isChecked() && !mainGame->dInfo.isReplay) {
switch (buttonOp) {
case 1:
mainGame->btnCancelOrFinish->setText(dataManager.GetSysString(1295));
mainGame->btnCancelOrFinish->setVisible(true);
break;
case 2:
mainGame->btnCancelOrFinish->setText(dataManager.GetSysString(1296));
mainGame->btnCancelOrFinish->setVisible(true);
break;
case 0:
default:
mainGame->btnCancelOrFinish->setVisible(false);
break;
}
} else {
mainGame->btnCancelOrFinish->setVisible(false);
}
}
void ClientField::SetResponseSelectedCards() const { void ClientField::SetResponseSelectedCards() const {
unsigned char respbuf[64]; unsigned char respbuf[64];
respbuf[0] = selected_cards.size(); respbuf[0] = selected_cards.size();
......
...@@ -541,6 +541,9 @@ bool Game::Initialize() { ...@@ -541,6 +541,9 @@ bool Game::Initialize() {
btnChainIgnore->setVisible(false); btnChainIgnore->setVisible(false);
btnChainAlways->setVisible(false); btnChainAlways->setVisible(false);
btnChainWhenAvail->setVisible(false); btnChainWhenAvail->setVisible(false);
//cancel or finish
btnCancelOrFinish = env->addButton(rect<s32>(205, 230, 295, 265), 0, BUTTON_CANCEL_OR_FINISH, dataManager.GetSysString(1295));
btnCancelOrFinish->setVisible(false);
//leave/surrender/exit //leave/surrender/exit
btnLeaveGame = env->addButton(rect<s32>(205, 5, 295, 80), 0, BUTTON_LEAVE_GAME, L""); btnLeaveGame = env->addButton(rect<s32>(205, 5, 295, 80), 0, BUTTON_LEAVE_GAME, L"");
btnLeaveGame->setVisible(false); btnLeaveGame->setVisible(false);
...@@ -1122,6 +1125,7 @@ void Game::CloseDuelWindow() { ...@@ -1122,6 +1125,7 @@ void Game::CloseDuelWindow() {
btnChainIgnore->setVisible(false); btnChainIgnore->setVisible(false);
btnChainAlways->setVisible(false); btnChainAlways->setVisible(false);
btnChainWhenAvail->setVisible(false); btnChainWhenAvail->setVisible(false);
btnCancelOrFinish->setVisible(false);
wChat->setVisible(false); wChat->setVisible(false);
lstLog->clear(); lstLog->clear();
logParam.clear(); logParam.clear();
......
...@@ -395,7 +395,8 @@ public: ...@@ -395,7 +395,8 @@ public:
irr::gui::IGUIButton* btnChainIgnore; irr::gui::IGUIButton* btnChainIgnore;
irr::gui::IGUIButton* btnChainAlways; irr::gui::IGUIButton* btnChainAlways;
irr::gui::IGUIButton* btnChainWhenAvail; irr::gui::IGUIButton* btnChainWhenAvail;
//cancel or finish
irr::gui::IGUIButton* btnCancelOrFinish;
}; };
extern Game* mainGame; extern Game* mainGame;
...@@ -486,6 +487,7 @@ extern Game* mainGame; ...@@ -486,6 +487,7 @@ extern Game* mainGame;
#define BUTTON_CHAIN_IGNORE 264 #define BUTTON_CHAIN_IGNORE 264
#define BUTTON_CHAIN_ALWAYS 265 #define BUTTON_CHAIN_ALWAYS 265
#define BUTTON_CHAIN_WHENAVAIL 266 #define BUTTON_CHAIN_WHENAVAIL 266
#define BUTTON_CANCEL_OR_FINISH 267
#define BUTTON_CLEAR_LOG 270 #define BUTTON_CLEAR_LOG 270
#define LISTBOX_LOG 271 #define LISTBOX_LOG 271
#define SCROLL_CARDTEXT 280 #define SCROLL_CARDTEXT 280
......
...@@ -286,6 +286,8 @@ ...@@ -286,6 +286,8 @@
!system 1292 忽略时点 !system 1292 忽略时点
!system 1293 显示时点 !system 1293 显示时点
!system 1294 可用时点 !system 1294 可用时点
!system 1295 取消操作
!system 1296 完成选择
!system 1300 禁限卡表: !system 1300 禁限卡表:
!system 1301 卡组列表: !system 1301 卡组列表:
!system 1302 保存 !system 1302 保存
......
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