Commit a3c68478 authored by mercury233's avatar mercury233 Committed by GitHub

fix select unselect (#2104)

parent 390d2074
......@@ -1062,7 +1062,7 @@ bool ClientField::ShowSelectSum(bool panelmode) {
select_ready = false;
}
if (select_ready) {
ShowCancelOrFinishButton(1);
ShowCancelOrFinishButton(2);
} else {
ShowCancelOrFinishButton(0);
}
......
......@@ -54,8 +54,8 @@ public:
int select_max;
int must_select_count;
int select_sumval;
int select_cancelable;
int select_mode;
bool select_cancelable;
bool select_panalmode;
bool select_ready;
int announce_count;
......
......@@ -1340,7 +1340,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case MSG_SELECT_CARD: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf);
mainGame->dField.select_cancelable = BufferIO::ReadInt8(pbuf);
mainGame->dField.select_cancelable = BufferIO::ReadInt8(pbuf) != 0;
mainGame->dField.select_min = BufferIO::ReadInt8(pbuf);
mainGame->dField.select_max = BufferIO::ReadInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf);
......@@ -1397,8 +1397,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case MSG_SELECT_UNSELECT_CARD: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf);
bool buttonok = !!BufferIO::ReadInt8(pbuf);
mainGame->dField.select_cancelable = BufferIO::ReadInt8(pbuf);
bool finishable = BufferIO::ReadInt8(pbuf) != 0;
bool cancelable = BufferIO::ReadInt8(pbuf) != 0;
mainGame->dField.select_cancelable = finishable || cancelable;
mainGame->dField.select_min = BufferIO::ReadInt8(pbuf);
mainGame->dField.select_max = BufferIO::ReadInt8(pbuf);
int count1 = BufferIO::ReadInt8(pbuf);
......@@ -1457,19 +1458,20 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if (panelmode) {
mainGame->gMutex.Lock();
mainGame->wCardSelect->setText(textBuffer);
mainGame->dField.ShowSelectCard(buttonok);
mainGame->dField.ShowSelectCard(mainGame->dField.select_cancelable);
mainGame->gMutex.Unlock();
} else {
mainGame->stHintMsg->setText(textBuffer);
mainGame->stHintMsg->setVisible(true);
}
if (mainGame->dField.select_cancelable) {
if (count2 == 0)
mainGame->dField.ShowCancelOrFinishButton(1);
else {
if(finishable) {
mainGame->dField.select_ready = true;
mainGame->dField.ShowCancelOrFinishButton(2);
}
else {
mainGame->dField.ShowCancelOrFinishButton(1);
}
}
else
mainGame->dField.ShowCancelOrFinishButton(0);
......@@ -1688,7 +1690,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
case MSG_SELECT_TRIBUTE: {
/*int selecting_player = */BufferIO::ReadInt8(pbuf);
mainGame->dField.select_cancelable = BufferIO::ReadInt8(pbuf) ? true : false;
mainGame->dField.select_cancelable = BufferIO::ReadInt8(pbuf) != 0;
mainGame->dField.select_min = BufferIO::ReadInt8(pbuf);
mainGame->dField.select_max = BufferIO::ReadInt8(pbuf);
int count = BufferIO::ReadInt8(pbuf);
......
......@@ -464,6 +464,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
list_command = COMMAND_SPSUMMON;
mainGame->wCardSelect->setText(dataManager.GetSysString(509));
ShowSelectCard();
select_ready = false;
ShowCancelOrFinishButton(1);
}
break;
......
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