Commit 1dc1e961 authored by 独孤朲's avatar 独孤朲

Merge pull request #1774 from mercury233/patch-1

add click mbutton to add a same card to deck
parents 7e6476ba 580c4caa
......@@ -544,11 +544,73 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
deckManager.current_deck.extra.push_back(draging_pointer);
} else if(!(draging_pointer->second.type & 0x802040) && deckManager.current_deck.main.size() < 60) {
deckManager.current_deck.main.push_back(draging_pointer);
} else if (deckManager.current_deck.side.size() < 15) {
deckManager.current_deck.side.push_back(draging_pointer);
}
}
}
break;
}
case irr::EMIE_MMOUSE_LEFT_UP: {
if (mainGame->is_siding)
break;
if (mainGame->wCategories->isVisible() || mainGame->wQuery->isVisible())
break;
if (hovered_pos == 0 || hovered_seq == -1)
break;
if (is_draging)
break;
draging_pointer = dataManager.GetCodePointer(hovered_code);
unsigned int limitcode = draging_pointer->second.alias ? draging_pointer->second.alias : draging_pointer->first;
int limit = 3;
if (filterList->count(limitcode))
limit = (*filterList)[limitcode];
for (size_t i = 0; i < deckManager.current_deck.main.size(); ++i)
if (deckManager.current_deck.main[i]->first == limitcode
|| deckManager.current_deck.main[i]->second.alias == limitcode)
limit--;
for (size_t i = 0; i < deckManager.current_deck.extra.size(); ++i)
if (deckManager.current_deck.extra[i]->first == limitcode
|| deckManager.current_deck.extra[i]->second.alias == limitcode)
limit--;
for (size_t i = 0; i < deckManager.current_deck.side.size(); ++i)
if (deckManager.current_deck.side[i]->first == limitcode
|| deckManager.current_deck.side[i]->second.alias == limitcode)
limit--;
if (limit <= 0)
break;
if (hovered_pos == 1) {
if (deckManager.current_deck.main.size() < 60)
deckManager.current_deck.main.push_back(draging_pointer);
else if (deckManager.current_deck.side.size() < 15)
deckManager.current_deck.side.push_back(draging_pointer);
}
else if (hovered_pos == 2) {
if (deckManager.current_deck.extra.size() < 15)
deckManager.current_deck.extra.push_back(draging_pointer);
else if (deckManager.current_deck.side.size() < 15)
deckManager.current_deck.side.push_back(draging_pointer);
}
else if (hovered_pos == 3) {
if (deckManager.current_deck.side.size() < 15)
deckManager.current_deck.side.push_back(draging_pointer);
else {
if ((draging_pointer->second.type & 0x802040) && deckManager.current_deck.extra.size() < 15)
deckManager.current_deck.extra.push_back(draging_pointer);
else if (!(draging_pointer->second.type & 0x802040) && deckManager.current_deck.main.size() < 60)
deckManager.current_deck.main.push_back(draging_pointer);
}
}
else {
if ((draging_pointer->second.type & 0x802040) && deckManager.current_deck.extra.size() < 15)
deckManager.current_deck.extra.push_back(draging_pointer);
else if (!(draging_pointer->second.type & 0x802040) && deckManager.current_deck.main.size() < 60)
deckManager.current_deck.main.push_back(draging_pointer);
else if (deckManager.current_deck.side.size() < 15)
deckManager.current_deck.side.push_back(draging_pointer);
}
break;
}
case irr::EMIE_MOUSE_MOVED: {
int x = event.MouseInput.X;
int y = event.MouseInput.Y;
......
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