Commit f97ed0f4 authored by mercury233's avatar mercury233

update

parent e2130808
...@@ -137,6 +137,7 @@ public: ...@@ -137,6 +137,7 @@ public:
void ShowCancelOrFinishButton(int buttonOp); void ShowCancelOrFinishButton(int buttonOp);
void SetShowMark(ClientCard* pcard, bool enable); void SetShowMark(ClientCard* pcard, bool enable);
void SetResponseSelectedCards() const; void SetResponseSelectedCards() const;
void CancelOrFinish();
}; };
} }
......
...@@ -158,133 +158,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -158,133 +158,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CANCEL_OR_FINISH: { case BUTTON_CANCEL_OR_FINISH: {
switch (mainGame->dInfo.curMsg) { CancelOrFinish();
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();
}
}
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; break;
} }
case BUTTON_MSG_OK: { case BUTTON_MSG_OK: {
...@@ -1499,132 +1373,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1499,132 +1373,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->wCmdMenu->setVisible(false); mainGame->wCmdMenu->setVisible(false);
if(mainGame->fadingList.size()) if(mainGame->fadingList.size())
break; break;
switch(mainGame->dInfo.curMsg) { CancelOrFinish();
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();
}
}
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; break;
} }
case irr::EMIE_MOUSE_MOVED: { case irr::EMIE_MOUSE_MOVED: {
...@@ -2361,4 +2110,132 @@ void ClientField::SetResponseSelectedCards() const { ...@@ -2361,4 +2110,132 @@ void ClientField::SetResponseSelectedCards() const {
respbuf[i + 1] = selected_cards[i]->select_seq; respbuf[i + 1] = selected_cards[i]->select_seq;
DuelClient::SetResponseB(respbuf, selected_cards.size() + 1); DuelClient::SetResponseB(respbuf, selected_cards.size() + 1);
} }
void ClientField::CancelOrFinish() {
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();
}
}
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;
}
}
}
} }
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